Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

ColdFusion question - calculating sales tax

Posted on 2006-07-10
3
Medium Priority
?
469 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 2000 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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

Turn A Profile Picture Into A Cartoon Using Photoshop And Illustrator This tutorial will teach you how to make a cartoon style image out of a regular picture. I have tried to keep the tutorial as simple as possible. I used Adobe CS4 for this tuto…
When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

688 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