Primarly a cleanup checkin, although a couple minor bugfixes were included as well.
git-svn-id: file:///svn-source/pmgr/branches/ledger_transactions_20090605/site@82 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -8,12 +8,16 @@ class LedgersController extends AppController {
|
||||
'Account',
|
||||
'LedgerEntry' =>
|
||||
array('fields' =>
|
||||
array('SUM(IF(LedgerEntry.debit_ledger_id = Ledger.id, LedgerEntry.amount, 0)) AS debits',
|
||||
'SUM(IF(LedgerEntry.credit_ledger_id = Ledger.id, LedgerEntry.amount, 0)) AS credits',
|
||||
"SUM(IF(Account.type IN ('ASSET', 'EXPENSE'),
|
||||
IF(LedgerEntry.debit_ledger_id = Ledger.id, 1, -1),
|
||||
IF(LedgerEntry.credit_ledger_id = Ledger.id, 1, -1)) * LedgerEntry.amount) AS balance",
|
||||
'COUNT(LedgerEntry.id) AS entries'),
|
||||
array('SUM(IF(LedgerEntry.debit_ledger_id = Ledger.id,
|
||||
LedgerEntry.amount, NULL)) AS debits',
|
||||
'SUM(IF(LedgerEntry.credit_ledger_id = Ledger.id,
|
||||
LedgerEntry.amount, NULL)) AS credits',
|
||||
"SUM(IF(Account.type IN ('ASSET', 'EXPENSE'),
|
||||
IF(LedgerEntry.debit_ledger_id = Ledger.id, 1, -1),
|
||||
IF(LedgerEntry.credit_ledger_id = Ledger.id, 1, -1)
|
||||
) * IF(LedgerEntry.amount, LedgerEntry.amount, 0)
|
||||
) AS balance",
|
||||
'COUNT(LedgerEntry.id) AS entries'),
|
||||
'conditions' =>
|
||||
array('OR' =>
|
||||
array('LedgerEntry.debit_ledger_id = Ledger.id',
|
||||
@@ -23,7 +27,7 @@ class LedgersController extends AppController {
|
||||
),
|
||||
|
||||
'group' => 'Ledger.id',
|
||||
'order' => array('Ledger.name' => 'ASC'));
|
||||
'order' => array('Ledger.account_id', 'Ledger.sequence'));
|
||||
|
||||
var $sidemenu_links =
|
||||
array(array('name' => 'Ledgers', 'header' => true),
|
||||
@@ -130,13 +134,6 @@ class LedgersController extends AppController {
|
||||
$ledger['LedgerEntry'] = $this->Ledger->findLedgerEntries
|
||||
($id, $ledger['Account']['type']);
|
||||
|
||||
/* $ledger['LedgerEntry'] = $this->Ledger->LedgerEntry->findInLedgerContext */
|
||||
/* ($id,
|
||||
/* $ledger['LedgerEntry'] = $this->Ledger->findLedgerEntries */
|
||||
/* ($id); */
|
||||
//($id, $ledger['Account']['type']);
|
||||
|
||||
|
||||
// Summarize the entries, and obtain the ledger balance
|
||||
$ledger['Ledger'] =
|
||||
array_merge($ledger['Ledger'],
|
||||
|
||||
Reference in New Issue
Block a user