Added job sorting links to index

This commit is contained in:
Karl Cordes 2011-04-13 11:26:38 +10:00
parent acd21f97f2
commit 674876f2e4
3 changed files with 210 additions and 164 deletions

View file

@ -14,9 +14,37 @@ class JobsController extends AppController {
);
function index() {
function index($showUnpaid = null, $showUnsent = null) {
$this->Job->recursive = 1;
$this->set('jobs', $this->paginate());
if(isset($showUnpaid) && isset($showUnsent)) {
$conditions = array(
'Job.all_paid' => 0,
'Job.all_sent' => 0,
);
}
else if(isset($showUnpaid)) {
$conditions = array(
'Job.all_paid' => 0,
);
}
else if(isset($showUnsent)) {
$conditions = array(
'Job.all_sent' => 0,
);
}
else {
$conditions = array();
}
$this->set('jobs', $this->paginate($conditions));
$this->set('customers', $this->Job->Enquiry->Customer->find('list'));
$this->set('currencies', $this->Job->Currency->find('list'));
@ -32,7 +60,7 @@ class JobsController extends AppController {
/** Called via AJAX to get an editable row */
function getEditableRow($id) {
$this->layout = 'ajax';
$job = $this->Job->find('first', array('conditions'=>array('Job.id'=>$id)));
$this->set('job', $job);

View file

@ -7,12 +7,14 @@ echo $javascript->link('job_index');
<h2><?php __('Jobs');?></h2>
<? //<iframe src="/jobs/index_grid" id="jobs_grid_iframe"></iframe>
?>
<div class="showActions">
<ul>
<li><?=$html->link('Show all', array('action'=>'index'));?></li>
<li><?=$html->link('Show only Unpaid', array('action'=>'index/1'));?></li>
<li><?=$html->link('Show only Unsent', array('action'=>'index/0/1'));?></li>
<li><?=$html->link('Show only Unpaid & Unsent', array('action'=>'index/1/1'));?></li>
</ul>
</div>
<?php
echo $paginator->counter(array(
@ -27,163 +29,162 @@ echo $paginator->counter(array(
<?php echo $form->create('Job', array('action'=>'/jobs/ajax_edit'));?>
<div id="fixedHeader">
<div class="scrollHorizontal">
<table cellpadding="0" cellspacing="0" class="jobsTable">
<thead class="jobTableHead">
<tr class="jobTableHeadRow" id="originalHeader">
<th class="actions">Actions</th>
<th><?php echo $paginator->sort('Order Received', 'date_order_received');?></th>
<th><?php echo $paginator->sort('All Paid', 'all_paid');?></th>
<th><?php echo $paginator->sort('All Sent', 'all_sent');?></th>
<th><?php echo $paginator->sort('Status', 'job_status');?></th>
<th class="sale_category"><?php echo $paginator->sort('Sale Category');?></th>
<th><?php echo $paginator->sort('Job Type', 'job_type');?></th>
<th><?php echo $paginator->sort('Shipment Category','shipment_category');?></th>
<th><?php echo $paginator->sort('Job Number','title');?></th>
<th>Enquiry Number</th>
<th>CMC POs</th>
<th>Date Order Placed on Principle</th>
<th><?php echo $paginator->sort('Customer','Customer.name');?></th>
<th>Customer Order No</th>
<th><?php echo $paginator->sort('Supplier Ref');?></th>
<th><?php echo $paginator->sort('Scheduled Ex-Works', 'date_scheduled_ex_works');?></th>
<th><?php echo $paginator->sort('Date Sent to Customer', 'date_sent_to_customer');?></th>
<th><?php echo $paginator->sort('Freight Paid By CMC');?></th>
<th><?php echo $paginator->sort('Sale Currency');?></th>
<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 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>
<th><?php echo $paginator->sort('Gross Australian Sales Foreign Currency');?></th>
<th><?php echo $paginator->sort('Net Australian Sales Foreign Currency');?></th>
<th><?php echo $paginator->sort('Gross Profit value Australian Sales Foreign Currency');?></th>
<th><?php echo $paginator->sort('Gross Export Sales Foreign Currency');?></th>
<th><?php echo $paginator->sort('Net Export Sales Foreign Currency');?></th>
<th><?php echo $paginator->sort('Gross Profit Value After Discount Exports Foreign Currency');?></th>
<th><?php echo $paginator->sort('Gross Commissions');?></th>
<th><?php echo $paginator->sort('Net Commisions');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
</thead>
<tbody>
<? //echo $form->create('Job', array('action'=>'ajax_edit', 'class'=>'job_table_form', 'default'=>false));
?>
<? foreach($jobs as $job):?>
<tr id="<?=$job['Job']['id']?>">
<td><button class="editButton">Edit</button></td>
<td>
<?=$this->element('isEmptyDate', array('date'=>$job['Job']['date_order_received']));?></td>
<td>
<?=$this->element('booleanTick', array('bool'=>$job['Job']['all_paid'])); ?>
</td>
<td>
<?=$this->element('booleanTick', array('bool'=>$job['Job']['all_sent'])); ?>
</td>
<td class=""><?=$job['Job']['job_status'];?></td>
<td class="sale_category nowrap">
<?=$sale_category_array[$job['Job']['sale_category']];?>
</td>
<td>
<?=$job['Job']['job_type'];?></td>
<td><?=$job['Job']['shipment_category'];?></td>
<td><?=$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><?
$poString = '';
foreach($job['PurchaseOrder'] as $po) {
echo $html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']))."<br>";
}
?>
</td>
<td class="nowrap"><?
foreach($job['PurchaseOrder'] as $po) {
echo $this->element('isEmptyDate', array('date'=>$po['issue_date']));
echo "<br>";
}
?>
</td>
<td><?=$html->link($job['Customer']['name'], array('controller'=>'customers','action'=>'view', $job['Customer']['id']));?></td>
<td class="nowrap">
<?=$job['Job']['customer_order_number'];?>
</td>
<td> <?
foreach($job['PurchaseOrder'] as $po) {
echo $po['principle_reference'];
echo "<br>";
}
?>
</td>
<td>
<?=$this->element('isEmptyDate', array('date'=>$job['Job']['date_scheduled_ex_works']));?>
</td>
<td>
<?=$this->element('isEmptyDate', array('date'=>$job['Job']['date_order_sent_to_customer']));?>
</td>
<td> <?=$job['Job']['domestic_freight_paid_by'];?>
</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']['net_export_sales_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>
<td><button class="editButton">Edit</button></td>
</tr>
<? endforeach;?>
</tbody>
</table>
</div>
<table cellpadding="0" cellspacing="0" class="jobsTable">
<thead class="jobTableHead">
<tr class="jobTableHeadRow" id="originalHeader">
<th class="actions">Actions</th>
<th><?php echo $paginator->sort('Order Received', 'date_order_received');?></th>
<th><?php echo $paginator->sort('All Paid', 'all_paid');?></th>
<th><?php echo $paginator->sort('All Sent', 'all_sent');?></th>
<th><?php echo $paginator->sort('Status', 'job_status');?></th>
<th class="sale_category"><?php echo $paginator->sort('Sale Category');?></th>
<th><?php echo $paginator->sort('Job Type', 'job_type');?></th>
<th><?php echo $paginator->sort('Shipment Category','shipment_category');?></th>
<th><?php echo $paginator->sort('Job Number','title');?></th>
<th>Enquiry Number</th>
<th>CMC POs</th>
<th>Date Order Placed on Principle</th>
<th><?php echo $paginator->sort('Customer','Customer.name');?></th>
<th>Customer Order No</th>
<th><?php echo $paginator->sort('Supplier Ref');?></th>
<th><?php echo $paginator->sort('Scheduled Ex-Works', 'date_scheduled_ex_works');?></th>
<th><?php echo $paginator->sort('Date Sent to Customer', 'date_sent_to_customer');?></th>
<th><?php echo $paginator->sort('Freight Paid By CMC');?></th>
<th><?php echo $paginator->sort('Sale Currency');?></th>
<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 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>
<th><?php echo $paginator->sort('Gross Australian Sales Foreign Currency');?></th>
<th><?php echo $paginator->sort('Net Australian Sales Foreign Currency');?></th>
<th><?php echo $paginator->sort('Gross Profit value Australian Sales Foreign Currency');?></th>
<th><?php echo $paginator->sort('Gross Export Sales Foreign Currency');?></th>
<th><?php echo $paginator->sort('Net Export Sales Foreign Currency');?></th>
<th><?php echo $paginator->sort('Gross Profit Value After Discount Exports Foreign Currency');?></th>
<th><?php echo $paginator->sort('Gross Commissions');?></th>
<th><?php echo $paginator->sort('Net Commisions');?></th>
<th class="actions"><?php __('Actions');?></th>
</tr>
</thead>
<tbody>
<? //echo $form->create('Job', array('action'=>'ajax_edit', 'class'=>'job_table_form', 'default'=>false));
?>
<? foreach($jobs as $job):?>
<tr id="<?=$job['Job']['id']?>">
<td><button class="editButton">Edit</button></td>
<td>
<?=$this->element('isEmptyDate', array('date'=>$job['Job']['date_order_received']));?></td>
<td>
<?=$this->element('booleanTick', array('bool'=>$job['Job']['all_paid'])); ?>
</td>
<td>
<?=$this->element('booleanTick', array('bool'=>$job['Job']['all_sent'])); ?>
</td>
<td class=""><?=$job['Job']['job_status'];?></td>
<td class="sale_category nowrap">
<?=$sale_category_array[$job['Job']['sale_category']];?>
</td>
<td>
<?=$job['Job']['job_type'];?></td>
<td><?=$job['Job']['shipment_category'];?></td>
<td><?=$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><?
$poString = '';
foreach($job['PurchaseOrder'] as $po) {
echo $html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']))."<br>";
}
?>
</td>
<td class="nowrap"><?
foreach($job['PurchaseOrder'] as $po) {
echo $this->element('isEmptyDate', array('date'=>$po['issue_date']));
echo "<br>";
}
?>
</td>
<td><?=$html->link($job['Customer']['name'], array('controller'=>'customers','action'=>'view', $job['Customer']['id']));?></td>
<td class="nowrap">
<?=$job['Job']['customer_order_number'];?>
</td>
<td> <?
foreach($job['PurchaseOrder'] as $po) {
echo $po['principle_reference'];
echo "<br>";
}
?>
</td>
<td>
<?=$this->element('isEmptyDate', array('date'=>$job['Job']['date_scheduled_ex_works']));?>
</td>
<td>
<?=$this->element('isEmptyDate', array('date'=>$job['Job']['date_order_sent_to_customer']));?>
</td>
<td> <?=$job['Job']['domestic_freight_paid_by'];?>
</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']['net_export_sales_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>
<td><button class="editButton">Edit</button></td>
</tr>
<? endforeach;?>
</tbody>
</table>
<div class="paging">
<?php echo $paginator->prev('<< '.__('previous', true), array(), null, array('class'=>'disabled'));?>

View file

@ -1335,7 +1335,24 @@ select.job_status {
}
.showActions ul {
list-style: none;
}
.showActions ul li {
display: inline;
padding-left: 0.2em;
}
.showActions {
padding-bottom: 1em;
}
.scrollHorizontal {
height: 800px;
overflow:scroll;
}
/* CSS for the Job Reporting */