Re-implemented the deposit functionality. This is mostly working, although I'd like to get customer added to the tenders table, and probably change to a single deposit ledger entry for each tender type. A single entry would require that all tender types have been recorded to the same account, something that isn't mandated at the present, but is likely to be true most of the time. Perhaps they could just be grouped by account id, which should work in all cases and yet align with tender type 99% of the time. I'll have to think about it.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@412 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -1,66 +0,0 @@
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
echo '<div class="account deposit">' . "\n";
|
||||
echo '<H2>Perform Bank Deposit</H2>' . "\n";
|
||||
echo '<P>Make sure to select the checkboxes below for only those types of currency (Cash, Check, etc) which you intend to actually deposit (you can see all the individual items by dropping down the list below the checkbox). Then, select the Deposit Account where you will make the deposit, and click "Perform Deposit" to close the books on the selected currency types and reset them to a zero balance. On the next page, you will be provided with a deposit slip to prepare the actual deposit.' . "\n";
|
||||
echo '<P><BR>' . "\n";
|
||||
|
||||
pr(compact('paymentAccounts', 'depositAccounts'));
|
||||
|
||||
echo $form->create(null, array('id' => 'deposit-form',
|
||||
'url' => array('controller' => 'accounts',
|
||||
'action' => 'deposit')));
|
||||
|
||||
foreach ($paymentAccounts AS $acct) {
|
||||
//$acct = $acct['Account'];
|
||||
|
||||
echo "\n";
|
||||
echo $form->input("Tillable.Ledger.{$acct['id']}.checked",
|
||||
array(//'label' => $acct['name'],
|
||||
'type' => 'checkbox',
|
||||
'checked' => true,
|
||||
'value' => true,
|
||||
'label' => (" I have exactly " .
|
||||
FormatHelper::currency($acct['stats']['Ledger']['balance']) .
|
||||
" in " . Inflector::pluralize($acct['name']) .
|
||||
" and will be depositing it all.")
|
||||
));
|
||||
echo "\n";
|
||||
echo $form->input("Tillable.Ledger.{$acct['id']}.amount",
|
||||
array('type' => 'hidden',
|
||||
'value' => $acct['stats']['Ledger']['balance'],
|
||||
));
|
||||
echo "\n";
|
||||
echo $form->input("Tillable.Ledger.{$acct['id']}.account_id",
|
||||
array('type' => 'hidden',
|
||||
'value' => $acct['id'],
|
||||
));
|
||||
echo "\n";
|
||||
echo $form->input("Tillable.Ledger.{$acct['id']}.account_name",
|
||||
array('type' => 'hidden',
|
||||
'value' => $acct['name'],
|
||||
));
|
||||
echo "\n";
|
||||
|
||||
$grid_div_id = "tenders-{$acct['id']}-list";
|
||||
echo $this->element('tenders', array
|
||||
(// Grid configuration
|
||||
'config' => array
|
||||
(
|
||||
'grid_div_id' => $grid_div_id,
|
||||
'grid_setup' => array('hiddengrid' => true),
|
||||
'caption' => ('<A HREF="#" ONCLICK="$(\'#'.$grid_div_id.' .HeaderButton\').click();'.
|
||||
' return false;">Items in '.$acct['name'].' Ledger</A>'),
|
||||
'filter' => array('Tender.deposit_transaction_id' => null,
|
||||
'LedgerEntry.account_id' => $acct['id']),
|
||||
'exclude' => array(/*'Account'*/),
|
||||
),
|
||||
));
|
||||
}
|
||||
|
||||
echo $form->input('Deposit.Account.id', array('label' => 'Deposit Account ',
|
||||
'options' => $depositAccounts));
|
||||
echo $form->end('Perform Deposit');
|
||||
|
||||
/* End page div */
|
||||
echo '</div>' . "\n";
|
||||
@@ -1,53 +0,0 @@
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
echo '<H2>Deposit Slip: ' . date('l, F jS, Y, g:ia') . '</H2>' . "\n";
|
||||
|
||||
//pr(compact('deposit'));
|
||||
|
||||
// Handle account summaries
|
||||
$rows = array();
|
||||
$row_class = array();
|
||||
foreach ($deposit['ledgers'] AS $ledger) {
|
||||
$row_class[] = array();
|
||||
$rows[] = array($ledger['name'].':',
|
||||
FormatHelper::_n(count($ledger['entries']), 'Item'),
|
||||
FormatHelper::currency($ledger['total'], true));
|
||||
}
|
||||
$row_class[] = 'grand';
|
||||
$rows[] = array('Deposit Total:',
|
||||
null,
|
||||
FormatHelper::currency($deposit['total'], true));
|
||||
echo $this->element('table',
|
||||
array('class' => 'deposit-summary',
|
||||
'rows' => $rows,
|
||||
'row_class' => $row_class,
|
||||
'column_class' => array('account', 'quantity', 'total'),
|
||||
'suppress_alternate_rows' => true,
|
||||
));
|
||||
|
||||
|
||||
// Print out the items of each ledger
|
||||
foreach ($deposit['ledgers'] AS $ledger) {
|
||||
//echo ('Count: ' . count($ledger['entries']) . '<BR>');
|
||||
//pr($ledger['entries']);
|
||||
if (count($ledger['entries']) == 0)
|
||||
continue;
|
||||
|
||||
$rows = array();
|
||||
foreach ($ledger['entries'] AS $entry) {
|
||||
$rows[] = array($entry['Customer']['name'],
|
||||
$entry['MonetarySource']['name'],
|
||||
$entry['LedgerEntry']['amount']);
|
||||
}
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => 'item deposit-slip list',
|
||||
'caption' => $ledger['name'] . ' Items',
|
||||
'rows' => $rows,
|
||||
'headers' => array('Customer', 'Item', 'Amount'),
|
||||
'column_class' => array('customer', 'item', 'amount'),
|
||||
));
|
||||
}
|
||||
|
||||
/* End page div */
|
||||
//echo '</div>' . "\n";
|
||||
Reference in New Issue
Block a user