Added routines to reconcile a new ledger entry against unreconciled entries. I haven't tested it robustly, but it seems to work on the surface at least.

git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@161 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-06-17 18:40:39 +00:00
parent f5bb9bac83
commit 65acd0e181
4 changed files with 312 additions and 103 deletions

View File

@@ -103,11 +103,24 @@ class TransactionsController extends AppController {
*/
function postReceipt() {
if ($this->RequestHandler->isPost()) {
pr($this->data);
//$this->redirect(array('action'=>'index'));
}
$this->autoRender = false;
if (!$this->RequestHandler->isPost()) {
echo('<H2>THIS IS NOT A POST FOR SOME REASON</H2>');
return;
}
//pr($this->data);
$amount = 0;
foreach ($this->data['LedgerEntry'] AS $entry) {
$amount += isset($entry['amount']) ? $entry['amount'] : 0;
}
$cust_id = $this->data['Customer']['id'];
$cust = new Customer();
$unreconciled = $cust->findUnreconciledLedgerEntries($cust_id);
$reconciled = $cust->reconcileNewLedgerEntry($cust_id, 'credit', $amount);
pr(compact('amount', 'unreconciled', 'reconciled'));
}
}