Reports and added net aud export column to job index

This commit is contained in:
Karl Cordes 2011-04-07 18:52:01 +10:00
parent 0841b715c1
commit 9350766561
8 changed files with 184 additions and 22 deletions

View file

@ -84,6 +84,47 @@ class JobsController extends AppController {
$this->set('year', $year);
$this->set('month', $month);
if(isset($month) && isset($year)) { //After a Specific Month for a Year
$nMonth = date('m',strtotime($month));
$startDate = $year.'-'.$nMonth.'-01';
$startDateTime = strtotime($startDate);
$numberOfDaysInMonth = date('t', $startDateTime);
$endDate = $year.'-'.$nMonth.'-'.$numberOfDaysInMonth;
$jobs = $this->Job->find('all', array('conditions'=>
array('Job.date_order_received BETWEEN ? AND ?'=>array($startDate, $endDate))));
$this->set('jobs', $jobs);
$this->set('principleList',$this->Job->Enquiry->Principle->find('list'));
$this->set('startDate',$startDate);
$this->set('endDate',$endDate);
}
elseif(isset($year) && !isset($month)) { //After a whole Years Stats.
}
else {
echo "Failure";
}
//$this->set('jobs', )
}
@ -101,7 +142,15 @@ class JobsController extends AppController {
$time = strtotime($job['Job']['date_order_received']);
$year = date('Y', $time); //ISO-8601 year number
$month = date('F', $time);
$monthList[$year][$month][] = $job;
//$monthList[$year][$month][] = $job;
if(!isset($monthList[$year][$month])) {
$monthList[$year][$month] = 1;
}
else {
$monthList[$year][$month]++;
}
}
krsort($monthList);

View file

