From 35eee7ddc7f21496de71d36ecf4c3661cd499bf1 Mon Sep 17 00:00:00 2001
From: Lyon3 Team
Date: Thu, 31 May 2012 17:30:57 +0200
Subject: [PATCH] Tax rate calculation in reception summary page
In the Already received table, the total was wrong due to
an erroneous calculation of tax rate
---
acqui/parcel.pl | 10 +++++++---
.../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 9 +++++++--
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/acqui/parcel.pl b/acqui/parcel.pl
index 5d0d164..714ef62 100755
--- a/acqui/parcel.pl
+++ b/acqui/parcel.pl
@@ -295,7 +295,9 @@ if ($count>$resultsperpage){
#$totalfreight=$freight;
$tototal = $tototal + $freight;
-
+my $gstreg = $bookseller->{gstreg};
+my $gstpart = ($gstreg)? $tototal - ($tototal / ($gst + 1)) : $tototal * $gst;
+my $grandtot = ($gstreg)? sprintf($cfstr, $tototal) : sprintf($cfstr, $tototal + $gstpart);
$template->param(
invoice => $invoice,
datereceived => $datereceived->output('iso'),
@@ -315,8 +317,10 @@ $template->param(
totalquantity => $totalquantity,
tototal => sprintf($cfstr, $tototal),
ordergrandtotal => sprintf($cfstr, $ordergrandtotal),
- gst => $gst,
- grandtot => sprintf($cfstr, $tototal + $gst),
+ gstpercent => sprintf( "%.2f", $gst * 100 ) . '%',
+ gstpart => sprintf($cfstr,$gstpart),
+ gstreg => $gstreg,
+ grandtot => $grandtot,
totalPunitprice => sprintf("%.2f", $totalPunitprice),
totalPquantity => $totalPquantity,
totalPqtyrcvd => $totalPqtyrcvd,
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
index a5d3e1a..ea967e3 100644
--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/parcel.tt
@@ -348,8 +348,13 @@
The total at the bottom of the page should be within a few cents of the total for the invoice.
- Tax rate |
- [% gst %] |
+ [% IF ( gstreg ) %]
+ From which included
+ (tax rate [% gstpercent %]) |
+ [% ELSE %]
+ Tax rate ([% gstpercent %]) |
+ [% END %]
+ [% gstpart %] |
[% END %]
--
1.7.2.5