Solved

ColdFusion question - calculating sales tax

Posted on 2006-07-10
3
465 Views
Last Modified: 2013-12-20
I am using Cartweaver shopping cart for ColdFusion.  Cartweaver does not have an option for the below question as far as I can tell, so I'm wondering how i can get this done with custom code.  (I'm *slightly* under pressure!!)
 
The company I work for is in Texas.  I just found out (with 99% of the website done) that we don't charge a flat Texas sales tax.  Normally, if you are in Texas and buy something in Texas, you are charged the flat Texas sales tax.
 
My company bases it's sales tax on the final destination of the product.  We have 5 warehouses in 5 different states.  If an item is being *shipped* to anyone living in one of those 5 states (even if someone out of state purchased it), the purchaser's tax is based on the local rates in that state.
 
Our warehouses are located in New Jersey, Texas, California, Nevada, and Tennessee.  So if someone in Oklahoma buys an item but has it shipped to New Jersey, he/she will be charged the New Jersey tax.  If they live in Oklahoma and the item is shipped to Oklahoma, there is no sales tax.
 
Question 1:  is there a way to code tax based on the shipping address (or zip code maybe?)
Question 2:  California (and I think Nevada) charge city tax instead of state, which means I'd need to enter 100s of different tax percentages for that.  I assume if I can find the code, I can just modify the percentage rate.

Anyone?

Thank you!!!

texastwostep
0
Comment
Question by:texastwostep
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
mmc98dl1 earned 500 total points
ID: 17078875
1: of course
2: correct

So you could do one of 2 things, store a database table with the zip and percentage next to it, then do a lookup on the table against the database. I would recommend this but dont have time to do a smaple.

Or an array of the same thing.

<cfset zipTax = ArrayNew(2)>
<cfset zipTax[1][1] = 2000><!--- postcode --->
<cfset zipTax[1][2] = 10><!--- percentage --->
<cfset zipTax[2][1] = 2001>
<cfset zipTax[2][2] = 11>
<cfset zipTax[3][1] = 2002>
<cfset zipTax[3][2] = 12>
<cfset zipTax[4][1] = 2003>
<cfset zipTax[4][2] = 13>

<cfset url.userZipCode = 2000>
<cfloop from="0" to="#arrayLen(zipTax)#" index="i">
<cfif zipTax[i][1] eq url.userZipCode>
<cfset taxPercentage = zipTax[i][2]>
</cfif>
</cfloop>

you will have a var called taxPercentage with the correct rate in it.

The theory is the same with a query except you do

<cfquery name="getTaxRates">
Select taxRate, zipCode
FROM taxrates
</cfquery>

<cfloop query="getTaxRates" index="i">
<cfif getTaxRates.zipcode eq url.userZipCode>
<cfset taxPercentage = zipTax.taxRate
</cfif>

HTH
</cfloop>
0
 

Author Comment

by:texastwostep
ID: 17078914
1. i thank you
2. i really, really, really thank you alot!

0
 
LVL 12

Expert Comment

by:mmc98dl1
ID: 17078973
not a problem - glad this helps.
0

Featured Post

 [eBook] Windows Nano Server

Download this FREE eBook and learn all you need to get started with Windows Nano Server, including deployment options, remote management
and troubleshooting tips and tricks

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this short web based tutorial, I wanted to show users how they can still use the powers of FrontPage in conjunction with Expression Web 3.  Even though Microsoft eliminated the use of Web components, we can still use them with FrontPage and edit …
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Go t…

627 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question