'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['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['Account'] = array('index' => 'Account.name', 'formatter' => 'name'); $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'); // 'balance' is already in use as part of charge/disbursement/balance. // 'unapplied' isn't quite the right term, but it's not customer visible. $cols['Balance'] = array('index' => "unapplied", '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')));