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:
abijah
2009-07-29 08:55:09 +00:00
parent 3128880c4d
commit cdf6ce86e3
10 changed files with 318 additions and 174 deletions

View File

@@ -5,14 +5,16 @@ $cols = array();
//$cols['ID'] = array('index' => 'Tender.id', 'formatter' => 'id');
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
$cols['Name'] = array('index' => 'Tender.name', 'formatter' => 'longname');
$cols['Type'] = array('index' => 'TenderType.name', 'formatter' => 'name');
$cols['Comment'] = array('index' => 'Tender.comment', 'formatter' => 'comment');
$cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency');
$cols['Sub-Total'] = array('index' => 'subtotal-LedgerEntry.amount', 'formatter' => 'currency');
// Render the grid
$grid
->columns($cols)
->sortField('Date')
->defaultFields(array('Date', 'Name', 'Amount'))
->searchFields(array('Name'))
->searchFields(array('Name', 'Type'))
->render($this, isset($config) ? $config : null,
array_diff(array_keys($cols), array()));
array_diff(array_keys($cols), array('Sub-Total')));

View File

@@ -1,48 +1,48 @@
<?php /* -*- mode:PHP -*- */
echo '<div class="account deposit">' . "\n";
echo '<div class="tender 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'));
//pr(compact('depositTypes', 'depositAccounts'));
echo $form->create(null, array('id' => 'deposit-form',
'url' => array('controller' => 'accounts',
'action' => 'deposit')));
'url' => array(//'controller' => 'accounts',
'action' => 'deposit_slip')));
foreach ($paymentAccounts AS $acct) {
foreach ($depositTypes AS $type) {
//$acct = $acct['Account'];
echo "\n";
echo $form->input("Tillable.Ledger.{$acct['id']}.checked",
array(//'label' => $acct['name'],
echo $form->input("TenderType.{$type['id']}.checked",
array(//'label' => $type['name'],
'type' => 'checkbox',
'checked' => true,
'value' => true,
'label' => (" I have exactly " .
FormatHelper::currency($acct['stats']['Ledger']['balance']) .
" in " . Inflector::pluralize($acct['name']) .
FormatHelper::currency($type['stats']['undeposited']) .
" in " . Inflector::pluralize($type['name']) .
" and will be depositing it all.")
));
echo "\n";
echo $form->input("Tillable.Ledger.{$acct['id']}.amount",
echo $form->input("TenderType.{$type['id']}.amount",
array('type' => 'hidden',
'value' => $acct['stats']['Ledger']['balance'],
'value' => $type['stats']['undeposited'],
));
echo "\n";
echo $form->input("Tillable.Ledger.{$acct['id']}.account_id",
echo $form->input("TenderType.{$type['id']}.id",
array('type' => 'hidden',
'value' => $acct['id'],
'value' => $type['id'],
));
echo "\n";
echo $form->input("Tillable.Ledger.{$acct['id']}.account_name",
echo $form->input("TenderType.{$type['id']}.name",
array('type' => 'hidden',
'value' => $acct['name'],
'value' => $type['name'],
));
echo "\n";
$grid_div_id = "tenders-{$acct['id']}-list";
$grid_div_id = "tenders-{$type['id']}-list";
echo $this->element('tenders', array
(// Grid configuration
'config' => array
@@ -50,10 +50,10 @@ foreach ($paymentAccounts AS $acct) {
'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>'),
' return false;">Items in '.$type['name'].' Ledger</A>'),
'filter' => array('Tender.deposit_transaction_id' => null,
'LedgerEntry.account_id' => $acct['id']),
'exclude' => array(/*'Account'*/),
'Tender.tender_type_id' => $type['id']),
'exclude' => array('Type'),
),
));
}

View File

@@ -7,11 +7,11 @@ echo '<H2>Deposit Slip: ' . date('l, F jS, Y, g:ia') . '</H2>' . "\n";
// Handle account summaries
$rows = array();
$row_class = array();
foreach ($deposit['ledgers'] AS $ledger) {
foreach ($deposit['types'] AS $type) {
$row_class[] = array();
$rows[] = array($ledger['name'].':',
FormatHelper::_n(count($ledger['entries']), 'Item'),
FormatHelper::currency($ledger['total'], true));
$rows[] = array($type['name'].':',
FormatHelper::_n(count($type['entries']), 'Item'),
FormatHelper::currency($type['total'], true));
}
$row_class[] = 'grand';
$rows[] = array('Deposit Total:',
@@ -27,22 +27,20 @@ echo $this->element('table',
// 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)
foreach ($deposit['types'] AS $type) {
if (count($type['entries']) == 0)
continue;
$rows = array();
foreach ($ledger['entries'] AS $entry) {
$rows[] = array($entry['Customer']['name'],
$entry['MonetarySource']['name'],
$entry['LedgerEntry']['amount']);
foreach ($type['entries'] AS $entry) {
$rows[] = array($entry['customer'],
$entry['name'],
$entry['amount']);
}
echo $this->element('table',
array('class' => 'item deposit-slip list',
'caption' => $ledger['name'] . ' Items',
'caption' => $type['name'] . ' Items',
'rows' => $rows,
'headers' => array('Customer', 'Item', 'Amount'),
'column_class' => array('customer', 'item', 'amount'),

View File

@@ -25,6 +25,15 @@ for ($i=1; $i<=4; ++$i)
if (!empty($ttype["data{$i}_name"]))
$rows[] = array($ttype["data{$i}_name"], $tender["data{$i}"]);
$rows[] = array('Deposit', $html->link('#'.$tender['deposit_transaction_id'],
array('controller' => 'transactions',
'action' => 'view',
$tender['deposit_transaction_id'])));
if (!empty($tender['nsf_transaction_id']))
$rows[] = array('NSF', $html->link('#'.$tender['nsf_transaction_id'],
array('controller' => 'transactions',
'action' => 'view',
$tender['nsf_transaction_id'])));
$rows[] = array('Comment', $tender['comment']);
echo $this->element('table',

View File

@@ -67,14 +67,16 @@ echo '<div CLASS="detail supporting">' . "\n";
* Statement Entries
*/
echo $this->element('statement_entries', array
(// Grid configuration
'config' => array
(
'caption' => 'Statement Entries',
'filter' => array('transaction_id' => $transaction['id']),
'exclude' => array('Transaction'),
)));
if ($transaction['type'] === 'INVOICE' || $transaction['type'] === 'RECEIPT') {
echo $this->element('statement_entries', array
(// Grid configuration
'config' => array
(
'caption' => 'Statement Entries',
'filter' => array('transaction_id' => $transaction['id']),
'exclude' => array('Transaction'),
)));
}
/**********************************************************************