More cleanup to hide ID from the user except where ID is intended to be the externally visible identification method (like transactions and ledger/statement entries).
git-svn-id: file:///svn-source/pmgr/branches/pre_0.1_work_20090819@737 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -97,17 +97,14 @@ class LedgersController extends AppController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function gridDataOrder(&$params, &$model, $index, $direction) {
|
function gridDataOrder(&$params, &$model, $index, $direction) {
|
||||||
$id_sequence = false;
|
|
||||||
if ($index === 'id_sequence') {
|
|
||||||
$id_sequence = true;
|
|
||||||
$index = 'Ledger.account_id';
|
|
||||||
}
|
|
||||||
|
|
||||||
$order = parent::gridDataOrder($params, $model, $index, $direction);
|
$order = parent::gridDataOrder($params, $model, $index, $direction);
|
||||||
|
|
||||||
if ($id_sequence) {
|
// After sorting by whatever the user wants, add these
|
||||||
$order[] = 'Ledger.sequence ' . $direction;
|
// defaults into the sort mechanism. If we're already
|
||||||
}
|
// sorting by one of them, it will only be redundant,
|
||||||
|
// and should cause no harm (possible a longer query?)
|
||||||
|
$order[] = 'Account.name ' . $direction;
|
||||||
|
$order[] = 'Ledger.sequence ' . $direction;
|
||||||
|
|
||||||
return $order;
|
return $order;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ class StatementEntriesController extends AppController {
|
|||||||
('Transaction' => array('fields' => array('id', 'type', 'stamp')),
|
('Transaction' => array('fields' => array('id', 'type', 'stamp')),
|
||||||
'Account' => array('id', 'name', 'type'),
|
'Account' => array('id', 'name', 'type'),
|
||||||
'Customer' => array('fields' => array('id', 'name')),
|
'Customer' => array('fields' => array('id', 'name')),
|
||||||
'Lease' => array('fields' => array('id')),
|
'Lease' => array('fields' => array('id', 'number')),
|
||||||
),
|
),
|
||||||
|
|
||||||
'conditions' => array(array('StatementEntry.id' => $id),
|
'conditions' => array(array('StatementEntry.id' => $id),
|
||||||
|
|||||||
@@ -16,7 +16,6 @@ if (isset($account['Account']))
|
|||||||
$account = $account['Account'];
|
$account = $account['Account'];
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$rows[] = array('ID', $account['id']);
|
|
||||||
$rows[] = array('Name', $account['name']);
|
$rows[] = array('Name', $account['name']);
|
||||||
$rows[] = array('Type', $account['type']);
|
$rows[] = array('Type', $account['type']);
|
||||||
$rows[] = array('External Name', $account['external_name']);
|
$rows[] = array('External Name', $account['external_name']);
|
||||||
|
|||||||
@@ -1,50 +1,17 @@
|
|||||||
<?php /* -*- mode:PHP -*- */
|
<?php /* -*- mode:PHP -*- */
|
||||||
|
|
||||||
echo '<div class="ledger-entry view">' . "\n";
|
echo '<div class="double-entry view">' . "\n";
|
||||||
|
|
||||||
// The two entry ids, debit and credit, are actually individual
|
// The two entries, debit and credit, are actually individual
|
||||||
// entries in separate accounts (each make up one of the two
|
// entries in separate accounts (each make up one of the two
|
||||||
// entries required for "double entry"). This, when we provide
|
// entries required for "double entry").
|
||||||
// reconcile information, we're really providing reconcile info
|
|
||||||
// for two independent accounts. The reconciling entries,
|
|
||||||
// therefore, are those on the opposite side of the ledger in
|
|
||||||
// each account. For example, assume this "double" entry is
|
|
||||||
//
|
|
||||||
// debit: A/R credit: Cash amount: 55
|
|
||||||
//
|
|
||||||
// Then, our accounts might look like:
|
|
||||||
//
|
|
||||||
// RENT TAX A/R CASH BANK
|
|
||||||
// ------- ------- ------- ------- -------
|
|
||||||
// |20 | 20| | | <-- Unrelated
|
|
||||||
// | | |20 20| | <-- Unrelated
|
|
||||||
// | | | | |
|
|
||||||
// |50 | 50| | | <-- Rent paid by this entry
|
|
||||||
// | |5 5| | | <-- Tax paid by this entry
|
|
||||||
// | | |55 55| | <-- THIS ENTRY
|
|
||||||
// | | | | |
|
|
||||||
// | | | |75 75| <-- Deposit includes this entry
|
|
||||||
// | | | | |
|
|
||||||
//
|
|
||||||
// In this case, we're looking to provide reconcile information
|
|
||||||
// of A/R for (the credit side of) this entry, and also of Cash
|
|
||||||
// (for the debit side). Taking the accounts as individual
|
|
||||||
// entries, instead of the "double entry" representation in the
|
|
||||||
// database, we're actually providing information on the two
|
|
||||||
// A/R entries, 50 & 5, which are both debits, i.e. opposite
|
|
||||||
// entries to the credit of A/R. The cash account entry
|
|
||||||
// reconciles against the credit of 75. Again, this is the
|
|
||||||
// opposite entry to the debit of Cash.
|
|
||||||
//
|
|
||||||
// Thus, for our debit_ledger_id, we're reconciling against
|
|
||||||
// credits, and for our credit_ledger_id, against debits.
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
**********************************************************************
|
**********************************************************************
|
||||||
* LedgerEntry Detail Main Section
|
* DoubleEntry Detail Main Section
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$transaction = $entry['Transaction'];
|
$transaction = $entry['Transaction'];
|
||||||
@@ -55,7 +22,6 @@ $entries = array('debit' => $entry['DebitEntry'],
|
|||||||
$entry = $entry['DoubleEntry'];
|
$entry = $entry['DoubleEntry'];
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$rows[] = array('ID', $entry['id']);
|
|
||||||
$rows[] = array('Transaction', $html->link('#'.$transaction['id'],
|
$rows[] = array('Transaction', $html->link('#'.$transaction['id'],
|
||||||
array('controller' => 'transactions',
|
array('controller' => 'transactions',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
@@ -64,41 +30,17 @@ $rows[] = array('Timestamp', FormatHelper::datetime($transaction['stamp']
|
|||||||
$rows[] = array('Comment', $entry['comment']);
|
$rows[] = array('Comment', $entry['comment']);
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => 'item ledger-entry detail',
|
array('class' => 'item double-entry detail',
|
||||||
'caption' => 'Double Ledger Entry Detail',
|
'caption' => 'Double Ledger Entry',
|
||||||
'rows' => $rows,
|
'rows' => $rows,
|
||||||
'column_class' => array('field', 'value')));
|
'column_class' => array('field', 'value')));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* LedgerEntry Info Box
|
* Debit/Credit Entries
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* echo '<div class="infobox">' . "\n"; */
|
|
||||||
/* foreach ($ledgers AS $type => $ledger) { */
|
|
||||||
/* //pr($ledger); */
|
|
||||||
/* if (!$ledger['Account']['trackable']) */
|
|
||||||
/* continue; */
|
|
||||||
|
|
||||||
/* $applied_caption = "Transfers applied"; */
|
|
||||||
/* $remaining_caption = "Unapplied amount"; */
|
|
||||||
|
|
||||||
/* $rows = array(); */
|
|
||||||
/* $rows[] = array($applied_caption, */
|
|
||||||
/* FormatHelper::currency($stats[$type]['amount_reconciled'])); */
|
|
||||||
/* $rows[] = array($remaining_caption, */
|
|
||||||
/* FormatHelper::currency($stats[$type]['amount_remaining'])); */
|
|
||||||
/* echo $this->element('table', */
|
|
||||||
/* array('class' => 'item summary', */
|
|
||||||
/* 'caption' => "{$ledger['Account']['name']} Ledger Entry", */
|
|
||||||
/* 'rows' => $rows, */
|
|
||||||
/* 'column_class' => array('field', 'value'), */
|
|
||||||
/* //'suppress_alternate_rows' => true, */
|
|
||||||
/* )); */
|
|
||||||
/* } */
|
|
||||||
|
|
||||||
/* echo '</div>' . "\n"; */
|
|
||||||
|
|
||||||
echo ('<DIV CLASS="ledger-double-entry">' . "\n");
|
echo ('<DIV CLASS="ledger-double-entry">' . "\n");
|
||||||
foreach ($ledgers AS $type => $ledger) {
|
foreach ($ledgers AS $type => $ledger) {
|
||||||
$rows = array();
|
$rows = array();
|
||||||
@@ -118,8 +60,7 @@ foreach ($ledgers AS $type => $ledger) {
|
|||||||
array('controller' => 'accounts',
|
array('controller' => 'accounts',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$ledger['Account']['id'])));
|
$ledger['Account']['id'])));
|
||||||
$rows[] = array('Ledger', $html->link('#' . $ledger['Account']['id']
|
$rows[] = array('Ledger', $html->link('#' . $ledger['sequence'],
|
||||||
. '-' . $ledger['sequence'],
|
|
||||||
array('controller' => 'ledgers',
|
array('controller' => 'ledgers',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$ledger['id'])));
|
$ledger['id'])));
|
||||||
@@ -128,7 +69,7 @@ foreach ($ledgers AS $type => $ledger) {
|
|||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => array('item', $type, 'detail'),
|
array('class' => array('item', $type, 'detail'),
|
||||||
'caption' => ucfirst($type) . ' Ledger Entry',
|
'caption' => ucfirst($type) . ' Entry',
|
||||||
'rows' => $rows,
|
'rows' => $rows,
|
||||||
'column_class' => array('field', 'value')));
|
'column_class' => array('field', 'value')));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,8 @@
|
|||||||
|
|
||||||
// Define the table columns
|
// Define the table columns
|
||||||
$cols = array();
|
$cols = array();
|
||||||
$cols['ID'] = array('index' => 'id_sequence', 'formatter' => 'id', 'hidden' => true);
|
|
||||||
$cols['Name'] = array('index' => 'Ledger.name', 'formatter' => 'name');
|
|
||||||
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'longname');
|
$cols['Account'] = array('index' => 'Account.name', 'formatter' => 'longname');
|
||||||
|
$cols['Sequence'] = array('index' => 'Ledger.sequence', 'formatter' => 'id');
|
||||||
$cols['Open Date'] = array('index' => 'PriorCloseTransaction.stamp', 'formatter' => 'date');
|
$cols['Open Date'] = array('index' => 'PriorCloseTransaction.stamp', 'formatter' => 'date');
|
||||||
$cols['Close Date'] = array('index' => 'CloseTransaction.stamp', 'formatter' => 'date');
|
$cols['Close Date'] = array('index' => 'CloseTransaction.stamp', 'formatter' => 'date');
|
||||||
$cols['Comment'] = array('index' => 'Ledger.comment', 'formatter' => 'comment');
|
$cols['Comment'] = array('index' => 'Ledger.comment', 'formatter' => 'comment');
|
||||||
@@ -16,8 +15,8 @@ $cols['Balance'] = array('index' => 'balance', 'formatter' => 'c
|
|||||||
// Render the grid
|
// Render the grid
|
||||||
$grid
|
$grid
|
||||||
->columns($cols)
|
->columns($cols)
|
||||||
->sortField('ID', 'ASC')
|
->sortField('Account')
|
||||||
->defaultFields(array('ID', 'Name', 'Account'))
|
->defaultFields(array('Account', 'Sequence'))
|
||||||
->searchFields(array('Account', 'Comment'))
|
->searchFields(array('Account', 'Comment'))
|
||||||
->render($this, isset($config) ? $config : null,
|
->render($this, isset($config) ? $config : null,
|
||||||
array_diff(array_keys($cols), array('Open Date', 'Comment')));
|
array_diff(array_keys($cols), array('Open Date', 'Comment')));
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ if (isset($lease['Lease']))
|
|||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
|
|
||||||
$rows[] = array('ID', $lease['id']);
|
|
||||||
$rows[] = array('Number', $lease['number']);
|
$rows[] = array('Number', $lease['number']);
|
||||||
$rows[] = array('Lease Type', $lease_type['name']);
|
$rows[] = array('Lease Type', $lease_type['name']);
|
||||||
$rows[] = array('Unit', $html->link($unit['name'],
|
$rows[] = array('Unit', $html->link($unit['name'],
|
||||||
|
|||||||
@@ -16,8 +16,6 @@ if (isset($ledger['Ledger']))
|
|||||||
$ledger = $ledger['Ledger'];
|
$ledger = $ledger['Ledger'];
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$rows[] = array('ID', $ledger['id']);
|
|
||||||
$rows[] = array('Name', $ledger['name']);
|
|
||||||
$rows[] = array('Account', $html->link($account['name'],
|
$rows[] = array('Account', $html->link($account['name'],
|
||||||
array('controller' => 'accounts',
|
array('controller' => 'accounts',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ $rows[] = array('Customer', (isset($customer['name'])
|
|||||||
$customer['id']))
|
$customer['id']))
|
||||||
: null));
|
: null));
|
||||||
$rows[] = array('Lease', (isset($lease['id'])
|
$rows[] = array('Lease', (isset($lease['id'])
|
||||||
? $html->link('#'.$lease['id'],
|
? $html->link('#'.$lease['number'],
|
||||||
array('controller' => 'leases',
|
array('controller' => 'leases',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$lease['id']))
|
$lease['id']))
|
||||||
|
|||||||
@@ -16,14 +16,13 @@ $transaction = $entry['Transaction'];
|
|||||||
$tender = $tender['Tender'];
|
$tender = $tender['Tender'];
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$rows[] = array('ID', $tender['id']);
|
$rows[] = array('Item', $tender['name']);
|
||||||
$rows[] = array('Received', FormatHelper::date($transaction['stamp']));
|
$rows[] = array('Received', FormatHelper::date($transaction['stamp']));
|
||||||
$rows[] = array('Customer', $html->link($customer['name'],
|
$rows[] = array('Customer', $html->link($customer['name'],
|
||||||
array('controller' => 'customers',
|
array('controller' => 'customers',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$customer['id'])));
|
$customer['id'])));
|
||||||
$rows[] = array('Amount', FormatHelper::currency($entry['amount']));
|
$rows[] = array('Amount', FormatHelper::currency($entry['amount']));
|
||||||
$rows[] = array('Item', $tender['name']);
|
|
||||||
$rows[] = array('Type', $ttype['name']);
|
$rows[] = array('Type', $ttype['name']);
|
||||||
/* $rows[] = array('Type', $html->link($ttype['name'], */
|
/* $rows[] = array('Type', $html->link($ttype['name'], */
|
||||||
/* array('controller' => 'tender_types', */
|
/* array('controller' => 'tender_types', */
|
||||||
|
|||||||
Reference in New Issue
Block a user