Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

WA state destination based sales tax


kidsngarden

Recommended Posts

  • Replies 274
  • Created
  • Last Reply

Snarg,

I personally have a default tax for wa entered via the admin, just like you didn't have this installed. But there is a line in wa_taxes.php function that you can uncomment and use instead. See Step 17 of the install. I think either will work. If not let us know....

 

lildog

 

 

Using this contrib (thank you for it by the way :) do I enter a default tax rate or should I leave it blank?
Link to comment
Share on other sites

Reporting looks like it'll be pretty easy if I know what I need to incorporate. I am not much of an accountant...sorry. I also don't have that many in state orders so it'll be easy for me to just pull them out and enter them into the dor thingy...mmmm maybe not as easy as I thought.

 

lildog

Link to comment
Share on other sites

In the report display we need:

 

the order #?

the order total?

The Wa tax collected

The zone id collected from? Or county? Or both?

 

 

Is that all? It is pretty much just one sql query with some parameters(dates) chosen.

 

lildog

Link to comment
Share on other sites

Do you know why // if (tep_get_zone_code($customer_country_id, $customer_zone_id, "") == "WA") { //make sure this universal didn't work for you? Is this something that may cause others problems?

 

I really could not figure that one out. I assumed it was working for others as you had written it. However, our implementation starts out with a custom order page as the customer didn't want to change it when OSC was installed. So I think things in our case slightly diverge from the "OSC" path.

Link to comment
Share on other sites

WOW! what an overwhelming amount of info from those who want a tax report! Amazing. :angry:

 

Is it fair to say that ALMOST all of the stores will only charge washington tax because they are in washington?

So any order with tax will be a washington order?

 

lildog

Link to comment
Share on other sites

WOW! what an overwhelming amount of info from those who want a tax report! Amazing. :angry:

 

Is it fair to say that ALMOST all of the stores will only charge washington tax because they are in washington?

So any order with tax will be a washington order?

 

lildog

 

Hi lildog - This is what I'm using currently - it pops up from another report and passes the month and year to this. It seems to be working well for my clients reporting needs with WA DOR.

 

<table align="center">
<tr class="dataTableHeadingRow"><td class="dataTableHeadingContent" align='center' valign="bottom">City</td><td class="dataTableHeadingContent" width='70' align="center">Tax</td></tr>
<?
$month=$_GET['month'];
$year=$_GET['year'];
if (strlen($month)<2) $month="0".$month;
$mystring=$year."-".$month;

$sql="SELECT sum(value) AS tax_total, customers_city  
FROM orders_total 
INNER JOIN orders 
ON orders_total.orders_id=orders.orders_id  
WHERE class='ot_tax' AND date_purchased LIKE '%".$mystring."%'
GROUP BY customers_city
ORDER BY customers_city ASC";

//echo $sql;
$x=mysql_query($sql) or die("problem"); 

//begin perfect class display for dates today and beyond (cross-module compatible)
while ($data=mysql_fetch_array($x)) 
{
$tax=$data["tax_total"];
$city=$data["customers_city"];
$month=$data["MONTH"];
$tax_total=$tax_total+$tax;
echo "<tr><td class=\"dataTableContent\" style=\"border:1px solid #CCCCCC;font-weight:bold;text-align:right;padding-right:2px;\">".$city."</td><td class=\"dataTableContent\" style=\"border:1px solid #CCCCCC;\">$".number_format($tax,2)."</td></tr>";
}
echo "<tr class=\"dataTableHeadingRow\"><td></td><td class=\"dataTableHeadingContent\">$".number_format($tax_total,2)."</td></tr>";

?>
</table>

Link to comment
Share on other sites

Where is this code inserted? I can use some of it, my sql is not the best. This does not return the location code right? I should have a preliminary working report with zone ids soon. I talked to DOR and each zone will be reported on a separate line.

 

lildog

 

 

 

Hi lildog - This is what I'm using currently - it pops up from another report and passes the month and year to this. It seems to be working well for my clients reporting needs with WA DOR.

 

<table align="center">
<tr class="dataTableHeadingRow"><td class="dataTableHeadingContent" align='center' valign="bottom">City</td><td class="dataTableHeadingContent" width='70' align="center">Tax</td></tr>
<?
$month=$_GET['month'];
$year=$_GET['year'];
if (strlen($month)<2) $month="0".$month;
$mystring=$year."-".$month;

$sql="SELECT sum(value) AS tax_total, customers_city  
FROM orders_total 
INNER JOIN orders 
ON orders_total.orders_id=orders.orders_id  
WHERE class='ot_tax' AND date_purchased LIKE '%".$mystring."%'
GROUP BY customers_city
ORDER BY customers_city ASC";

//echo $sql;
$x=mysql_query($sql) or die("problem"); 

//begin perfect class display for dates today and beyond (cross-module compatible)
while ($data=mysql_fetch_array($x)) 
{
$tax=$data["tax_total"];
$city=$data["customers_city"];
$month=$data["MONTH"];
$tax_total=$tax_total+$tax;
echo "<tr><td class=\"dataTableContent\" style=\"border:1px solid #CCCCCC;font-weight:bold;text-align:right;padding-right:2px;\">".$city."</td><td class=\"dataTableContent\" style=\"border:1px solid #CCCCCC;\">$".number_format($tax,2)."</td></tr>";
}
echo "<tr class=\"dataTableHeadingRow\"><td></td><td class=\"dataTableHeadingContent\">$".number_format($tax_total,2)."</td></tr>";

?>
</table>

Link to comment
Share on other sites

I have uploaded a new version with very rough and basic reporting. The location code is now stored with the order so it can be called upon later for reporting. The sooner this update is installed the sooner your orders will have the location code added to them. If anyone knows sql better than I maybe you can fix the sql query to include the months and days to the range of dates shown in the report. Right now, the report only shows an entire year(s).

 

lildog

Link to comment
Share on other sites

Where is this code inserted? I can use some of it, my sql is not the best. This does not return the location code right? I should have a preliminary working report with zone ids soon. I talked to DOR and each zone will be reported on a separate line.

 

lildog

 

It's its own page that is pulled up as a pop-up from a sales report. Yes, for now it just pulls the name of the city, which the WA DOR folks said was acceptable according to my client.

Link to comment
Share on other sites

lildog, thank you so much for this contrib. I am running into a few small problems that I hope you may be able to help me out with.

 

I am running OSC Ver 2.2 RC2. I have the following contribs installed in the following order:

 

1) Continue Shopping.

2) 02 - WA Sales Tax 2.2c. (I updated this from 2.1.9 following the update guides)

3) Fancy Lightbox Popup.

4) Simple Template System 4.5..

 

I used a test item costing $1 and have a test flat rate shipping of $1. I have a base WA state tax of 2% setup to test with. Using the three test address's supplied, this is my results:

1. 10746 5th Ave NE, Seattle, WA 98125
  Rate: .090

Cost : $2.09
Email: There has been an error calculating the tax for an order. Order#: 5. Error Code: 9
Report: Fatal error: Call to undefined function: tep_strip_currency_sign() in /homepages/25/d238487425/htdocs/admin/wa_taxes_report.php on line 187
Zone: 1726

2. 4793 Pt Fosdick Dr NW Gig Harbor, WA 98335
  Rate: .084

Cost: $2.08
Email: There has been an error calculating the tax for an order. Order#: 6. Error Code: 8.4
Report: 
Fatal error: Call to undefined function: tep_strip_currency_sign() in /homepages/25/d238487425/htdocs/admin/wa_taxes_report.php on line 187
Zone: 4127

3. 42793 Pt Fosdick Dr NW Gig Harbor, WA 93335

Cost: $2.02
Email: There has been an error calculating the tax for an order. Order#: 7. Error Code: false
Report: 
Fatal error: Call to undefined function: tep_strip_currency_sign() in /homepages/25/d238487425/htdocs/admin/wa_taxes_report.php on line 187
Zone: Unknown

 

As you can see, I get an error from WA state using all three address's. I also get an error when I attempt to view the report. It seems to correctly calculate all of the tax rates however, I still get the error. I can see the report but the error is still there.

 

Any help you can provide on this would be greatly appreciated.

Link to comment
Share on other sites

I just searched through a virgin copy of osCommerce and it doesn't contain the strip tep_strip_currency_sign. Shoot! I must have acquired that somewhere else. I have uploaded a new version.

 

lildog

Link to comment
Share on other sites

lildog,

 

Again, thank you for your efforts. You have been a heck of a lot of help. I still have two small issues however:

 

1) The report is awesome but the formatting is, for lack of a better word, ugly :) Two screenshots below, one of an empty report, one with some data:

2udz47m.jpg

1495o2x.jpg

 

2) I'm still getting an error from the WA Dept of Revenue website :(. The taxes are calculated correctly, but I don't know why I am getting the error. Should I just ignore it? Below is the test address I used and the error returned:

 

1. 10746 5th Ave NE, Seattle, WA 98125

