'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' => 'longenum'); $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['Received'] = 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']; if ((isset($action) && $action == 'unreconciled') || (isset($config) && isset($config['action']) && $config['action'] == 'unreconciled')) { if (isset($config) && !isset($config['grid_div_id'])) $config['grid_div_id'] = 'unpaid'; $include_columns = array('Entry', 'Date', 'Effective', 'Customer', 'Unit', 'Account', 'Amount', 'Received', 'Balance'); } else { $include_columns = array_diff(array_keys($cols), array('Transaction', 'Through', 'Lease', 'Amount', 'Received', 'Balance', 'Sub-Total', 'Comment')); } // Include custom data $grid->customData(compact('statement_entry_id')); // Render the grid $grid ->columns($cols) ->sortField('Date', 'DESC') ->defaultFields(array('Entry', 'Date', 'Charge', 'Payment')) ->searchFields(array('Customer', 'Unit')) ->render($this, isset($config) ? $config : null, $include_columns);