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:
@@ -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'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user