Author Topic: Shipping VAT rounded together with final sales price?  (Read 8645 times)

lindapowers

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Venta de naranjas online y mandarinas
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Shipping VAT rounded together with final sales price?
« on: December 26, 2012, 18:07:51 pm »
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

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Venta de naranjas online y mandarinas
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: Shipping VAT rounded together with final sales price?
« Reply #1 on: December 27, 2012, 12:21:50 pm »
Any idea?

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

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

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10400
  • VirtueMart Version: 3+
Re: Shipping VAT rounded together with final sales price?
« Reply #2 on: December 30, 2012, 15:29:45 pm »
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"


J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

jjk

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3630
  • using Matomo instead of Google Analytics
Re: Shipping VAT rounded together with final sales price?
« Reply #3 on: December 30, 2012, 22:20:54 pm »
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

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Venta de naranjas online y mandarinas
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: Shipping VAT rounded together with final sales price?
« Reply #4 on: December 30, 2012, 22:34:47 pm »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3630
  • using Matomo instead of Google Analytics
Re: Shipping VAT rounded together with final sales price?
« Reply #5 on: December 30, 2012, 23:26:20 pm »
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

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Venta de naranjas online y mandarinas
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: Shipping VAT rounded together with final sales price?
« Reply #6 on: December 30, 2012, 23:50:06 pm »
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

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Venta de naranjas online y mandarinas
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: Shipping VAT rounded together with final sales price?
« Reply #7 on: December 31, 2012, 00:05:40 am »
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

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 3630
  • using Matomo instead of Google Analytics
Re: Shipping VAT rounded together with final sales price?
« Reply #8 on: December 31, 2012, 00:41:39 am »
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

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Venta de naranjas online y mandarinas
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: Shipping VAT rounded together with final sales price?
« Reply #9 on: December 31, 2012, 01:12:58 am »
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:

Code: [Select]
/**
* 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

  • Full Member
  • ***
  • Posts: 1335
  • If you're going through hell, keep going.
    • Venta de naranjas online y mandarinas
  • Skype Name: manu.gonzalez91
  • VirtueMart Version: Latest avi
Re: Shipping VAT rounded together with final sales price?
« Reply #10 on: January 01, 2013, 18:31:32 pm »
Milbo solved it:

administrator/components/com_virtuemart/helpers/calculationh.php

In line 1220 add:

Code: [Select]
$name = 0;
so your code will look like these:

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

Thanks a lot.