I think I now have something in invoice.pl :

    $line->{total_tax_excluded} = Koha::Number::Price->new(
$line->{unitprice_tax_excluded} * $line->{quantity} )->format;
    $line->{total_tax_included} = Koha::Number::Price->new(
$line->{unitprice_tax_included} * $line->{quantity} )->format;


Format yield a string, with a comma for french format and not a dot.
The problem is: we're doing calculation with the formatted value, for
example :

$total_tax_excluded += $$line{total_tax_excluded};


With a string with comma, it rounds the result:

$ perl -E 'say "2,2" + 2'
4
$ perl -E 'say "2.2" + 2'
4.2


2017-04-19 17:43 GMT+02:00 Jonathan Druart
<jonathan.dru...@bugs.koha-community.org>:
> Nicolas, what you describe can be ok, if the tax rate is 0.
> You need to provide ALL the price values from aqorders (quantity,
> listprice, unitprice, unitprice_tax_excluded, unitprice_tax_included,
> quantityreceived, rrp, rrp_tax_excluded, rrp_tax_included, ecost,
> ecost_tax_excluded, ecost_tax_included, tax_rate_bak, tax_rate_on_ordering,
> tax_rate_on_receiving, tax_value_bak, tax_value_on_ordering,
> tax_value_on_receiving, discount, uncertainprice).
>
>
> On Wed, 19 Apr 2017 at 12:16 Nicolas Legrand <nicolas.legr...@bulac.fr>
> wrote:
>
>> Hey Jonathan, Hey Hugo,
>>
>> we also have trouble in 16.11 with tax calculation :
>>
>> mysql> select unitprice_tax_excluded, unitprice_tax_included from
>> aqorders join aqinvoices on aqinvoices.invoiceid = aqorders.invoiceid
>> where aqinvoices.invoiceid = 2674 limit 10;
>> +------------------------+------------------------+
>> | unitprice_tax_excluded | unitprice_tax_included |
>> +------------------------+------------------------+
>> |              80.400000 |              80.400000 |
>> |              32.760000 |              32.760000 |
>> |             110.700000 |             110.700000 |
>> |              87.410000 |              87.410000 |
>> |              23.290000 |              23.290000 |
>> |             127.320000 |             127.320000 |
>> |              28.940000 |              28.940000 |
>> |              72.240000 |              72.240000 |
>> |             205.670000 |             205.670000 |
>> |              18.590000 |              18.590000 |
>> +------------------------+------------------------+
>> 10 rows in set (0.00 sec)
>>
>> We had a lot of errors while upgrading we unfortunately didn't pay
>> attention to:
>>
>> Use of uninitialized value in multiplication (*) at
>> ./installer/data/mysql/updatedatabase.pl line 13614.
>> [A LOT MORE OF THE SAME THING]
>> Use of uninitialized value in multiplication (*) at
>> ./installer/data/mysql/updatedatabase.pl line 13619.
>> Upgrade to 16.06.00.043 done (Bug 13323 - Change the tax rate on receiving)
>>
>>
>> I'm going to investigate this, if someone as good ideas I'm eager to
>> hear from them :).
>>
> _______________________________________________
> Koha mailing list  http://koha-community.org
> Koha@lists.katipo.co.nz
> https://lists.katipo.co.nz/mailman/listinfo/koha



-- 

Nicolas Legrand
Administration technique et développements du système de gestion de la
bibliothèque


Bibliothèque universitaire
des langues et civilisations

65 rue des Grands Moulins
F-75013 PARIS
T +33 1 81 69 18 22
www.bulac.fr
_______________________________________________
Koha mailing list  http://koha-community.org
Koha@lists.katipo.co.nz
https://lists.katipo.co.nz/mailman/listinfo/koha

Reply via email to