Testing month view in reports
This commit is contained in:
parent
369d5defd4
commit
2a6f370351
|
|
@ -127,22 +127,29 @@ class JobsController extends AppController {
|
|||
|
||||
if(isset($month) && isset($year)) { //After a Specific Month for a Year
|
||||
|
||||
$nMonth = date('m',strtotime($month));
|
||||
|
||||
$startDate = $year.'-'.$nMonth.'-01';
|
||||
|
||||
|
||||
$startDate = $year.'-'.$month.'-01';
|
||||
|
||||
$startDateTime = strtotime($startDate);
|
||||
|
||||
$numberOfDaysInMonth = date('t', $startDateTime);
|
||||
|
||||
$endDate = $year.'-'.$nMonth.'-'.$numberOfDaysInMonth;
|
||||
|
||||
$endDate = $year.'-'.$month.'-'.$numberOfDaysInMonth;
|
||||
|
||||
|
||||
$jobRangeTitle = "$month/$year";
|
||||
$jobs = $this->Job->find('all', array('conditions'=>
|
||||
array('Job.date_order_received BETWEEN ? AND ?'=>array($startDate, $endDate))));
|
||||
array('Job.date_order_received BETWEEN ? AND ?'=>array($startDate, $endDate)),
|
||||
'order'=>'Job.date_order_received ASC'));
|
||||
|
||||
|
||||
/* $dateStringFormat = 'j F Y';
|
||||
$dateString['first'] = date($dateStringFormat, $firstDayUnix);
|
||||
$dateString['last'] = date($dateStringFormat, $lastDayUnix);
|
||||
*/
|
||||
$this->set('jobRangeTitle', $jobRangeTitle);
|
||||
|
||||
$this->set('year', $year);
|
||||
$this->set('month', $month);
|
||||
|
||||
|
|
@ -296,7 +303,6 @@ class JobsController extends AppController {
|
|||
|
||||
$startFYunix = $this->getFirstDayFY($year); //1 July of $year.
|
||||
|
||||
$month = date('n', $time);
|
||||
if($time < $startFYunix) { //Date is before 1 July $year.
|
||||
$lastYear = $year - 1;
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@
|
|||
<?endforeach;?>
|
||||
</ul>
|
||||
|
||||
<ul months="months">
|
||||
<span class="whichYear"></span>
|
||||
|
||||
<ul class="months">
|
||||
|
||||
</ul>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,54 @@
|
|||
<h3><?=$jobRangeTitle?></h3>
|
||||
|
||||
<a href="#totals">Skip to Totals</a>
|
||||
<h4>Totals</h4>
|
||||
<table cellpadding="0" cellspacing="0" class="totals">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
<th class="purple">Gross Sales AUD</th>
|
||||
<th class="purple">Net Sales AUD</th>
|
||||
<th class="purple">Gross Profit AUD</th>
|
||||
<th class="purple">Net Export Sales Converted to Or Invoiced in AUD</th>
|
||||
<th class="purple">Gross Profit Value Export in AUD</th>
|
||||
<th class="purple">GP% Excl Commissions</th>
|
||||
|
||||
<th class="lightblue">Gross Australian Sales Foreign Currency</th>
|
||||
<th class="lightblue">Net Australian Sales Foreign Currency</th>
|
||||
<th class="lightblue">Gross Profit value Australian Sales Foreign Currency</th>
|
||||
<th class="lightgreen">Gross Export Sales Foreign Currency</th>
|
||||
<th class="lightgreen">Net Export Sales Foreign Currency</th>
|
||||
<th class="lightgreen">Gross Profit Value After Discount Exports Foreign Currency</th>
|
||||
<th class="darkgreen">Gross Commissions</th>
|
||||
<th class="darkgreen">Net Commisions</th>
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
|
||||
<td id="totals"><?=$number->currency($totals['company_gross_sales_aud']);?></td>
|
||||
<td><?=$number->currency($totals['net_sales_aud']);?></td>
|
||||
<td><?=$number->currency($totals['gross_profit_aud']);?></td>
|
||||
|
||||
<td><?=$number->currency($totals['net_export_sales_aud']);?></td>
|
||||
<td><?=$number->currency($totals['gross_profit_exports_aud']);?></td>
|
||||
<td><?=$number->toPercentage($totals['gp_percent']);?></td>
|
||||
|
||||
<td><?=$number->currency($totals['gross_australian_sales_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['net_australian_sales_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['gross_profit_value_australian_sales_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['gross_export_sales_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['net_export_sales_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['gross_profit_value_after_discount_exports_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['gross_commissions']);?></td>
|
||||
<td><?=$number->currency($totals['net_commissions']);?></td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h4>List of Jobs</h4>
|
||||
<table cellpadding="0" cellspacing="0" class="jobsTable">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -129,70 +177,6 @@
|
|||
endforeach;?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Order Received</th>
|
||||
<th>All Paid</th>
|
||||
<th>All Sent</th>
|
||||
<th>Status</th>
|
||||
<th class="sale_category">Sale Category</th>
|
||||
<th>Job Type</th>
|
||||
<th>Shipment Category</th>
|
||||
<th>Job Number</th>
|
||||
<th>Enquiry Number</th>
|
||||
<th>Principle</th>
|
||||
<th>CMC POs</th>
|
||||
<th>Customer</th>
|
||||
<th>Sale Currency</th>
|
||||
<th class="purple">Gross Sales AUD</th>
|
||||
<th class="purple">Net Sales AUD</th>
|
||||
<th class="purple">Gross Profit AUD</th>
|
||||
<th class="purple">Net Export Sales Converted to Or Invoiced in AUD</th>
|
||||
<th class="purple">Gross Profit Value Export in AUD</th>
|
||||
<th class="purple">GP% Excl Commissions</th>
|
||||
<th class="pink">ATO Exchange Rate</th>
|
||||
<th class="lightblue">Gross Australian Sales Foreign Currency</th>
|
||||
<th class="lightblue">Net Australian Sales Foreign Currency</th>
|
||||
<th class="lightblue">Gross Profit value Australian Sales Foreign Currency</th>
|
||||
<th class="lightgreen">Gross Export Sales Foreign Currency</th>
|
||||
<th class="lightgreen">Net Export Sales Foreign Currency</th>
|
||||
<th class="lightgreen">Gross Profit Value After Discount Exports Foreign Currency</th>
|
||||
<th class="darkgreen">Gross Commissions</th>
|
||||
<th class="darkgreen">Net Commisions</th>
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
<tr>
|
||||
<td><?//Order Recd ?></td>
|
||||
<td><? //All Paid ?></td>
|
||||
<td><?//All Sent ?></td>
|
||||
<td><?//Status ?></td>
|
||||
<td><?//Sale Cat ?></td>
|
||||
<td><?//Job Type ?></td>
|
||||
<td><?// Ship Cat ?></td>
|
||||
<td><?// Job No ?></td>
|
||||
<td><?// Enq No ?></td>
|
||||
<td><?// Principle ?></td>
|
||||
<td><?// CMC PO ?></td>
|
||||
<td><?// Customer ?></td>
|
||||
<td><?// Sale Currenct ?></td>
|
||||
<td id="totals"><?=$number->currency($totals['company_gross_sales_aud']);?></td>
|
||||
<td><?=$number->currency($totals['net_sales_aud']);?></td>
|
||||
<td><?=$number->currency($totals['gross_profit_aud']);?></td>
|
||||
|
||||
<td><?=$number->currency($totals['net_export_sales_aud']);?></td>
|
||||
<td><?=$number->currency($totals['gross_profit_exports_aud']);?></td>
|
||||
<td><?=$number->toPercentage($totals['gp_percent']);?></td>
|
||||
<td><?//ATO Exch Rate?></td>
|
||||
<td><?=$number->currency($totals['gross_australian_sales_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['net_australian_sales_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['gross_profit_value_australian_sales_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['gross_export_sales_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['net_export_sales_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['gross_profit_value_after_discount_exports_foreign_currency']);?></td>
|
||||
<td><?=$number->currency($totals['gross_commissions']);?></td>
|
||||
<td><?=$number->currency($totals['net_commissions']);?></td>
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
|
|
|||
|
|
@ -1244,6 +1244,12 @@ table .jobsTable tr td {
|
|||
margin:0;
|
||||
}
|
||||
|
||||
span.whichYear {
|
||||
display: block;
|
||||
font-size: 110%;
|
||||
padding-top:0.5em;
|
||||
}
|
||||
|
||||
/** Header Colors for Job table to replaced 'Book1'. */
|
||||
th.purple {
|
||||
background-color: #8D80FC;
|
||||
|
|
@ -1269,9 +1275,16 @@ th.darkgreen {
|
|||
|
||||
table.jobsTable tr td {
|
||||
border: 1px solid;
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
table.totals thead tr th {
|
||||
font-size: 60%;
|
||||
}
|
||||
|
||||
table.totals tr td{
|
||||
border: 1px solid;
|
||||
}
|
||||
|
||||
|
||||
.jobsTable input {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,34 @@
|
|||
$(function() {
|
||||
|
||||
|
||||
$(".month").live('click',function(event) {
|
||||
event.preventDefault();
|
||||
|
||||
var target = $(this).children('a').attr('href');
|
||||
|
||||
var targetString = '/jobs/viewReport/'+target;
|
||||
|
||||
$.get(targetString, function(data) {
|
||||
$("#reports").html(data);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
$(".year").click(function() {
|
||||
var thisYear = $(this).attr('id');
|
||||
//alert(thisYear);
|
||||
|
||||
var lastYear = parseInt(thisYear) - 1;
|
||||
|
||||
var yearString = lastYear+'-'+thisYear;
|
||||
|
||||
$(".whichYear").html(yearString);
|
||||
|
||||
|
||||
$(".months").html(getMonthsFY(thisYear));
|
||||
|
||||
|
||||
$.get('/jobs/viewReport/'+thisYear, function(data) {
|
||||
$("#reports").html(data);
|
||||
});
|
||||
|
|
@ -12,7 +36,36 @@ $(function() {
|
|||
});
|
||||
|
||||
|
||||
$(".month").click(function() {
|
||||
|
||||
function getMonthsFY(year) {
|
||||
var months = new Object();
|
||||
|
||||
lastYear = parseInt(year) - 1;
|
||||
|
||||
months['July'] = lastYear+'/07';
|
||||
months['August'] = lastYear+'/08';
|
||||
months['September'] = lastYear+'/09';
|
||||
months['October'] = lastYear+'/10';
|
||||
months['November'] = lastYear+'/11';
|
||||
months['December'] = lastYear+'/12';
|
||||
months['January'] = year+'/01';
|
||||
months['February'] = year+'/02';
|
||||
months['March'] = year+'/03';
|
||||
months['April'] = year+'/04';
|
||||
months['May'] = year+'/05';
|
||||
months['June'] = year+'/06';
|
||||
|
||||
var monthList = '';
|
||||
|
||||
for(var i in months) {
|
||||
//alert(i +' is'+months[i] );
|
||||
monthList += '<li class="month"><a href="'+months[i]+'">'+i+'</a>';
|
||||
}
|
||||
return monthList;
|
||||
}
|
||||
|
||||
|
||||
/*$(".month").click(function() {
|
||||
var thisMonth = $(this).html();
|
||||
var thisYear = $(this).parents('.monthList').attr('id');
|
||||
|
||||
|
|
@ -20,7 +73,7 @@ $(function() {
|
|||
$("#reports").html(data);
|
||||
});
|
||||
|
||||
});
|
||||
});*/
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue