X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=bin%2Fmozilla%2Foe.pl;h=1fc3fe3d653fd939046486a0930875c7e7903392;hb=21e3b9697fa7e9481b79d0f16ef8cc5d0892f299;hp=40eecc38846ac380e8f6dc063855bf1394d41507;hpb=77923db35bd792bcc4a5581a4f01e8d3599b0153;p=kivitendo-erp.git
diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl
index 40eecc388..1fc3fe3d6 100644
--- a/bin/mozilla/oe.pl
+++ b/bin/mozilla/oe.pl
@@ -1,4 +1,4 @@
-# #=====================================================================
+#=====================================================================
# LX-Office ERP
# Copyright (C) 2004
# Based on SQL-Ledger Version 2.1.9
@@ -33,15 +33,18 @@
use POSIX qw(strftime);
+use SL::DO;
+use SL::FU;
use SL::OE;
use SL::IR;
use SL::IS;
use SL::PE;
use SL::ReportGenerator;
+use List::Util qw(max reduce sum);
require "bin/mozilla/io.pl";
require "bin/mozilla/arap.pl";
-require "bin/mozilla/report_generator.pl";
+require "bin/mozilla/reportgenerator.pl";
1;
@@ -58,9 +61,25 @@ require "bin/mozilla/report_generator.pl";
# $locale->text('Workflow request_quotation');
# $locale->text('Workflow sales_quotation');
+my $oe_access_map = {
+ 'sales_order' => 'sales_order_edit',
+ 'purchase_order' => 'purchase_order_edit',
+ 'request_quotation' => 'request_quotation_edit',
+ 'sales_quotation' => 'sales_quotation_edit',
+};
+
+sub check_oe_access {
+ my $right = $oe_access_map->{$form->{type}};
+ $right ||= 'DOES_NOT_EXIST';
+
+ $auth->assert($right);
+}
+
sub set_headings {
$lxdebug->enter_sub();
+ check_oe_access();
+
my ($action) = @_;
if ($form->{type} eq 'purchase_order') {
@@ -98,10 +117,12 @@ sub set_headings {
sub add {
$lxdebug->enter_sub();
+ check_oe_access();
+
set_headings("add");
$form->{callback} =
- "$form->{script}?action=add&type=$form->{type}&vc=$form->{vc}&login=$form->{login}&password=$form->{password}"
+ "$form->{script}?action=add&type=$form->{type}&vc=$form->{vc}"
unless $form->{callback};
&order_links;
@@ -113,6 +134,9 @@ sub add {
sub edit {
$lxdebug->enter_sub();
+
+ check_oe_access();
+
# show history button
$form->{javascript} = qq||;
#/show hhistory button
@@ -122,7 +146,7 @@ sub edit {
set_headings("edit");
# editing without stuff to edit? try adding it first
- if ($form->{rowcount}) {
+ if ($form->{rowcount} && !$form->{print_and_save}) {
map { $id++ if $form->{"multi_id_$_"} } (1 .. $form->{rowcount});
if (!$id) {
@@ -148,11 +172,20 @@ sub edit {
set_headings("edit");
&order_links;
+
+ $form->{rowcount} = 0;
+ foreach $ref (@{ $form->{form_details} }) {
+ $form->{rowcount}++;
+ map { $form->{"${_}_$form->{rowcount}"} = $ref->{$_} } keys %{$ref};
+ }
+
&prepare_order;
+
if ($form->{print_and_save}) {
$form->{language_id} = $language_id;
$form->{printer_id} = $printer_id;
}
+
&display_form;
$lxdebug->leave_sub();
@@ -160,9 +193,11 @@ sub edit {
sub order_links {
$lxdebug->enter_sub();
+
+ check_oe_access();
+
# get customer/vendor
- $form->all_vc(\%myconfig, $form->{vc},
- ($form->{vc} eq 'customer') ? "AR" : "AP");
+ $form->all_vc(\%myconfig, $form->{vc}, ($form->{vc} eq 'customer') ? "AR" : "AP");
# retrieve order/quotation
$form->{webdav} = $webdav;
@@ -172,150 +207,55 @@ sub order_links {
OE->retrieve(\%myconfig, \%$form);
- if ($form->{payment_id}) {
- $payment_id = $form->{payment_id};
- }
- if ($form->{language_id}) {
- $language_id = $form->{language_id};
- }
- if ($form->{taxzone_id}) {
- $taxzone_id = $form->{taxzone_id};
- }
-
- $salesman_id = $form->{salesman_id} if ($editing);
-
-
# if multiple rowcounts (== collective order) then check if the
# there were more than one customer (in that case OE::retrieve removes
# the content from the field)
- if ( $form->{rowcount}
- && $form->{type} eq 'sales_order'
- && defined $form->{customer}
- && $form->{customer} eq '') {
-
- # $main::lxdebug->message(0, "Detected Edit order with concurrent customers");
- $form->error(
- $locale->text(
- 'Collective Orders only work for orders from one customer!')
- );
- }
+ $form->error($locale->text('Collective Orders only work for orders from one customer!'))
+ if $form->{rowcount} && $form->{type} eq 'sales_order'
+ && defined $form->{customer} && $form->{customer} eq '';
- $taxincluded = $form->{taxincluded};
- $form->{shipto} = 1 if $form->{id};
-
- if ($form->{"all_$form->{vc}"}) {
- unless ($form->{"$form->{vc}_id"}) {
- $form->{"$form->{vc}_id"} = $form->{"all_$form->{vc}"}->[0]->{id};
- }
- }
+ $form->{"$form->{vc}_id"} ||= $form->{"all_$form->{vc}"}->[0]->{id} if $form->{"all_$form->{vc}"};
- $cp_id = $form->{cp_id};
- $intnotes = $form->{intnotes};
+ $form->backup_vars(qw(payment_id language_id taxzone_id salesman_id taxincluded cp_id intnotes));
+ $form->{shipto} = 1 if $form->{id};
# get customer / vendor
- if ($form->{type} =~ /(purchase_order|request_quotation)/) {
- IR->get_vendor(\%myconfig, \%$form);
+ IR->get_vendor(\%myconfig, \%$form) if $form->{type} =~ /(purchase_order|request_quotation)/;
+ IS->get_customer(\%myconfig, \%$form) if $form->{type} =~ /sales_(order|quotation)/;
- #quote all_vendor Bug 133
- foreach $ref (@{ $form->{all_vendor} }) {
- $ref->{name} = $form->quote($ref->{name});
- }
-
- }
- if ($form->{type} =~ /sales_(order|quotation)/) {
- IS->get_customer(\%myconfig, \%$form);
-
- #quote all_vendor Bug 133
- foreach $ref (@{ $form->{all_customer} }) {
- $ref->{name} = $form->quote($ref->{name});
- }
-
- }
- $form->{cp_id} = $cp_id;
-
- if ($payment_id) {
- $form->{payment_id} = $payment_id;
- }
- if ($language_id) {
- $form->{language_id} = $language_id;
- }
- if ($taxzone_id) {
- $form->{taxzone_id} = $taxzone_id;
- }
- $form->{intnotes} = $intnotes if $intnotes;
- ($form->{ $form->{vc} }) = split /--/, $form->{ $form->{vc} };
- $form->{"old$form->{vc}"} =
- qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
+ $form->restore_vars(qw(payment_id language_id taxzone_id intnotes cp_id));
+ $form->restore_vars(qw(taxincluded)) if $form->{id};
+ $form->restore_vars(qw(salesman_id)) if $editing;
+ $form->{forex} = $form->{exchangerate};
+ $form->{employee} = "$form->{employee}--$form->{employee_id}";
- # build the popup menus
+ # build vendor/customer drop down comatibility... don't ask
if (@{ $form->{"all_$form->{vc}"} }) {
- $form->{ $form->{vc} } =
- qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
- map { $form->{"select$form->{vc}"} .=
-"\n" }
- (@{ $form->{"all_$form->{vc}"} });
+ $form->{"select$form->{vc}"} = 1;
+ $form->{$form->{vc}} = qq|$form->{$form->{vc}}--$form->{"$form->{vc}_id"}|;
}
- $form->{taxincluded} = $taxincluded if ($form->{id});
-
- # departments
- if (@{ $form->{all_departments} }) {
- $form->{selectdepartment} = "\n"
- } (@{ $form->{all_departments} });
- }
-
- $form->{employee} = "$form->{employee}--$form->{employee_id}";
-
- # forex
- $form->{forex} = $form->{exchangerate};
-
- $form->{salesman_id} = $salesman_id if ($editing);
+ $form->{"old$form->{vc}"} = $form->{$form->{vc}};
+ $form->{"old$form->{vc}"} .= qq|--$form->{"$form->{vc}_id"}| unless ($form->{"old$form->{vc}"} =~ m/--\d+$/);
$lxdebug->leave_sub();
}
sub prepare_order {
$lxdebug->enter_sub();
- $form->{formname} = $form->{type} unless $form->{formname};
- my $i = 0;
- foreach $ref (@{ $form->{form_details} }) {
- $form->{rowcount} = ++$i;
+ check_oe_access();
- map { $form->{"${_}_$i"} = $ref->{$_} } keys %{$ref};
- }
- for my $i (1 .. $form->{rowcount}) {
- if ($form->{id}) {
- $form->{"discount_$i"} =
- $form->format_amount(\%myconfig, $form->{"discount_$i"} * 100);
- } else {
- $form->{"discount_$i"} =
- $form->format_amount(\%myconfig, $form->{"discount_$i"});
- }
- ($dec) = ($form->{"sellprice_$i"} =~ /\.(\d+)/);
- $dec = length $dec;
- $decimalplaces = ($dec > 2) ? $dec : 2;
+ $form->{formname} ||= $form->{type};
- # copy reqdate from deliverydate for invoice -> order conversion
- $form->{"reqdate_$i"} = $form->{"deliverydate_$i"}
- unless $form->{"reqdate_$i"};
+ # format discounts if values come from db. either as single id, or as a collective order
+ my $format_discounts = $form->{id} || $form->{convert_from_oe_ids};
- $form->{"sellprice_$i"} =
- $form->format_amount(\%myconfig, $form->{"sellprice_$i"},
- $decimalplaces);
-
- (my $dec_qty) = ($form->{"qty_$i"} =~ /\.(\d+)/);
- $dec_qty = length $dec_qty;
- $form->{"qty_$i"} =
- $form->format_amount(\%myconfig, $form->{"qty_$i"}, $dec_qty);
-
- map { $form->{"${_}_$i"} =~ s/\"/"/g }
- qw(partnumber description unit);
+ for my $i (1 .. $form->{rowcount}) {
+ $form->{"reqdate_$i"} ||= $form->{"deliverydate_$i"};
+ $form->{"discount_$i"} = $form->format_amount(\%myconfig, $form->{"discount_$i"} * ($format_discounts ? 100 : 1));
+ $form->{"sellprice_$i"} = $form->format_amount(\%myconfig, $form->{"sellprice_$i"});
+ $form->{"qty_$i"} = $form->format_amount(\%myconfig, $form->{"qty_$i"});
}
$lxdebug->leave_sub();
@@ -323,888 +263,229 @@ sub prepare_order {
sub form_header {
$lxdebug->enter_sub();
+ my @custom_hiddens;
- my $checkedclosed = $form->{"closed"} ? "checked" : "";
- my $checkeddelivered = $form->{"delivered"} ? "checked" : "";
-
- if ($form->{old_employee_id}) {
- $form->{employee_id} = $form->{old_employee_id};
- }
- if ($form->{old_salesman_id}) {
- $form->{salesman_id} = $form->{old_salesman_id};
- }
-
- $form->{defaultcurrency} = $form->get_default_currency(\%myconfig);
-
-
- if ($form->{old_employee_id}) {
- $form->{employee_id} = $form->{old_employee_id};
- }
- if ($form->{old_salesman_id}) {
- $form->{salesman_id} = $form->{old_salesman_id};
- }
-
- map { $form->{$_} =~ s/\"/"/g }
- qw(ordnumber quonumber shippingpoint shipvia notes intnotes shiptoname
- shiptostreet shiptozipcode shiptocity shiptocountry shiptocontact
- shiptophone shiptofax shiptodepartment_1 shiptodepartment_2);
-
- # use JavaScript Calendar or not
- $form->{jsscript} = 1;
- $jsscript = "";
-
- $button1 = qq|
-
- text('button') . qq|> |
- |;
- $button2 = qq|
-
- text('button') . qq|> |
- |;
-
- #write Trigger
- $jsscript =
- Form->write_trigger(\%myconfig, "2", "transdate", "BL", "trigger1",
- "reqdate", "BL", "trigger2");
-
- my @tmp;
-
- if (($form->{"type"} eq "sales_order") ||
- ($form->{"type"} eq "purchase_order")) {
- push(@tmp, qq|
-
- |);
- }
-
- if ($form->{id}) {
- push(@tmp, qq|
-
- |);
- }
-
- if (@tmp) {
- $openclosed .= qq|
-
- | . join("\n", @tmp) . qq|
- |
-
-|;
- }
-
- # set option selected
- foreach $item ($form->{vc}, currency, department, ($form->{vc} eq "customer" ? customer : vendor)) {
- $form->{"select$item"} =~ s/ selected//;
- $form->{"select$item"} =~
- s/option>\Q$form->{$item}\E/option selected>$form->{$item}/;
- }
-
- #quote select[customer|vendor] Bug 133
- $form->{"select$form->{vc}"} = $form->quote($form->{"select$form->{vc}"});
-
- #substitute \n and \r to \s (bug 543)
- $form->{"select$form->{vc}"} =~ s/[\n\r]/ /g;
-
- my @old_project_ids = ($form->{"globalproject_id"});
- map({ push(@old_project_ids, $form->{"project_id_$_"})
- if ($form->{"project_id_$_"}); } (1..$form->{"rowcount"}));
-
- my $vc = $form->{vc} eq "customer" ? "customers" : "vendors";
- $form->get_lists("contacts" => "ALL_CONTACTS",
- "shipto" => "ALL_SHIPTO",
- "projects" => { "key" => "ALL_PROJECTS",
- "all" => 0,
- "old_id" => \@old_project_ids },
- "employees" => "ALL_EMPLOYEES",
- "salesmen" => "ALL_SALESMEN",
- "taxzones" => "ALL_TAXZONES",
- "payments" => "ALL_PAYMENTS",
- "currencies" => "ALL_CURRENCIES",
- $vc => "ALL_" . uc($vc));
-
- my %labels;
- my @values = (undef);
- foreach my $item (@{ $form->{"ALL_CONTACTS"} }) {
- push(@values, $item->{"cp_id"});
- $labels{$item->{"cp_id"}} = $item->{"cp_name"} .
- ($item->{"cp_abteilung"} ? " ($item->{cp_abteilung})" : "");
- }
-
- my $contact;
- if (scalar @values > 1) {
- $contact = qq|
-
- | . $locale->text('Contact Person') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'cp_id', '-values' => \@values, '-style' => 'width: 250px',
- '-labels' => \%labels, '-default' => $form->{"cp_id"}))
- . qq|
- |
-
|;
- }
-
- %labels = ();
- @values = ();
-
- foreach my $item (@{ $form->{($form->{vc} eq "customer" ? "ALL_CUSTOMERS" : "ALL_VENDORS")}}) {
- push(@values, $item->{"name"}.qq|--|.$item->{"id"});
- $labels{$item->{"name"}.qq|--|.$item->{"id"}} = $item->{name};
- }
-
- $vc = qq|
- {vc}_id"}) . qq|">
- {vc}"}) . qq|">
- | . $locale->text(ucfirst($form->{vc})) . qq| |
- | .
- (($myconfig{vclimit} <= scalar(@values))
- ? qq|{vc}"} =~ /^(.*)\-\-.*$/)) . qq|" name="$form->{vc}">|
- : (NTI($cgi->popup_menu('-name' => "$form->{vc}", '-default' => $form->{"old$form->{vc}"},
- '-onChange' => 'document.getElementById(\'update_button\').click();',
- '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')))) . qq|
-
- | {vc}"}) . qq|">|;
-
- %labels = ();
- @values = ("");
- foreach my $item (@{ $form->{"ALL_PAYMENTS"} }) {
- push(@values, $item->{"id"});
- $labels{$item->{"id"}} = $item->{"description"};
- }
-
- $payments = qq|
- | . $locale->text('Payment Terms') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'payment_id', '-values' => \@values, '-style' => 'width: 250px',
- '-labels' => \%labels, '-default' => $form->{payment_id}))
- . qq| | |;
-
- %labels = ();
- @values = ("");
- foreach my $item (@{ $form->{"ALL_SHIPTO"} }) {
- push(@values, $item->{"shipto_id"});
- $labels{$item->{"shipto_id"}} = join "; ", grep { $_ } map { $item->{"shipto${_}" } } qw(name department_1 street city);
- }
-
- my $shipto;
- if (scalar @values > 1) {
- $shipto = qq|
-
- | . $locale->text('Shipping Address') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'shipto_id', '-values' => \@values, '-style' => 'width: 250px',
- '-labels' => \%labels, '-default' => $form->{"shipto_id"}))
- . qq| | |;
- }
-
- %labels = ();
- @values = ("");
- foreach my $item (@{ $form->{"ALL_PROJECTS"} }) {
- push(@values, $item->{"id"});
- $labels{$item->{"id"}} = $item->{"projectnumber"};
- }
- my $globalprojectnumber =
- NTI($cgi->popup_menu('-name' => 'globalproject_id', '-values' => \@values,
- '-labels' => \%labels,
- '-default' => $form->{"globalproject_id"}));
-
- my $salesmen = "";
- %labels = ();
- @values = ();
- if ($form->{type} =~ /^sales_/) {
- foreach my $item (@{ $form->{"ALL_SALESMEN"} }) {
- push(@values, $item->{"id"});
- $labels{$item->{"id"}} = ($item->{"name"} ne "" ? $item->{"name"} : $item->{"login"});
- }
- $salesmen =
- qq|
- | . $locale->text('Salesman') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'salesman_id', '-default' => $form->{"salesman_id"} ? $form->{"salesman_id"} : $form->{"employee_id"},
- '-values' => \@values, '-labels' => \%labels))
- . qq| |
-
|;
- }
-
- %labels = ();
- @values = ();
- foreach my $item (@{ $form->{"ALL_EMPLOYEES"} }) {
- push(@values, $item->{"id"});
- $labels{$item->{"id"}} = $item->{"name"} ne "" ? $item->{"name"} : $item->{"login"};
- }
-
- my $employee = qq|
-
- | . $locale->text('Employee') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'employee_id', '-default' => $form->{"employee_id"},
- '-values' => \@values, '-labels' => \%labels)) . qq|
- |
-
|;
-
- %labels = ();
- @values = ();
- foreach my $item (@{ $form->{"ALL_TAXZONES"} }) {
- push(@values, $item->{"id"});
- $labels{$item->{"id"}} = $item->{"description"};
- }
-
- $taxzone = qq|
-
- | . $locale->text('Steuersatz') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'taxzone_id', '-default' => $form->{"taxzone_id"},
- '-values' => \@values, '-labels' => \%labels, '-style' => 'width: 250px')) . qq|
- |
-
|;
-
- %labels = ();
- @values = ();
- my $i = 0;
- foreach my $item (@{ $form->{"ALL_CURRENCIES"} }) {
- push(@values, $item);
- $labels{$item} = $item;
- }
-
- $form->{currency} = $form->{defaultcurrency} unless $form->{currency};
- my $currencies;
- if (scalar @values) {
- $currencies = qq|
-
- | . $locale->text('Currency') . qq| |
- | .
- NTI($cgi->popup_menu('-name' => 'currency', '-default' => $form->{"currency"},
- '-values' => \@values, '-labels' => \%labels)) . qq|
- |
-
|;
- }
-
- $form->{exchangerate} =
- $form->format_amount(\%myconfig, $form->{exchangerate});
-
- if (!$form->{exchangerate}) {
- $form->{exchangerate} = "";
- }
-
- if (($form->{creditlimit} != 0) && ($form->{creditremaining} < 0) && !$form->{update}) {
- $creditwarning = 1;
- } else {
- $creditwarning = 0;
- }
-
- $form->{creditlimit} =
- $form->format_amount(\%myconfig, $form->{creditlimit}, 0, "0");
- $form->{creditremaining} =
- $form->format_amount(\%myconfig, $form->{creditremaining}, 0, "0");
-
- $exchangerate = qq|
-{forex}>
-|;
-
- if ($form->{currency} ne $form->{defaultcurrency}) {
- if ($form->{forex}) {
- $exchangerate .=
- qq||
- . $locale->text('Exchangerate')
- . qq| | $form->{exchangerate} |
- {exchangerate}>
-|;
- } else {
- $exchangerate .=
- qq||
- . $locale->text('Exchangerate')
- . qq| | {exchangerate}> | |;
- }
- }
-
- if ($form->{business}) {
- $business = qq|
-
- | . ($form->{vc} eq "customer" ? $locale->text('Customer type') : $locale->text('Vendor type')) . qq| |
- $form->{business}; | . $locale->text('Trade Discount') . qq| |
- . $form->format_amount(\%myconfig, $form->{tradediscount} * 100)
- . qq| % |
-
-|;
- }
-
- if ($form->{max_dunning_level}) {
- $dunning = qq|
-
- | . $locale->text('Max. Dunning Level') . qq|: |
-
- $form->{max_dunning_level};
- | . $locale->text('Dunning Amount') . qq|: |
- . $form->format_amount(\%myconfig, $form->{dunning_amount},2)
- . qq|
- |
-
-|;
- }
-
- if ($form->{type} !~ /_quotation$/) {
- $ordnumber = qq|
-
- | . $locale->text('Order Number') . qq| |
- |
-
-
- |
- . $locale->text('Quotation Number') . qq| |
- |
-
-
- |
- . $locale->text('Customer Order Number') . qq| |
- |
-
-
- | . $locale->text('Order Date') . qq| |
- $button1
-
-
-
- | . $locale->text('Required by') . qq| |
- $button2
-
-|;
-
- $n = ($form->{creditremaining} =~ /-/) ? "0" : "1";
-
- $creditremaining = qq|
- $shipto
-
- | . $locale->text('Credit Limit') . qq| |
- $form->{creditlimit}; | . $locale->text('Remaining') . qq| $form->{creditremaining} |
-
-
-|;
- } else {
- $reqlabel =
- ($form->{type} eq 'sales_quotation')
- ? $locale->text('Valid until')
- : $locale->text('Required by');
- if ($form->{type} eq 'sales_quotation') {
- $ordnumber = qq|
-
- |
- . $locale->text('Quotation Number') . qq| |
- |
-
-
-|;
- } else {
- $ordnumber = qq|
-
- | . $locale->text('RFQ Number') . qq| |
- |
-
-
-|;
-
- }
-
- $ordnumber .= qq|
-
- | . $locale->text('Quotation Date') . qq| |
- $button1
-
-
- $reqlabel |
- $button2
-
-|;
- $creditremaining = qq|
- |
- $shipto
-
|;
- }
-
- $department = qq|
-
- | . $locale->text('Department') . qq| |
-
-
- |
-
| if $form->{selectdepartment};
-
- if ($form->{type} eq 'sales_order') {
- if ($form->{selectemployee}) {
- $employee .= qq|
- |;
- }
- } else {
- $employee .= qq|
- |;
- }
- if ($form->{resubmit} && ($form->{format} eq "html")) {
- $onload =
- qq|window.open('about:blank','Beleg'); document.oe.target = 'Beleg';document.oe.submit()|;
- } elsif ($form->{resubmit}) {
- $onload = qq|document.oe.submit()|;
- } else {
- $onload = "focus()";
- }
-
- $credittext = $locale->text('Credit Limit exceeded!!!');
- if ($creditwarning) {
- $onload = qq|alert('$credittext')|;
- }
-
- $onload .= qq|;setupDateFormat('|. $myconfig{dateformat} .qq|', '|. $locale->text("Falsches Datumsformat!") .qq|')|;
- $onload .= qq|;setupPoints('|. $myconfig{numberformat} .qq|', '|. $locale->text("wrongformat") .qq|')|;
-
- $form->{"javascript"} .= qq||;
- # show history button js
- $form->{javascript} .= qq||;
- #/show history button js
- $form->{javascript} .= qq||;
-
- $form->header;
-
- print qq|
-
-
-
+# $form->{invsubtotal} = $form->format_amount(\%myconfig, $form->{invsubtotal}, 2, 0); # template does this
+
+ } else {
+ 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);
+
+ $TMPL_VAR{tax} .= qq|
+
+ Enthaltene $form->{"${item}_description"} | . $form->{"${item}_rate"} * 100 .qq|% |
+ $form->{"${item}_total"} |
+
+
+ Nettobetrag |
+ $form->{"${item}_netto"} |
+
|;
+ }
+ }
+ }
+
+ $form->{oldinvtotal} = $form->{invtotal};
+
+ print $form->parse_html_template("oe/form_footer", {
+ %TMPL_VAR,
+ webdav => $webdav,
+ print_options => print_options(inline => 1),
+ label_edit => $locale->text("Edit the $form->{type}"),
+ label_workflow => $locale->text("Workflow $form->{type}"),
+ });
-
-