-
- $form->{title} |
-
-
-
-
-
- |
-
-
-
- |
-
-
-$jsscript
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-|;
-
- foreach $item (split / /, $form->{taxaccounts}) {
- print qq|
-
-
-
-|;
- }
- $lxdebug->leave_sub();
+ $main::lxdebug->leave_sub();
}
sub form_footer {
- $lxdebug->enter_sub();
+ $main::lxdebug->enter_sub();
- $form->{invtotal} = $form->{invsubtotal};
-
- if (($rows = $form->numtextrows($form->{notes}, 26, 8)) < 2) {
- $rows = 2;
- }
- if (($introws = $form->numtextrows($form->{intnotes}, 35, 8)) < 2) {
- $introws = 2;
- }
- $rows = ($rows > $introws) ? $rows : $introws;
- $notes =
- qq||;
- $intnotes =
- qq||;
-
- $form->{taxincluded} = ($form->{taxincluded}) ? "checked" : "";
-
- $taxincluded = "";
- if ($form->{taxaccounts}) {
- $taxincluded = qq|
- {taxincluded}> |
- . $locale->text('Tax Included') . qq|
|;
- }
+ my $form = $main::form;
+ my %myconfig = %main::myconfig;
+ my $locale = $main::locale;
- if (!$form->{taxincluded}) {
+ $main::auth->assert('invoice_edit');
- foreach $item (split / /, $form->{taxaccounts}) {
- if ($form->{"${item}_base"}) {
- $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}_total"} |
-
-|;
- }
- }
+ $form->{invtotal} = $form->{invsubtotal};
+ $form->{oldinvtotal} = $form->{invtotal};
- $form->{invsubtotal} =
- $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0);
+ # note rows
+ $form->{rows} = max 2,
+ $form->numtextrows($form->{notes}, 26, 8),
+ $form->numtextrows($form->{intnotes}, 35, 8);
- $subtotal = qq|
-
- | . $locale->text('Subtotal') . qq| |
- $form->{invsubtotal} |
-
-|;
- }
+ # tax, total and subtotal calculations
+ my ($tax, $subtotal);
+ $form->{taxaccounts_array} = [ split / /, $form->{taxaccounts} ];
- if ($form->{taxincluded}) {
- foreach $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}_total"} |
-
-
- Nettobetrag |
- $form->{"${item}_netto"} |
-
-|;
+ 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->{oldinvtotal} = $form->{invtotal};
- $form->{invtotal} =
- $form->format_amount(\%myconfig, $form->{invtotal}, 2, 0);
-
- print qq|
-
-
-
-
-
-
-
- | . $locale->text('Notes') . qq| |
- | . $locale->text('Internal Notes') . qq| |
-
-
- $notes |
- $intnotes |
-
-
- |
-
- $taxincluded
-
- $subtotal
- $tax
-
- | . $locale->text('Total') . qq| |
- $form->{invtotal} |
-
-
- |
-
-
- |
-
-|;
- if ($webdav) {
- $webdav_list = qq|
-
-
|
-
-
- Dokumente im Webdav-Repository |
-
-
- Dateiname |
- Webdavlink |
-|;
- foreach $file (keys %{ $form->{WEBDAV} }) {
- $webdav_list .= qq|
-
- $file |
- $form->{WEBDAV}{$file} |
-
-|;
- }
- $webdav_list .= qq|
-
-
-|;
-
- print $webdav_list;
}
- print qq|
-
-
-
- |
-
-
-
|
-
-
-
-|;
-
- &print_options;
+ print $form->parse_html_template('is/form_footer', {
+ is_type_credit_note => ($form->{type} eq "credit_note"),
+ totalpaid => $totalpaid,
+ paid_missing => $form->{invtotal} - $totalpaid,
+ print_options => print_options(inline => 1),
+ show_storno => $form->{id} && !$form->{storno} && !IS->has_storno(\%myconfig, $form, "ar") && !$totalpaid,
+ show_delete => ($form->current_date(\%myconfig) eq $form->{gldate}),
+ });
+##print $form->parse_html_template('is/_payments'); # parser
+##print $form->parse_html_template('webdav/_list'); # parser
- print qq|
- |
-
-
-|;
+ $main::lxdebug->leave_sub();
+}
- $invdate = $form->datetonum($form->{invdate}, \%myconfig);
- $closedto = $form->datetonum($form->{closedto}, \%myconfig);
+sub mark_as_paid {
+ $main::lxdebug->enter_sub();
- if ($form->{id}) {
- print qq|
-