Solved

ColdFusion question - calculating sales tax

Posted on 2006-07-10
3
456 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

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Have you ever sent email via ColdFusion and thought of tracking this mail to capture the exact date and time when the message was opened ?  If yes, then this article is for you ! First we need a table user_email with columns user_id , email , sub…
One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
The purpose of this video is to demonstrate how to add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to Import and export files in WordPress. 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 : Click on Too…

740 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