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:
abijah
2009-06-22 17:58:13 +00:00
parent 3953e1dbf3
commit e00e10bbb5
2 changed files with 13 additions and 0 deletions

View File

@@ -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);

View File

@@ -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,