[ic] ship country ?- tax? (partly done, need help)

jojo@buchonline.net jojo@buchonline.net
Tue, 30 Jan 2001 17:36:36 +0100 (CET)


On 30 Jan, Company InterNet Services wrote:
> 
>>I need to change the defults for country: USA, canada, other
> 
> 
> I manually edited checkout.html, and added the country list.
> 
>>I there a way to make it calculate seperatly like the TOTAL price.
> 
> 
> Using the code(modified) from JOJO the checkout page can display the tax for each item when listed.
> However I need a way to add this number to the [salestax] inside JOJO's script.
> 
> 
> 
> Screen output:
> 
> Remove | SKU | Description  | Quantity | Price | Item Tax | Item Total  
> [*]     |    0000043 | Gft Wrap  | Jesus/reason 1/2 Ream (test:MWST1) |  1 |  $72.00  | $5.06 |  $72.00 
> ---------------------
> Subtotal:  $72.25 
> Sales Tax1 (7%):  $0.00   which is actually [salestax]
> Sales Tax2 (16%):  [salestax2] 
> Shipping:  $4.76 
> TOTAL:  $77.01 
> 
> 
> USING your COMPUT_VAT script:
> 
> if($vatkz =~ /MWST2/){
> $a = ($outprice * $outmenge)*"0.16";
> $vat = $vat + $a;
> } else {
> $a = ($outprice * $outmenge)*"0.07";
> $vat = $vat + $a;
> }
> 
> 
> I need to add something line $salestax = $salestax + a$  on the 7%, and 
> $salestax2 = $salestax2 + a$  on the 16%.


Maybe like this

UserTag compute_vat Routine <<EOF
sub {
	package Vend::Interpolate;
	my $a;
	my $tax;
	my $tax2;
        my $cart;
	$cart = $Vend::Items;
        my $item;
	my $outprice;
	my $outmenge;
	my $vatkz;
	my $out;
        foreach my $item (@$cart){
                my $item_dummy = '';
		my $item_price = '';
		$outprice = tag_data('products','price', $item->{code});
		$vatkz = tag_data('products','dummy', $item->{code});
		$outmenge =  $item->{quantity};
		if($vatkz =~ /MWSTKZ2/){
		$a = ($outprice * $outmenge)/116*16;
		$tax2 = $tax2 + $a;
		} else {
		$a = ($outprice * $outmenge)/107*7;
		$tax = $tax + $a;
		}
        }
         $Safe{'scratch'}->{'tax'} = $tax;
         $Safe{'scratch'}->{'tax2'} = $tax2;        
        return '';
}
EOF

and then...

Sales Tax1 (7%):   [scratch tax] 
Sales Tax2 (16%):  [scratch tax2] 

Joachim

-- 
Hans-Joachim Leidinger
buch online                 jojo@buchonline.net
Munscheidstr. 14            FAX: +49 209 1671441
45886 Gelsenkirchen         FAX: 0209 1671441