Fixed a bug when viewing ledgers (related to the Close change), removed some debug code, added titles to the deposit pages, and fixed a bug with creating new transactions and/or balance transfers for a deposit when there is nothing to deposit.

git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@201 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2009-07-02 09:33:42 +00:00
parent ed673de22f
commit e060c16252
3 changed files with 12 additions and 7 deletions

View File

@@ -191,15 +191,18 @@ class AccountsController extends AppController {
// Estabish a set of ledgers to close
$set = array();
foreach ($this->data['Tillable']['Ledger'] AS $ledger_id => $ledger) {
if (!$ledger['checked'])
if (!$ledger['checked'] || $ledger['amount'] == 0)
continue;
$set[] = array('ledger_id' => $ledger_id, 'amount' => $ledger['amount']);
}
// Pull the trigger
$this->Account->closeAndDeposit($set, $this->data['Deposit']['Account']['id']);
// 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->set(compact('deposit'));
$title = 'Account: Deposit Slip';
$this->set(compact('title', 'deposit'));
$this->render('deposit_slip');
return;
}
@@ -212,7 +215,8 @@ class AccountsController extends AppController {
$acct['Account']['stats'] = $this->Account->stats($acct['Account']['id']);
}
$this->set(compact('tillable_account', 'depositable_account'));
$title = 'Account: Prepare Deposit';
$this->set(compact('title', 'tillable_account', 'depositable_account'));
}