News:

Support the VirtueMart project and become a member

Main Menu

Shipping VAT rounded together with final sales price?

Started by lindapowers, December 26, 2012, 18:07:51 PM

Previous topic - Next topic

lindapowers

Hi

Using Joomla 2.58 and VM 2.016

Im getting mad trying to solve this:

Setting up a product final price with the auto calculate cost price works perfectly.

i.e we enter 7.00 in final price and the system says cost price 6.73077 so the final cost of the product will be 7.00 always, a perfect round number.

Now the problem comes with shipping costs with VAT applied:

-------------------------------------------------------------------------------------

What we want to achieve is a shipping cost of 7.00 (with 21%VAT) which seems impossible.

so we set up our shipping cost for 15 kg=  5.7851 + 21%VAT 

I even used the same calculation inside the products tab to use the exact number VM2 will handle.

The only way it shows correctly is using 3 decimals at final sales price but that gives us a final price of 14.000 as you see in the image.

Why does final price relate to the shipping cost VAT????? If we change decimals at final price to 2 the shipping cost VAT gets rounded and that causes the error in the calculation.



Any idea?

We have tried even entering: 5.785123967 at transport VAT, 2 decimals, 3 etc

Why can't i set 3 decimal points for the transport VAT and 2 for the final price, they get rounded together.

Isn't the transport VAT supposed to be set in  "set decimals for VAT" configuration instead of "set final price" decimals??

There seems to be an error in the calculations for the shipping costs, we need to handle 3 or 4 or even 5 decimals there or the number will never be .00



I have tried setting it to VAT, TAXVAT etc

Am I missing something obvious?

Thanks

lindapowers

#1
Any idea?

How  can I show 3 or 4 decimals at shipping cost VAT?

Without it price will never get rounded to .00 :'(

PRO

how many shipment rates do you have?

are you using the weight_countries   plugin?


have you tried mine?
http://www.kaizenmediaworks.com/pro-ship-virtuemart-2-0-shipping-plugin-module


you could try mine and use the "else cost"



jjk

My price configuration certainly is very different from yours and I currently can't show VAT in the cart, because it is possible that customers add i.e. three different products with three different VAT rates into the cart. So my solution is to disable 'Show tax in cart" in VM configuration. As far as I know, there is no legal requirement in EU countries to display it in the cart (order form) - "invoices" are a different story.

To achieve "7 Euro" for the shipping cost, I've typed 7 / 1.19 into my electronic calculator, which displays 5.882352941 as the result and entered that net shipping cost amount into the shipment cost field (see screenshot). I'm not shure if this works in your case too, because my sales prices are rounded to "0" and are the result of several calculation rules added to my real cost price (what I have to pay to the supplier), while you apparently just calculate the net price from the final sales price.

[attachment cleanup by admin]
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

lindapowers

#4
Hi PRO we are using the weight_countries plugin

And we have a lot of shipping costs, can't tell you exact cause we are bulding them, for now we have set up like 8 and on 4 we get wrong rounding price.

We sell our products in boxes of 5,10 and 15 kg. Thats gives a lot of variants until 100 kg.

I looked at your shipping plugin before but we can't use it cause we need prices by zip code interval.

In Spain we have different prices for Canary islands and Baleares etc etc


Hi Joseph

Here is not legal to show 0 decimals, we need 2 even in the checkout. If we put 0 decimals, sure it works but is not legal and the rounding becomes even more dramatic with the Tax.

If you change your rounding from 0 to 2 you will have the same problem as me cause virtuemart rounds shipping costs TAX no matter how many decimals you add.

I'm glad to see there is actually an error in the calculation system.

Try to obtain 7.00 € in a shipping tax with 21% VAT applied:

It doesn't matter if you put 5.7851, 5,79, 57851 etcetc Virtuemart rounds the shipping TAX to 2 decimals and that breaks all calculations.

Your shipping tax will never be 7.00 it will be 7.01 consequently your final sales price will have a cent more.

So what I wonder is 2 things:

1 - why does virtuemart round shipping Tax with "round final sales price" instead of "round tax" (im talking about configuration tab in vm for rounding)

2 - why does virtuemart automatically round the shipping tax to 2 no matter how many decimals you add.

If you see the screenshot in my post above you can see 1.215 gets rounded to 1.22 and thats where we are dead :o

Regards


jjk

I didn't test this, but what happens if you change the number of decimals in the currency configuration for the Euro from 2 to 3 or more decimals?
(And eventually try "-1" instead of "2" in your price roundings except for the final sales price. "-1" would tell VM to use the currency rounding)
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

lindapowers

#6
Just tested with 4 and 5 decimals, the only change I see is in the minicart that shows 4 or 5 decimals but the checkout still rounds shipping cost tax to 2 so the cent still adds to the final price giving a nasty 19.01 final price.

lindapowers

#7
Oops sorry just read your edited version.

I tried exactly what you said but theres no effect.

The problem is that setting final sales price to 2 decimals makes the shipping TAX rounded to 2 also as you can see in the image.


jjk

Is there any law in Spain that forbids to display full Euro prices in the format "19 €" instead of "19,00 €"? If I search for full prices (0 decimals) in google.es, there are shops displaying only full Euro. (However, this only makes sense if your products don't have price tags with cents).
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

lindapowers

#9
Yes as you mention it wont make sense if you have prices like 10.50 € 25.50 € etc

And yes there are shops using 19 € instead of 19.00 which is not legal here or allowed... but this is Spain and they dont care.

From where are you if i may ask? I'm quite surprised that they allow you to put prices without 2 decimals.

Anyway the issue is that I still cant understand why VM rounds the shipping TAX this way.

Is this the file controlling the shipping TAX at checkout?

administrator/components/com_virtuemart/helpers/calculationh.php

cause i find things like these here:

/**
* Standard round function, we round every number with 6 fractionnumbers
* We need at least 4 to calculate something like 9.25% => 0.0925
* 2 digits
* Should be setable via config (just for the crazy case)
*/
function roundInternal($value,$name = 0) {

if($name!==0){
if(isset($this->_currencyDisplay->_priceConfig[$name][1])){
//vmdebug('roundInternal rounding use '.$this->_currencyDisplay->_priceConfig[$name][1].' digits');
// if(strpos($this->_currencyDisplay->_priceConfig[$name][1],'.')!==FALSE){

//return round(2.0*$value,1)/2.0;


Dont know if i could change something in that file or if is even that file the one rounding the shipping tax, have no idea about php, any help is appreciated.

Regards

lindapowers

Milbo solved it:

administrator/components/com_virtuemart/helpers/calculationh.php

In line 1220 add:

$name = 0;

so your code will look like these:

function roundInternal($value,$name = 0) {
$name = 0;
if($name!==0){
if(isset($this->_currencyDisplay->_priceConfig[$name][1])){


Thanks a lot.