X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/b8916e5c2982dd12e0a612252c85f5e1648e162c..7130d91ec4941cad5aba49bdd39911a2d5fa9a89:/bin/mozilla/is.pl diff --git a/bin/mozilla/is.pl b/bin/mozilla/is.pl index a732e4d95..5dc3b1a1f 100644 --- a/bin/mozilla/is.pl +++ b/bin/mozilla/is.pl @@ -397,73 +397,60 @@ sub form_footer { $form->{rows} = ($rows > $introws) ? $rows : $introws; my ($tax, $subtotal); - if (!$form->{taxincluded}) { + $form->{taxaccounts_array} = [ split / /, $form->{taxaccounts} ]; - foreach my $item (split / /, $form->{taxaccounts}) { - if ($form->{"${item}_base"}) { + foreach my $item (@{ $form->{taxaccounts_array} }) { + if ($form->{"${item}_base"}) { + if ($form->{taxincluded}) { + $form->{"${item}_total"} = $form->round_amount( ($form->{"${item}_base"} * $form->{"${item}_rate"} + / (1 + $form->{"${item}_rate"})), 2); + $form->{"${item}_netto"} = $form->round_amount( ($form->{"${item}_base"} - $form->{"${item}_total"}), 2); + } else { $form->{"${item}_total"} = $form->round_amount( $form->{"${item}_base"} * $form->{"${item}_rate"}, 2); $form->{invtotal} += $form->{"${item}_total"}; - $form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2); - - $tax .= qq| - - $form->{"${item}_description"} | . $form->{"${item}_rate"} * 100 .qq|% - $form->{"${item}_total"} - |; } } - -# $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0); - - $subtotal = qq| - - | . $locale->text('Subtotal') . qq| - $form->{invsubtotal} - -|; - - } - - if ($form->{taxincluded}) { - $form->{taxaccounts_array} = [ split / /, $form->{taxaccounts} ]; - foreach my $item (split / /, $form->{taxaccounts}) { - if ($form->{"${item}_base"}) { - $form->{"${item}_total"} = $form->round_amount( ($form->{"${item}_base"} * $form->{"${item}_rate"} / (1 + $form->{"${item}_rate"})), 2); - $form->{"${item}_netto"} = $form->round_amount( ($form->{"${item}_base"} - $form->{"${item}_total"}), 2); - $form->{"${item}_total"} = $form->format_amount(\%myconfig, $form->{"${item}_total"}, 2); - $form->{"${item}_netto"} = $form->format_amount(\%myconfig, $form->{"${item}_netto"}, 2); - -# $tax .= qq| -# -# Enthaltene $form->{"${item}_description"} | -# . $form->{"${item}_rate"} * 100 .qq|% -# $form->{"${item}_total"} -# -# -# Nettobetrag -# $form->{"${item}_netto"} -# -#|; - } - } - } $form->{oldinvtotal} = $form->{invtotal}; -# $form->{invtotal} = $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0); # unfortunately locales doesn't support extended syntax if ($form->{id}) { my $follow_ups = FU->follow_ups('trans_id' => $form->{id}); if (@{ $follow_ups} ) { - $form->{follow_ups_text} = $locale->text("There are #1 unfinished follow-ups of which #2 are due.", - scalar @{ $follow_ups }, + $form->{follow_up_text} = $locale->text("There are #1 unfinished follow-ups of which #2 are due.", + scalar(@{ $follow_ups }), sum map { $_->{due} * 1 } @{ $follow_ups }); } } +# payments + my $totalpaid = 0; + + $form->{paidaccounts}++ if ($form->{"paid_$form->{paidaccounts}"}); + $form->{paid_indices} = [ 1 .. $form->{paidaccounts} ]; + + for my $i (1 .. $form->{paidaccounts}) { + $form->{"selectAR_paid_$i"} = $form->{selectAR_paid}; + $form->{"selectAR_paid_$i"} =~ s/option>\Q$form->{"AR_paid_$i"}\E/option selected>$form->{"AR_paid_$i"}/; + + # format amounts + $totalpaid += $form->{"paid_$i"}; + if ($form->{"paid_$i"}) { + $form->{"paid_$i"} = $form->format_amount(\%myconfig, $form->{"paid_$i"}, 2); + } + $form->{"exchangerate_$i"} = $form->format_amount(\%myconfig, $form->{"exchangerate_$i"}); + $form->{"exchangerate_$i"} ||= ""; + } + + + $form->{print_options} = print_options(inline => 1); + print $form->parse_html_template('is/form_footer'); +# print $form->parse_html_template('is/_payments'); # parser + + # print qq| #