Bugzilla – Attachment 161691 Details for
Bug 35114
Calculation around basket details and basketgroup not correct
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35114: Fix calculation around basketgroup and basket details
Bug-35114-Fix-calculation-around-basketgroup-and-b.patch (text/plain), 4.43 KB, created by
Thibaud Guillot (thibaud_g)
on 2024-01-31 14:54:28 UTC
(
hide
)
Description:
Bug 35114: Fix calculation around basketgroup and basket details
Filename:
MIME Type:
Creator:
Thibaud Guillot (thibaud_g)
Created:
2024-01-31 14:54:28 UTC
Size:
4.43 KB
patch
obsolete
>From fb20dd6c2a53ba33daf649114f391f3e96be5e10 Mon Sep 17 00:00:00 2001 >From: Thibaud Guillot <thibaud.guillot@biblibre.com> >Date: Tue, 16 Jan 2024 16:02:11 +0100 >Subject: [PATCH] Bug 35114: Fix calculation around basketgroup and basket > details > >Test plan: > >1) I purpose a simple way to test it with new fresh data. First of all >go to one of your vendor and set a discount of 9%. Then create a new >basket, add to basket a new line from an empty record. >Set a vendor price to 15.90 and just add this order > >2) Configure the basket.pl table to show all columns, see budgeted cost >and actual cost (exc or inc). There is already a difference of one cent. > >3) Let's take a look at the basket groups now, for this, close this >basket. Go on tab menu and select basket group. Click on new basket >group. Normally you will see the new basket created on step 1. The total >here is 14.47.. and when you check on basket detail it's 14.46 cause >this total (from basket groups) comes from ecost exc. while total line >on basket detail comes from actual cost exc. > >4) Apply this patch and see changes > >Sponsored-by: BibLibre >--- > acqui/basket.pl | 8 +++----- > acqui/basketgroup.pl | 8 ++++---- > koha-tmpl/intranet-tmpl/prog/js/acq.js | 2 +- > 3 files changed, 8 insertions(+), 10 deletions(-) > >diff --git a/acqui/basket.pl b/acqui/basket.pl >index 33253aa..33ca9a5 100755 >--- a/acqui/basket.pl >+++ b/acqui/basket.pl >@@ -343,7 +343,7 @@ if ( $op eq 'list' ) { > $foot{$$line{tax_rate}}{tax_rate} = $$line{tax_rate}; > $foot{$$line{tax_rate}}{tax_value} += get_rounded_price($$line{tax_value}); > $total_tax_value += $$line{tax_value}; >- $foot{$$line{tax_rate}}{quantity} += get_rounded_price($$line{quantity}); >+ $foot{$$line{tax_rate}}{quantity} += $$line{quantity}; > $total_quantity += $$line{quantity}; > $foot{$$line{tax_rate}}{total_tax_excluded} += $$line{total_tax_excluded}; > $total_tax_excluded += $$line{total_tax_excluded}; >@@ -456,10 +456,8 @@ sub get_order_infos { > # If we have an actual cost that should be the total, otherwise use the ecost > $line{unitprice_tax_included} += 0; > $line{unitprice_tax_excluded} += 0; >- my $cost_tax_included = $line{unitprice_tax_included} || $line{ecost_tax_included}; >- my $cost_tax_excluded = $line{unitprice_tax_excluded} || $line{ecost_tax_excluded}; >- $line{total_tax_included} = get_rounded_price($cost_tax_included) * $line{quantity}; >- $line{total_tax_excluded} = get_rounded_price($cost_tax_excluded) * $line{quantity}; >+ $line{total_tax_included} = get_rounded_price($line{ecost_tax_included} * $line{quantity}); >+ $line{total_tax_excluded} = get_rounded_price($line{ecost_tax_excluded} * $line{quantity}); > $line{tax_value} = $line{tax_value_on_ordering}; > $line{tax_rate} = $line{tax_rate_on_ordering}; > >diff --git a/acqui/basketgroup.pl b/acqui/basketgroup.pl >index 38f7b6b..1f83708 100755 >--- a/acqui/basketgroup.pl >+++ b/acqui/basketgroup.pl >@@ -75,14 +75,14 @@ sub BasketTotal { > my $total = 0; > my @orders = GetOrders($basketno); > for my $order (@orders){ >- # FIXME The following is wrong >+ # FIXME The following is wrong <- still true ? remove if patch 35114 fixed it > if ( $bookseller->listincgst ) { >- $total = $total + ( get_rounded_price($order->{ecost_tax_included}) * $order->{quantity} ); >+ $total = $total + ( $order->{ecost_tax_included} * $order->{quantity} ); > } else { >- $total = $total + ( get_rounded_price($order->{ecost_tax_excluded}) * $order->{quantity} ); >+ $total = $total + ( $order->{ecost_tax_excluded} * $order->{quantity} ); > } > } >- return $total; >+ return get_rounded_price($total); > } > > #displays all basketgroups and all closed baskets (in their respective groups) >diff --git a/koha-tmpl/intranet-tmpl/prog/js/acq.js b/koha-tmpl/intranet-tmpl/prog/js/acq.js >index 89e1ad1..83e70b7 100644 >--- a/koha-tmpl/intranet-tmpl/prog/js/acq.js >+++ b/koha-tmpl/intranet-tmpl/prog/js/acq.js >@@ -190,7 +190,7 @@ function updateCosts(){ > var rep = new Number(listprice*exchangerate); > var ecost = rrp; > if ( 100-discount != 100 ) { //Prevent rounding issues if no discount >- ecost = new Number(Math.floor(rrp * (100 - discount )) / 100); >+ ecost = new Number(Math.round(rrp * (100 - discount )) / 100); > } > var total = new Number( ecost * quantity); > $("#rrp").val(rrp.toFixed(2)); >-- >2.30.2
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 35114
:
157495
|
161066
|
161691
|
161799
|
161800
|
162060
|
172124