@ -122,7 +122,7 @@ else {
<td> <?=$form->input('gross_profit_aud', array('value'=>$job['Job']['gross_profit_aud'], 'label'=>false ));?>
</td>
<td>
Net Export Sales Conv to AUD?
<?=$form->input('net_export_sales_aud', array('value'=>$job['Job']['net_export_sales_aud'], 'label'=>false ));?>
</td>
<td>
<?=$form->input('gross_profit_exports_aud', array('value'=>$job['Job']['gross_profit_exports_aud'], 'label'=>false));?>

View file

@ -49,7 +49,7 @@
<td> <?=$job['Job']['gross_profit_aud'];?>
</td>
<td>
Net Export Sales Conv to AUD?
<?=$job['Job']['net_export_sales_aud'];?>
</td>
<td>
<?=$job['Job']['gross_profit_exports_aud'];?>

View file

@ -55,7 +55,7 @@ echo $paginator->counter(array(
<th><?php echo $paginator->sort('Gross Sales AUD');?></th>
<th><?php echo $paginator->sort('Net Sales AUD');?></th>
<th><?php echo $paginator->sort('Gross Profit AUD');?></th>
<th><?php echo $paginator->sort('Net Export Sales Converted to Or Charged in AUD');?></th>
<th><?php echo $paginator->sort('Net Export Sales Converted to Or Invoiced in AUD');?></th>
<th><?php echo $paginator->sort('Gross Profit Value Export in AUD');?></th>
<th><?php echo $paginator->sort('GP% Excl Commissions');?></th>
<th><?php echo $paginator->sort('ATO Exchange Rate');?></th>
@ -129,7 +129,7 @@ echo $paginator->counter(array(
<td> <?=$job['Job']['gross_profit_aud'];?>
</td>
<td>
Net Export Sales Conv to AUD?
<?=$job['Job']['net_export_sales_aud'];?>
</td>
<td>
<?=$job['Job']['gross_profit_exports_aud'];?>

View file

@ -10,8 +10,8 @@
<ul class="yearList">
<li><span class="year"><?=$year?></span>
<ul class="monthList" id="<?=$year?>">
<?foreach($monthArr as $month => $job):?>
<li><span class="month"><?=$month;?></span></li>
<?foreach($monthArr as $month => $count):?>
<li><span class="month"><?=$month;?></span> (<?=$count?>)</li>
<?endforeach;?>
</ul>
</li>

View file

@ -3,3 +3,88 @@
<? if(isset($month)):?>
<h4><?=$month?></h4>
<?endif;?>
<table class="jobsTable">
<thead>
<tr>
<th>Order Received</th>
<th>Job Number</th>
<th>Enquiry Number</th>
<th>Principle</th>
<th>Customer</th>
<th>Sale Currency</th>
<th>Gross Sales AUD</th>
<th>Net Sales AUD</th>
<th>Gross Profit AUD</th>
<th>Net Sales Converted to or Charge in AUD</th>
<th>GP% Excl Commissions</th>
<th>ATO Exchange Rate</th>
</tr>
</thead>
<tbody>
<?foreach($jobs as $job):?>
<tr>
<td><?=$job['Job']['date_order_received'];?></td>
<td class="nowrap"><?=$html->link($job['Job']['title'], array('controller'=>'jobs', 'action'=>'view', $job['Job']['id']));?>
</td>
<td class="nowrap"><?=$html->link($job['Enquiry']['title'], array('controller'=>'enquiries','action'=>'view', $job['Enquiry']['id']));?>
</td>
<td><?=$principleList[$job['Enquiry']['principle_id']];?></td>
<td><?=$html->link($job['Customer']['name'], array('controller'=>'customers','action'=>'view', $job['Customer']['id']));?></td>
<td>
<?=$job['Currency']['name'];?>
</td>
<td>
<?=$job['Job']['company_gross_sales_aud'];?>
</td>
<td>
<?=$job['Job']['net_sales_aud'];?>
</td>
<td>
<?=$job['Job']['gross_profit_aud'];?>
</td>
<td>
<?=$job['Job']['gross_profit_exports_aud'];?>
</td>
<td>
<?=$job['Job']['gp_percent'];?>
</td>
<td>
<?=$job['Job']['ato_exchange_rate'];?>
</td>
<td> <?=$job['Job']['gross_australian_sales_foreign_currency'];?>
</td>
<td>
<?=$job['Job']['net_australian_sales_foreign_currency'];?>
</td>
<td> <?=$job['Job']['gross_profit_value_australian_sales_foreign_currency'];?>
</td>
<td>
<?=$job['Job']['gross_export_sales_foreign_currency'];?>
</td>
<td> <?=$job['Job']['net_export_sales_foreign_currency'];?>
</td>
<td> <?=$job['Job']['gross_profit_value_after_discount_exports_foreign_currency'];?>
</td>
<td>
<?=$job['Job']['gross_commissions'];?>
</td>
<td> <?=$job['Job']['net_commissions'];?>
</td>
</tr>
<?endforeach;?>
</tbody>
</table>
<?
print_r($jobs);
?>

View file

@ -1330,27 +1330,32 @@ select.job_status {
/* CSS for the Job Reporting */
#yearMonths {
width: 10em;
width: 6em;
float: left;
margin-right: 4em;
}
#reports {
float: left;
}
ul.yearList {
list-style: none;
margin: 0;
padding-bottom: 1em;
}
ul.monthList {
list-style: none;
margin: 0;
padding-left: 0.5em;
}
ul.yearList li.year {
margin: 1em;
font-size: 200%;
cursor: pointer;
}
ul.monthList li {
margin-left:1em;
margin-left:0.5em;
margin-top:0.5em;
width: 10em;
}
span.month {
@ -1360,9 +1365,3 @@ span.month {
span.year {
cursor: pointer;
}
#fixedHeader {
position: absolute;
top: 20;
}

29
webroot/js/job_reports.js Normal file
View file

@ -0,0 +1,29 @@
$(function() {
$(".year").click(function() {
var thisYear = $(this).html();
$.get('/jobs/viewReport/'+thisYear, function(data) {
$("#reports").html(data);
});
;
});
$(".month").click(function() {
var thisMonth = $(this).html();
var thisYear = $(this).parents('.monthList').attr('id');
$.get('/jobs/viewReport/'+thisYear+'/'+thisMonth, function(data) {
$("#reports").html(data);
});
});
});