Page 1 of 4

Cumulative Tax in Canada

Posted: Tue Jun 23, 2009 3:45 am
by neochap
Canada has cumulative taxes in some states.
Structure of tax is

Quebec GST= 5%
PST = 7.5%



IMPORTANT>>* in Québec, PST is calculated on the total price including GST


that means for Quebec:
TaxwithGST = price +GST

Total tax = TaxwithGST + PST of TaxwithGST
How to implement taxes in Quebec where taxes are cumulative?

Is it possible to do in Open cart.
Because I have been trying it for past 2 days.

Re: Cumulative Tax in Canada

Posted: Wed Jun 24, 2009 9:56 pm
by neochap
Need help guys.

I have changed the entire View layer to suit my website.
Invested a lot of time in it.

But now I can't configure taxes.

Any help would be appreciated.

Thanks...

Re: Cumulative Tax in Canada

Posted: Wed Jun 24, 2009 11:37 pm
by Daniel
setup the geo zones first then add the tax rates.

Re: Cumulative Tax in Canada

Posted: Wed Oct 07, 2009 11:10 am
by novacom
Hi Daniel !

I also have to do this cummulative tax things. The way opencart calculate taxes is :

Code: Select all

base price 
+
base price * tax1 (5%)
+
base price * tax2 (7.5%)
So a 100$ item would end up as 112.50 $ which is wrong here in quebec, we should do cummulative tax :

Code: Select all

base price 
+
base price * tax1 (5%)
+
(base price + (base price * tax1 (5%))) * tax2 (7.5%)
The correct amount would be 112.88 $


Any way to do it simply or hard coding is the only way ?

Thanks for your time ;)

Re: Cumulative Tax in Canada

Posted: Wed Oct 07, 2009 11:35 am
by Qphoria
is 33 cents that major? just mark it up a bit and call the extra "handling" :)

Re: Cumulative Tax in Canada

Posted: Thu Oct 08, 2009 8:40 am
by novacom
I understand 33 cents is no big deal on a 100 $ item. But as your raise the base price (or the quantity), it becomes bigger and bigger. And for the sake of doing things correctly, it is just not an option to leave it this way.

Maybe if someone could just point up what file/module is doing the tax calculation, I will gladly change it and repost the modification I made in my site.

Thanks

Re: Cumulative Tax in Canada

Posted: Thu Oct 08, 2009 12:03 pm
by novacom
Allright, I managed to get this done the "correct way" I guess. I finally crafted an Extension for Orders Total. I simply disabled the default Taxes module. The new one recalculates taxes cumulatively. The only part where it does not work is for prices when browsing for items. I just configured "Display Prices With Tax: NO" and all seems fine.

I will be posting the contribution in a few days with appropriate docs.for fellow Canadians that would need this handy add-on. This gave me a good challenge and made me learn more about the internal structure of opencart, a very nice piece of software. Thumbs up to the developpers. ;)

Re: Cumulative Tax in Canada

Posted: Fri Nov 20, 2009 4:23 am
by tester_montreal
Hi. Please, can you help me with that module. I will appreciate a lot :)

Re: Cumulative Tax in Canada

Posted: Fri Nov 20, 2009 7:46 am
by sol
Hi,

need cumulative taxe module too.

thx

Re: Cumulative Tax in Canada

Posted: Fri Nov 20, 2009 8:45 am
by Daniel
hold on you want to add tax on a price that already has another tax already added to.

Re: Cumulative Tax in Canada

Posted: Fri Nov 20, 2009 9:44 am
by sol
Hi Daniel,

I know is weird. ;)

base price
+
base price * tax1(priority1) (5%)
+
(base price + (base price * tax1(priority1) (5%))) * tax2(priority2) (7.5%)

Prestashop dont offert this possibility. It's hard to find a web 2.0 shopping cart with cumulative tax.

Thx

Sol

Re: Cumulative Tax in Canada

Posted: Fri Nov 20, 2009 9:56 am
by tester_montreal
Is not weird.....this is the way to calculate TAXES in Quebec. I think is not hard to change the code. Lets go to work together in this. Thanks.

Re: Cumulative Tax in Canada

Posted: Fri Nov 20, 2009 5:08 pm
by Daniel
i'll see what I can do.

Re: Cumulative Tax in Canada

Posted: Mon Nov 23, 2009 9:44 pm
by sol
Ok ,

Thanks !

Re: Cumulative Tax in Canada

Posted: Mon Dec 21, 2009 3:41 am
by sol
Hi,

Anyone have a solution for cumulative tax in Canada ?

Re: Cumulative Tax in Canada

Posted: Wed Dec 30, 2009 11:12 am
by princess09
My uncle live in Canada told me that there are really cumulative tax in some state of Canada including their state. Honestly speaking, I don't know what is that cumulative tax for? Maybe that tax has a great advantages on us especially the poor ones. I hope you and ax Attorney could help me.

Re: Cumulative Tax in Canada

Posted: Mon Jan 04, 2010 7:24 am
by wadih
Hi Daniel / open cart developers / module developers,

I've done an analysis of the source code and noted that the "cumulative taxes" requirement could be implemented by amending the getRate() and calculate() functions in system/library/tax.php file.

Currently, the system sums up all tax rates of a particular tax class with getRate(), and does the multiplication with the product price with calculate() and divides by 100 to find the product after-tax total as shown below:

For reference, here's the code responsible for computing the after-tax total (in system/library/tax.php):

Code: Select all

    public function calculate($value, $tax_class_id, $calculate = TRUE) { 
    if (($calculate) && (isset($this->taxes[$tax_class_id])))  {
      $rate = $this->getRate($tax_class_id);

          return $value + ($value * $rate / 100);
      } else {
          return $value;
      }
    }

    public function getRate($tax_class_id) {
    if (isset($this->taxes[$tax_class_id])) {
      $rate = 0;

      foreach ($this->taxes[$tax_class_id] as $tax_rate) {
        $rate += $tax_rate['rate'];
      }

      return $rate;
    } else {
        return 0;
    }
  }
My problem is that I suspect files in the system/library/ folder are core files that shouldn't be modified directly.

Does opencart provide a way to override the getRate() and calculate() functions with custom ones through a module/extension, thus keeping the core files intact as well as the possibility of reverting back?

If not, what would be the best way to implement this cumulative taxes requirement into opencart, knowing that functionality must change at the system/library/tax.php level.

Thank you,
Wadih

Re: Cumulative Tax in Canada

Posted: Fri Jun 25, 2010 12:53 am
by reilly
Why not just use the effective tax rate for the Quebec QST? Thus Under the Tax Class for Quebec, the Description would read QST (7.5%) but the Tax Rate would be 7.875% (rounds to 7.88%).

Re: Cumulative Tax in Canada

Posted: Wed Apr 27, 2011 4:44 am
by nCube
This is actually called a "Compound" tax. IMO this should be a property that admins should be able to activate on a tax, most other shopping carts already support this. Using the effective tax rate is a temporary solution, but is sure to increase cart abandonment rates and support costs for high-volume stores.

Re: Cumulative Tax in Canada

Posted: Tue Nov 22, 2011 1:24 pm
by novacom
I have managed to extract the php files I created/modified/hacked to get these cumulative taxes to work.

Edit : Back in oct 2009... open cart 1.3.2 at that time

I do have those files handy if needed... You might have to make them fit in the new versions but at least they have done the job. PM me if you need those.

Regards

Francis