Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / August 2006

Tip: Looking for answers? Try searching our database.

formula for calculating sales tax (GST)

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
steve - 31 Aug 2006 08:08 GMT
Hi All

Not sure if this is the right forum, but I need the formula for calculating
the amount of Sales tax (GST) from the tax included price

In Australia GST is 10% and the standard formula is to divide the total by
11 to get the gst amount

This is great until the GST % changes one day

So I need a formula to calculate the amount of GST using the gst% as an
input

I am using VB.net 2005

Any ideas

Regards
Steve
Pritcham - 31 Aug 2006 08:47 GMT
Hi Steve

I'm assuming you meant "Divide by 1.1" and not "divide by 11" as that
would appear to make no sense.

If that's the case then something along the following will do the job:
GST = TotalPrice/(1+(GSTPercentage/100))

Hope that helps
Martin

> Hi All
>
[quoted text clipped - 15 lines]
> Regards
> Steve
Alex Turmer - 31 Aug 2006 12:29 GMT
> Hi Steve
>
[quoted text clipped - 26 lines]
>> Regards
>> Steve

Guys,

Something has gone screwy here!

Divide by 11 is correct.

The total = net * (1 + tax%/100)
thus
net=total/(1 + tax%/100)

But - be warned, you simply cannot do sales tax this way.  Each country
as strict laws which set the amount of decimal places the calculation
has to be correct to (in the UK is it 7).  Then there is another set of
rules has to how to round a fractional result, in the UK that is halve
even if memory serves.

So your steps are this:
1) Make sure everything is in double precision - or use a big decimal class
2) Make sure you know the rounding rules
3) Make the calculation in three steps

Kind of like this - but must be tailored to your local laws

const oneHundred as double = 100.0
const one as double = 1.0
const rounder as double = 7.0
function GetTaxFromGross(taxPercent as double, gross as double)
    dim tmpd as double
    dim tmpl as long
    tmpd=gross/(one + taxPercent/oneHundred )
    tmpl=clng(tmpd * (rounder + one))
    ' Better check this - done from memory!
    if tmpl mod 20 > 10 then
        if tmpl mod 10 > 5 then
            tmpl=tmpl + 10 -(tmpl mod 10)
        else
            tmpl=tmpl  -(tmpl mod 10)
        end if
    else
        if tmpl mod 10 > 5 then
            tmpl=tmpl  -(tmpl mod 10)
        else
            tmpl=tmpl + 10 -(tmpl mod 10)
        end if
    end if
    return tmpl/rounder
end function

Please pleas please - note this code is a raw translation of the Java
version I wrote a couple of years ago - it is a guideline only - you
must spin your own!

Best wishes

AJ

www.deployview.com
www.nerds-central.com
www.project-network.com
Cor Ligthert [MVP] - 31 Aug 2006 14:35 GMT
Alex,

Those Britain's are so clever, the Dutch tax rules are more like: Round at
xx and than always in your own benefit.

However probably are the taxes in Britain proud they still have pennies and
no cents, therefore they can still be penny wise and pound foolish.

Please don't see this a serious reply. I could not resist to sent it.

Cor

>> Hi Steve
>>
[quoted text clipped - 89 lines]
> www.nerds-central.com
> www.project-network.com
steve - 31 Aug 2006 21:46 GMT
Hi AJ

Thanks for the reply

Just what I wanted

Regards
Steve
>> Hi Steve
>>
[quoted text clipped - 89 lines]
> www.nerds-central.com
> www.project-network.com
GhostInAK - 31 Aug 2006 22:54 GMT
Hello Alex,

Other tax laws may apply as well.  Like In Homer, AK (where I used to live)
there is a 5.5% sales tax.. but you can only be taxed on the first $500.00
of any single invoice.  3 miles down the road (literally) the tax drops to
2.0%, but the same upper limit applies (so you can't hard-code the max tax,
it has to be the max taxable).

I prefer to enter taxes as a decimal instead of a percentage.. so instead
of entering (or passing) 5.5, I would pass .055.

The formula then becomes..
Gross = Net + (Net * TaxDecimal)

Or in the case of Homer:
Gross = Net + ((Math.Min(MaxTaxable, Net) * TaxDecimal) + Math.Max(Net -
MaxTaxable, 0))

Enjoy,
-Boo

>> Hi Steve
>>
[quoted text clipped - 84 lines]
> www.nerds-central.com
> www.project-network.com

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.