diff --git a/site/controllers/ledger_entries_controller.php b/site/controllers/ledger_entries_controller.php index cb370ad..25cd6f6 100644 --- a/site/controllers/ledger_entries_controller.php +++ b/site/controllers/ledger_entries_controller.php @@ -221,10 +221,10 @@ class LedgerEntriesController extends AppController { } function jqGridDataGroup(&$params, &$model) { - if (isset($params['custom']['notxgroup'])) - return parent::jqGridDataGroup($params, $model); + if (isset($params['custom']['group_by_tx']) && $params['custom']['group_by_tx']) + return $model->alias.'.transaction_id'; - return $model->alias.'.transaction_id'; + return parent::jqGridDataGroup($params, $model); } function jqGridDataOrder(&$params, &$model, $index, $direction) { diff --git a/site/views/accounts/view.ctp b/site/views/accounts/view.ctp index a041e52..fd17d41 100644 --- a/site/views/accounts/view.ctp +++ b/site/views/accounts/view.ctp @@ -70,6 +70,7 @@ echo $this->element('ledger_entries', array (// Element configuration 'ledger_id' => $account['CurrentLedger']['id'], 'account_type' => $account['Account']['type'], + 'group_by_tx' => true, // Grid configuration 'config' => array diff --git a/site/views/elements/ledger_entries.ctp b/site/views/elements/ledger_entries.ctp index a0a2bba..5770a1a 100644 --- a/site/views/elements/ledger_entries.ctp +++ b/site/views/elements/ledger_entries.ctp @@ -28,12 +28,37 @@ $cols['Applied'] = array('index' => "Reconciliation.amount", 'formatter' $cols['Sub-Total'] = array('index' => 'subtotal', 'formatter' => 'currency', 'sortable' => false); +// Since group_by_tx is a boolean, let's just get it +// defined, regardless of whether the caller did so. +// group_by_tx will cause all entry fields to be +// invalidated, and will leave only the transaction +// fields. Yes... the caller should just use the +// transactions element instead, in theory. However, +// it hasn't yet been implemented to the level of +// this element, and additionally, the transactions +// element will not allow for customer information +// (rightly so, since it's a ledger_entry field). +// However, at the current implementation, all ledger +// entries of a transaction are for the same customer. +// So... we allow it for now. +if (!isset($group_by_tx)) + $group_by_tx = false; + +if (isset($transaction_id) || isset($reconcile_id)) + $grid->invalidFields('Transaction'); + +if ($group_by_tx) + $grid->invalidFields('Entry'); + +if ($group_by_tx) + $grid->invalidFields(array('Effective', 'Through')); + if (isset($account_ftype) || isset($ledger_id) || isset($account_id) || isset($ar_account)) $grid->invalidFields(array('Debit Account', 'Credit Account')); else $grid->invalidFields('Account'); -if (isset($no_account)) +if (isset($no_account) || $group_by_tx) $grid->invalidFields(array('Account', 'Debit Account', 'Credit Account')); if (isset($ledger_id) || isset($account_id) || isset($ar_account)) @@ -41,10 +66,13 @@ if (isset($ledger_id) || isset($account_id) || isset($ar_account)) else $grid->invalidFields(array('Debit', 'Credit')); +// group_by_tx SHOULD wipe out Customer, but the reality +// is that it works good at the present, so we'll leave it. if (isset($lease_id) || isset($customer_id)) - $grid->invalidFields(array('Customer', 'Lease', 'Unit')) - // Invoice/Receipt accounts don't use effective/through - ->invalidFields(array('Effective', 'Through')); + $grid->invalidFields(array('Customer')) + +if (isset($lease_id) || $group_by_tx) + $grid->invalidFields(array('Lease', 'Unit')) if (!isset($reconcile_id)) $grid->invalidFields('Applied'); @@ -59,7 +87,7 @@ if (!isset($config['rows'])) { } if (isset($reconcile_id)) { - $grid->customData(compact('reconcile_id'))->limit(5); + $grid->customData(compact('reconcile_id'))->limit(20); } // Set up search fields if requested by caller @@ -69,7 +97,7 @@ if (isset($searchfields)) // Include custom data $grid->customData(compact('ledger_id', 'account_id', 'ar_account', 'account_type', 'account_ftype', - 'customer_id', 'lease_id', 'transaction_id', 'notxgroup')); + 'customer_id', 'lease_id', 'transaction_id', 'group_by_tx')); // Render the grid $grid diff --git a/site/views/ledgers/view.ctp b/site/views/ledgers/view.ctp index de10d73..aa3c27f 100644 --- a/site/views/ledgers/view.ctp +++ b/site/views/ledgers/view.ctp @@ -67,6 +67,7 @@ echo $this->element('ledger_entries', array (// Element configuration 'ledger_id' => $ledger['id'], 'account_type' => $account['type'], + 'group_by_tx' => true, // Grid configuration 'config' => array diff --git a/site/views/transactions/view.ctp b/site/views/transactions/view.ctp index 081138d..5c6f02a 100644 --- a/site/views/transactions/view.ctp +++ b/site/views/transactions/view.ctp @@ -54,7 +54,11 @@ echo '