Bug 27203: Calculate tax based on ecost if unitprice not set
There is code in populate_order_with_prices that is intended to use ecost over unitprice,
it just doens't seem to be working.
Making it more explicit seems to take care of the issue.
To test:
1 - Create a basket
2 - Add an order line, don't set 'Actual cost: ', but use vendor price
and a discount.
3 - Save
4 - Display all columns, 'Actual cost tax inc.' are GST columns aren't set.
5 - Apply batch
6 - Redo 1,2, 3
7 - Display all columns, GST is calculated correctly, unitprice remains 0.
Signed-off-by: Marjorie <marjorie.barry-vila@collecto.ca>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit 66d26fa301)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
6eb3790ff4
commit
a103cdbf1f
|
|
@ -2798,8 +2798,8 @@ sub populate_order_with_prices {
|
|||
|
||||
# tax value = quantity * ecost tax excluded * tax rate
|
||||
# we should use the unitprice if included
|
||||
my $cost_tax_included = $order->{unitprice_tax_included} || $order->{ecost_tax_included};
|
||||
my $cost_tax_excluded = $order->{unitprice_tax_excluded} || $order->{ecost_tax_excluded};
|
||||
my $cost_tax_included = $order->{unitprice_tax_included} == 0 ? $order->{ecost_tax_included} : $order->{unitprice_tax_included};
|
||||
my $cost_tax_excluded = $order->{unitprice_tax_excluded} == 0 ? $order->{ecost_tax_excluded} : $order->{unitprice_tax_excluded};
|
||||
$order->{tax_value_on_ordering} = ( get_rounded_price($cost_tax_included) - get_rounded_price($cost_tax_excluded) ) * $order->{quantity};
|
||||
|
||||
}
|
||||
|
|
@ -2820,7 +2820,7 @@ sub populate_order_with_prices {
|
|||
|
||||
# tax value = quantity * ecost tax included * tax rate
|
||||
# we should use the unitprice if included
|
||||
my $cost_tax_excluded = $order->{unitprice_tax_excluded} || $order->{ecost_tax_excluded};
|
||||
my $cost_tax_excluded = $order->{unitprice_tax_excluded} == 0 ? $order->{ecost_tax_excluded} : $order->{unitprice_tax_excluded};
|
||||
$order->{tax_value_on_ordering} = $order->{quantity} * get_rounded_price($cost_tax_excluded) * $order->{tax_rate_on_ordering};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue