[interchange-cvs] interchange - ton modified lib/Vend/Interpolate.pm

interchange-cvs at icdevgroup.org interchange-cvs at icdevgroup.org
Wed Dec 29 15:06:46 EST 2004


User:      ton
Date:      2004-12-29 20:06:46 GMT
Modified:  lib/Vend Interpolate.pm
Log:
	Add code to tax_vat function to enable proper
	tax calculations when TaxInclusive is set.

Revision  Changes    Path
2.228     +6 -2      interchange/lib/Vend/Interpolate.pm


rev 2.228, prev_rev 2.227
Index: Interpolate.pm
===================================================================
RCS file: /var/cvs/interchange/lib/Vend/Interpolate.pm,v
retrieving revision 2.227
retrieving revision 2.228
diff -u -r2.227 -r2.228
--- Interpolate.pm	14 Dec 2004 20:55:38 -0000	2.227
+++ Interpolate.pm	29 Dec 2004 20:06:46 -0000	2.228
@@ -1,6 +1,6 @@
 # Vend::Interpolate - Interpret Interchange tags
 # 
-# $Id: Interpolate.pm,v 2.227 2004/12/14 20:55:38 racke Exp $
+# $Id: Interpolate.pm,v 2.228 2004/12/29 20:06:46 ton Exp $
 #
 # Copyright (C) 2002-2003 Interchange Development Group
 # Copyright (C) 1996-2002 Red Hat, Inc.
@@ -28,7 +28,7 @@
 require Exporter;
 @ISA = qw(Exporter);
 
-$VERSION = substr(q$Revision: 2.227 $, 10);
+$VERSION = substr(q$Revision: 2.228 $, 10);
 
 @EXPORT = qw (
 
@@ -5304,6 +5304,7 @@
 		if($t =~ /^(\d+(?:\.\d+)?)\s*(\%)$/) {
 			my $rate = $1;
 			$rate /= 100 if $2;
+                        $rate = $rate / (1 + $rate) if $Vend::Cfg->{TaxInclusive};
 			my $amount = Vend::Interpolate::taxable_amount();
 			$total += ($rate * $amount);
 		}
@@ -5323,6 +5324,7 @@
 #::logDebug("item $item->{code} cat=$cat rate=$rate");
 			$rate =~ s/\s*%\s*$// and $rate /= 100;
 			next if $rate <= 0;
+                        $rate = $rate / (1 + $rate) if $Vend::Cfg->{TaxInclusive};
 			my $sub = Vend::Data::item_subtotal($item);
 #::logDebug("item $item->{code} subtotal=$sub");
 			$total += $sub * $rate;
@@ -5333,6 +5335,7 @@
 		if ($tax->{mv_shipping} > 0) {
 			my $rate = $tax->{mv_shipping};
 			$rate =~ s/\s*%\s*$// and $rate /= 100;
+                        $rate = $rate / (1 + $rate) if $Vend::Cfg->{TaxInclusive};
 			my $sub = tag_shipping() * $rate;
 #::logDebug("applying shipping tax rate of $rate, tax of $sub");
 			$total += $sub;
@@ -5342,6 +5345,7 @@
 		if ($tax->{mv_handling} > 0) {
 			my $rate = $tax->{mv_handling};
 			$rate =~ s/\s*%\s*$// and $rate /= 100;
+                        $rate = $rate / (1 + $rate) if $Vend::Cfg->{TaxInclusive};
 			my $sub = tag_handling() * $rate;
 #::logDebug("applying handling tax rate of $rate, tax of $sub");
 			$total += $sub;








More information about the interchange-cvs mailing list