[ic] GST/PST solution?

Mike Heins interchange-users@interchange.redhat.com
Fri Oct 12 11:10:01 2001


Quoting Jud Harris (jud@judharris.com):
> UserTag vat-calc Order table field
> UserTag vat-calc addAttr
> UserTag vat-calc Routine <<EOR
> sub {
>         my ($table, $field, $opt) = @_;
> 
>         my $error = sub {
>                 my $msg = shift;
>                 Log($msg);
>                 return undef;
>         }
> 
>         foreach my $item (@$Vend::Items) {
>                 my $taxrate = tag_data($table, $field, $item->{code});
>                 $tax += ($taxrate * $item->{quantity});
>         }
>         return $tax;
> }
> EOR 
> 
> --- 
> 
> When I IC starts, it report this error:
> 
> UserTag 'vat_calc' subroutine failed compilation:
> 
>          syntax error at (eval 13) line 10, near "}
> 
>         my "
> Global symbol "$tax" requires explicit package name at (eval 13) line 10,
> <GLOBAL> line 115.
> Global symbol "$tax" requires explicit package name at (eval 13) line 13,
> <GLOBAL> line 115.
> Global symbol "$tax" requires explicit package name at (eval 13) line 15,
> <GLOBAL> line 115.

You didn't follow the example exactly -- a "my $tax = 0" is missing.

In any case, this is all moot in 4.8. The new "multi" mode that you can
configure will work best.

Here is a short tutorial on using it for Canada.

1. Make sure you have a country database table with CA as an entry and the
following values:

code:CA
tax:state

2. Make sure you have a state database table and one entry for each
province code. It should have something like the following for
each province:

code|sorder|country|state|name|tax|postcode|shipmodes|tax_name
00185|01|CA|AB|Alberta|default=15%|||PST
00187|01|CA|MB|Manitoba|default=16%%, food=8%|||GST
00039|01|CA|AB|Alberta|default=16%%|||GST
00040|01|CA|BC|British Columbia|default=15%|||
00041|01|CA|MB|Manitoba|default=14%|||PST
00042|01|CA|NB|New Brunswick|default=14%||
00043|01|CA|NF|Newfoundland|default=15%|||
00044|01|CA|NS|Nova Scotia|default=15%|||
00045|01|CA|NT|Northwest Territories|default=15%|||
00046|01|CA|NT|Nunavut|default=15%|||
00047|01|CA|ON|Ontario|default=15%|||
00048|01|CA|PE|Prince Edward Island|default=15%|||
00049|01|CA|QC|Quebec|default=15%|||
00050|01|CA|SK|Saskatchewan|default=15%|||
00051|01|CA|YT|Yukon Territory|default=15%|||

The "default=N%" should be equal to PST + GST for each province. If you
want to tax diffent categories different amounts, use the tax_category
field in products to set it. In this case, if the tax_category field is
"food", and the province is MB, it would cause only GST to be charged.

3. In catalog.cfg:

	SalesTax   multi

4. Restart.

There is a UI interface for all of this; if you have SalesTax set to
"multi" it will provide some tools for setting the above.


-- 
Red Hat, Inc., 3005 Nichols Rd., Hamilton, OH  45013
phone +1.513.523.7621      <mheins@redhat.com>

Fast, reliable, cheap.  Pick two and we'll talk.  -- unknown