an ASP.NET Open Source CMS & eCommerce platform
Search:
Last Post 6/24/2009 5:57:17 AM By micahsdad1402. 8 replies.
3/13/2009 11:11:14 PM
micahsdad1402
Posts: 31
Joined: 11/2/2008
Location:Melboune Australia
Australian Tax Law and DSC
In Australia, we must advertise the price inclusive of the the tax (GST).
 
I have set up the tax rate of 10% in the tax tables. however, when I create the order the tax is added on to the price.
 
It is OK to have:
 
item 1 ....... $11.00
item 2 ........$22.00
 
Order Total $30.00 which includes $3.00 GST
 
How hard would it be to change DSC to handle this?
 
PS. This is the last show stopper in me being able to use DSC.
3/14/2009 4:58:35 AM
micahsdad1402
Posts: 31
Joined: 11/2/2008
Location:Melboune Australia
Re: Australian Tax Law and DSC
Excuse my ignorance of C#.
 
Found following code in relation to tax
 
        public override DSC.OrderTotal GetOrderTotal(Cart cart, TaxLocation taxLocation, List<DSC.OrderTotal> orderTotals) {
            decimal taxRate = TaxService.GetProvider().GetTaxRate(taxLocation);
            decimal total = 0;
            foreach (DSC.OrderTotal orderTotal in orderTotals) {
                total += orderTotal.Amount;
            }
            decimal taxTotal = 0;
            if (0 != cart.SubTotal)
                taxTotal = Utils.Round(total * cart.TaxableSubTotal / cart.SubTotal * taxRate);
            return new DSC.OrderTotal("Tax", taxTotal);
        }
 
What I don't understand is when "total" is not going to equal "cart.SubTotal". If they are always the same, they are superfluous to the formula.
 
What I believe I need to do is:
 
1. Add an extra field to the Tax Rules which is a flag to indicate if pricing is inclusive or exclusive of the tax.
2. Test the falue of this field, and if it is inclusive use taxTotal = Utils.Round(total * cart.TaxableSubTotal / cart.SubTotal * taxRate / (1+taxrate));
 
I need to also add a Text value to the tax table to describe the name of the tax, ie, "Includes GST of"
 
Not sure what else this impacts yet. Any advice or pointers would be appreciated.
 
 
 
3/14/2009 3:18:21 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Australian Tax Law and DSC
"total" doesn't equal to cart.subtotal when there are shipping charge or discount coupon involved.
DotShoppingCart Staff
3/20/2009 3:41:35 PM
micahsdad1402
Posts: 31
Joined: 11/2/2008
Location:Melboune Australia
Re: Australian Tax Law and DSC
Lukesy,
 
Got this working. Changed the tax calc in the tax provide to calculate the tax amount assuming tax was included in pricing.
 
Then put in an exception so the tax wasn't added to the Order Total.
3/20/2009 3:45:54 PM
lukezy
Posts: 2109
Joined: 6/12/2007
Location:WA, US
Re: Australian Tax Law and DSC
Glad to hear it working for you. If you don't mind please post your site to our gallery once it's live.
DotShoppingCart Staff
6/23/2009 8:38:44 PM
pspeirs
Posts: 3
Joined: 6/21/2009
Re: Australian Tax Law and DSC
Any chance of detailing the fixes you had to make to get this working correctly for GST.
 
Paul
 
6/24/2009 1:27:41 AM
micahsdad1402
Posts: 31
Joined: 11/2/2008
Location:Melboune Australia
Re: Australian Tax Law and DSC
Really simple. Just need to change calcuation of the Grand total to not include the tax, as it's in the line item values already.
 
Then change the formula to calcuate the amount of the total that is tax.
 
I think that was all. Was a while ago that I did it. Code is supplied without warranty and at your risk. Hope it helps.
 
In Providers\OrderTotal\dotShoppingCart.OpenSource.OrderTotal

 

GrantTotalOrderProvider.cs

 

Change so doesn't add in Tax.

 

 

     foreach (DSC.OrderTotal orderTotal in orderTotals) {
                if (orderTotal.Name != "Includes GST of") // Don't add GST Tax into the total. It's already there.
                {
                    DebugString += orderTotal.Name + ": " + orderTotal.Amount + "/";

                    total += orderTotal.Amount;
                }
            }
 

 

TaxOrderTotalProvider.cs

 

 

            // -----------***JJ***----------
            // if tax is included in price
            decimal taxTotal = 0;
            if (0 != cart.SubTotal)
                taxTotal = Utils.Round(total * cart.TaxableSubTotal / cart.SubTotal * taxRate / (1 + taxRate));
                //taxTotal = Utils.Round(total * cart.TaxableSubTotal / cart.SubTotal * taxRate);
            return new DSC.OrderTotal("Includes GST of", taxTotal);
 

 

6/24/2009 4:44:16 AM
pspeirs
Posts: 3
Joined: 6/21/2009
Re: Australian Tax Law and DSC
OK, with my limited knowledge of C I found the bits to modify.  I'm not sure which database tables to be looking at however.  From modifying the code described, how does that relate to the database table.  I assume the additional field will be a type bit.  However what names are we assigning, and the other field where you noted a label of GST inclusive, where would that go.
 
Sorry for all the questions, but I really want to nail this bit.  We'll just see how it all compiles now :-)
 
Regards,
Paul
6/24/2009 5:57:17 AM
micahsdad1402
Posts: 31
Joined: 11/2/2008
Location:Melboune Australia
Re: Australian Tax Law and DSC
Paul,
 
don't need to change tables.
 
Just think about the basics...
 
USA have all prices ex tax, and then add it on at the end, so all prices are considered without the tax.
 
Here and in NZ, prices are all considered to include the tax component. All you have to do is report the amout of tax in the total sale.
 
You could just turn the tax off all together, and then just calculate the tax as an extra line as 1/11 of the total. I did it this way so it would work with two different tax rates, ie here and in NZ.
 
JJ