VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: SUGO on April 20, 2012, 13:20:26 PM

Title: [BUG] Calculation of taxes in VM 2.0.6
Post by: SUGO on April 20, 2012, 13:20:26 PM
Hi,

Sorry for the possible bad translation, the text has been translated with bing.

There is a problem of calculation of taxes in VM coming carry-over from previous versions, not is if you have observed the problem, open this post to discuss the problem and if you have a possible solution.

When VM estimated taxes per product line totals and taxes calculates them correctly, but the calculation in product lines are wrong.

Here is a detail of two orders and make accounts...

****************************************************************
Line by line of product with 5% requested with tax...
(http://www.webempresa.com/media/kunena/attachments/3279/ProblemasVM206lineasmaltotalesbien.png)

The tax of 2.43 where gets it?
(15 * 18) / 100 = 2.7 not 2,43 €

Still invoice totals are correct
****************************************************************
Second option is that I ought to be implemented by the type of store...

Asked by line with 5% and by total of invoice...
(http://www.webempresa.com/media/kunena/attachments/3279/ProblemasVM206lineasbientotalesmal.png)

(1.138,50*18)/100= 204.93 no 207.48

By most calculations that I do not is where he takes this figure, I guess that it is the sum of total rounding error, from there, totals and other data calculated them wrongly loading the invoice

****************************************************************

In the details of the order, if I put VM in debug mode, is that only stores total, so there is no way to "pass" the calculations of VM and power in the templates fix this error.


vmdebug tmpl details_item $item Var1:
stdClass Object
(
[virtuemart_order_item_id] => 129
[product_quantity] => 10
[order_item_name] => Lija resina R/A - Grano: 50
[order_item_sku] => SA-LRA-GR:50
[virtuemart_product_id] => 230
[product_item_price] => 25.00000
[product_final_price] => 26.55000
[product_basePriceWithTax] => 29.50000
[product_subtotal_with_tax] => 265.50000
[product_subtotal_discount] => -29.50000
[product_tax] => 40.50000
[product_attribute] =>
[order_status] => P
[intnotes] =>
[virtuemart_category_id] => 3
)

Array
(
)



Doing hacks in the file of calculations of prices see an error, then it is successive updates because you know the problems that give rise to all these changes.

I open the debate and to see if someone can give me a bit of light, that has me this already of nerves

Best regards
Javier Gómez.

Site URL: www.sugo.es
Joomla! 2.5.4
VM 2.0.6 (stable version?)

Forum at Spanish where I'm trying to give light to this problem.
http://www.webempresa.com/foro/30-VirtueMart-20/47910-Error-en-el-c%C3%A1lculo-de-impuestos-en-VM-206.html (http://www.webempresa.com/foro/30-VirtueMart-20/47910-Error-en-el-c%C3%A1lculo-de-impuestos-en-VM-206.html)
Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: Jörgen on April 20, 2012, 14:13:34 PM
Hello Javier

I think it looks alright.

In Sweden we have 25 % VAT. Which means 25 % on the price 20 % of the total price.

In Your example it would be :

1360,14 € = is Your price + 18 % VAT = P + T = P + (P x 0,18) = P x 1,18
P = is Your price without tax
T = is Your VAT 18% = P x 0,18
T = P x 0,18

1,18 x P = 1360,14
P = 1152,66
T = P x 0,18 = 1152,66 x 0,18 = 207,48 €

This is how I understand this

Jörgen @ Kreativ Fotografi



Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: teobgeno on April 20, 2012, 16:36:51 PM
By regarding this i just notice another issue

In the first example the second product costs 25. The quantity is 10 .So 10 x 25 =250 . The tax 18% so (250*18)/100=45

250+45=295 the total column is ok.

The column impuesto(tax) shows the total tax  but it shows 405 . Is it possible the total tax to have bigger value than the total amount :)
This value must be 45 .The product costs 25 tax is (25*18)/100=4,5    4,5*10=45.
The problem is that the value of total tax per product assigned to the tpl has already been multiplied by the quantity and at the tpl is multiplied again by the quantity

At components/com_virtuemart/views/orders/tmpl/details_items.php

this line

<td align="right" class="priceCol"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($item->product_tax ,0$qtt)."</span>" ?></td>


should modified to


<td align="right" class="priceCol"><?php echo "<span  class='priceColor2'>".$this->currency->priceDisplay($item->product_tax ,01)."</span>" ?></td>


As for the problem with the wrong tax calculation testing on joomla 1.5.26 VM 2.0.6 no such an issue

Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: SUGO on April 21, 2012, 21:30:19 PM
There is still an error of calculation in the totals when the invoice with VAT per invoice, look at the two totals, of the second order is wrong, the total does not calculate it well.
Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: marub on April 22, 2012, 10:36:11 AM
I have the same problem with wrong tax if you have more than one qty.
see picture below

[attachment cleanup by admin]
Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: SUGO on April 22, 2012, 21:11:58 PM
Hi,

I think that the guys from development should focus its work in these areas, a shop that does not calculate well the lines or the totals on invoices is a disaster for all users.

Without encouragement to create controversy, I see no intention to explain how and when may solve these problems.

best regards
Javier Gomez
Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: simbus82 on April 23, 2012, 12:02:46 PM
Quote from: SUGO on April 22, 2012, 21:11:58 PM
Hi,

I think that the guys from development should focus its work in these areas, a shop that does not calculate well the lines or the totals on invoices is a disaster for all users.

Without encouragement to create controversy, I see no intention to explain how and when may solve these problems.

best regards
Javier Gomez


too much weeks that we know this problem.

a broken calculation system is equal to a full broken ecommerce.

Stop adding features plaese (klarna?systempay? bha!!!), stay on correcting this issue!!!
Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: teobgeno on April 23, 2012, 16:53:47 PM
I would like to make a question to anyone who has this issue.
Did you have this calculation problem at 2.0.4 ?
Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: marub on April 23, 2012, 19:23:15 PM
it works fine at 2.0.4
Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: teobgeno on April 23, 2012, 19:39:11 PM
ok but i seems that you have not the same problem as simbus82 and SUGO . Their problem is that tax calculation is completely wrong even for 1 quantity. Yours is that the tax clculation is correct for 1 quantity but is wrong for > 1 quantity . Check my reply above with the code modification i  made maybe it will help solve your problem. Actually i am waiting a reply from someone with the kind of error like simbus82 - SUGO described.
Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: Namit on May 20, 2012, 22:44:06 PM
Thank You, teobgeno
Your way to solve this problem is working fine. :)
Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: ScooterStrick on May 21, 2012, 05:26:13 AM
Not sure if this can shed a lite... I had problems also until I selected to tax the entire order(not individual products) and I couldn't use decimal as I thought I should. This being using % of 'Tax Per Bill'. I am in US, so needed 6% for my state. Simply input 'Tax Per Bill', '+%', and '6' for 6% on dollar. I do have rounding up, but 7.9999999 is pretty much '8'. Works no matter how many items are in cart. Hope this makes sense and helps!
Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: awdsas on June 13, 2012, 16:23:24 PM
Hi - the solution suggested by teobgeno have to be applied to the invoice_order.php template that can be found at:

$webdir/components/com_virtuemart/views/invoice/tmpl/


My .02€,

Andrea
Title: Re: [BUG] Calculation of taxes in VM 2.0.6
Post by: awdsas on June 13, 2012, 16:26:01 PM
I did a mistake - the correct template name is invoice_items.php.

Sorry about that.


- ANdrea