Added a balance column to customer. Like lease, since it's based on additional queries for stats, it's not sortable.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@176 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -122,6 +122,18 @@ class CustomersController extends AppController {
|
||||
return $count;
|
||||
}
|
||||
|
||||
function jqGridDataRecords(&$params, &$model, $query) {
|
||||
$customers = parent::jqGridDataRecords($params, $model, $query);
|
||||
|
||||
// Get the balance on each customer.
|
||||
foreach ($customers AS &$customer) {
|
||||
$stats = $this->Customer->stats($customer['Customer']['id']);
|
||||
$customer['Customer']['balance'] = $stats['balance'];
|
||||
}
|
||||
|
||||
return $customers;
|
||||
}
|
||||
|
||||
function jqGridRecordLinks(&$params, &$model, &$records, $links) {
|
||||
$links['Customer'] = array('name');
|
||||
return parent::jqGridRecordLinks($params, $model, $records, $links);
|
||||
|
||||
@@ -9,6 +9,7 @@ $cols['Name'] = array('index' => 'Customer.name', 'formatter
|
||||
$cols['Last Name'] = array('index' => 'PrimaryContact.last_name', 'formatter' => 'name');
|
||||
$cols['First Name'] = array('index' => 'PrimaryContact.first_name', 'formatter' => 'name');
|
||||
$cols['Leases'] = array('index' => 'lease_count', 'width' => '60');
|
||||
$cols['Balance'] = array('index' => 'balance', 'formatter' => 'currency', 'sortable' => false);
|
||||
$cols['Comment'] = array('index' => 'Customer.comment', 'formatter' => 'comment');
|
||||
|
||||
$jqGrid_options = array('jqGridColumns' => $cols,
|
||||
|
||||
Reference in New Issue
Block a user