Modified a couple reports to have url control over the period

git-svn-id: file:///svn-source/pmgr/branches/v0.3_work/site@997 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
abijah
2010-07-02 22:05:24 +00:00
parent 3495a3d760
commit fccaed681d
3 changed files with 6 additions and 5 deletions

View File

@@ -264,7 +264,7 @@ class StatementEntriesController extends AppController {
* - Displays charges by month
*/
function chargesbymonth() {
function chargesbymonth($months = 12) {
$result = $this->StatementEntry->find
('all',
array('link' => array('Account' => array('fields' => 'name')),
@@ -272,7 +272,7 @@ class StatementEntriesController extends AppController {
'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 >= DATE(NOW() - INTERVAL '.($months-1).' MONTH - INTERVAL DAY(NOW())-1 DAY)',
'effective_date <= NOW()',
),
'group' => array('YEAR(effective_date)', 'MONTH(effective_date)', 'Account.id'),
@@ -298,6 +298,7 @@ class StatementEntriesController extends AppController {
$this->sideMenuAreaActivate('REPORT');
// Prepare to render.
$this->set('months', $months);
$this->set('title', 'Monthly Charges');
$this->set(compact('overview'));
}