Revision 101b9705
Von Moritz Bunkus vor mehr als 7 Jahren hinzugefügt
bin/mozilla/ar.pl | ||
---|---|---|
112 | 112 |
$::form->{AR_chart_id} = $template->ar_ap_chart_id; |
113 | 113 |
$::form->{transdate} = $today->to_kivitendo; |
114 | 114 |
$::form->{duedate} = $today->to_kivitendo; |
115 |
$::form->{rowcount} = @{ $template->items } + 1;
|
|
115 |
$::form->{rowcount} = @{ $template->items }; |
|
116 | 116 |
$::form->{paidaccounts} = 1; |
117 | 117 |
$::form->{$_} = $template->$_ for qw(department_id ordnumber taxincluded employee_id notes); |
118 | 118 |
|
... | ... | |
150 | 150 |
|
151 | 151 |
flash('info', $::locale->text("The record template '#1' has been loaded.", $template->template_name)); |
152 | 152 |
|
153 |
update(); |
|
153 |
update( |
|
154 |
keep_rows_without_amount => 1, |
|
155 |
dont_add_new_row => 1, |
|
156 |
); |
|
154 | 157 |
} |
155 | 158 |
|
156 | 159 |
sub save_record_template { |
... | ... | |
163 | 166 |
$js->dialog->close('#record_template_dialog'); |
164 | 167 |
|
165 | 168 |
my @items = grep { |
166 |
$_->{chart_id} && (($_->{tax_id} // '') ne '') && ($_->{amount1} != 0)
|
|
169 |
$_->{chart_id} && (($_->{tax_id} // '') ne '') |
|
167 | 170 |
} map { |
168 | 171 |
+{ chart_id => $::form->{"AR_amount_chart_id_${_}"}, |
169 | 172 |
amount1 => $::form->parse_amount(\%::myconfig, $::form->{"amount_${_}"}), |
... | ... | |
567 | 570 |
} |
568 | 571 |
|
569 | 572 |
sub update { |
573 |
my %params = @_; |
|
570 | 574 |
$main::lxdebug->enter_sub(); |
571 | 575 |
|
572 | 576 |
$main::auth->assert('ar_transactions'); |
... | ... | |
591 | 595 |
|
592 | 596 |
for my $i (1 .. $form->{rowcount}) { |
593 | 597 |
$form->{"amount_$i"} = $form->parse_amount(\%myconfig, $form->{"amount_$i"}); |
594 |
if ($form->{"amount_$i"}) { |
|
598 |
if ($form->{"amount_$i"} || $params{keep_rows_without_amount}) {
|
|
595 | 599 |
push @a, {}; |
596 | 600 |
my $j = $#a; |
597 | 601 |
my ($taxkey, $rate) = split(/--/, $form->{"taxchart_$i"}); |
... | ... | |
606 | 610 |
} |
607 | 611 |
|
608 | 612 |
$form->redo_rows(\@flds, \@a, $count, $form->{rowcount}); |
609 |
$form->{rowcount} = $count + 1;
|
|
613 |
$form->{rowcount} = $count + ($params{dont_add_new_row} ? 0 : 1);
|
|
610 | 614 |
map { $form->{invtotal} += $form->{"amount_$_"} } (1 .. $form->{rowcount}); |
611 | 615 |
|
612 | 616 |
$form->{forex} = $form->check_exchangerate( \%myconfig, $form->{currency}, $form->{transdate}, 'buy'); |
... | ... | |
641 | 645 |
$form->{oldinvtotal} = $form->{invtotal}; |
642 | 646 |
$form->{oldtotalpaid} = $form->{totalpaid}; |
643 | 647 |
|
644 |
&display_form;
|
|
648 |
display_form();
|
|
645 | 649 |
|
646 | 650 |
$main::lxdebug->leave_sub(); |
647 | 651 |
} |
Auch abrufbar als: Unified diff
Belegvorlagen: Zeilen ohne Betrag beibehalten