diff --git a/controllers/jobs_controller.php b/controllers/jobs_controller.php index ed8b53b6..2f2dd5f2 100755 --- a/controllers/jobs_controller.php +++ b/controllers/jobs_controller.php @@ -15,10 +15,10 @@ class JobsController extends AppController { ); function index() { -/* $this->Job->recursive = 1; + $this->Job->recursive = 1; $this->set('jobs', $this->paginate()); $this->set('customers', $this->Job->Enquiry->Customer->find('list')); - $this->set('currencies', $this->Job->Currency->find('list'));*/ + $this->set('currencies', $this->Job->Currency->find('list')); } diff --git a/views/jobs/build_jobs_json.ctp b/views/jobs/build_jobs_json.ctp index 40f53fe0..88568536 100644 --- a/views/jobs/build_jobs_json.ctp +++ b/views/jobs/build_jobs_json.ctp @@ -25,61 +25,70 @@ $i=0; foreach($jobs as $job) { - $cellArray = array( + $poString = ''; + foreach($job['PurchaseOrder'] as $po) { + $poString .= ' '.$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id'])); + } - // $job['Job']['id'], - $job['Job']['job_status'], - $job['Job']['sale_category'], - $job['Job']['shipment_category'], - $html->link($job['Job']['title'], array('controller'=>'jobs','action'=>'view', $job['Job']['id'])), - $html->link($customers[$job['Enquiry']['customer_id']], array('controller'=>'customers','action'=>'view', $job['Enquiry']['customer_id'])), - $job['Job']['comments'], - $job['Job']['customer_order_number'], - $job['Job']['date_order_received'], + $cellArray = array( - $job['Job']['supplier_reference'], - $job['Job']['date_order_placed_on_principle'], - - $job['Job']['date_scheduled_ex_works'], - $job['Job']['date_order_sent_to_customer'], - $job['Job']['domestic_freight_paid_by'], + // $job['Job']['id'], - - $job['Job']['company_gross_sales_aud'], - $job['Job']['net_sales_aud'], - $job['Job']['gross_profit_aud'], - $job['Job']['ato_exchange_rate'], - $job['Job']['gst'], - $job['Job']['currency_id'], - $job['Job']['gst_amount'], - $job['Job']['gross_commisions'], - $job['Job']['invoiced_amount_inc_gst'], - $job['Job']['net_export_sales_aud'], - $job['Job']['gross_profit_exports_aud'], - $job['Job']['gp_percent'], - $job['Job']['gross_australian_sales_foreign_currency'], - $job['Job']['net_australian_sales_foreign_currency'], - $job['Job']['gross_profit_value_australian_sales_foreign_currency'], - $job['Job']['gross_export_sales_foreign_currency'], - $job['Job']['net_export_sales_foreign_currency'], - $job['Job']['gross_profit_value_after_discount_exports_foreign_currency'], - $job['Job']['gross_commissions'], - $job['Job']['net_commissions'] - ); + $job['Job']['job_status'], + $job['Job']['sale_category'], + $job['Job']['shipment_category'], + $html->link($job['Job']['title'], array('controller'=>'jobs','action'=>'view', $job['Job']['id'])), + $poString, + + + $html->link($customers[$job['Enquiry']['customer_id']], array('controller'=>'customers','action'=>'view', $job['Enquiry']['customer_id'])), + $job['Job']['comments'], + $job['Job']['customer_order_number'], + $job['Job']['date_order_received'], + + $job['Job']['supplier_reference'], + $job['Job']['date_order_placed_on_principle'], + + $job['Job']['date_scheduled_ex_works'], + $job['Job']['date_order_sent_to_customer'], + $job['Job']['domestic_freight_paid_by'], + + + $job['Job']['company_gross_sales_aud'], + $job['Job']['net_sales_aud'], + $job['Job']['gross_profit_aud'], + $job['Job']['ato_exchange_rate'], + $job['Job']['gst'], + $job['Job']['currency_id'], + $job['Job']['gst_amount'], + $job['Job']['gross_commisions'], + $job['Job']['invoiced_amount_inc_gst'], + $job['Job']['net_export_sales_aud'], + $job['Job']['gross_profit_exports_aud'], + $job['Job']['gp_percent'], + $job['Job']['gross_australian_sales_foreign_currency'], + $job['Job']['net_australian_sales_foreign_currency'], + $job['Job']['gross_profit_value_australian_sales_foreign_currency'], + $job['Job']['gross_export_sales_foreign_currency'], + $job['Job']['net_export_sales_foreign_currency'], + $job['Job']['gross_profit_value_after_discount_exports_foreign_currency'], + $job['Job']['gross_commissions'], + $job['Job']['net_commissions'] + ); - $recordObj->rows[$i]['id'] = $job['Job']['id']; - //$rows[$i] = $job; - $recordObj->rows[$i]['cell'] = $cellArray; - //$recordObj->rows[$i]['cell'] = $job['Job']; - $i++; -}; + $recordObj->rows[$i]['id'] = $job['Job']['id']; + //$rows[$i] = $job; + $recordObj->rows[$i]['cell'] = $cellArray; + //$recordObj->rows[$i]['cell'] = $job['Job']; + $i++; + }; -$jsonObj = json_encode($recordObj); -echo $jsonObj; + $jsonObj = json_encode($recordObj); + echo $jsonObj; ?> \ No newline at end of file diff --git a/views/jobs/index.ctp b/views/jobs/index.ctp index 6a38ebfc..16aec24d 100644 --- a/views/jobs/index.ctp +++ b/views/jobs/index.ctp @@ -22,5 +22,5 @@ echo $javascript->link('job_index');
- \ No newline at end of file diff --git a/webroot/js/job_grid.js b/webroot/js/job_grid.js index b4ffd09a..b1aca5d6 100644 --- a/webroot/js/job_grid.js +++ b/webroot/js/job_grid.js @@ -36,7 +36,7 @@ jQuery(document).ready(function(){ mtype: 'GET', colNames:[ //'id', - 'Status', 'Sale Cat.','Shipment Cat.','Job Number','Customer','Description','Customer O/N','Order Received','Supplier Ref', + 'Status', 'Sale Cat.','Shipment Cat.','Job Number','CMC POs', 'Customer','Description','Customer O/N','Order Received','Supplier Ref', 'Order Placed Principle','date_scheduled_ex_works','date_order_sent_to_customer','Freight Paid By', 'company_gross_sales_aud','net_sales_aud','gross_profit_aud','ato_exchange_rate', 'gst','Sale Currency','gst_amount','gross_commisions','invoiced_amount_inc_gst','net_export_sales_aud', @@ -107,6 +107,13 @@ jQuery(document).ready(function(){ editable:false }, + { + name:'purchase_orders', + index:'purchase_orders', + width:100, + editable:false + }, + { name:'customer', index:'customer',