fly-tax —
Interchange 5.9.0:
Source: code/SystemTag/fly_tax.coretag
Lines: 15
# Copyright 2002-2007 Interchange Development Group and others # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. See the LICENSE file for details. # # $Id: fly_tax.coretag,v 1.5 2007-03-30 23:40:49 pajamian Exp $ UserTag fly-tax Order area UserTag fly-tax PosNumber 1 UserTag fly-tax AddAttr UserTag fly-tax attrAlias space discount_space UserTag fly-tax Version $Revision: 1.5 $ UserTag fly-tax MapRoutine Vend::Interpolate::fly_tax
Source: lib/Vend/Interpolate.pm
Lines: 5518
sub fly_tax { my ($area, $opt) = @_; if(my $country_check = $::Variable->{TAXCOUNTRY}) { $country_check =~ /\b$::Values->{country}\b/ or return 0; } if(! $area) { my $zone = $Vend::Cfg->{SalesTax}; while($zone =~ m/(\w+)/g) { last if $area = $::Values->{$1}; } } #::logDebug("flytax area=$area"); return 0 unless $area; my $rates = $::Variable->{TAXRATE}; my $taxable_shipping = $::Variable->{TAXSHIPPING} || ''; my $taxable_handling = $::Variable->{TAXHANDLING} || ''; $rates =~ s/^\s+//; $rates =~ s/\s+$//; $area =~ s/^\s+//; $area =~ s/\s+$//; my (@rates) = split /\s*,\s*/, $rates; my $rate; for(@rates) { my ($k,$v) = split /\s*=\s*/, $_, 2; next unless "\U$k" eq "\U$area"; $rate = $v; $rate = $rate / 100 if $rate > 1; last; } #::logDebug("flytax rate=$rate"); return 0 unless $rate; my ($oldcart, $oldspace); if ($opt->{cart}) { $oldcart = $Vend::Items; tag_cart($opt->{cart}); } if ($opt->{discount_space}) { $oldspace = switch_discount_space($opt->{discount_space}); } my $amount = taxable_amount(); #::logDebug("flytax before shipping amount=$amount"); $amount += tag_shipping() if $taxable_shipping =~ m{(^|[\s,])$area([\s,]|$)}i; $amount += tag_handling() if $taxable_handling =~ m{(^|[\s,])$area([\s,]|$)}i; $Vend::Items = $oldcart if defined $oldcart; switch_discount_space($oldspace) if defined $oldspace; #::logDebug("flytax amount=$amount return=" . $amount*$rate); return $amount * $rate; }