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:
@@ -450,11 +450,11 @@ class LeasesController extends AppController {
|
||||
* action: overview
|
||||
* - Displays lease up information
|
||||
*/
|
||||
function overview() {
|
||||
function overview($months = 12) {
|
||||
|
||||
$overview = array('months' => array());
|
||||
|
||||
for ($month = 0; $month < 12; ++$month) {
|
||||
for ($month = 0; $month < $months; ++$month) {
|
||||
//for ($month = 12; $month >= 0; --$month) {
|
||||
$this_month = "(DATE(NOW() - INTERVAL $month MONTH - INTERVAL DAY(NOW())-1 DAY))";
|
||||
$next_month = "($this_month + INTERVAL 1 MONTH)";
|
||||
|
||||
@@ -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'));
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ echo '<div class="statement_entry overview">' . "\n";
|
||||
*/
|
||||
|
||||
$rows = array();
|
||||
$rows[] = array('12 Month Charges', FormatHelper::currency($overview['charges']));
|
||||
$rows[] = array("$months Month Charges", FormatHelper::currency($overview['charges']));
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => 'item statement_entry detail',
|
||||
|
||||
Reference in New Issue
Block a user