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@201 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -191,15 +191,18 @@ class AccountsController extends AppController {
|
|||||||
// Estabish a set of ledgers to close
|
// Estabish a set of ledgers to close
|
||||||
$set = array();
|
$set = array();
|
||||||
foreach ($this->data['Tillable']['Ledger'] AS $ledger_id => $ledger) {
|
foreach ($this->data['Tillable']['Ledger'] AS $ledger_id => $ledger) {
|
||||||
if (!$ledger['checked'])
|
if (!$ledger['checked'] || $ledger['amount'] == 0)
|
||||||
continue;
|
continue;
|
||||||
$set[] = array('ledger_id' => $ledger_id, 'amount' => $ledger['amount']);
|
$set[] = array('ledger_id' => $ledger_id, 'amount' => $ledger['amount']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pull the trigger
|
// Perform the accounting work necessary to close the
|
||||||
$this->Account->closeAndDeposit($set, $this->data['Deposit']['Account']['id']);
|
// 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');
|
$this->render('deposit_slip');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -212,7 +215,8 @@ class AccountsController extends AppController {
|
|||||||
$acct['Account']['stats'] = $this->Account->stats($acct['Account']['id']);
|
$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'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
echo '<H2>Deposit Slip: ' . date('l, F jS, Y, g:ia') . '</H2>' . "\n";
|
echo '<H2>Deposit Slip: ' . date('l, F jS, Y, g:ia') . '</H2>' . "\n";
|
||||||
|
|
||||||
pr(compact('deposit'));
|
//pr(compact('deposit'));
|
||||||
|
|
||||||
// Handle account summaries
|
// Handle account summaries
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ echo '<div class="ledger view">' . "\n";
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
$account = $ledger['Account'];
|
$account = $ledger['Account'];
|
||||||
|
//$close = $ledger['Close'];
|
||||||
|
|
||||||
if (isset($ledger['Ledger']))
|
if (isset($ledger['Ledger']))
|
||||||
$ledger = $ledger['Ledger'];
|
$ledger = $ledger['Ledger'];
|
||||||
@@ -20,7 +21,7 @@ $rows = array(array('ID', $ledger['id']),
|
|||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$account['id']))),
|
$account['id']))),
|
||||||
array('Sequence', $ledger['sequence']),
|
array('Sequence', $ledger['sequence']),
|
||||||
array('Status', $ledger['closed'] ? 'Closed' : 'Open'),
|
array('Status', $ledger['close_id'] ? 'Closed' : 'Open'),
|
||||||
array('Comment', $ledger['comment']));
|
array('Comment', $ledger['comment']));
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
|
|||||||
Reference in New Issue
Block a user