Modified a couple reports to have url control over the period

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

View File

@@ -450,11 +450,11 @@ class LeasesController extends AppController {
* action: overview * action: overview
* - Displays lease up information * - Displays lease up information
*/ */
function overview() { function overview($months = 12) {
$overview = array('months' => array()); $overview = array('months' => array());
for ($month = 0; $month < 12; ++$month) { for ($month = 0; $month < $months; ++$month) {
//for ($month = 12; $month >= 0; --$month) { //for ($month = 12; $month >= 0; --$month) {
$this_month = "(DATE(NOW() - INTERVAL $month MONTH - INTERVAL DAY(NOW())-1 DAY))"; $this_month = "(DATE(NOW() - INTERVAL $month MONTH - INTERVAL DAY(NOW())-1 DAY))";
$next_month = "($this_month + INTERVAL 1 MONTH)"; $next_month = "($this_month + INTERVAL 1 MONTH)";

View File

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

View File

@@ -10,7 +10,7 @@ echo '<div class="statement_entry overview">' . "\n";
*/ */
$rows = array(); $rows = array();
$rows[] = array('12 Month Charges', FormatHelper::currency($overview['charges'])); $rows[] = array("$months Month Charges", FormatHelper::currency($overview['charges']));
echo $this->element('table', echo $this->element('table',
array('class' => 'item statement_entry detail', array('class' => 'item statement_entry detail',