Deleted the stupid shipment categories model. Con just making shit difficult.

This commit is contained in:
Karl Cordes 2011-04-15 10:49:42 +10:00
parent 1300916053
commit c65f353d44
8 changed files with 89 additions and 46 deletions

View file

@ -51,7 +51,7 @@ class JobsController extends AppController {
$this->set('sale_category_options', $this->sale_category_options());
$this->set('sale_category_array', $this->sale_category_array());
$this->set('job_type_options', $this->job_type_options());
$this->set('shipment_options', $this->shipment_options());
$this->set('shipment_category_options', $this->shipment_category_options());
$this->set('freight_paid_by_options',$this->freight_paid_options());
$this->set('gst_options', $this->gst_options());
@ -67,13 +67,12 @@ class JobsController extends AppController {
$this->data = $job;
$this->set('shipment_category_options', $this->shipment_category_options());
$this->set('yesNo', array(0=>'No', 1=>'Yes'));
$this->set('currencies', $this->Job->Currency->find('list'));
$this->set('sale_category_options', $this->sale_category_options());
$this->set('sale_category_array', $this->sale_category_array());
$this->set('job_type_options', $this->job_type_options());
$this->set('shipment_options', $this->shipment_options());
$this->set('freight_paid_by_options',$this->freight_paid_options());
$this->set('gst_options', $this->gst_options());
$this->set('job_status_options', $this->job_status_options());
@ -89,7 +88,7 @@ class JobsController extends AppController {
$this->set('sale_category_options', $this->sale_category_options());
$this->set('sale_category_array', $this->sale_category_array());
$this->set('job_type_options', $this->job_type_options());
$this->set('shipment_options', $this->shipment_options());
$this->set('shipment_category_options', $this->shipment_category_options());
$this->set('freight_paid_by_options',$this->freight_paid_options());
$this->set('gst_options', $this->gst_options());
@ -215,16 +214,16 @@ class JobsController extends AppController {
function sale_category_options() {
$options['Australian Sale'] = array(
0 => "Australian Customer & Australian Destination (GST Applies)",
1 => "Overseas Customer & Australian Destination (GST Applies)",
2 => "Commission from Australian Company or Supplier (GST Applies)",
0 => "AS: Australian Customer & Australian Destination (GST Applies)",
1 => "AS: Overseas Customer & Australian Destination (GST Applies)",
2 => "AS: Commission from Australian Company or Supplier (GST Applies)",
);
$options['Exports'] = array(
3 => "Overseas Customer & Overseas Destination (no GST)",
4 => "Australian Customer & Overseas Destination (no GST)",
5 => "Commission from Overseas Company (no GST)"
3 => "EX: Overseas Customer & Overseas Destination (no GST)",
4 => "EX: Australian Customer & Overseas Destination (no GST)",
5 => "EX: Commission from Overseas Company (no GST)"
);
@ -234,32 +233,42 @@ class JobsController extends AppController {
/** For viewing the sale Cat */
function sale_category_array() {
$options = array(
0 => "Australian Customer & Australian Destination (GST Applies)",
1 => "Overseas Customer & Australian Destination (GST Applies)",
2 => "Commission from Australian Company or Supplier (GST Applies)",
3 => "Overseas Customer & Overseas Destination (no GST)",
4 => "Australian Customer & Overseas Destination (no GST)",
5 => "Commission from Overseas Company (no GST)"
0 => "AS: Australian Customer & Australian Destination (GST Applies)",
1 => "AS: Overseas Customer & Australian Destination (GST Applies)",
2 => "AS: Commission from Australian Company or Supplier (GST Applies)",
3 => "EX: Overseas Customer & Overseas Destination (no GST)",
4 => "EX: Australian Customer & Overseas Destination (no GST)",
5 => "EX: Commission from Overseas Company (no GST)"
);
return $options;
}
/**
* Build the Array for 'job_type'
*/
function job_type_options() {
$options = array('INDENT','STOCK','COMMISSION','SERVICE');
//$options = array('INDENT','STOCK','COMMISSION','SERVICE');
$options = array('GOODS','SERVICES');
$enumOpts = $this->buildEnumOpts($options);
return $enumOpts;
}
function shipment_options() {
$options = array('AUSTRALIA','EXPORT','DIRECT-INTL','DIRECT-AUST','NO-SHIP');
$enumOpts = $this->buildEnumOpts($options);
return $enumOpts;
function shipment_category_options() {
$options = array(
0 => 'Indent - via CMC',
1 => 'Direct - Principle to final',
2 => 'Stock',
3 => 'No Shipment'
);
return $options;
}
function freight_paid_options() {
@ -286,7 +295,7 @@ class JobsController extends AppController {
function ajax_edit() {
if(!empty($this->data)) {
print_r($this->data);
if ($this->Job->save($this->data)) {
echo "SUCCESS";
}

View file

@ -49,13 +49,14 @@ class Job extends AppModel {
'Email' => array(
'className' => 'Email',
'joinTable' => 'emails_jobs',
),
'ShipmentCategory' => array(
'className' => 'ShipmentCategory',
'joinTable' => 'jobs_shipment_categories'
)
);
function getJobsByWeekNumber() {
}
}
?>

View file

@ -31,6 +31,9 @@
});
});
@ -70,7 +73,9 @@ else {
</td>
<td>
<?=$form->input('job_type', array('options'=>$job_type_options, 'label' => false, 'selected'=>$job['Job']['job_type']));?></td>
<td><?=$form->input('shipment_category', array('options'=>$shipment_options, 'label'=>false,'selected'=>$job['Job']['shipment_category']));?></td>
<td><?=$form->input('shipment_category', array('options'=>$shipment_category_options,
'type'=>'select','label'=>false,'value'=>$job['Job']['shipment_category']));?>
</td>
<td><?=$html->link($job['Job']['title'], array('controller'=>'jobs', 'action'=>'view', $job['Job']['id']));?></td>
<td><?=$html->link($job['Enquiry']['title'], array('controller'=>'enquiries','action'=>'view', $job['Enquiry']['id']));?>
<td><?

View file

@ -16,7 +16,7 @@
</td>
<td>
<?=$job['Job']['job_type'];?></td>
<td><?=$job['Job']['shipment_category'];?></td>
<td><?=$shipment_category_options[$job['Job']['shipment_category']];?></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><?

View file

@ -27,7 +27,7 @@ echo $paginator->counter(array(
</div>
<?php echo $form->create('Job', array('action'=>'/jobs/ajax_edit'));?>
<?php echo $form->create('Job', array('action'=>'/jobs/ajax_edit', 'default'=>false));?>
<div class="scrollHorizontal">
<table cellpadding="0" cellspacing="0" class="jobsTable">
<thead class="jobTableHead">
@ -93,7 +93,7 @@ echo $paginator->counter(array(
</td>
<td>
<?=$job['Job']['job_type'];?></td>
<td><?=$job['Job']['shipment_category'];?></td>
<td class="nowrap"><?=$shipment_category_options[$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><?

View file

@ -17,7 +17,7 @@
<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>Net Export Sales Converted to Or Invoiced in AUD</th>
<th>GP% Excl Commissions</th>
<th>ATO Exchange Rate</th>
@ -81,7 +81,7 @@
</td>
<td>
<?=$job['Job']['company_gross_sales_aud'];?>
<?=$number->currency($job['Job']['company_gross_sales_aud']);?>
<?
if($doCount) {
$gross_sales_aud_total += $job['Job']['company_gross_sales_aud'];
@ -89,7 +89,7 @@
?>
</td>
<td>
<?=$job['Job']['net_sales_aud'];?>
<?=$number->currency($job['Job']['net_sales_aud']);?>
<?
if($doCount) {
$net_sales_aud_total += $job['Job']['net_sales_aud'];
@ -97,7 +97,7 @@
} ?>
</td>
<td>
<?=$job['Job']['gross_profit_aud'];?>
<?=$number->currency($job['Job']['gross_profit_aud']);?>
<?
if($doCount) {
$gross_profit_total += $job['Job']['gross_profit_aud'];
@ -107,7 +107,7 @@
</td>
<td>
<?=$job['Job']['gross_profit_exports_aud'];?>
<?=$number->currency($job['Job']['gross_profit_exports_aud']);?>
</td>
<td>
<?=$job['Job']['gp_percent'];?>
@ -116,14 +116,14 @@
<td>
<?=$job['Job']['ato_exchange_rate'];?>
</td>
<td> <?=$job['Job']['gross_australian_sales_foreign_currency'];?>
<td> <?=$number->currency($job['Job']['gross_australian_sales_foreign_currency'], $job['Currency']['iso4217']);?>
<?
if($doCount) {
$gross_australian_sales_foreign_currency_total += $job['Job']['gross_australian_sales_foreign_currency']; }
?>
</td>
<td>
<?=$job['Job']['net_australian_sales_foreign_currency'];
<?=$number->currency($job['Job']['net_australian_sales_foreign_currency'], $job['Currency']['iso4217']);
if($doCount) {
$net_australian_sales_foreign_currency_total += $job['Job']['net_australian_sales_foreign_currency'];
@ -131,7 +131,7 @@
?>
</td>
<td> <?=$job['Job']['gross_profit_value_australian_sales_foreign_currency'];
<td> <?=$number->currency($job['Job']['gross_profit_value_australian_sales_foreign_currency'], $job['Currency']['iso4217']);
if($doCount) {
$gross_profit_value_australian_sales_foreign_currency_total += $job['Job']['gross_profit_value_australian_sales_foreign_currency'];
@ -139,7 +139,7 @@
?>
</td>
<td>
<?=$job['Job']['gross_export_sales_foreign_currency'];
<?=$number->currency($job['Job']['gross_export_sales_foreign_currency'],$job['Currency']['iso4217']);
if($doCount) {
@ -147,13 +147,13 @@
}
?>
</td>
<td> <?=$job['Job']['net_export_sales_foreign_currency'];
<td> <?=$number->currency($job['Job']['net_export_sales_foreign_currency'],$job['Currency']['iso4217']);
if($doCount) {
$net_export_sales_foreign_currency_total += $job['Job']['net_export_sales_foreign_currency'];
}
?>
</td>
<td> <?=$job['Job']['gross_profit_value_after_discount_exports_foreign_currency'];
<td> <?=$number->currency($job['Job']['gross_profit_value_after_discount_exports_foreign_currency'],$job['Currency']['iso4217']);
if($doCount) {
$gross_profit_value_after_discount_exports_foreign_currency_total += $job['Job']['gross_profit_value_after_discount_exports_foreign_currency'];
@ -161,13 +161,13 @@
?>
</td>
<td>
<?=$job['Job']['gross_commissions'];
<?=$number->currency($job['Job']['gross_commissions']);
if($doCount) {
$gross_commissions_total += $job['Job']['gross_commissions'];
}
?>
</td>
<td> <?=$job['Job']['net_commissions'];
<td> <?=$number->currency($job['Job']['net_commissions']);
if($doCount) {
$net_commissions_total += $job['Job']['net_commissions'];
}
@ -210,5 +210,5 @@
<?
//print_r($jobs);
print_r($jobs);
?>

View file

@ -1354,6 +1354,10 @@ select.job_status {
overflow:scroll;
}
select.shipmentCategories {
width: 200px;
}
/* CSS for the Job Reporting */
@ -1388,10 +1392,12 @@ ul.monthList li {
span.month {
cursor: pointer;
font-size: 80%
}
span.year {
cursor: pointer;
}
tr.cancelled td {

View file

@ -1,9 +1,10 @@
$(function() {
// $(".editButton").show();
// $(".editButton").show();
$(".editButton").live('click',function() {
@ -27,10 +28,31 @@ $(function() {
var id = $(this).parents('tr').attr('id');
var thisJobInputs = $('#'+id).find('input,select');
/*var selectedShipmentCategories = [];
$('#'+id+'_shipment_categories option').each(function(i) {
if (this.selected == true) {
selectedShipmentCategories.push(this.value);
}
});
alert(selectedShipmentCategories);
*/
$.post('/jobs/ajax_edit', thisJobInputs, function(data) {
getViewable(id);
});
/*$.ajax({
type:"post",
url:"/ajax_edit",
data: {
'job': thisJobInputs,
'shipmentCategory': selectedShipmentCategories
}
}); */
return false;
});