From 2db7cb03ba883534e07fc3eeffe954eb3d1ba77c Mon Sep 17 00:00:00 2001 From: Chris Hall Date: Tue, 28 Feb 2012 12:45:57 +1300 Subject: [PATCH] bug 2865 acq calculations incorrectly calculating gst and discounts --- acqui/parcel.pl | 4 ++-- koha-tmpl/intranet-tmpl/prog/en/js/acq.js | 12 +++++++----- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/acqui/parcel.pl b/acqui/parcel.pl index 5d0d164..5a5ba3c 100755 --- a/acqui/parcel.pl +++ b/acqui/parcel.pl @@ -315,8 +315,8 @@ $template->param( totalquantity => $totalquantity, tototal => sprintf($cfstr, $tototal), ordergrandtotal => sprintf($cfstr, $ordergrandtotal), - gst => $gst, - grandtot => sprintf($cfstr, $tototal + $gst), + gst => sprintf($cfstr, $gst), + grandtot => sprintf($cfstr, $tototal * (1+$gst)), totalPunitprice => sprintf("%.2f", $totalPunitprice), totalPquantity => $totalPquantity, totalPqtyrcvd => $totalPqtyrcvd, diff --git a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js index b137f59..c9ae9ca 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js +++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js @@ -660,15 +660,17 @@ function calcNeworderTotal(){ var currcode = new String(document.getElementById('currency').value); var exchangerate = new Number(document.getElementById(currcode).value); - var gst_on=(!listinc && invoiceingst); - //do real stuff var rrp = new Number(listprice*exchangerate); var ecost = new Number(Math.floor(rrp * (100 - discount ))/100); var GST = new Number(0); - if (gst_on) { - rrp=rrp * (1+f.gstrate.value / 100); - GST=ecost * f.gstrate.value / 100; + + rrp *= (100-discount) / 100; + if (listinc==0){ + rrp *= 1 + new Number(f.gstrate.value); + if(invoiceingst!=0) { + GST=ecost * f.gstrate.value / 100; + } } var total = new Number( (ecost + GST) * quantity); -- 1.7.4.1