Making progress. Much still to do, but there are hints of functionality finally returning so I'm snapshotting.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@360 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -62,7 +62,7 @@ echo $this->element('contacts', array
|
||||
*/
|
||||
|
||||
echo $this->element('leases', array
|
||||
('customer_id' => $customer['id'],
|
||||
('customer_id' => $customer['Customer']['id'],
|
||||
|
||||
'config' => array
|
||||
('caption' => 'Lease History',
|
||||
|
||||
@@ -16,6 +16,9 @@ $cols['Comment'] = array('index' => 'Customer.comment', 'formatter
|
||||
if (isset($searchfields))
|
||||
$grid->searchFields(array('Last Name', 'First Name'));
|
||||
|
||||
// Include custom data
|
||||
//$grid->customData(compact('lease_id'));
|
||||
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
|
||||
@@ -18,9 +18,12 @@ $cols['Comment'] = array('index' => 'Lease.comment', 'formatter' => 'com
|
||||
if (isset($searchfields))
|
||||
$grid->searchFields(array('Customer', 'Unit'));
|
||||
|
||||
if (isset($no_customer))
|
||||
if (isset($customer_id))
|
||||
$grid->invalidFields('Customer');
|
||||
|
||||
// Include custom data
|
||||
$grid->customData(compact('customer_id'));
|
||||
|
||||
// Render the grid
|
||||
$grid
|
||||
->columns($cols)
|
||||
|
||||
79
views/elements/statement_entries.ctp
Normal file
79
views/elements/statement_entries.ctp
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
// Define the table columns
|
||||
$cols = array();
|
||||
$cols['Transaction'] = array('index' => 'Transaction.id', 'formatter' => 'id');
|
||||
$cols['StatementEntry'] = 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' => 'name');
|
||||
|
||||
$cols['Comment'] = array('index' => 'StatementEntry.comment', 'formatter' => 'comment', 'width'=>150);
|
||||
|
||||
$cols['Charge'] = array('index' => 'charge', 'formatter' => 'currency');
|
||||
$cols['Payment'] = array('index' => 'payment', 'formatter' => 'currency');
|
||||
|
||||
$cols['Last Payment'] = array('index' => 'last_paid', 'formatter' => 'date');
|
||||
$cols['Applied'] = array('index' => "applied", 'formatter' => 'currency');
|
||||
$cols['Sub-Total'] = array('index' => 'subtotal-StatementEntry.amount', 'formatter' => 'currency', 'sortable' => false);
|
||||
|
||||
|
||||
if (isset($transaction_id))
|
||||
$grid->invalidFields('Transaction');
|
||||
|
||||
if (!isset($collected_account_id))
|
||||
$grid->invalidFields('Last Payment');
|
||||
|
||||
if (isset($ledger_id) || isset($account_id))
|
||||
$grid->invalidFields(array('Account'));
|
||||
|
||||
if (isset($lease_id) || isset($customer_id))
|
||||
$grid->invalidFields(array('Customer'));
|
||||
|
||||
if (isset($lease_id))
|
||||
$grid->invalidFields(array('Lease', 'Unit'));
|
||||
|
||||
if (!isset($statement_entry_id))
|
||||
$grid->invalidFields('Applied');
|
||||
else
|
||||
$cols['Sub-Total']['index'] = 'subtotal-applied';
|
||||
|
||||
$grid->invalidFields('Sub-Total');
|
||||
$grid->invalidFields('Applied');
|
||||
|
||||
|
||||
// Now that columns are defined, establish basic grid parameters
|
||||
$grid
|
||||
->columns($cols)
|
||||
->sortField('Date')
|
||||
->defaultFields(array('Entry', 'Date', 'Amount', 'Credit', 'Debit'));
|
||||
|
||||
|
||||
/* // Set up search fields if requested by caller */
|
||||
/* if (isset($searchfields)) */
|
||||
/* $grid->searchFields(array('Customer', 'Unit')); */
|
||||
|
||||
|
||||
// Include custom data
|
||||
$grid->customData(compact('transaction_id', 'account_id', 'customer_id', 'lease_id',
|
||||
'statement_entry_id', 'from_date', 'through_date',
|
||||
'payment_accounts', 'charge_accounts'));
|
||||
|
||||
// Render the grid
|
||||
$grid
|
||||
->render($this, isset($config) ? $config : null,
|
||||
array('Transaction', 'StatementEntry', 'Date', 'Effective', 'Last Payment',
|
||||
'Account',
|
||||
'Customer', 'Unit',
|
||||
'Comment',
|
||||
'Charge', 'Payment', 'Amount',
|
||||
'Applied', 'Sub-Total')
|
||||
);
|
||||
|
||||
@@ -79,11 +79,9 @@ echo '<div CLASS="detail supporting">' . "\n";
|
||||
* Lease Account History
|
||||
*/
|
||||
|
||||
echo $this->element('entries', array
|
||||
echo $this->element('ledger_entries', array
|
||||
(// Element configuration
|
||||
'lease_id' => $lease['id'],
|
||||
//'charge_payment' => true,
|
||||
//'entry_type' => array('CHARGE', 'PAYMENT'),
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
|
||||
114
views/statement_entries/view.ctp
Normal file
114
views/statement_entries/view.ctp
Normal file
@@ -0,0 +1,114 @@
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
echo '<div class="statement-entry view">' . "\n";
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
* Entry Detail Main Section
|
||||
*/
|
||||
|
||||
$transaction = $entry['Transaction'];
|
||||
$account = $entry['Account'];
|
||||
$customer = $entry['Customer'];
|
||||
$lease = $entry['Lease'];
|
||||
$entry = $entry['StatementEntry'];
|
||||
|
||||
$rows = array();
|
||||
$rows[] = array('ID', $entry['id']);
|
||||
$rows[] = array('Transaction', $html->link('#'.$transaction['id'],
|
||||
array('controller' => 'transactions',
|
||||
'action' => 'view',
|
||||
$transaction['id'])));
|
||||
$rows[] = array('Timestamp', FormatHelper::datetime($transaction['stamp']));
|
||||
$rows[] = array('Effective', FormatHelper::date($entry['effective_date']));
|
||||
$rows[] = array('Through', FormatHelper::date($entry['through_date']));
|
||||
$rows[] = array('Type', $entry['type']);
|
||||
$rows[] = array('Amount', FormatHelper::currency($entry['amount']));
|
||||
$rows[] = array('Account', $html->link($account['name'],
|
||||
array('controller' => 'accounts',
|
||||
'action' => 'view',
|
||||
$account['id'])));
|
||||
$rows[] = array('Customer', (isset($customer['name'])
|
||||
? $html->link($customer['name'],
|
||||
array('controller' => 'customers',
|
||||
'action' => 'view',
|
||||
$customer['id']))
|
||||
: null));
|
||||
$rows[] = array('Lease', (isset($lease['id'])
|
||||
? $html->link('#'.$lease['id'],
|
||||
array('controller' => 'leases',
|
||||
'action' => 'view',
|
||||
$lease['id']))
|
||||
: null));
|
||||
$rows[] = array('Comment', $entry['comment']);
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => 'item statement-entry detail',
|
||||
'caption' => 'Statement Entry Detail',
|
||||
'rows' => $rows,
|
||||
'column_class' => array('field', 'value')));
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Entry Info Box
|
||||
*/
|
||||
|
||||
echo '<div class="infobox">' . "\n";
|
||||
|
||||
$applied_caption = "Applied";
|
||||
$remaining_caption = "Balance";
|
||||
|
||||
$rows = array();
|
||||
$rows[] = array($applied_caption,
|
||||
'<SPAN id="statement-entry-applied">' .
|
||||
FormatHelper::currency($stats['reconciled']) .
|
||||
'</SPAN>');
|
||||
$rows[] = array($remaining_caption,
|
||||
'<SPAN id="statement-entry-balance">' .
|
||||
FormatHelper::currency($stats['balance']) .
|
||||
'</SPAN>');
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => 'item summary',
|
||||
'caption' => null,
|
||||
'rows' => $rows,
|
||||
'column_class' => array('field', 'value'),
|
||||
//'suppress_alternate_rows' => true,
|
||||
));
|
||||
|
||||
echo '</div>' . "\n";
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
* Supporting Elements Section
|
||||
*/
|
||||
|
||||
echo '<div CLASS="detail supporting">' . "\n";
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
* Reconciliation Ledger Entries
|
||||
*/
|
||||
|
||||
echo $this->element('statement_entries', array
|
||||
(// Element configuration
|
||||
'statement_entry_id' => $entry['id'],
|
||||
/* 'action' => 'reconcile', */
|
||||
|
||||
// Grid configuration
|
||||
'config' => array
|
||||
('caption' => 'Entries Applied',
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
/* End "detail supporting" div */
|
||||
echo '</div>' . "\n";
|
||||
|
||||
/* End page div */
|
||||
echo '</div>' . "\n";
|
||||
Reference in New Issue
Block a user