Koha does not manage the VAT properly when filling a basket with staged records. Let's take a book whose Recommended Retail Price excluding tax is 39 euros. On the vendor's website, I import the record for this book in iso2709 In the record (UNIMARC), the price is in 010$d after the ISBN. So, I found in my record 10$d39.00 EUR I stage this record in Koha with Stage Marc Records Tools. In Acquisition module, I create a vendor with: - List item price includes tax: Yes - Invoice item price includes tax: Yes - Discount: 9.0000 % - Tax rate: 5.5% I create a new basket for this vendor. I fill this basket with my stage record. I think I should have for the command line in this basket : - RRP tax included : 39 euros - Ecost tax included : 39 euros - 3,51 euros = 35,49 euros - RRP tax excluded : 39*100/105.5 = 36,96 euros - Ecost tax excluded : 35,49*100/105.5 = 33,63 euros BUT instead I see the following values : - RRP tax included : 42.86 euros - Ecost tax included : 39 euros - RRP tax excluded : 40,63 - Ecost tax excluded : 36,97 So, Koha considered the "39 euros" value in my record as a Ecost price. I dont think it is normal, as as chose "List item price includes tax: Yes" in vendor record. M. Saby Rennes 2 University
Created attachment 14071 [details] [review] Bug 9280: FIX price calculation adding an order from a staged file Test plan: Add an order from a staged file containing a price value (010$d for UNIMARC user). Check this patch with 2 different vendors (listprice=1 and listprice=0). Check the calculated price (depending discount and gstrate).
It failed : I have got negative ecost inc. prices (for vendor with listprice =1 ; didn't test for listprice=0) in record : 75 euros RRP tax inc. : 75.00 ecost inc. : -675.00 Total tax in. : -675.00 GST rate 5% GST : -32.14 M. Saby
Yep, bad test just before pushing :-/
Created attachment 14074 [details] [review] Bug 9280: Followup FIX price calculation adding an order from a staged file
I applied the 2 patches. Bug partially corrected : 1st vendor : List item price includes tax: Yes Invoice item price includes tax: Yes Discount: 10.0000 % Tax rate: 5.0% => OK : => Stage record with 27 euros in 010$d => line in a basket : - RRP tax exc. : 25,71 - ecost tax exc. : 23,14 - RRP tax inc. : 27 - ecost tax inc. : 24,30 - Total tax exc. (EURO) : 23,14 - Total tax inc. (EURO) : 24,30 - GST % : 5% - GST : 1,16 Prices are correct : - (25,71 * 5 / 100) + 25,71 = 27 - 27 * 0.9 = 24,30 - 23,14 * 5 / 100 = 24,30 2d vendor : 1st vendor : List item price includes tax: No Invoice item price includes tax: Yes Discount: 10.0000 % Tax rate: 5.0% => KO I have exactly the same values for 2d vendor, while I was waiting for RRP tax exc. = 27 euros M. Saby
Created attachment 14079 [details] [review] Bug 9280: FIX price calculation adding an order from a staged file Test plan: Add an order from a staged file containing a price value (010$d for UNIMARC user). Check this patch with 2 different vendors (listprice=1 and listprice=0). Check the calculated price (depending discount and gstrate).
I'm a little bit lost... I don't understand the behavior we want here. The Bug 7180 includes a complex calculation and rewrite a big part of this page but I don't know what we want for this current version. The patch does in *ALL* cases: rrp = 010$d (or similar) ecost = rrp * ( 1 - discount) This 2 values are stored in the DB and the values are calculated on the fly depending of the bookseller parameters.
Yes, it is tiresome... I found a way to explain what I mean : If you create a new order line from scratch (not from staged record), Koha ask for "Vendor price", and calculates other prices. For me, 010$d is the equivalent of this "Vendor price", and should be treated in the same way. And it is not currently the case. M. Saby
With the last patch, what is wrong ?
you mean only with patch 14079 ? I did not test yet...
It is OK with patch 14079, I have : -1d vendor : List item price includes tax: Yes Invoice item price includes tax: Yes Discount: 10.0000 % Tax rate: 5.0% stage record with 010$d = 27 euros RRP tax exc. = 25.71 euros RRP tax incl. = 27 euros (wich is 25.71+ (25,71 * 5/100)) discount calculated correctly -2d vendor : List item price includes tax: No Invoice item price includes tax: Yes Discount: 10.0000 % Tax rate: 5.0% stage record with 010$d = 27 euros RRP tax exc. = 27 euros RRP tax incl. = 28.35 (which is 27 + (27*5/100)) discount calculated correctly I sign off.
Created attachment 14084 [details] [review] Bug 9280: FIX price calculation adding an order from a staged file
Is this problem really minor ? It does not happen in a lot of places, but it's very annoying (and not "circumventable" ?). I would say "normal" or "major"
Changed to "normal"
Created attachment 14707 [details] [review] [Passed QA] Bug 9280: FIX price calculation adding an order from a staged file Test plan: Add an order from a staged file containing a price value (010$d for UNIMARC user). Check this patch with 2 different vendors (listprice=1 and listprice=0). Check the calculated price (depending discount and gstrate). Signed-off-by: mathieu saby <mathieu.saby@univ-rennes2.fr> Signed-off-by: Elliott Davis <elliott@bywatersolions.com> introduces no new bugs
This patch has been pushed to master.
Pushed to 3.10.x will be in 3.10.3