Fixed unset dates in job report
This commit is contained in:
parent
676c5db9a3
commit
369d5defd4
|
|
@ -122,8 +122,7 @@ class JobsController extends AppController {
|
||||||
|
|
||||||
|
|
||||||
function viewReport($year, $month = null) {
|
function viewReport($year, $month = null) {
|
||||||
//$this->layout = 'ajax';
|
$this->layout = 'ajax';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(isset($month) && isset($year)) { //After a Specific Month for a Year
|
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
|
elseif(isset($year) && !isset($month)) { //Requested a whole Financial Year Jobs
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$this->set('year', $year);
|
$this->set('year', $year);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$lastDayUnix = $this->getLastDayFY($year);
|
$lastDayUnix = $this->getLastDayFY($year);
|
||||||
$firstDayUnix = $this->getFirstDayFY($year,true);
|
$firstDayUnix = $this->getFirstDayFY($year,true);
|
||||||
|
|
||||||
|
|
@ -176,20 +176,25 @@ class JobsController extends AppController {
|
||||||
$dateString['last'] = date($dateStringFormat, $lastDayUnix);
|
$dateString['last'] = date($dateStringFormat, $lastDayUnix);
|
||||||
|
|
||||||
|
|
||||||
$jobs = $this->Job->find('all', array('conditions'=>
|
if($year == 0) { //Jobs with an empty 'date_order_received
|
||||||
array('Job.date_order_received BETWEEN ? AND ?'=>array($firstDayDate, $lastDayDate))
|
$jobs = $this->Job->find('all', array('conditions'=>array('Job.date_order_received'=>'0000-00-000')));
|
||||||
)
|
$jobRangeTitle = "Jobs without Order Received date";
|
||||||
);
|
}
|
||||||
$this->set('jobs',$jobs);
|
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))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
$lastYear = $year - 1;
|
$lastYear = $year - 1;
|
||||||
|
$jobRangeTitle = $lastYear.' - '.$year.' ('.$dateString['first']." to ".$dateString['last'].')';
|
||||||
|
|
||||||
$jobRangeTitle = $lastYear.' - '.$year.' ('.$dateString['first']." to ".$dateString['last'].')';
|
}
|
||||||
|
|
||||||
$this->set('jobRangeTitle', $jobRangeTitle);
|
$this->set('jobRangeTitle', $jobRangeTitle);
|
||||||
|
|
||||||
|
$this->set('jobs',$jobs);
|
||||||
$this->set('principleList',$this->Job->Enquiry->Principle->find('list'));
|
$this->set('principleList',$this->Job->Enquiry->Principle->find('list'));
|
||||||
$this->set('sale_category_options', $this->sale_category_options());
|
$this->set('sale_category_options', $this->sale_category_options());
|
||||||
$this->set('sale_category_array', $this->sale_category_array());
|
$this->set('sale_category_array', $this->sale_category_array());
|
||||||
|
|
@ -227,21 +232,21 @@ class JobsController extends AppController {
|
||||||
function getTotals($jobs) {
|
function getTotals($jobs) {
|
||||||
|
|
||||||
$fields = array(
|
$fields = array(
|
||||||
'company_gross_sales_aud' => 'total',
|
'company_gross_sales_aud' => 'total',
|
||||||
'net_sales_aud' =>'total',
|
'net_sales_aud' =>'total',
|
||||||
'gross_profit_aud' => 'total',
|
'gross_profit_aud' => 'total',
|
||||||
'net_export_sales_aud' => 'total',
|
'net_export_sales_aud' => 'total',
|
||||||
'gross_profit_exports_aud' => 'total',
|
'gross_profit_exports_aud' => 'total',
|
||||||
'gp_percent' => 'average',
|
'gp_percent' => 'average',
|
||||||
'gross_australian_sales_foreign_currency' => 'total',
|
'gross_australian_sales_foreign_currency' => 'total',
|
||||||
'net_australian_sales_foreign_currency' => 'total',
|
'net_australian_sales_foreign_currency' => 'total',
|
||||||
'gross_profit_value_australian_sales_foreign_currency' => 'total',
|
'gross_profit_value_australian_sales_foreign_currency' => 'total',
|
||||||
'gross_export_sales_foreign_currency' => 'total',
|
'gross_export_sales_foreign_currency' => 'total',
|
||||||
'net_export_sales_foreign_currency' => 'total',
|
'net_export_sales_foreign_currency' => 'total',
|
||||||
'gross_profit_value_after_discount_exports_foreign_currency' => 'total',
|
'gross_profit_value_after_discount_exports_foreign_currency' => 'total',
|
||||||
'gross_commissions' => 'total',
|
'gross_commissions' => 'total',
|
||||||
'net_commissions' => 'total'
|
'net_commissions' => 'total'
|
||||||
);
|
);
|
||||||
|
|
||||||
$totals = array();
|
$totals = array();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
<?if($year != 1970 && $year != 0):?>
|
<?if($year != 1970 && $year != 0):?>
|
||||||
<li id="<?=$year?>" class="year"><?=$lastYear?> - <?=$year?> <span class="count">(<?=$count?>)</span></li>
|
<li id="<?=$year?>" class="year"><?=$lastYear?> - <?=$year?> <span class="count">(<?=$count?>)</span></li>
|
||||||
<?else:?>
|
<?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;?>
|
<?endif;?>
|
||||||
|
|
||||||
<?endforeach;?>
|
<?endforeach;?>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue