Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Canadian Tax Display with MS1


Misho

Recommended Posts

Ok, i'm figuring out a way to upgrade Kenneth Wang's & Jian Wang's Canadian Seperate Tax Hack 1.2-4 for MS1 which by the way is a great contrubution because it simply does not modify any files in order for it to work and includes a separate shipping tax display, but i need major help!

 

http://www.oscommerce.com/community/contri...ions,289/page,2

 

Right now I only have it partially working for the files ot_tax_gst.php and ot_tax_pst.php (it will display proper GST, GST#, & PST values, however, both GST and PST always appears to be visible despite tax zones:

 

includesmodulesorder_totalot_tax_gst.php

<?php

/*

 $Id: ot_tax_gst.php,v 1.14 2003/02/14 05:58:35 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



 class ot_tax_gst {

   var $title, $output;



   function ot_tax_gst() {

     $this->code = 'ot_tax_gst';

     $this->title = MODULE_ORDER_TOTAL_TAX_GST_TITLE . ' #' . MODULE_ORDER_TOTAL_TAX_GST_NUMBER;

     $this->description = MODULE_ORDER_TOTAL_TAX_GST_DESCRIPTION;

     $this->enabled = ((MODULE_ORDER_TOTAL_TAX_GST_STATUS == 'true') ? true : false);

     $this->sort_order = MODULE_ORDER_TOTAL_TAX_GST_SORT_ORDER;



     $this->output = array();

   }



   function process() {

     global $order, $currencies;



     reset($order->info['tax_groups']);



     while (list($key, $value) = each($order->info['tax_groups'])) {

         if ($value > 0) {

           $this->output[] = array('title' => $this->title . ' ( 7% ):',

                                 'text' => $currencies->format($order->info['subtotal']*(0.07), true, $order->info['currency'], $order->info['currency_value']),

                                   'value' => $value);

         }

     }

   }



   function check() {

     if (!isset($this->_check)) {

       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_TAX_GST_STATUS'");

       $this->_check = tep_db_num_rows($check_query);

     }



     return $this->_check;

   }



   function keys() {

     return array('MODULE_ORDER_TOTAL_TAX_GST_STATUS', 'MODULE_ORDER_TOTAL_TAX_GST_SORT_ORDER', 'MODULE_ORDER_TOTAL_TAX_GST_NUMBER');

   }



   function install() {

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Tax', 'MODULE_ORDER_TOTAL_TAX_GST_STATUS', 'true', 'Do you want to display the order tax value?', '6', '1','tep_cfg_select_option(array('true', 'false'), ', now())");

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_TAX_GST_SORT_ORDER', '2', 'Sort order of display.', '6', '2', now())");

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('GST Number', 'MODULE_ORDER_TOTAL_TAX_GST_NUMBER', '', 'input your business's GST Number.', '6', '3', now())");

   }



   function remove() {

     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");

   }

 }

?>

 

includesmodulesorder_totalos_tax_pst.php

<?php

/*

 $Id: ot_tax_pst.php,v 1.14 2003/02/14 05:58:35 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



 class ot_tax_pst {

   var $title, $output;



   function ot_tax_pst() {

     $this->code = 'ot_tax_pst';

     $this->title = MODULE_ORDER_TOTAL_TAX_PST_TITLE;

     $this->rate = MODULE_ORDER_TOTAL_TAX_PST_RATE;

     $this->description = MODULE_ORDER_TOTAL_TAX_PST_DESCRIPTION;

     $this->enabled = ((MODULE_ORDER_TOTAL_TAX_PST_STATUS == 'true') ? true : false);

     $this->sort_order = MODULE_ORDER_TOTAL_TAX_PST_SORT_ORDER;



     $this->output = array();

   }



   function process() {

     global $order, $currencies;



     reset($order->info['tax_groups']);



     while (list($key, $value) = each($order->info['tax_groups'])) {

         if ($value > 0) {

           $this->output[] = array('title' => $this->title . ' ( ' . $this->rate . '% ):',

                                 'text' => $currencies->format($order->info['subtotal']*($this->rate / 100), true, $order->info['currency'], $order->info['currency_value']),

                                   'value' => $value);

         }

     }

   }



   function check() {

     if (!isset($this->_check)) {

       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_ORDER_TOTAL_TAX_PST_STATUS'");

       $this->_check = tep_db_num_rows($check_query);

     }



     return $this->_check;

   }



   function keys() {

     return array('MODULE_ORDER_TOTAL_TAX_PST_STATUS', 'MODULE_ORDER_TOTAL_TAX_PST_RATE', 'MODULE_ORDER_TOTAL_TAX_PST_SORT_ORDER');

   }



   function install() {

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Display Tax', 'MODULE_ORDER_TOTAL_TAX_PST_STATUS', 'true', 'Do you want to display the order tax value?', '6', '1','tep_cfg_select_option(array('true', 'false'), ', now())");

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('PST Rate', 'MODULE_ORDER_TOTAL_TAX_PST_RATE', '8', 'PST Rate (%, i.e. input 8 for 8%)', '6', '2', now())");

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_ORDER_TOTAL_TAX_PST_SORT_ORDER', '3', 'Sort order of display.', '6', '3', now())");

   }



   function remove() {



     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");

   }

 }

?>

 

If anybody knows how to code a comparison between the billing zone with the appropriate tax zones, by all means please share (im a php newbie). By comparing the billing zone & tax zones I think it would be possible to make the GST and/or PST visible and invisible when both zones match or mismatch respectively.

 

This current contribution works for late november versions. I just don't know how or why its not working for current snapshots! :shock:

-Martin.

Link to comment
Share on other sites

  • 3 weeks later...

I guess I am hijacking this thread for the same topic :P

 

Let's get this Canadian Tax issue in details.

 

I would like to discuss it in terms of a PURE MS1

installation or a Current CVS installation.

 

We recently fixed the compounding tax problem

which I broke 6 months ago and I can provide

the code snip to fix it for MS1

 

I want to address these issues as how should we

configure the current code to do what is needed

for the Provinces that have special cases.

 

Is there someone that runs Canadian shops that

knows the rules for each province?

 

Tom

Thomas A. Moulton, W2VY

osCommerce core developer osc2.1 to osc 2.3.x

Support the developers!

http://www.oscommerce.com/about/team

Link to comment
Share on other sites

Store located in Quebec, ship to quebec:

 

add 7% GST to total

add 7.5% QST to new total.

 

... ship outside quebec except special case of HST:

add 7% GST

 

ship to province with HST (harmonized sales tax):

add 15% HST

 

ship outside country:

NO TAX! (But attach nafta form and customs invoices)

 

In Ontario I've heard the GST and PST are added separately to the total,

not multiplied.

 

In quebec tax is added to total including shipping. I don't know about

other provinces.

 

George

Link to comment
Share on other sites

Store located in Quebec

In quebec tax is added to total including shipping. I don't know about

other provinces.

 

George

 

It sounds like all the cases you mention can be configured

with the current code.

 

The only possible exception is if Shipping is taxed or not.

 

We can't change the order_total based upon zone at

this point.

 

The question is:

 

Do different provinces tax shipping while others do not?

Thomas A. Moulton, W2VY

osCommerce core developer osc2.1 to osc 2.3.x

Support the developers!

http://www.oscommerce.com/about/team

Link to comment
Share on other sites

I thought I had the tax working with 2.1 but

with 2.2 it wasn't correct. It was adding instead

of multiplying. I decided to scrap everything and start over with a clean database.

 

In the bug reports (#977?) there is a weird tax calculation for Ontario that didn't make any sense to me. Maybe he wasn't taxing the shipping?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...