diff options
author | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-03-21 06:30:38 +0000 |
---|---|---|
committer | einhverfr <einhverfr@4979c152-3d1c-0410-bac9-87ea11338e46> | 2007-03-21 06:30:38 +0000 |
commit | 9f75262de676d3a0ab486f53892f08e4412f93ed (patch) | |
tree | daac4b1a9c93f4bc28e4a9345a5c7140f51d31be | |
parent | c7ff92cdcfd5d6f46ecf7e110e181fdc5f2ea04a (diff) |
Fixing multiple check printing and paymen bugs
git-svn-id: https://ledger-smb.svn.sourceforge.net/svnroot/ledger-smb/trunk@973 4979c152-3d1c-0410-bac9-87ea11338e46
-rwxr-xr-x | LedgerSMB/CP.pm | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/LedgerSMB/CP.pm b/LedgerSMB/CP.pm index da39ba76..bfd18585 100755 --- a/LedgerSMB/CP.pm +++ b/LedgerSMB/CP.pm @@ -417,11 +417,13 @@ sub post_payment { 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 @@ sub post_payment { $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 @@ sub post_payment { 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 @@ sub post_payments { 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 @@ sub post_payments { 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 @@ sub post_payments { # 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( |