Implemented a bank deposit routine, to transfer funds out of the till and into the bank.
git-svn-id: file:///svn-source/pmgr/branches/invoice_receipt_20090629/site@196 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
58
views/accounts/deposit.ctp
Normal file
58
views/accounts/deposit.ctp
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
echo '<div class="account deposit">' . "\n";
|
||||
echo '<H2>Perform Bank Deposit</H2>' . "\n";
|
||||
|
||||
//pr(compact('tillableAccount', 'depositableAccount'));
|
||||
|
||||
echo $form->create(null, array('id' => 'deposit-form',
|
||||
'url' => array('controller' => 'accounts',
|
||||
'action' => 'deposit')));
|
||||
|
||||
$grid_setup = array();
|
||||
$grid_setup['hiddengrid'] = true;
|
||||
|
||||
foreach ($tillableAccount AS $acct) {
|
||||
//$acct = $acct['Account'];
|
||||
|
||||
echo ('<INPUT type="checkbox"' .
|
||||
' name="data[Tillable][Ledger][id][]"' .
|
||||
' value="'.$acct['CurrentLedger']['id'].'"' .
|
||||
' CHECKED> ');
|
||||
echo ("I have exactly " .
|
||||
FormatHelper::currency($acct['Account']['stats']['Ledger']['balance']) .
|
||||
" in " . ($acct['Account']['name'] === 'Cash'
|
||||
? 'Cash'
|
||||
: Inflector::pluralize($acct['Account']['name'])) .
|
||||
" and will be depositing it all." .
|
||||
"" . "\n");
|
||||
echo ('<INPUT type="hidden"' .
|
||||
' name="data[Tillable][Ledger]['.$acct['CurrentLedger']['id'].'][amount]"' .
|
||||
' value="'.$acct['Account']['stats']['Ledger']['balance'].'"' .
|
||||
'> ');
|
||||
|
||||
$grid_div_id = 'ledger_entries'.$acct['CurrentLedger']['id'].'-list';
|
||||
echo $this->element('ledger_entries',
|
||||
array('grid_div_id' => $grid_div_id,
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#'.$grid_div_id.' .HeaderButton\').click();'.
|
||||
' return false;">Items in '.$acct['Account']['name'].' Ledger</A>'),
|
||||
'ledger_id' => $acct['CurrentLedger']['id'],
|
||||
'no_account' => true,
|
||||
'grid_setup' => $grid_setup,
|
||||
//'account_id' => $acct['Account']['id'],
|
||||
//'account_type' => $acct['Account']['type'],
|
||||
//'account_ftype' => 'debit',
|
||||
));
|
||||
}
|
||||
|
||||
$options = array();
|
||||
foreach ($depositableAccount AS $acct) {
|
||||
$options[$acct['Account']['id']] = $acct['Account']['name'];
|
||||
}
|
||||
|
||||
echo $form->input('Deposit.Account.id', array('label' => 'Deposit Account ',
|
||||
'options' => $options));
|
||||
echo $form->end('Perform Deposit');
|
||||
|
||||
/* End page div */
|
||||
echo '</div>' . "\n";
|
||||
@@ -11,9 +11,14 @@ $cols['Credits'] = array('index' => 'credits', 'formatter' => 'currenc
|
||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency');
|
||||
$cols['Comment'] = array('index' => 'Account.comment', 'formatter' => 'comment');
|
||||
|
||||
$custom_post_data = compact('nothing');
|
||||
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
'controller' => 'accounts',
|
||||
'caption' => isset($caption) ? $caption : null);
|
||||
);
|
||||
|
||||
$jqGrid_options += compact('grid_div_id', 'grid_id', 'caption', 'grid_setup', 'limit');
|
||||
|
||||
|
||||
if (isset($accounts)) {
|
||||
$jqGrid_options += array('custom_ids' =>
|
||||
@@ -26,4 +31,6 @@ else {
|
||||
$jqGrid_options += array('search_fields' => array('Name'));
|
||||
}
|
||||
|
||||
$jqGrid_options += compact('custom_post_data');
|
||||
$jqGrid_options['sort_column'] = 'Name';
|
||||
echo $this->element('jqGrid', $jqGrid_options);
|
||||
|
||||
@@ -2,10 +2,15 @@
|
||||
|
||||
if (isset($account_ftype) || isset($ledger_id) || isset($account_id) || isset($ar_account)) {
|
||||
$single_account = true;
|
||||
$double_account = false;
|
||||
} else {
|
||||
$single_account = false;
|
||||
$double_account = true;
|
||||
}
|
||||
|
||||
if (isset($no_account))
|
||||
$single_account = $double_account = false;
|
||||
|
||||
if (isset($ledger_id) || isset($account_id) || isset($ar_account)) {
|
||||
$single_amount = false;
|
||||
} else {
|
||||
@@ -49,7 +54,8 @@ $cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' =>
|
||||
if ($single_account) {
|
||||
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name');
|
||||
}
|
||||
else {
|
||||
|
||||
if ($double_account) {
|
||||
$cols['Debit Account'] = array('index' => 'DebitAccount.name', 'formatter' => 'name');
|
||||
$cols['Credit Account'] = array('index' => 'CreditAccount.name', 'formatter' => 'name');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user