Fixed the monthly charges report to only reflect income accounts (not things like security deposits). Also, by restricting to charges, the report was neglecting things like reversals, leaving the totals skewed. Thefore, the 'CHARGES' restriction was removed and replaced with the much more appropriate chargeDisbursementFields() function, which dumps fields that tabulate correctly.
git-svn-id: file:///svn-source/pmgr/branches/v0.3_work@962 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -264,11 +264,10 @@ class StatementEntriesController extends AppController {
|
||||
$result = $this->StatementEntry->find
|
||||
('all',
|
||||
array('link' => array('Account' => array('fields' => 'name')),
|
||||
'fields' => array('MONTHNAME(effective_date) AS month',
|
||||
'YEAR(effective_date) AS year',
|
||||
'SUM(amount) AS amount',
|
||||
),
|
||||
'conditions' => array('StatementEntry.type' => 'CHARGE',
|
||||
'fields' => array_merge(array('MONTHNAME(effective_date) AS month',
|
||||
'YEAR(effective_date) AS year'),
|
||||
$this->StatementEntry->chargeDisbursementFields(true)),
|
||||
'conditions' => array('Account.type' => 'INCOME',
|
||||
'effective_date >= DATE(NOW() - INTERVAL 11 MONTH - INTERVAL DAY(NOW())-1 DAY)',
|
||||
'effective_date <= NOW()',
|
||||
),
|
||||
@@ -285,10 +284,10 @@ class StatementEntriesController extends AppController {
|
||||
'charges' => 0);
|
||||
$month = &$overview['months'][$mname];
|
||||
$month['subs'][] = array('name' => $row['Account']['name'],
|
||||
'charges' => $row[0]['amount']);
|
||||
'charges' => $row[0]['balance']);
|
||||
|
||||
$month['charges'] += $row[0]['amount'];
|
||||
$overview['charges'] += $row[0]['amount'];
|
||||
$month['charges'] += $row[0]['balance'];
|
||||
$overview['charges'] += $row[0]['balance'];
|
||||
}
|
||||
|
||||
// Enable the Reports menu section
|
||||
|
||||
Reference in New Issue
Block a user