From c0cc8bb220b76219934bee9ac5dd5e8e971ddc65 Mon Sep 17 00:00:00 2001 From: Rolf Fluehmann Date: Thu, 9 Jun 2016 12:43:08 +0200 Subject: [PATCH] added roundings on prints --- SL/IS.pm | 10 +++++-- SL/OE.pm | 8 ++++- templates/print/RB/invoice.html | 23 ++++++++++----- templates/print/RB/sales_order.html | 19 +++++++----- templates/print/RB/sales_quotation.html | 39 ++++++++++++++----------- templates/webpages/is/form_footer.html | 15 +++++----- templates/webpages/oe/form_footer.html | 2 +- 7 files changed, 73 insertions(+), 43 deletions(-) diff --git a/SL/IS.pm b/SL/IS.pm index e32827f44..c579aad8d 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -519,9 +519,15 @@ sub invoice_details { $form->{nodiscount} = $form->format_amount($myconfig, $nodiscount, 2); $form->{yesdiscount} = $form->format_amount($myconfig, $form->{nodiscount_total} - $nodiscount, 2); - $form->{invtotal} = ($form->{taxincluded}) ? $form->{total} : $form->{total} + $tax; - $form->{total} = $form->format_amount($myconfig, $form->{invtotal} - $form->{paid}, 2); + my $grossamount = ($form->{taxincluded}) ? $form->{total} : $form->{total} + $tax; + $form->{invtotal} = $form->round_amount($grossamount, 2, 1); + $form->{rounding} = $form->round_amount( + $form->{invtotal} - $form->round_amount($grossamount, 2), + 2 + ); + $form->{rounding} = $form->format_amount($myconfig, $form->{rounding}, 2); + $form->{total} = $form->format_amount($myconfig, $form->{invtotal} - $form->{paid}, 2); $form->{invtotal} = $form->format_amount($myconfig, $form->{invtotal}, 2); $form->{paid} = $form->format_amount($myconfig, $form->{paid}, 2); diff --git a/SL/OE.pm b/SL/OE.pm index c4e768be0..31b3067f5 100644 --- a/SL/OE.pm +++ b/SL/OE.pm @@ -1576,9 +1576,15 @@ sub order_details { $form->{subtotal_nofmt} = $form->{ordtotal}; } - $form->{ordtotal} = ($form->{taxincluded}) ? $form->{ordtotal} : $form->{ordtotal} + $tax; + my $grossamount = ($form->{taxincluded}) ? $form->{ordtotal} : $form->{ordtotal} + $tax; + $form->{ordtotal} = $form->round_amount( $grossamount, 2, 1); + $form->{rounding} = $form->round_amount( + $form->{ordtotal} - $form->round_amount($grossamount, 2), + 2 + ); # format amounts + $form->{rounding} = $form->format_amount($myconfig, $form->{rounding}, 2); $form->{quototal} = $form->{ordtotal} = $form->format_amount($myconfig, $form->{ordtotal}, 2); $form->set_payment_options($myconfig, $form->{$form->{type} =~ /_quotation/ ? 'quodate' : 'orddate'}, $form->{type}); diff --git a/templates/print/RB/invoice.html b/templates/print/RB/invoice.html index b4a5ec9d9..a167dc63d 100644 --- a/templates/print/RB/invoice.html +++ b/templates/print/RB/invoice.html @@ -5,7 +5,7 @@   - +
@@ -33,14 +33,14 @@ - +
- + @@ -48,7 +48,7 @@ - + @@ -85,7 +85,7 @@
<%city%>
<%country%> - + - +
Ausgestellt am <%invdate%>
Bezahlbar bis <%duedate%>
Nummer <%invnumber%>
Lieferdatum <%deliverydate%>
<%shiptoname%>
<%shiptostreet%>
<%shiptozipcode%> @@ -100,7 +100,7 @@
 
@@ -139,7 +139,7 @@ netprice = linetotal/qty - + <%if taxincluded%> @@ -160,6 +160,13 @@ netprice = linetotal/qty <%end tax%> +<%if rounding%> + + + + +<%end rounding%> + <%if paid%> @@ -207,7 +214,7 @@ netprice = linetotal/qty - +

Total
Rundung<%rounding%>
Bezahlt
 
diff --git a/templates/print/RB/sales_order.html b/templates/print/RB/sales_order.html index 4cbe20afb..260d1ed96 100644 --- a/templates/print/RB/sales_order.html +++ b/templates/print/RB/sales_order.html @@ -5,7 +5,7 @@
  - +
@@ -33,14 +33,14 @@ - +
- + @@ -48,7 +48,7 @@ - + @@ -86,7 +86,7 @@ - +
Bestelldatum <%orddate%>
Lieferbar bei <%reqdate%>
Bestellnummer <%ordnumber%>
 
 
@@ -119,7 +119,7 @@ adjust the colspan if you include this to shift subtotal one to the right - + <%if taxincluded%> @@ -141,6 +141,11 @@ adjust the colspan if you include this to shift subtotal one to the right <%end tax%> +<%if rounding%> + + +<%end rounding%> + @@ -184,7 +189,7 @@ adjust the colspan if you include this to shift subtotal one to the right - +

Total
Rundung<%rounding%>
 
 
diff --git a/templates/print/RB/sales_quotation.html b/templates/print/RB/sales_quotation.html index 138063154..983d976d5 100644 --- a/templates/print/RB/sales_quotation.html +++ b/templates/print/RB/sales_quotation.html @@ -5,7 +5,7 @@
  - + @@ -151,6 +151,11 @@ <%end tax%> +<%if rounding%> + + +<%end rounding%> + diff --git a/templates/webpages/is/form_footer.html b/templates/webpages/is/form_footer.html index 7f1bb622a..9101d2c14 100644 --- a/templates/webpages/is/form_footer.html +++ b/templates/webpages/is/form_footer.html @@ -107,13 +107,6 @@ [%- END %] -[%- IF rounding %] - - - - -[%- END %] - [%# tax %] [% FOREACH item = taxaccounts_array %] [% SET description_ref = item _ '_description' %] @@ -131,6 +124,14 @@ [%- END %] [%- END %] + +[%- IF rounding %] + + + + +[%- END %] + diff --git a/templates/webpages/oe/form_footer.html b/templates/webpages/oe/form_footer.html index fbeb52992..6c6072e84 100644 --- a/templates/webpages/oe/form_footer.html +++ b/templates/webpages/oe/form_footer.html @@ -108,13 +108,13 @@ [%- END %] + [% tax %] [%- IF rounding %] [%- END %] - [% tax %]
@@ -76,22 +76,22 @@ - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + +
NummerDatumGültig bisKontaktLagerplatzLieferung mit
<%quonumber%><%quodate%><%reqdate%><%employee%><%shippingpoint%><%shipvia%>
NummerDatumGültig bisKontaktLagerplatzLieferung mit
<%quonumber%><%quodate%><%reqdate%><%employee%><%shippingpoint%><%shipvia%>
Rundung<%rounding%>
 
[% 'Rounding' | $T8 %][% LxERP.format_amount(rounding, 2) %]
[% 'Rounding' | $T8 %][% LxERP.format_amount(rounding, 2) %]
[% 'Total' | $T8 %] [% LxERP.format_amount(invtotal, 2) %][% LxERP.format_amount(invsubtotal, 2) %]
[% 'Rounding' | $T8 %] [% LxERP.format_amount(rounding, 2) %]
[% 'Total' | $T8 %] [% LxERP.format_amount(invtotal, 2) %] -- 2.20.1