Bugzilla – Attachment 8460 Details for
Bug 2865
Acquisitions: GST not calculating correctly.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Corrected errors in previous patch
0001-bug-2865-acq-calculations-incorrectly-calculating-gs.patch (text/plain), 3.29 KB, created by
Chris Hall
on 2012-03-22 04:34:09 UTC
(
hide
)
Description:
Corrected errors in previous patch
Filename:
MIME Type:
Creator:
Chris Hall
Created:
2012-03-22 04:34:09 UTC
Size:
3.29 KB
patch
obsolete
>From a8f3876c837f7e7de588e01c30cbf39c0946bfc2 Mon Sep 17 00:00:00 2001 >From: Chris Hall <chrish@catalyst.net.nz> >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 | 31 +++++++++++++++++----------- > 2 files changed, 21 insertions(+), 14 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..1bf144a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/js/acq.js >+++ b/koha-tmpl/intranet-tmpl/prog/en/js/acq.js >@@ -657,30 +657,37 @@ function calcNeworderTotal(){ > var listprice = new Number(f.listprice.value); > var invoiceingst = new Number (f.invoiceincgst.value); > // var exchangerate = new Number(f.elements[currency].value); //get exchange rate >- var currcode = new String(document.getElementById('currency').value); >- var exchangerate = new Number(document.getElementById(currcode).value); >- >- var gst_on=(!listinc && invoiceingst); >+ var currcode = new String(document.getElementById('currency').value); >+ var exchangerate = new Number(document.getElementById(currcode).value); >+ var gstrate = new Number(f.gstrate.value); > > //do real stuff >+ // rrp (replacement cost) should be inclusive of gst and should not take a discount into account > var rrp = new Number(listprice*exchangerate); >+ // ecost (budgeted cost) should be gst exclusive and should take a discount into account > var ecost = new Number(Math.floor(rrp * (100 - discount ))/100); >+ // the value of the gst, the rate is in f.gstrate.value > 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){ >+ // list price is gst exclusive so can calc gst easily >+ GST = rrp * gstrate; >+ // list price is gst exclusive, rrp must include gst >+ rrp *= 1 + gstrate; >+ } else { >+ // list price is gst inclusive >+ GST = (rrp/1.15)*0.15; >+ ecost /= 1 + gstrate; > } > >- var total = new Number( (ecost + GST) * quantity); >+ var total = new Number(ecost * quantity); > > f.rrp.value = rrp.toFixed(2); >- >-// f.rrp.value = rrp >-// f.rrp.value = 'moo' >- > f.ecost.value = ecost.toFixed(2); > f.total.value = total.toFixed(2); > f.listprice.value = listprice.toFixed(2); >+ f.unitprice.value = ecost.toFixed(2); > > // gst-stuff needs verifing, mason. > if (f.GST) { >-- >1.7.4.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 2865
:
898
|
899
|
7911
|
8375
|
8460
|
9212