Quick and dirty hack to get double entries to show again.
git-svn-id: file:///svn-source/pmgr/branches/surplus_account_20090815@571 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -36,6 +36,28 @@ class DoubleEntriesController extends AppController {
|
|||||||
'conditions' => array('DoubleEntry.id' => $id),
|
'conditions' => array('DoubleEntry.id' => $id),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$entry += $this->DoubleEntry->DebitEntry->Transaction->find
|
||||||
|
('first',
|
||||||
|
array('contain' => false,
|
||||||
|
'conditions' => array('id' => $entry['DebitEntry']['transaction_id']),
|
||||||
|
));
|
||||||
|
|
||||||
|
$entry += $this->DoubleEntry->DebitEntry->find
|
||||||
|
('first',
|
||||||
|
array('contain' => array('Ledger' => array('Account')),
|
||||||
|
'conditions' => array('DebitEntry.id' => $entry['DebitEntry']['id']),
|
||||||
|
));
|
||||||
|
$entry['DebitLedger'] = $entry['Ledger'];
|
||||||
|
unset($entry['Ledger']);
|
||||||
|
|
||||||
|
$entry += $this->DoubleEntry->CreditEntry->find
|
||||||
|
('first',
|
||||||
|
array('contain' => array('Ledger' => array('Account')),
|
||||||
|
'conditions' => array('CreditEntry.id' => $entry['CreditEntry']['id']),
|
||||||
|
));
|
||||||
|
$entry['CreditLedger'] = $entry['Ledger'];
|
||||||
|
unset($entry['Ledger']);
|
||||||
|
|
||||||
// Prepare to render.
|
// Prepare to render.
|
||||||
$title = "Double Ledger Entry #{$entry['DoubleEntry']['id']}";
|
$title = "Double Ledger Entry #{$entry['DoubleEntry']['id']}";
|
||||||
$this->set(compact('entry', 'title'));
|
$this->set(compact('entry', 'title'));
|
||||||
|
|||||||
@@ -168,6 +168,9 @@ class LedgerEntriesController extends AppController {
|
|||||||
array('fields' => array('id', 'name'),
|
array('fields' => array('id', 'name'),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
'DebitDoubleEntry' => array('id'),
|
||||||
|
'CreditDoubleEntry' => array('id'),
|
||||||
|
|
||||||
'DebitEntry' => array('fields' => array('id', 'crdr')),
|
'DebitEntry' => array('fields' => array('id', 'crdr')),
|
||||||
'CreditEntry' => array('fields' => array('id', 'crdr')),
|
'CreditEntry' => array('fields' => array('id', 'crdr')),
|
||||||
),
|
),
|
||||||
@@ -194,6 +197,11 @@ class LedgerEntriesController extends AppController {
|
|||||||
else
|
else
|
||||||
$entry['MatchingEntry'] = $entry['DebitEntry'][0];
|
$entry['MatchingEntry'] = $entry['DebitEntry'][0];
|
||||||
|
|
||||||
|
if (empty($entry['DebitDoubleEntry']))
|
||||||
|
$entry['DoubleEntry'] = $entry['CreditDoubleEntry'];
|
||||||
|
else
|
||||||
|
$entry['DoubleEntry'] = $entry['DebitDoubleEntry'];
|
||||||
|
|
||||||
// Prepare to render.
|
// Prepare to render.
|
||||||
$title = "Ledger Entry #{$entry['LedgerEntry']['id']}";
|
$title = "Ledger Entry #{$entry['LedgerEntry']['id']}";
|
||||||
$this->set(compact('entry', 'title'));
|
$this->set(compact('entry', 'title'));
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ $ledgers = array('debit' => $entry['DebitLedger'],
|
|||||||
'credit' => $entry['CreditLedger']);
|
'credit' => $entry['CreditLedger']);
|
||||||
$entries = array('debit' => $entry['DebitEntry'],
|
$entries = array('debit' => $entry['DebitEntry'],
|
||||||
'credit' => $entry['CreditEntry']);
|
'credit' => $entry['CreditEntry']);
|
||||||
$customer = $entry['Customer'];
|
|
||||||
$lease = $entry['Lease'];
|
|
||||||
$entry = $entry['DoubleEntry'];
|
$entry = $entry['DoubleEntry'];
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
@@ -63,21 +61,7 @@ $rows[] = array('Transaction', $html->link('#'.$transaction['id'],
|
|||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$transaction['id'])));
|
$transaction['id'])));
|
||||||
$rows[] = array('Timestamp', FormatHelper::datetime($transaction['stamp']));
|
$rows[] = array('Timestamp', FormatHelper::datetime($transaction['stamp']));
|
||||||
$rows[] = array('Effective', FormatHelper::date($entry['effective_date']));
|
$rows[] = array('Comment', $entry['comment']);
|
||||||
//$rows[] = array('Through', FormatHelper::date($entry['through_date']));
|
|
||||||
$rows[] = array('Customer', (isset($customer['name'])
|
|
||||||
? $html->link($customer['name'],
|
|
||||||
array('controller' => 'customers',
|
|
||||||
'action' => 'view',
|
|
||||||
$customer['id']))
|
|
||||||
: null));
|
|
||||||
$rows[] = array('Lease', (isset($lease['id'])
|
|
||||||
? $html->link('#'.$lease['id'],
|
|
||||||
array('controller' => 'leases',
|
|
||||||
'action' => 'view',
|
|
||||||
$lease['id']))
|
|
||||||
: null));
|
|
||||||
$rows[] = array('Comment', $entry['comment']);
|
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => 'item ledger-entry detail',
|
array('class' => 'item ledger-entry detail',
|
||||||
@@ -132,8 +116,8 @@ foreach ($ledgers AS $type => $ledger) {
|
|||||||
array('controller' => 'ledgers',
|
array('controller' => 'ledgers',
|
||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$ledger['id'])));
|
$ledger['id'])));
|
||||||
$rows[] = array('Amount', FormatHelper::currency($entry['amount']));
|
$rows[] = array('Amount', FormatHelper::currency($entries[$type]['amount']));
|
||||||
$rows[] = array('Effect', $ledger['Account']['ftype'] == $type ? 'INCREASE' : 'DECREASE');
|
//$rows[] = array('Effect', $ledger['Account']['ftype'] == $type ? 'INCREASE' : 'DECREASE');
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
array('class' => array('item', $type, 'detail'),
|
array('class' => array('item', $type, 'detail'),
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ $ledger = $entry['Ledger'];
|
|||||||
$account = $ledger['Account'];
|
$account = $ledger['Account'];
|
||||||
$tender = $entry['Tender'];
|
$tender = $entry['Tender'];
|
||||||
$matching = $entry['MatchingEntry'];
|
$matching = $entry['MatchingEntry'];
|
||||||
|
$double = $entry['DoubleEntry'];
|
||||||
$entry = $entry['LedgerEntry'];
|
$entry = $entry['LedgerEntry'];
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
@@ -43,6 +44,10 @@ $rows[] = array('Cr/Dr', ($entry['crdr'] .
|
|||||||
'action' => 'view',
|
'action' => 'view',
|
||||||
$matching['id'])) .
|
$matching['id'])) .
|
||||||
')'));
|
')'));
|
||||||
|
$rows[] = array('Double Entry', $html->link('#'.$double['id'],
|
||||||
|
array('controller' => 'double_entries',
|
||||||
|
'action' => 'view',
|
||||||
|
$double['id'])));
|
||||||
$rows[] = array('Comment', $entry['comment']);
|
$rows[] = array('Comment', $entry['comment']);
|
||||||
|
|
||||||
echo $this->element('table',
|
echo $this->element('table',
|
||||||
|
|||||||
Reference in New Issue
Block a user