Revision 101b9705
Von Moritz Bunkus vor mehr als 7 Jahren hinzugefügt
bin/mozilla/ap.pl | ||
---|---|---|
114 | 114 |
$::form->{AP_chart_id} = $template->ar_ap_chart_id; |
115 | 115 |
$::form->{transdate} = $today->to_kivitendo; |
116 | 116 |
$::form->{duedate} = $today->to_kivitendo; |
117 |
$::form->{rowcount} = @{ $template->items } + 1;
|
|
117 |
$::form->{rowcount} = @{ $template->items }; |
|
118 | 118 |
$::form->{paidaccounts} = 1; |
119 | 119 |
$::form->{$_} = $template->$_ for qw(department_id ordnumber taxincluded notes); |
120 | 120 |
|
... | ... | |
152 | 152 |
|
153 | 153 |
flash('info', $::locale->text("The record template '#1' has been loaded.", $template->template_name)); |
154 | 154 |
|
155 |
update(); |
|
155 |
update( |
|
156 |
keep_rows_without_amount => 1, |
|
157 |
dont_add_new_row => 1, |
|
158 |
); |
|
156 | 159 |
} |
157 | 160 |
|
158 | 161 |
sub save_record_template { |
... | ... | |
165 | 168 |
$js->dialog->close('#record_template_dialog'); |
166 | 169 |
|
167 | 170 |
my @items = grep { |
168 |
$_->{chart_id} && (($_->{tax_id} // '') ne '') && ($_->{amount1} != 0)
|
|
171 |
$_->{chart_id} && (($_->{tax_id} // '') ne '') |
|
169 | 172 |
} map { |
170 | 173 |
+{ chart_id => $::form->{"AP_amount_chart_id_${_}"}, |
171 | 174 |
amount1 => $::form->parse_amount(\%::myconfig, $::form->{"amount_${_}"}), |
... | ... | |
584 | 587 |
} |
585 | 588 |
|
586 | 589 |
sub update { |
590 |
my %params = @_; |
|
591 |
|
|
587 | 592 |
$main::lxdebug->enter_sub(); |
588 | 593 |
|
589 | 594 |
my $form = $main::form; |
... | ... | |
605 | 610 |
my (@a, $j, $totaltax); |
606 | 611 |
for my $i (1 .. $form->{rowcount}) { |
607 | 612 |
$form->{"amount_$i"} = $form->parse_amount(\%myconfig, $form->{"amount_$i"}); |
608 |
if ($form->{"amount_$i"}) { |
|
613 |
if ($form->{"amount_$i"} || $params{keep_rows_without_amount}) {
|
|
609 | 614 |
push @a, {}; |
610 | 615 |
$j = $#a; |
611 | 616 |
my ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"}); |
... | ... | |
632 | 637 |
IR->get_vendor(\%::myconfig, $form); |
633 | 638 |
} |
634 | 639 |
|
635 |
$form->{rowcount} = $count + 1;
|
|
640 |
$form->{rowcount} = $count + ($params{dont_add_new_row} ? 0 : 1);
|
|
636 | 641 |
|
637 | 642 |
$form->{invtotal} = |
638 | 643 |
($form->{taxincluded}) ? $form->{invtotal} : $form->{invtotal} + $totaltax; |
... | ... | |
658 | 663 |
$form->{oldinvtotal} = $form->{invtotal}; |
659 | 664 |
$form->{oldtotalpaid} = $totalpaid; |
660 | 665 |
|
661 |
&display_form;
|
|
666 |
display_form();
|
|
662 | 667 |
|
663 | 668 |
$main::lxdebug->leave_sub(); |
664 | 669 |
} |
Auch abrufbar als: Unified diff
Belegvorlagen: Zeilen ohne Betrag beibehalten