[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1045] branches/1.2



Revision: 1045
          http://svn.sourceforge.net/ledger-smb/?rev=1045&view=rev
Author:   einhverfr
Date:     2007-04-09 13:37:21 -0700 (Mon, 09 Apr 2007)

Log Message:
-----------
All sales tax bugs fixed

Modified Paths:
--------------
    branches/1.2/LedgerSMB/Tax.pm
    branches/1.2/bin/arapprn.pl
    branches/1.2/bin/ic.pl
    branches/1.2/bin/io.pl
    branches/1.2/bin/ir.pl
    branches/1.2/bin/is.pl

Modified: branches/1.2/LedgerSMB/Tax.pm
===================================================================
--- branches/1.2/LedgerSMB/Tax.pm	2007-04-09 19:43:31 UTC (rev 1044)
+++ branches/1.2/LedgerSMB/Tax.pm	2007-04-09 20:37:21 UTC (rev 1045)
@@ -38,15 +38,12 @@
 		my @tmpaccounts = @accounts;
 		$#accounts = 0;
 		for my $acct (split / /, $taxaccounts2){
-			if  ($taxaccounts =~ /$acct/){
+			if  ($taxaccounts =~ /\s$acct\s/){
 				push @accounts, $acct;
 			}
 		}
 		
 	}
-	if (! scalar @accounts){
-		return @accounts;
-	}
 	my $query = qq|SELECT t.taxnumber, c.description,
 			t.rate, t.chart_id, t.pass, m.taxmodulename
 			FROM tax t INNER JOIN chart c ON (t.chart_id = c.id)
@@ -55,6 +52,9 @@
 	my $sth = $dbh->prepare($query);
 	foreach $taxaccount (@accounts) {
 		next if (! defined $taxaccount);
+		if (defined $taxaccounts2){
+			next if $taxaccount !~ /$taxaccounts2/;
+		}
 		$sth->execute($taxaccount) || $form->dberror($query);
 		my $ref = $sth->fetchrow_hashref;
 

Modified: branches/1.2/bin/arapprn.pl
===================================================================
--- branches/1.2/bin/arapprn.pl	2007-04-09 19:43:31 UTC (rev 1044)
+++ branches/1.2/bin/arapprn.pl	2007-04-09 20:37:21 UTC (rev 1045)
@@ -322,7 +322,6 @@
     $form->{subtotal} += $form->parse_amount(\%myconfig, $form->{"amount_$i"});
     
   }
-
   foreach $accno (split / /, $form->{taxaccounts}) {
     if ($form->{"tax_$accno"}) {
       $form->format_string("${accno}_description");

Modified: branches/1.2/bin/ic.pl
===================================================================
--- branches/1.2/bin/ic.pl	2007-04-09 19:43:31 UTC (rev 1044)
+++ branches/1.2/bin/ic.pl	2007-04-09 20:37:21 UTC (rev 1045)
@@ -2982,7 +2982,8 @@
       $amount = $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) * $form->{"qty_$i"};
       for (split / /, $form->{"taxaccounts_$i"}) { $form->{"${_}_base"} += $amount }
       if (!$form->{taxincluded}) {
-        my @taxlist= Tax::init_taxes($form, $form->{"taxaccounts_$i"});
+        my @taxlist= Tax::init_taxes($form, $form->{"taxaccounts_$i"}, 
+		$form->{taxaccounts});
 	$amount += Tax::calculate_taxes(..hidden.., $form, $amount, 0);
       }
 

Modified: branches/1.2/bin/io.pl
===================================================================
--- branches/1.2/bin/io.pl	2007-04-09 19:43:31 UTC (rev 1044)
+++ branches/1.2/bin/io.pl	2007-04-09 20:37:21 UTC (rev 1045)
@@ -508,7 +508,8 @@
       $amount = $form->{"sellprice_$i"} * (1 - $form->{"discount_$i"} / 100) * $form->{"qty_$i"};
       for (split / /, $form->{"taxaccounts_$i"}) { $form->{"${_}_base"} += $amount }
       if (!$form->{taxincluded}) {
-        my @taxlist= Tax::init_taxes($form, $form->{"taxaccounts_$i"});
+        my @taxlist= Tax::init_taxes($form, $form->{"taxaccounts_$i"}, 
+		$form->{taxaccounts});
 	$amount += Tax::calculate_taxes(..hidden.., $form, $amount, 0);
       }
 
@@ -1222,7 +1223,6 @@
 
 sub print_form {
   my ($old_form) = @_;
-
   $inv = "inv";
   $due = "due";
 
@@ -1370,7 +1370,6 @@
   } else {
     IS->invoice_details(\%myconfig, \%$form);
   }
-
   if (exists $form->{longformat}) {
     $form->{"${due}date"} = $duedate;
     for ("${inv}date", "${due}date", "shippingdate", "transdate") { $form->{$_} = $locale->date(\%myconfig, $form->{$_}, $form->{longformat}) }

Modified: branches/1.2/bin/ir.pl
===================================================================
--- branches/1.2/bin/ir.pl	2007-04-09 19:43:31 UTC (rev 1044)
+++ branches/1.2/bin/ir.pl	2007-04-09 20:37:21 UTC (rev 1045)
@@ -804,7 +804,8 @@
 	for (split / /, $form->{taxaccounts}) { $form->{"${_}_base"} = 0 }
 	for (split / /, $form->{"taxaccounts_$i"}) { $form->{"${_}_base"} += $amount }
 	if (!$form->{taxincluded}) {
-	  my @taxes = Tax::init_taxes($form, $form->{"taxaccounts_$i"});
+	  my @taxes = Tax::init_taxes($form, $form->{"taxaccounts_$i"},
+		$form->{"taxaccounts"});
 	  $amount += (Tax::calculate_taxes(..hidden.., $form, $amount, 0));
 	}
 

Modified: branches/1.2/bin/is.pl
===================================================================
--- branches/1.2/bin/is.pl	2007-04-09 19:43:31 UTC (rev 1044)
+++ branches/1.2/bin/is.pl	2007-04-09 20:37:21 UTC (rev 1045)
@@ -470,14 +470,13 @@
   }
 
   if (!$form->{taxincluded}) {
-    
     my @taxes = Tax::init_taxes($form, $form->{taxaccounts});
     $form->{invtotal} += Tax::calculate_taxes(..hidden.., $form, 
       $form->{invsubtotal}, 0);
     foreach $item (@taxes) {
       my $taccno = $item->account;
       $form->{"${taccno}_total"} = $form->format_amount(\%myconfig, 
-        $item->value, 2);
+        $form->{"${taccno}_rate"} * $form->{"${taccno}_base"}, 2);
       $tax .= qq|
         <tr>
       	<th align=right>$form->{"${taccno}_description"}</th>
@@ -818,7 +817,8 @@
 	for (split / /, $form->{taxaccounts}) { $form->{"${_}_base"} = 0 }
         for (split / /, $form->{"taxaccounts_$i"}) { $form->{"${_}_base"} += $amount }
 	if (!$form->{taxincluded}) {
-	  my @taxes = Tax::init_taxes($form, $form->{"taxaccounts_$i"});
+	  my @taxes = Tax::init_taxes($form, $form->{"taxaccounts_$i"},
+		$form->{taxaccounts});
 	  $amount += Tax::calculate_taxes(..hidden.., $form, $amount, 0);
 	}
 	


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.