'Transaction.id', 'formatter' => 'id'); $cols['Entry'] = array('index' => 'LedgerEntry.id', 'formatter' => 'id'); $cols['Date'] = array('index' => 'Transaction.stamp', 'formatter' => 'date'); if (isset($account_ftype) || isset($ledger_id)) { $cols['Account'] = array('index' => 'Account.name', 'formatter' => 'longname'); } else { $cols['Debit Account'] = array('index' => 'DebitAccount.name', 'formatter' => 'longname'); $cols['Credit Account'] = array('index' => 'CreditAccount.name', 'formatter' => 'longname'); } $cols['Source'] = array('index' => 'MonetarySource.name', 'formatter' => 'name'); $cols['Comment'] = array('index' => 'LedgerEntry.comment', 'formatter' => 'comment', 'width'=>150); if (isset($ledger_id)) { $cols['Debit'] = array('index' => 'debit', 'formatter' => 'currency'); $cols['Credit'] = array('index' => 'credit', 'formatter' => 'currency'); } else { $cols['Amount'] = array('index' => 'LedgerEntry.amount', 'formatter' => 'currency'); } if (isset($reconcile_id)) { $cols['Applied'] = array('index' => "Reconciliation.amount", 'formatter' => 'currency'); } $custom_post_data = compact('ledger_id', 'account_type', 'account_ftype'); $jqGrid_options = array('jqGridColumns' => $cols, 'controller' => 'ledger_entries', ); $jqGrid_options += compact('grid_div_id', 'grid_id', 'caption', 'grid_setup', 'limit'); if (isset($ledger_id)) { $jqGrid_options += array('action' => 'ledger', 'limit' => 50); } if (isset($ledger_entries)) { $jqGrid_options += array('custom_ids' => array_map(create_function('$data', 'return $data["id"];'), $ledger_entries), 'limit' => 10); } if (isset($reconcile_id)) { $custom_post_data += compact('reconcile_id'); $jqGrid_options += array('limit' => 5); } $jqGrid_options += compact('custom_post_data'); echo $this->element('jqGrid', $jqGrid_options);