[ic] Sales tax in Canada : Solution .

John Beima interchange-users@interchange.redhat.com
Mon Apr 22 12:04:00 2002


G'Day Alexander,


None of this is needed... If you would have just searched the archives for GST
or 2 tierd tax systems you would find it is all built into Interchange. You
could also try searching in VAT if I recall correctly...


John Beima
jbeima@palb.com, support@alocalagent.com, and support@alocalchurch.com

P.A.L.B. Systems - Phone: (780)451-1086 - Fax: (780)447-4760
11639-122 Street, Edmonton, Alberta, Canada, T5M 0B6

Affordable Web Pages - Phone: (888)932-9990 - Fax: (256)351-7297
2713B Spring Place SW, Decatur, Alabama, United States, 35603



Quoting Alexander Fedorenko <maint@intercollab.net>:

> Here is simple solution to habdle sales tax in Canada, with explaining
> of tax calculation.
> 
> Usually in Canada it's required to explain tax calculation on order.
> 
> It can be useful in some areas where salex tax is complex function .
> 
> 
> Note :
> TPS: Tax on Products and Services (federal tax)
> TVQ: Tax on Value added Quebec (provincial tax)
> TVH: Another tax ( don't know what exactly )
> 
> 
> Content of catalog.cfg :  based on example for Quebec .
> 
> 
> a)  defining of SalesTaxFunction
> 
> SalesTaxFunction  <<EOR
> 
>  if ( ! defined $Values->{country} or $Values->{country} ne "CA" ) {
>    return { DEFAULT => 0.0 } ;
>  }
> 
>     return {
>         DEFAULT => 0.0,
>         AB => 0.07 ,
>         BC => 0.07 ,
>         MB => 0.07 ,
>         NB => 0.15 ,
>         NW => 0.07 ,
>         NS => 0.15 ,
>         NT => 0.07 ,
>         ON => 0.07 ,
>         PE => 0.07 ,
>         QC => 0.15025 ,
>         SK => 0.07 ,
>         YT => 0.07
>     };
> EOR
> 
> 
> 
> b)    defining of salestax-comment    user  tag
>       Now in order and report you can insert new tag  :
> [salestax-comment], that will explain tax calculation .
> 
>       For example for Quebec :
>       Subtotal    -   13.68 CAN
>       Sales Tax   -   2.06  CAN
>       Explaining  -   TPS (7%) = 0.96, TPQ (7.5%) = 1.1
>       Total       -   15.74 CAN  
> 
> 
> 
> UserTag salestax-comment Order area
>  UserTag salestax-comment Routine <<EOF
>  sub {
> 
>  if ( ! defined $Values->{country} or $Values->{country} ne "CA" ) {
>    return "-" ;
>  }
> 
>  my $area = $Values->{state} ;
> 
>  my %hash = (
> 
>   AB  =>  sub { return "TPS (7%) "  . $Tag->salestax },
>   BC  =>  sub { return "TPS (7%) "  . $Tag->salestax },
>   MB  =>  sub { return "TPS (7%) "  . $Tag->salestax },
>   NB  =>  sub { return "TVH (15%) " . $Tag->salestax },
>   NF  =>  sub { return "TVH (15%) " . $Tag->salestax },
>   NW  =>  sub { return "TPS (7%) "  . $Tag->salestax },
>   NS  =>  sub { return "TVH (15%) " . $Tag->salestax },
>   NT  =>  sub { return "TPS (7%) "  . $Tag->salestax },
>   ON  =>  sub { return "TPS (7%) "  . $Tag->salestax },
>   PE  =>  sub { return "TPS (7%) "  . $Tag->salestax },
> 
>   QC  =>  sub {
>             my $tps = Vend::Util::round_to_frac_digits($Tag->subtotal *
> 0.07) ;
>             my $ret = "TPS (7%) = $tps" ;
>             $ret .= ", " ;
>             my $tpq = $Tag->salestax - $tps ;
>             $ret .= "TPQ (7.5%) = $tpq" ;
>             return $ret ; 
>           } ,
>   SK  =>  sub { return "TPS (7%) " . $Tag->salestax },
>   YT  =>  sub { return "TPS (7%) " . $Tag->salestax }
> 
> 
>  ) ;
> 
>  
>  if  ( defined $hash{$area} ) {
>    my $subr = $hash{$area} ;
>    return &$subr ;
>  } else {
>    return "-"  ;
>  }
> 
> }
> EOF
> 
> _______________________________________________
> interchange-users mailing list
> interchange-users@interchange.redhat.com
> http://interchange.redhat.com/mailman/listinfo/interchange-users
> 


-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/