Added a lease up report
git-svn-id: file:///svn-source/pmgr/branches/v0.3_work/site@960 97e9348a-65ac-dc4b-aefc-98561f571b83
This commit is contained in:
@@ -263,6 +263,9 @@ class AppController extends Controller {
|
||||
'SITE', $this->op_area);
|
||||
|
||||
if ($this->admin()) {
|
||||
$this->addSideMenuLink('Lease Up',
|
||||
array('controller' => 'leases', 'action' => 'overview'), null,
|
||||
'REPORT');
|
||||
$this->addSideMenuLink('Unit Summary',
|
||||
array('controller' => 'units', 'action' => 'overview'), null,
|
||||
'REPORT');
|
||||
|
||||
@@ -440,6 +440,64 @@ class LeasesController extends AppController {
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
* action: overview
|
||||
* - Displays lease up information
|
||||
*/
|
||||
function overview() {
|
||||
|
||||
$overview = array('months' => array());
|
||||
|
||||
for ($month = 0; $month < 12; ++$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)";
|
||||
|
||||
$row = $this->Lease->find
|
||||
('first', array('link' => array(),
|
||||
'fields' => array("MONTHNAME($this_month) AS month",
|
||||
"YEAR($this_month) AS year"),
|
||||
));
|
||||
|
||||
$mname = $row[0]['month'] .', '. $row[0]['year'];
|
||||
$overview['months'][$mname] = array('name' => $mname);
|
||||
|
||||
foreach(array('start' => array('before' => $this_month, 'after' => $this_month),
|
||||
'finish' => array('before' => $next_month, 'after' => $next_month),
|
||||
'peak' => array('before' => $next_month, 'after' => $this_month))
|
||||
AS $type => $parm) {
|
||||
$count = $this->Lease->find
|
||||
('count',
|
||||
array('link' => array(),
|
||||
'conditions' => array("movein_date < {$parm['before']}",
|
||||
"(moveout_date IS NULL OR moveout_date >= {$parm['after']})",
|
||||
),
|
||||
));
|
||||
$overview['months'][$mname][$type] = $count;
|
||||
}
|
||||
|
||||
foreach(array('movein', 'moveout') AS $mvinout) {
|
||||
$count = $this->Lease->find
|
||||
('count',
|
||||
array('link' => array(),
|
||||
'conditions' => array("{$mvinout}_date < $next_month",
|
||||
"{$mvinout}_date >= $this_month")
|
||||
));
|
||||
$overview['months'][$mname][$mvinout] = $count;
|
||||
}
|
||||
}
|
||||
|
||||
// Enable the Reports menu section
|
||||
$this->sideMenuAreaActivate('REPORT');
|
||||
|
||||
// Prepare to render.
|
||||
$this->set('title', 'Lease Up Report');
|
||||
$this->set(compact('overview'));
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************************
|
||||
**************************************************************************
|
||||
**************************************************************************
|
||||
|
||||
74
views/leases/overview.ctp
Normal file
74
views/leases/overview.ctp
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php /* -*- mode:PHP -*- */
|
||||
|
||||
echo '<div class="lease overview">' . "\n";
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
* Overview Main Section
|
||||
*/
|
||||
|
||||
/*
|
||||
$rows = array();
|
||||
$rows[] = array('', FormatHelper::currency($overview['']));
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => 'item lease detail',
|
||||
'caption' => '',
|
||||
'rows' => $rows,
|
||||
'column_class' => array('field', 'value')));
|
||||
*/
|
||||
|
||||
|
||||
/**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
**********************************************************************
|
||||
* Supporting Elements Section
|
||||
*/
|
||||
|
||||
echo '<div CLASS="detail supporting">' . "\n";
|
||||
|
||||
$headers = array('', 'Count');
|
||||
$row_class = array();
|
||||
$rows = array();
|
||||
foreach ($overview['months'] AS $month) {
|
||||
$row_class[] = 'subheader';
|
||||
$rows[] = array($month['name']);
|
||||
|
||||
$odd = 1;
|
||||
$row_class[] = array('subitem', $odd ? 'oddrow' : 'evenrow');
|
||||
$rows[] = array('Beginning of Month', $month['start']); $odd = !$odd;
|
||||
$row_class[] = array('subitem', $odd ? 'oddrow' : 'evenrow');
|
||||
$rows[] = array('+ Move-Ins', $month['movein']); $odd = !$odd;
|
||||
$row_class[] = array('subitem', $odd ? 'oddrow' : 'evenrow');
|
||||
$rows[] = array('- Move-Outs', $month['moveout']); $odd = !$odd;
|
||||
|
||||
$row_class[] = 'grand';
|
||||
$rows[] = array('End of ' . $month['name'], $month['finish']);
|
||||
}
|
||||
|
||||
echo $this->element('table',
|
||||
array('class' => 'item lease-overview overview list',
|
||||
'caption' => 'Leased Units By Month',
|
||||
'headers' => $headers,
|
||||
'rows' => $rows,
|
||||
'row_class' => $row_class,
|
||||
'suppress_alternate_rows' => true
|
||||
));
|
||||
|
||||
?>
|
||||
<script type="text/javascript"><!--
|
||||
jQuery(document).ready(function(){
|
||||
jQuery('table.overview td.subheader').attr('colSpan', 2);
|
||||
});
|
||||
--></script>
|
||||
<?php
|
||||
|
||||
|
||||
/* End "detail supporting" div */
|
||||
echo '</div>' . "\n";
|
||||
|
||||
/* End page div */
|
||||
echo '</div>' . "\n";
|
||||
@@ -273,6 +273,8 @@ table.overview td:first-child.subitem { padding-left: 2em; }
|
||||
table.overview td:first-child { text-align: left; }
|
||||
table.overview td { text-align: right; }
|
||||
table.overview td.oddrow { background : #f4f4f4; }
|
||||
table.statement_entry-overview { width : 50% }
|
||||
table.lease-overview { width : 50% }
|
||||
|
||||
|
||||
/************************************************************
|
||||
|
||||
Reference in New Issue
Block a user