Many, many changes, and yet still much to do. Many things are working, but certainly nothing beyond simply data retrieval (no editing or adding of any data). Also, some work is still required to ensure the grids have the right columns; we can strip out certain columns for some views (such as removing customer from the leases grid of the customer view... completely redundant). And of course, there are still many bugs and lots to clean up.
git-svn-id: file:///svn-source/pmgr/branches/yafr_20090716/site@368 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -110,7 +110,7 @@ class Ledger extends AppModel {
|
||||
* entries are a debit, or a credit, and also the effect each have
|
||||
* on the overall balance of the ledger.
|
||||
*/
|
||||
function debitCreditFields($sum = false, $entry_name = 'Entry', $account_name = 'Account') {
|
||||
function debitCreditFields($sum = false, $entry_name = 'LedgerEntry', $account_name = 'Account') {
|
||||
return $this->LedgerEntry->debitCreditFields
|
||||
($sum, $entry_name, $account_name);
|
||||
}
|
||||
@@ -128,7 +128,7 @@ class Ledger extends AppModel {
|
||||
|
||||
$entries = $this->LedgerEntry->find
|
||||
('all', array
|
||||
('contain' => array('Ledger' => array('Account')),
|
||||
('link' => array('Ledger' => array('Account')),
|
||||
'fields' => array_merge(array("LedgerEntry.*"),
|
||||
$this->LedgerEntry->debitCreditFields()),
|
||||
'conditions' => array('LedgerEntry.ledger_id' => $ids),
|
||||
@@ -151,14 +151,14 @@ class Ledger extends AppModel {
|
||||
|
||||
$this->queryInit($query);
|
||||
|
||||
if (!isset($query['link']['Ledger']))
|
||||
$query['link']['Ledger'] = array();
|
||||
if (!isset($query['link']['Ledger']['fields']))
|
||||
$query['link']['Ledger']['fields'] = array();
|
||||
if (!isset($query['link']['Ledger']['Account']))
|
||||
$query['link']['Ledger']['Account'] = array();
|
||||
if (!isset($query['link']['Ledger']['Account']['fields']))
|
||||
$query['link']['Ledger']['Account']['fields'] = array();
|
||||
/* if (!isset($query['link']['Ledger'])) */
|
||||
/* $query['link']['Ledger'] = array(); */
|
||||
/* if (!isset($query['link']['Ledger']['fields'])) */
|
||||
/* $query['link']['Ledger']['fields'] = array(); */
|
||||
if (!isset($query['link']['Account']))
|
||||
$query['link']['Account'] = array();
|
||||
if (!isset($query['link']['Account']['fields']))
|
||||
$query['link']['Account']['fields'] = array();
|
||||
/* if (!isset($query['link']['Transaction'])) */
|
||||
/* $query['link']['Transaction'] = array(); */
|
||||
/* if (!isset($query['link']['Transaction']['fields'])) */
|
||||
@@ -175,7 +175,7 @@ class Ledger extends AppModel {
|
||||
$query['group'][] = 'LedgerEntry.ledger_id';
|
||||
|
||||
$stats = $this->LedgerEntry->find('first', $query);
|
||||
pr(compact('stats'));
|
||||
//pr(compact('stats'));
|
||||
|
||||
|
||||
/* unset($query['group']); */
|
||||
@@ -187,6 +187,11 @@ class Ledger extends AppModel {
|
||||
// and the rest of the array is useless (empty).
|
||||
$stats = $stats[0];
|
||||
|
||||
// Make sure we have a member for debit/credit
|
||||
foreach(array('debits', 'credits') AS $crdr)
|
||||
if (!isset($stats[$crdr]))
|
||||
$stats[$crdr] = null;
|
||||
|
||||
// Make sure we have a non-null balance
|
||||
if (!isset($stats['balance']))
|
||||
$stats['balance'] = 0;
|
||||
|
||||
Reference in New Issue
Block a user