Bugzilla – Attachment 9212 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]
corrects errors in acquisitions calculations
0001-bug2865-corrected-acquisitons-calculations.patch (text/plain), 7.13 KB, created by
Chris Hall
on 2012-04-15 23:18:10 UTC
(
hide
)
Description:
corrects errors in acquisitions calculations
Filename:
MIME Type:
Creator:
Chris Hall
Created:
2012-04-15 23:18:10 UTC
Size:
7.13 KB
patch
obsolete
>From 598736fc6d4c3358fd6280bd74bfca4800bd6b6f Mon Sep 17 00:00:00 2001 >From: Chris Hall <chrish@catalyst.net.nz> >Date: Wed, 4 Apr 2012 14:51:26 +1200 >Subject: [PATCH] bug2865 corrected acquisitons calculations > >--- > acqui/basket.pl | 25 ++++--------------- > acqui/parcel.pl | 16 ++++++++---- > .../prog/en/modules/acqui/neworderempty.tt | 5 +++- > .../intranet-tmpl/prog/en/modules/acqui/parcel.tt | 4 +- > 4 files changed, 22 insertions(+), 28 deletions(-) > >diff --git a/acqui/basket.pl b/acqui/basket.pl >index de66891..eda6025 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -324,28 +324,15 @@ if ( $op eq 'delete_confirm' ) { > push @books_loop, \%line; > } > >-my $total_est_gste; >+ my $total_est_gste; > my $total_est_gsti; > my $gist_est; >- if ($gist){ # if we have GST >- if ( $bookseller->{'listincgst'} ) { # if prices already includes GST >- $total_rrp_gsti = $total_rrp; # we know $total_rrp_gsti >- $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 ); # and can reverse compute other values >- $gist_rrp = $total_rrp_gsti - $total_rrp_gste; # >- $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount ); >- $total_est_gsti = $total_rrp_est; >- } else { # if prices does not include GST >- $total_rrp_gste = $total_rrp; # then we use the common way to compute other values >- $gist_rrp = $total_rrp_gste * $gist; # >- $total_rrp_gsti = $total_rrp_gste + $gist_rrp; # >- $total_est_gste = $total_rrp_est; >- $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount ); >- } >- $gist_est = $gist_rrp - ( $gist_rrp * $discount ); >- } else { > $total_rrp_gsti = $total_rrp; >- $total_est_gsti = $total_rrp_est; >-} >+ $total_rrp_gste = $total_rrp_gsti / ( $gist + 1 ); >+ $gist_rrp = $total_rrp_gsti - $total_rrp_gste; >+ $total_est_gste = $total_rrp_gste - ( $total_rrp_gste * $discount ); >+ $total_est_gsti = $total_rrp_gsti - ( $total_rrp_gsti * $discount ); >+ $gist_est = $total_est_gsti / (1+$gist) * ($gist); # could also be ($total_est_gsti - $total_est_gste ) > > my $contract = &GetContract($basket->{contractnumber}); > my @orders = GetOrders($basketno); >diff --git a/acqui/parcel.pl b/acqui/parcel.pl >index 5d0d164..f3094b7 100755 >--- a/acqui/parcel.pl >+++ b/acqui/parcel.pl >@@ -77,7 +77,7 @@ my $bookseller=GetBookSellerFromId($booksellerid); > my $invoice=$input->param('invoice') || ''; > my $freight=$input->param('freight'); > my $input_gst = ($input->param('gst') eq '' ? undef : $input->param('gst')); >-my $gst= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; >+my $gstrate= $input_gst // $bookseller->{gstrate} // C4::Context->preference("gist") // 0; > my $datereceived = ($input->param('op') eq 'new') ? C4::Dates->new($input->param('datereceived')) > : C4::Dates->new($input->param('datereceived'), 'iso') ; > $datereceived = C4::Dates->new() unless $datereceived; >@@ -167,12 +167,12 @@ my @loop_received = (); > for (my $i = 0 ; $i < $countlines ; $i++) { > > #$total=($parcelitems[$i]->{'unitprice'} + $parcelitems[$i]->{'freight'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) >- $total = ($parcelitems[$i]->{'unitprice'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) >+ $total = ($parcelitems[$i]->{'ecost'}) * $parcelitems[$i]->{'quantityreceived'}; #weird, are the freight fees counted by book? (pierre) > $parcelitems[$i]->{'unitprice'} += 0; > my %line; > %line = %{ $parcelitems[$i] }; > $line{invoice} = $invoice; >- $line{gst} = $gst; >+ $line{gstrate} = $gstrate; > $line{total} = sprintf($cfstr, $total); > $line{booksellerid} = $booksellerid; > push @loop_received, \%line; >@@ -217,7 +217,9 @@ for (my $i = 0 ; $i < $countpendings ; $i++) { > $line{ordertotal} = sprintf("%.2f",$line{ecost}*$line{quantity}); > $line{unitprice} = sprintf("%.2f",$line{unitprice}); > $line{invoice} = $invoice; >- $line{gst} = $gst; >+ $line{gstrate} = $gstrate; >+ $line{gst} = $parcelitems[$i]->{'gst'} * $gstrate; >+ $line{total} = sprintf($cfstr, $total); > $line{total} = $total; > $line{booksellerid} = $booksellerid; > $ordergrandtotal += $line{ecost} * $line{quantity}; >@@ -304,6 +306,8 @@ $template->param( > name => $bookseller->{'name'}, > booksellerid => $booksellerid, > gst => $gst, >+ supplierid => $supplierid, >+ gstrate => $gstrate, > freight => $freight, > invoice => $invoice, > countreceived => $countlines, >@@ -315,8 +319,8 @@ $template->param( > totalquantity => $totalquantity, > tototal => sprintf($cfstr, $tototal), > ordergrandtotal => sprintf($cfstr, $ordergrandtotal), >- gst => $gst, >- grandtot => sprintf($cfstr, $tototal + $gst), >+ gst => sprintf($cfstr, $tototal*$gstrate), >+ grandtot => sprintf($cfstr, $tototal*(1+$gstrate)), # FIXME assumes budgeted cost is gst exclusive (currently correct), will need to be fixed once a pref exists for gst incl/excl gst > totalPunitprice => sprintf("%.2f", $totalPunitprice), > totalPquantity => $totalPquantity, > totalPqtyrcvd => $totalPqtyrcvd, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >index 8aec465..53007a7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/acqui/neworderempty.tt >@@ -31,10 +31,13 @@ function Check(ff) { > > _alertString +="-------------------------------------------------------------------\n\n"; > >- if ( isNull(ff.title,1) && isNull(ff.entertitle,1) ){ >+[% UNLESS( biblionumber ) %] >+// this caused errors so I enclosed it within an UNLESS, if biblionumber then ff.entertitle doesnt exist so checking it will cause a type error >+ if( isNull(ff.entertitle,1) ){ > ok=1; > _alertString += "\n- " + _("Title cannot be empty"); > } >+[% END %] > > if(isNull(ff.budget_id,1)){ > ok=1; >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..c034881 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,8 @@ > The total at the bottom of the page should be within a few cents of the total for the invoice. > </p> > </td> >- <td><b>Tax rate</b></td> >- <td>[% gst %]</td> >+ <td><b>Tax</b></td> >+ <td>[% gst %]</td> > </tr> > [% END %] > <tr> >-- >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