Fixed unset dates in job report

This commit is contained in:
Karl Cordes 2011-05-13 10:52:17 +10:00
parent 676c5db9a3
commit 369d5defd4
2 changed files with 41 additions and 36 deletions

View file

@ -122,8 +122,7 @@ class JobsController extends AppController {
function viewReport($year, $month = null) {
//$this->layout = 'ajax';
$this->layout = 'ajax';
if(isset($month) && isset($year)) { //After a Specific Month for a Year
@ -159,10 +158,11 @@ class JobsController extends AppController {
}
elseif(isset($year) && !isset($month)) { //Requested a whole Financial Year Jobs
$this->set('year', $year);
$lastDayUnix = $this->getLastDayFY($year);
$firstDayUnix = $this->getFirstDayFY($year,true);
@ -176,20 +176,25 @@ class JobsController extends AppController {
$dateString['last'] = date($dateStringFormat, $lastDayUnix);
if($year == 0) { //Jobs with an empty 'date_order_received
$jobs = $this->Job->find('all', array('conditions'=>array('Job.date_order_received'=>'0000-00-000')));
$jobRangeTitle = "Jobs without Order Received date";
}
else { //We're looking for Jobs that have an 'date_order_received'
$jobs = $this->Job->find('all', array('conditions'=>
array('Job.date_order_received BETWEEN ? AND ?'=>array($firstDayDate, $lastDayDate))
)
);
$this->set('jobs',$jobs);
$lastYear = $year - 1;
$jobRangeTitle = $lastYear.' - '.$year.' ('.$dateString['first']." to ".$dateString['last'].')';
}
$this->set('jobRangeTitle', $jobRangeTitle);
$this->set('jobs',$jobs);
$this->set('principleList',$this->Job->Enquiry->Principle->find('list'));
$this->set('sale_category_options', $this->sale_category_options());
$this->set('sale_category_array', $this->sale_category_array());

View file

@ -12,7 +12,7 @@
<?if($year != 1970 && $year != 0):?>
<li id="<?=$year?>" class="year"><?=$lastYear?> - <?=$year?> <span class="count">(<?=$count?>)</span></li>
<?else:?>
<li id="<?=$year?>" class="year">No Date <span class="count">(<?=$count?>)</span></li>
<li id="0" class="year">No Date <span class="count">(<?=$count?>)</span></li>
<?endif;?>
<?endforeach;?>