Rate: .090

 

There has been an error calculating the tax for an order. Order#: 9. Error Code: 9

 

3) I don't know if this is an osCommerce standard or if it has something to do with this contrib but, if a customer does not include a country *NO* taxes are processed. Just an FYI...

Link to comment
Share on other sites

Thank you for the input. I will look into the issues.

 

1. The formatting IS ugly. I would really like some ideas to pretty it up some. I can write the code but my design skills are lacking to say the least. So if anyone has any ideas to make it prettier let me know.

 

2. I will have to look into the error for now ignore it if everything seems to work ok.

 

3. And the taxes thing....I have no idea, maybe I can get someone without the contrib to check it.

 

lildog

Link to comment
Share on other sites

1. The formatting IS ugly. I would really like some ideas to pretty it up some. I can write the code but my design skills are lacking to say the least. So if anyone has any ideas to make it prettier let me know.

Well, for the time being having everything in columns would be nice. Possibly look into exporting the report to a .pdf file...? I have zero skills in the design area.

 

2. I will have to look into the error for now ignore it if everything seems to work ok.

Ok, thank you.

 

3. And the taxes thing....I have no idea, maybe I can get someone without the contrib to check it.

I'm going to guess it's an osCommerce thing. Does you code do any kind of country check?

Link to comment
Share on other sites

My country field is required. My code (wa dest tax) does not check country. In columns....you mean the pull downs and header stuff?

I am getting the same error.....I will fix it soon.

Link to comment
Share on other sites

My country field is required. My code (wa dest tax) does not check country. In columns....you mean the pull downs and header stuff?

No, just the information in the report. You have Zone ID twice, so if you got rid of one of the Zone ID columns it should pull everything else back into line. Something simple like this:

Order ID Date	WA Tax		Zone ID		Zone Tax Total

Link to comment
Share on other sites

It is actually two different tables. One shows the orders and their related tax info. The othe one the bottom one shows the totals for the zones NOT individual orders. if you had more than one order with more more zones it would be a longer list and to total each zone you would have to add each one up. When it comes tax time all you need is to look at the bottom table that looks outta line and write the zone id into the field on your return and enter the zone total next to it.

 

 

I have found the error it is a stupid mistake on my part. I am going to fix it now. In checkout process find:

 

$wa_email_body = sprintf(WA_DEST_TAX_ERROR_TEX,$insert_id,$wa_dest_tax_rate['rate']);

 

 

and change to:

$wa_email_body = sprintf(WA_DEST_TAX_ERROR_TEX,$insert_id,$wa_dest_tax_rate['resultcode']);

 

 

sorry about that

 

lildog

Link to comment
Share on other sites

Also:

 

find:

if (tep_session_is_registered('wa_dest_tax_rate') && ($wa_dest_tax_rate['rate']=='false' || $wa_dest_tax_rate['rate']>0 )){ //there was a tax error email the store owner

 

 

change to:

if (tep_session_is_registered('wa_dest_tax_rate') && ($wa_dest_tax_rate['rate']=='false' || $wa_dest_tax_rate['resultcode']>0 )){ //there was a tax error email the store owner

Link to comment
Share on other sites

Using the changes above and the following test address:

 

2. 4793 Pt Fosdick Dr NW Gig Harbor, WA 98335

Rate: .084

 

I get this error:

 

There has been an error calculating the tax for an order. Order#: 10. Error Code: 2

 

No idea if that helps or not :)

Link to comment
Share on other sites

That is the correct response. I am about to upload a new version that has the code explanations in the email. The code you have there says it didn't find the address but it did find the zip code. I don't know why because the web interface says it finds the address. Go here and see(http://www.dor.wa.gov/AddressRates.aspx?output=text&addr=4793 Pt Fosdick Dr NW&city=Gig Harbor&zip=98335). It's a correct address. I don't know how much error reporting to do. That seems to be a small error but an error none the less. If you wanted to you could raise the 0 in the mail loop to 1 2 or 3 all of which should be correct but a small error. If you guys get too many cannot find addresses or something let me know here because we maybe should report it to the DOR so they can check it out too. So basically the tax thing is doing what it should reporting an error so you can double check it. I will also add a link to the DOR web interface too.Here are the codes set the level of reporting you would like in checkout process.:

 

0: The address was found.

1: The address was not found, but the ZIP+4 was located.

2: Neither the address or ZIP+4 was found, but the 5-digit ZIP was located.

3: The address, ZIP+4, and ZIP could not be found.

4: Invalid arguements.

5: Internal error.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...