Fixed the bank deposit, which was not reconciling the income received with the actual deposit. Thus, there was no way to determine when a particular check, for example, was actually deposited in the bank... the trail was broken. This seems to work. I would like to move some of the logic in Transaction to simply use the Account::postLedgerEntry function, but I'll not do it just yet... other fish and all.
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@303 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -164,7 +164,7 @@ class AccountsController extends AppController {
|
||||
array('fields' => array('name')),
|
||||
|
||||
'LedgerEntry' =>
|
||||
array('fields' => array('amount'),
|
||||
array('fields' => array('id', 'amount'),
|
||||
|
||||
'MonetarySource' =>
|
||||
array('fields' => array('name')),
|
||||
@@ -183,23 +183,15 @@ class AccountsController extends AppController {
|
||||
));
|
||||
|
||||
$deposit['total'] += $ledger['amount'];
|
||||
$deposit['ledgers'][] = array('name' => $ledger['account_name'],
|
||||
$deposit['ledgers'][] = array('id' => $ledger_id,
|
||||
'name' => $ledger['account_name'],
|
||||
'total' => $ledger['amount'],
|
||||
'entries' => $ledger_entries);
|
||||
}
|
||||
|
||||
// Estabish a set of ledgers to close
|
||||
$set = array();
|
||||
foreach ($this->data['Tillable']['Ledger'] AS $ledger_id => $ledger) {
|
||||
if (!$ledger['checked'] || $ledger['amount'] == 0)
|
||||
continue;
|
||||
$set[] = array('ledger_id' => $ledger_id, 'amount' => $ledger['amount']);
|
||||
}
|
||||
|
||||
// Perform the accounting work necessary to close the
|
||||
// monetary ledgers and deposit into the bank account.
|
||||
if (count($set) > 0)
|
||||
$this->Account->closeAndDeposit($set, $this->data['Deposit']['Account']['id']);
|
||||
$this->Account->closeAndDeposit($deposit['ledgers'], $this->data['Deposit']['Account']['id']);
|
||||
|
||||
$title = 'Account: Deposit Slip';
|
||||
$this->set(compact('title', 'deposit'));
|
||||
|
||||
Reference in New Issue
Block a user