Author Topic: Tax calculation now wrong after upgrading to Virtuemart 3.4.2 and Joomla 3.8.13  (Read 1123 times)

peterf

  • Beginner
  • *
  • Posts: 6
  • A beginner
Hi,

After upgrading to Joomla 3.8.13 and Virtuemart 3.4.2 a couple of days ago I am now getting an incorrect Tax calculation at checkout when a discount coupon is applied. The system is now calculating the Tax on the item price before the discount is applied rather than after, as it used to. In the example attached the GST should be 15% of $240 ($300 - $60) = $36 and not $45 which is 15% of $300. Anyone have any ideas? Many thanks for any help.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8433
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
can you show exactly what your set up is re tax and discount rules

I just tried this -> I get (10 - 10%) x 1.2 = 10.80

this is using 20% vat tax

GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8433
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
r u using tax per bill? -- just tried that and yes - coupon comes off after tax

GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

peterf

  • Beginner
  • *
  • Posts: 6
  • A beginner
Hi GJC Web Design,

Thanks for your reply. Yes I am using Tax Per Bill but up to quite recently it worked exactly the way i wanted taking the discount off first and then adding the Tax. You can see from the 2 images below (both using Tax Per Bill) the difference started after Virtuemart 3.4 and now the Tax is added before discount (i.e. on the full price). Does anyone know if this is now permanent or a bug? Many thanks for your help.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8433
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
I assume it will be a change in administrator\components\com_virtuemart\helpers\calculationh.php

did a quick diff between 3.2.x and 3.4.x and there are some substantial changes in that file

if u diff the two versions around lines 800 and again 890 you can see changes to discounts and taxperbill there

Is there any reason you don't use Vat Tax?
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

peterf

  • Beginner
  • *
  • Posts: 6
  • A beginner
Thanks for your reply. I guess if I change anything in administrator\components\com_virtuemart\helpers\calculationh.php then it may be overwritten in a future update? So it looks like I will have to use VAT Tax. The reason I don't use it at present are small things like when an item is added to the basket Tax is added straight away. The site deals mainly with trades people who are used to seeing prices excl. Tax. With VAT Tax the price on the page is different to the price in the basket - see image below, because Tax has been added to the price in the basket whereas this didn't happen with Tax per Bill.

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8433
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
You can over ride the cart listings to display what ever prices you would like to show -- all prices are available there

GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

peterf

  • Beginner
  • *
  • Posts: 6
  • A beginner
Sorry to sound dumb. But where can I find those options? Thanks

GJC Web Design

  • 3rd party VirtueMart Developer
  • Super Hero
  • *
  • Posts: 8433
  • Virtuemart, Joomla & php developer
    • GJC Web Design
  • VirtueMart Version: 2.6.22 & 3.2.14
its not options but just over ride and adapt the code to show what prices u want to see in

templates\xxx\html\com_virtuemart\cart\default_pricelist.php

if in the loop u add

print 'Debug Line '.__LINE__.' $prow->prices <pre>'; print_r ($prow->prices); print "</pre><br />\n";

you can see all available prices

e.g.

Code: [Select]
Array
(
    [virtuemart_product_price_id] => 1193
    [virtuemart_product_id] => 1152
    [virtuemart_shoppergroup_id] => 0
    [product_price] => 81.72
    [override] => 0
    [product_override_price] => 0
    [product_tax_id] => 1
    [product_discount_id] => 0
    [product_currency] => 9
    [product_price_publish_up] => 0000-00-00 00:00:00
    [product_price_publish_down] => 0000-00-00 00:00:00
    [price_quantity_start] => 0
    [price_quantity_end] => 0
    [created_on] => 2017-07-26 03:18:18
    [created_by] => 2489
    [modified_on] => 2018-10-16 04:56:16
    [modified_by] => 62
    [locked_on] => 0000-00-00 00:00:00
    [locked_by] => 0
    [costPrice] => 81.72
    [basePrice] => 81.72
    [basePriceVariant] => 81.72
    [basePriceWithTax] => 89.892
    [discountedPriceWithoutTax] => 81.72
    [priceBeforeTax] => 81.72
    [salesPrice] => 89.892
    [taxAmount] => 8.172
    [salesPriceWithDiscount] => 0
    [salesPriceTemp] => 89.892
    [unitPrice] => 0
    [priceWithoutTax] => 81.72
    [discountAmount] => -0
    [variantModification] => 0
    [DBTax] => Array
        (
        )

    [Tax] => Array
        (
        )

    [VatTax] => Array
        (
            [1] => Array
                (
                    [0] => GST
                    [1] => 10.0000
                    [2] => +%
                    [3] => 0
                    [4] => 9
                    [5] =>
                    [6] => 1
                    [7] => 1
                )

        )

    [DATax] => Array
        (
        )

    [Marge] => Array
        (
        )

    [salesPriceTt] => 89.892
    [discountedPriceWithoutTaxTt] => 81.72
    [priceWithoutTaxTt] => 81.72
    [discountAmountTt] => -0
    [taxAmountTt] => 8.172
    [subtotal_with_tax] => 89.892
    [subtotal_tax_amount] => 8.172
    [subtotal_discount] => 0
    [subtotal] => 81.72
)
GJC Web Design
VirtueMart and Joomla Developers - php developers http://www.gjcwebdesign.com
VM3 AusPost Shipping Plugin - e-go Shipping Plugin - VM3 Postcode Shipping Plugin - Radius Shipping Plugin - VM3 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
http://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

peterf

  • Beginner
  • *
  • Posts: 6
  • A beginner
Thank you