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

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



Revision: 1044
          http://svn.sourceforge.net/ledger-smb/?rev=1044&view=rev
Author:   einhverfr
Date:     2007-04-09 12:43:31 -0700 (Mon, 09 Apr 2007)

Log Message:
-----------
Fixing sales tax posting issues not taking contact into consideration

Modified Paths:
--------------
    branches/1.2/LedgerSMB/IR.pm
    branches/1.2/LedgerSMB/IS.pm
    branches/1.2/LedgerSMB/OE.pm
    branches/1.2/LedgerSMB/Tax.pm

Modified: branches/1.2/LedgerSMB/IR.pm
===================================================================
--- branches/1.2/LedgerSMB/IR.pm	2007-04-09 18:53:05 UTC (rev 1043)
+++ branches/1.2/LedgerSMB/IR.pm	2007-04-09 19:43:31 UTC (rev 1044)
@@ -218,7 +218,8 @@
 			$fxdiff += $amount - $linetotal;
 
 			@taxaccounts = Tax::init_taxes(
-				$form, $form->{"taxaccounts_$i"});
+				$form, $form->{"taxaccounts_$i"},
+				$form->{'taxaccounts'});
 
 			$tax = Math::BigFloat->bzero();
 			$fxtax = Math::BigFloat->bzero();

Modified: branches/1.2/LedgerSMB/IS.pm
===================================================================
--- branches/1.2/LedgerSMB/IS.pm	2007-04-09 18:53:05 UTC (rev 1043)
+++ branches/1.2/LedgerSMB/IS.pm	2007-04-09 19:43:31 UTC (rev 1044)
@@ -354,7 +354,8 @@
 			push(@{ $form->{linetotal} }, $form->{"linetotal_$i"});
       
  			@taxaccounts = Tax::init_taxes(
-				$form, $form->{"taxaccounts_$i"});
+				$form, $form->{"taxaccounts_$i"}, 
+				$form->{"taxaccounts"});
       
 			my $ml = 1;
 			my @taxrates = ();
@@ -950,7 +951,8 @@
 			my $linetotal = $form->round_amount($amount, 2);
 			$fxdiff += $amount - $linetotal;
 			@taxaccounts = Tax::init_taxes(
-				$form, $form->{"taxaccounts_$i"});
+				$form, $form->{"taxaccounts_$i"}, 
+				$form->{"taxaccounts"});
 			$ml = 1;
 			$tax = Math::BigFloat->bzero();
 			$fxtax = Math::BigFloat->bzero();

Modified: branches/1.2/LedgerSMB/OE.pm
===================================================================
--- branches/1.2/LedgerSMB/OE.pm	2007-04-09 18:53:05 UTC (rev 1043)
+++ branches/1.2/LedgerSMB/OE.pm	2007-04-09 19:43:31 UTC (rev 1044)
@@ -423,7 +423,8 @@
 			);
       
 			@taxaccounts = Tax::init_taxes($form,
-				$form->{"taxaccounts_$i"});
+				$form->{"taxaccounts_$i"}, 
+				$form->{taxaccounts});
 			if ($form->{taxincluded}) {
 				$taxamount = Tax::calculate_taxes(..hidden..,
 					$form, $linetotal, 1);

Modified: branches/1.2/LedgerSMB/Tax.pm
===================================================================
--- branches/1.2/LedgerSMB/Tax.pm	2007-04-09 18:53:05 UTC (rev 1043)
+++ branches/1.2/LedgerSMB/Tax.pm	2007-04-09 19:43:31 UTC (rev 1044)
@@ -30,10 +30,23 @@
 use Math::BigFloat;
 
 sub init_taxes {
-	my ($form, $taxaccounts) = @_;
+	my ($form, $taxaccounts, $taxaccounts2) = @_;
 	my $dbh = $form->{dbh};
 	@taxes = ();
 	my @accounts = split / /, $taxaccounts;
+	if (defined $taxaccounts2){
+		my @tmpaccounts = @accounts;
+		$#accounts = 0;
+		for my $acct (split / /, $taxaccounts2){
+			if  ($taxaccounts =~ /$acct/){
+				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)
@@ -41,6 +54,7 @@
 			WHERE c.accno = ?|;
 	my $sth = $dbh->prepare($query);
 	foreach $taxaccount (@accounts) {
+		next if (! defined $taxaccount);
 		$sth->execute($taxaccount) || $form->dberror($query);
 		my $ref = $sth->fetchrow_hashref;
 


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