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

SF.net SVN: ledger-smb: [973] trunk/LedgerSMB/CP.pm



Revision: 973
          http://svn.sourceforge.net/ledger-smb/?rev=973&view=rev
Author:   einhverfr
Date:     2007-03-20 23:30:38 -0700 (Tue, 20 Mar 2007)

Log Message:
-----------
Fixing multiple check printing and paymen bugs

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

Modified: trunk/LedgerSMB/CP.pm
===================================================================
--- trunk/LedgerSMB/CP.pm	2007-03-21 06:29:55 UTC (rev 972)
+++ trunk/LedgerSMB/CP.pm	2007-03-21 06:30:38 UTC (rev 973)
@@ -417,11 +417,13 @@
 				INSERT INTO acc_trans 
 				            (trans_id, chart_id, transdate, 
 				            amount)
-				     VALUES (?, ?, ?, ?)|;
+				     VALUES (?, ?, 
+				            ?, 
+				            ?)|;
 			$sth = $dbh->prepare($query);
 			$sth->execute($form->{"id_$i"}, $id, 
 				$form->{date_paid}, $amount * $ml) 
-					|| $form->dberror($query, 'CP.pm', 427);
+					|| $form->dberror($query, __file__, __line__);
 
 			# add payment
 			$query = qq|
@@ -435,7 +437,8 @@
 			$sth = $dbh->prepare($query);
 			$sth->execute(
 				$form->{"id_$i"}, $paymentaccno, 
-				$form->{datepaid}, $form->{"paid_$i"} * $ml *-1,
+				$form->{datepaid}, 
+				$form->{"paid_$i"} * $ml * -1,
 				$form->{source}, $form->{memo})
 					|| $form->dberror(
 						$query, 'CP.pm', 444);
@@ -456,7 +459,8 @@
 					     VALUES (?, (SELECT id 
 					                   FROM chart
 					                  WHERE accno = ?),
-					             ?, ?, '0', '1', ?)|;
+					             ?, ?, '0', '1', 
+					             ?)|;
 				$sth = $dbh->prepare($query);
 				$sth->execute(
 					$form->{"id_$i"}, $paymentaccno,
@@ -665,7 +669,7 @@
 				 WHERE e.curr = ?
 				       AND a.id = ?|;
 
-			$sth = $sbh->prepare($query);
+			$sth = $dbh->prepare($query);
 			$sth->execute($form->{currency}, $form->{"id_$i"})
 				|| $form->dberror($query, 'CP.pm', 671);
 			my ($exchangerate) = $sth->fetchrow_array;
@@ -677,10 +681,11 @@
 				  FROM chart c
 				  JOIN acc_trans a ON (a.chart_id = c.id)
 				 WHERE $where
-				       AND a.trans_id = $form->{"id_$i"}|;
+				       AND a.trans_id = ?|;
 
 			$sth = $dbh->prepare($query);
 			$sth->execute($form->{"id_$i"});
+			($id) = $sth->fetchrow_array();
 
 			$paid = ($form->{"paid_$i"} > $form->{"due_$i"}) ? $form->{"due_$i"} : $form->{"paid_$i"};
 			$amount = $form->round_amount($paid * $exchangerate, 2);
@@ -786,9 +791,9 @@
 			# update AR/AP transaction
 			$query = qq|
 				UPDATE $form->{arap} 
-				   SET paid = $amount,
-				       datepaid = '$form->{datepaid}'
-				 WHERE id = $form->{"id_$i"}|;
+				   SET paid = ?,
+				       datepaid = ?
+				 WHERE id = ?|;
 
 			$sth = $dbh->prepare($query);
 			$sth->execute(


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