[ic] need to display gst and pst on separate lines

Ed Vallvé ed at ispnet.ca
Wed Aug 13 17:19:08 EDT 2003


Thank you for your prompt response. I however I have a question. will this
work with multi tax and tax categories in the products page?
Tahnks again.

> Someone already posted a way to just display separate taxes on the
> checkout page. We had to ALSO track the taxes separately. We extended
> their example as follows.
>
>
> Add this function to catalog.cfg
>
> # purpose: calculate pst/gst from subtotal and set them in the scratch
> #
> # usage: put [calculate_taxes] somewhere on your page
> #
> # preconditons: items in cart AND values country & state are defined.
> #
> # by: Picasso Fish Corporation, Chad Furniss, 2003-06-27
>
> UserTag calculate_taxes HasEndTag
> UserTag calculate_taxes Routine <<EOF
> sub
> {
> # check country variable
> if ( ! defined $Values->{country} or $Values->{country} ne "CA" )
>         {
> # if not in Canada
> $Scratch->{pst} = '0.00';
> $Scratch->{gst} = '0.00';
> $Tag->assign({salestax => '0.00'});
>                 return;
>         }
>
> # allocate variables, default to zero
> my $pst_val = '0.00';
>         my $pst_total = '0.00';
> my $gst_val = '0.00';
> my $gst_total = '0.00';
> my $subtotal = '0.00';
>
> # find percentages
> if ($Values->{state} eq "AL") { $pst_val = '0.00'; $gst_val = '0.07'; }
>         if ($Values->{state} eq "BC") { $pst_val = '0.00'; $gst_val =
> '0.07'; }
>         if ($Values->{state} eq "MB") { $pst_val = '0.00'; $gst_val =
> '0.07'; }
>         if ($Values->{state} eq "NB") { $pst_val = '0.00'; $gst_val =
> '0.07'; }
>         if ($Values->{state} eq "NW") { $pst_val = '0.00'; $gst_val =
> '0.07'; }
>         if ($Values->{state} eq "NS") { $pst_val = '0.00'; $gst_val =
> '0.07'; }
>         if ($Values->{state} eq "NT") { $pst_val = '0.00'; $gst_val =
> '0.07'; }
>         if ($Values->{state} eq "ON") { $pst_val = '0.08'; $gst_val =
> '0.07'; }
>         if ($Values->{state} eq "PE") { $pst_val = '0.00'; $gst_val =
> '0.07'; }
>         if ($Values->{state} eq "QC") { $pst_val = '0.00'; $gst_val =
> '0.07'; }
>         if ($Values->{state} eq "SK") { $pst_val = '0.00'; $gst_val =
> '0.07'; }
>         if ($Values->{state} eq "YT") { $pst_val = '0.00'; $gst_val =
> '0.07'; }
>
> # get current subtotal
> $subtotal = $Tag->subtotal( { noformat => 1 } );
>
> # calculate
> $gst_total = sprintf("%.2f", ($subtotal * $gst_val));
> $pst_total = sprintf("%.2f", ($subtotal * $pst_val));
>
> # set scratch variables for later stored to transaction table or
> display
> $Scratch->{pst} = sprintf("%.2f", $pst_total);
> $Scratch->{gst} = sprintf("%.2f", $gst_total);
>
> # force salestax total to sum of taxes to avoid 'off by a penny'
> problems
> $Tag->assign({salestax => ($pst_total + $gst_total) });
> return;
> }
> EOF
>
> ========
>
> Call this function after your shipping address is established.
>
> [calculate_taxes]
>
> We have a multi-part checkout form, so you will have figure out where to
> stick this in yours.
>
> ============
>
> Add this to log_transaction
>
> salestax: [salestax noformat=1]
> pst: [scratch pst]
> gst: [scratch gst]
>
>
> ===================================
>
> Add this to receipt.html
>
> [if value country =~ /(^$|CA)/]
> <tr>
> <td colspan=5>
> &nbsp;
> </td>
> <td>
> PST/QST
> </td>
> <td align=right>
> [currency][scratch pst][/currency]
> </td>
> </tr>
> <tr>
> <td colspan=5>
> &nbsp;
> </td>
> <td>
> [LC]GST[fr_FR]GST[/fr_FR][/LC]
> </td>
> <td align=right>
> [currency][scratch gst][/currency]
> </td>
> </tr>
> [/if]
>
>
> =====================
>
> add gst and pst columns to the transactions table
>
> ===================
>
> You will have to tweak other things too. Search around for the work tax
> to find them.
>
> Hopefully these code snippets will get you going. Good luck!
>
> -- 
> John Matecsa <matecsaj at picassofish.com>
> Picasso Fish Corporation
>
>
>
> On Tue, 2003-08-12 at 16:47, Ed Vallvé wrote:
> > Hi I need to display the gst and pst on separate lines in the checkout
doe
> > any body have a solution?
> > Thanks
> >
> > _______________________________________________
> > interchange-users mailing list
> > interchange-users at icdevgroup.org
> > http://www.icdevgroup.org/mailman/listinfo/interchange-users
>
>
> _______________________________________________
> interchange-users mailing list
> interchange-users at icdevgroup.org
> http://www.icdevgroup.org/mailman/listinfo/interchange-users
>



More information about the interchange-users mailing list