Files
pmgr/site/views/elements/statement_entries.ctp
abijah f82df229f2 Modified the statement entries grid, as well as the underlying controller, to support a couple new fields, 'applied' and 'balance'.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716@532 97e9348a-65ac-dc4b-aefc-98561f571b83
2009-08-11 07:27:56 +00:00

48 lines
2.3 KiB
PHP

<?php /* -*- mode:PHP -*- */
// Define the table columns
$cols = array();
$cols['Transaction'] = array('index' => 'Transaction.id', 'formatter' => 'id');
$cols['Entry'] = array('index' => 'StatementEntry.id', 'formatter' => 'id');
$cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date');
$cols['Effective'] = array('index' => 'StatementEntry.effective_date', 'formatter' => 'date');
$cols['Through'] = array('index' => 'StatementEntry.through_date', 'formatter' => 'date');
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'name');
$cols['Customer'] = array('index' => 'Customer.name', 'formatter' => 'longname');
$cols['Lease'] = array('index' => 'Lease.number', 'formatter' => 'id');
$cols['Unit'] = array('index' => 'Unit.name', 'formatter' => 'shortname');
$cols['Comment'] = array('index' => 'StatementEntry.comment', 'formatter' => 'comment', 'width'=>150);
$cols['Type'] = array('index' => 'StatementEntry.type', 'formatter' => 'enum', 'width'=>120);
$cols['Debit'] = array('index' => 'charge', 'formatter' => 'currency');
$cols['Credit'] = array('index' => 'disbursement', 'formatter' => 'currency');
$cols['Amount'] = array('index' => "StatementEntry.amount", 'formatter' => 'currency');
$cols['Applied'] = array('index' => "applied", 'formatter' => 'currency');
$cols['Balance'] = array('index' => "balance", 'formatter' => 'currency');
$cols['Sub-Total'] = array('index' => 'subtotal-balance', 'formatter' => 'currency', 'sortable' => false);
if (isset($subtotal_column))
$cols['Sub-Total']['index'] =
'subtotal-' . $cols[$subtotal_column]['index'];
// Include custom data
$grid->customData(compact('statement_entry_id'));
// Render the grid
$grid
->columns($cols)
->sortField('Date')
->defaultFields(array('Entry', 'Date', 'Charge', 'Payment'))
->searchFields(array('Customer', 'Unit'))
->render($this, isset($config) ? $config : null,
array_diff(array_keys($cols), array('Through', 'Lease',
'Amount', 'Applied', 'Balance', 'Sub-Total',
'Comment')));