-
- $form->{title} |
-
-
-
-
-
-
-
-
-
- | . $locale->text('Vendor') . qq| |
- $vendor |
-
-
-
- {terms}>
-
-
- |
-
-
-
- | . $locale->text('Credit Limit') . qq| |
- $form->{creditlimit} |
- | . $locale->text('Remaining') . qq| |
- $form->{creditremaining} |
- {creditlimit}>
- {creditremaining}>
-
-
- |
-
- | . $locale->text('Currency') . qq| |
- |
-
- {defaultcurrency}>
- {fxgain_accno}>
- {fxloss_accno}>
- $exchangerate
-
- $department
- $taxincluded
-
- |
-
-
- |
-
-
- |
-
-
-
-
-$jsscript
-
-
-
- {rowcount}>
-
-
-
-
- |
- . $locale->text('Account') . qq| |
- |
- . $locale->text('Amount') . qq| |
- |
- . $locale->text('Tax') . qq| |
- |
- . $locale->text('Korrektur') . qq| |
- |
- . $locale->text('Taxkey') . qq| |
- |
- . $locale->text('Project') . qq| |
-
-|;
-
- $amount = $locale->text('Amount');
- $project = $locale->text('Project');
-
- for $i (1 .. $form->{rowcount}) {
+ for my $i (1 .. $form->{rowcount}) {
# format amounts
- $form->{"amount_$i"} =
- $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
+ $form->{"amount_$i"} = $form->format_amount(\%myconfig, $form->{"amount_$i"}, 2);
$form->{"tax_$i"} = $form->format_amount(\%myconfig, $form->{"tax_$i"}, 2);
- $selectAP_amount = $selectAP_amount_unquoted;
- $re_amount = quotemeta($form->{"AP_amount_$i"});
- $selectAP_amount =~
- s/option value=\"${re_amount}\"/option value=\"$form->{"AP_amount_$i"}\" selected/;
- $tax = $taxchart;
- $tax_selected = $form->{"taxchart_$i"};
- $tax =~ s/value=\"$tax_selected\"/value=\"$tax_selected\" selected/;
- $tax =
- qq| | |;
-
- my $korrektur = $form->{"korrektur_$i"} ? 'checked' : '';
-
- print qq|
-
- |
- {"amount_$i"}> |
- {"tax_$i"}> |
- |
- $tax
-
- {"project_id_$i"}>
- |
-
-|;
- $amount = "";
- $project = "";
+
+ my ($default_taxchart, $taxchart_to_use);
+ my $amount_chart_id = $form->{"AP_amount_chart_id_$i"} || $default_ap_amount_chart_id;
+ my @taxcharts = GL->get_active_taxes_for_chart($amount_chart_id, $transdate);
+
+ foreach my $item (@taxcharts) {
+ my $key = $item->id . "--" . $item->rate;
+ $first_taxchart //= $item;
+ $default_taxchart = $item if $item->{is_default};
+ $taxchart_to_use = $item if $key eq $form->{"taxchart_$i"};
+ }
+
+ $taxchart_to_use //= $default_taxchart // $first_taxchart;
+ my $selected_taxchart = $taxchart_to_use->id . '--' . $taxchart_to_use->rate;
+ $form->{"selected_taxchart_$i"} = $selected_taxchart;
+ $form->{"AP_amount_chart_id_$i"} = $amount_chart_id;
+ $form->{"taxcharts_$i"} = \@taxcharts;
}
- $taxlabel =
- ($form->{taxincluded})
- ? $locale->text('Tax Included')
- : $locale->text('Tax');
+ $form->{taxchart_value_title_sub} = sub {
+ my $item = shift;
+ return [
+ $item->{id} .'--'. $item->{rate},
+ $item->{taxdescription} .' '. ($item->{rate} * 100) .' %',
+ ];
+ };
+ $form->{AP_paid_value_title_sub} = sub {
+ my $item = shift;
+ return [
+ $item->{accno},
+ $item->{accno} .'--'. $item->{description}
+ ];
+ };
+
+ $form->{invtotal_unformatted} = $form->{invtotal};
$form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2);
- print qq|
-
-
-
- |
-
-
- |
-
- $form->{invtotal} |
-
- {oldinvtotal}>
- {oldtotalpaid}>
-
-
-
- |
-
-
-
-
- |
-
-
-
-
-
- | . $locale->text('Notes') . qq| |
- $notes |
-
-
- |
-
-
-
-
- |
-
-
-
|
-
-
-|;
-
- $lxdebug->leave_sub();
-}
+ my $changeable = 1;
+ if (SL::DB::Default->get->payments_changeable == 0) {
+ # never
+ $changeable = ($form->{"acc_trans_id_$i"})? 0 : 1;
+ }
+ if (SL::DB::Default->get->payments_changeable == 2) {
+ # on the same day
+ $changeable = (($form->{"gldate_$i"} eq '') || $form->current_date(\%myconfig) eq $form->{"gldate_$i"});
+ }
-sub form_footer {
- $lxdebug->enter_sub();
+ #deaktivieren von gebuchten Zahlungen ausserhalb der Bücherkontrolle, vorher prüfen ob heute eingegeben
+ if ($form->date_closed($form->{"gldate_$i"})) {
+ $changeable = 0;
+ }
- print qq|
+ $form->{'paidaccount_changeable_'. $i} = $changeable;
-