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

SF.net SVN: ledger-smb: [822] trunk/LedgerSMB/AA.pm



Revision: 822
          http://svn.sourceforge.net/ledger-smb/?rev=822&view=rev
Author:   einhverfr
Date:     2007-02-22 13:51:36 -0800 (Thu, 22 Feb 2007)

Log Message:
-----------
Fixing bug 166425

Modified Paths:
--------------
    trunk/LedgerSMB/AA.pm

Modified: trunk/LedgerSMB/AA.pm
===================================================================
--- trunk/LedgerSMB/AA.pm	2007-02-22 21:36:38 UTC (rev 821)
+++ trunk/LedgerSMB/AA.pm	2007-02-22 21:51:36 UTC (rev 822)
@@ -90,7 +90,7 @@
 		push @{ $form->{acc_trans}{taxes} }, {
 			accno => $accno,
 			amount => $tax{fxamount}{$accno},
-			project_id => 'NULL',
+			project_id => undef,
 			fx_transaction => 0 };
 
 		$amount = $tax{fxamount}{$accno} * $form->{exchangerate};
@@ -103,7 +103,7 @@
 			push @{ $form->{acc_trans}{taxes} }, {
 				accno => $accno,
 				amount => $amount,
-				project_id => 'NULL',
+				project_id => undef,
 				fx_transaction => 1 };
 		}
 
@@ -138,7 +138,7 @@
 			$diff = $amount{amount}{$i} - ($amount - $diff);
 
 			($null, $project_id) = split /--/, $form->{"projectnumber_$i"};
-			$project_id ||= 'NULL';
+			$project_id ||= undef;
 			($accno) = split /--/, $form->{"${ARAP}_amount_$i"};
 
 			if ($keepcleared) {
@@ -264,7 +264,7 @@
 
 	# record last payment date in ar/ap table
 	$form->{datepaid} = $form->{transdate} unless $form->{datepaid};
-	my $datepaid = ($paid) ? qq|'$form->{datepaid}'| : 'NULL';
+	my $datepaid = ($paid) ? qq|'$form->{datepaid}'| : 'NOW';
 
 	$form->{invnumber} = $form->update_defaults($myconfig, $invnumber) unless $form->{invnumber};
 
@@ -368,8 +368,8 @@
 			            (trans_id, chart_id, amount, transdate)
 			     VALUES (?, (SELECT id FROM chart
 			                  WHERE accno = '?'), 
-			                  ? * -1 * $ml, ?)|;
-		@queryargs = ($form->{id}, $accno, $invamount, 
+			                  ?, ?)|;
+		@queryargs = ($form->{id}, $accno, $invamount * -1 * $ml, 
 			$form->{transdate});
 
 		$dbh->prepare($query)->execute(@queryargs) 
@@ -425,9 +425,10 @@
 					            amount,transdate)
 					     VALUES (?, (SELECT id FROM chart
 					                  WHERE accno = ?),
-					            ? * $ml, ?)|;
+					            ?, ?)|;
 
-				@queryargs = ($form->{id}, $paid{amount}{$i},
+				@queryargs = ($form->{id}, 
+					$paid{amount}{$i} * $ml,
 					$form->{"datepaid_$i"});
 				$dbh->prepare($query)->execute(@queryargs) 
 					|| $form->dberror($query);
@@ -453,7 +454,8 @@
 						          WHERE accno = ?),
 					            ? * -1 * $ml, ?, ?, ?, ?)|;
 
-				@queryargs = ($form->{id}, $accno, $amount, 
+				@queryargs = ($form->{id}, $accno, 
+					$amount * -1 * $ml, 
 					$form->{"datepaid_$i"}, 
 					$form->{"source_$i"}, 
 					$form->{"memo_$i"},
@@ -486,11 +488,12 @@
 							            fx_transaction, 
 							            cleared)
 							     VALUES (?, ?, 
-							            ? * $ml, 
+							            ?, 
 							            ?, '1', ?)|;
 
 						@queryargs = ($form->{id}, 
-							$accno_id, $amount,
+							$accno_id, 
+							$amount * $ml,
 							$form->{"datepaid_$i"},
 							$cleared);
 						$sth = $dbh->prepare($query);
@@ -513,11 +516,11 @@
 						                   FROM chart
 						                  WHERE accno 
 						                        = ?),
-						            ? * -1 * $ml, ?, 
-						            '1', ?, ?)|;
+						            ?, ?, '1', ?, ?)|;
 
 					@queryargs = ($form->{id}, $accno,
-						$amount, $form->{"datepaid_$i"},
+						$amount * -1 * $ml, 
+						$form->{"datepaid_$i"},
 						$cleared, $form->{"source_$i"});
 					$sth = $dbh->prepare($query) ;
 					$sth->execute(@queryargs)


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