From 726d5f4c72552ac5dcce04fa7591cf0671a30e7a Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Mon, 9 May 2011 14:12:00 +1000 Subject: [PATCH] Shipment Register going live --- controllers/shipments_controller.php | 6 +- views/elements/add_edit_shipment.ctp | 4 +- views/elements/shipment_index_all.ctp | 263 ++++++++++++++------------ webroot/css/quotenik.css | 2 +- webroot/js/add_edit_shipment.js | 2 +- 5 files changed, 153 insertions(+), 124 deletions(-) diff --git a/controllers/shipments_controller.php b/controllers/shipments_controller.php index 6331e510..03dfc8a2 100644 --- a/controllers/shipments_controller.php +++ b/controllers/shipments_controller.php @@ -66,9 +66,9 @@ class ShipmentsController extends AppController { $freightForwarders = $this->Shipment->FreightForwarder->find('list'); $shipmentType = $this->typeOptions(false); $shipmentTypeShort = $this->typeOptions(true); - $currencies = $this->Shipment->ShipmentInvoice->Currency->find('list'); - - $this->set(compact('principles', 'freightForwarders', 'shipmentType', 'shipmentTypeShort', 'currencies')); + $currencies = $this->Shipment->ShipmentInvoice->Currency->find('list', array('fields'=>array('Currency.id','Currency.iso4217'))); + $principles = $this->Shipment->Principle->find('list'); + $this->set(compact('principles', 'freightForwarders', 'shipmentType', 'shipmentTypeShort', 'currencies', 'principles')); } diff --git a/views/elements/add_edit_shipment.ctp b/views/elements/add_edit_shipment.ctp index fb682f6e..ab6ed829 100644 --- a/views/elements/add_edit_shipment.ctp +++ b/views/elements/add_edit_shipment.ctp @@ -140,6 +140,7 @@ echo $form->input('id', array('type'=>'hidden')); echo $form->input("ShipmentInvoice.{$invNo}.invoice_type", array('type'=>'select','label'=>'Invoice Type', 'div'=>'inv_invoice_type', 'options'=>$invoiceType)); echo $form->input("ShipmentInvoice.{$invNo}.currency_id",array('label'=>'Currency', 'div'=>'inv_currency_id', 'options'=>$currencies, 'empty'=>'Choose Invoice Currency')); echo $form->input("ShipmentInvoice.{$invNo}.freight_forwarder_id", array('label'=>'Freight Forwarder', 'div'=>'inv_freight_forwarder_id', 'options'=>$freightForwarders, 'empty'=>'Select Freight Forwarder')); + echo $form->input("ShipmentInvoice.{$invNo}.principle_id", array('label'=>'Invoice Issued by Principle', 'div'=>'inv_principle_id', 'options'=>$principles, 'empty'=>'Select Principle')); echo $form->input("ShipmentInvoice.{$invNo}.invoice_number", array('label'=>'Invoice Number', 'div'=>'inv_invoice_number')); echo $form->input("ShipmentInvoice.{$invNo}.invoice_amount", array('label'=>'Invoice Amount', 'div'=>'inv_invoice_amount')); echo $form->input("ShipmentInvoice.{$invNo}.gst_amount", array('label'=>'GST Amount', 'div'=>'inv_gst_amount')); @@ -175,7 +176,8 @@ echo $form->input('id', array('type'=>'hidden')); input("invoice_type", array('type'=>'select','label'=>'Invoice Type', 'div'=>'inv_invoice_type', 'options'=>$invoiceType)); echo $form->input("currency_id",array('label'=>'Currency', 'div'=>'inv_currency_id', 'options'=>$currencies, 'empty'=>'Choose Invoice Currency')); - echo $form->input("freight_forwarder_id", array('label'=>'Freight Forwarder', 'div'=>'inv_freight_forwarder_id', 'options'=>$freightForwarders, 'empty'=>'Select Freight Forwarder')); + echo $form->input("freight_forwarder_id", array('label'=>'Invoice Issued by Freight Forwarder', 'div'=>'inv_freight_forwarder_id', 'options'=>$freightForwarders, 'empty'=>'Select Freight Forwarder')); + echo $form->input('principle_id', array('label'=>'Invoice Issued by Principle', 'div'=>'inv_principle_id', 'options'=>$principles, 'empty'=>'Select Principle')); echo $form->input("invoice_number", array('label'=>'Invoice Number', 'div'=>'inv_invoice_number')); echo $form->input("invoice_amount", array('label'=>'Invoice Amount', 'div'=>'inv_invoice_amount')); echo $form->input("gst_amount", array('label'=>'GST Amount', 'div'=>'inv_gst_amount')); diff --git a/views/elements/shipment_index_all.ctp b/views/elements/shipment_index_all.ctp index c49d17aa..879a23a1 100644 --- a/views/elements/shipment_index_all.ctp +++ b/views/elements/shipment_index_all.ctp @@ -1,142 +1,169 @@ - - - - - - - - - - + + + + + + + + + - - - - - - - - - - - + + + + + + + + + + + - - - - sort('comments');?> + + + + + + + - + + - - + - + -
- - + - + - + - + - + - - + }?> + + kg + + - + - - + + - - + + - - - + + + - - - - -
sort('date_arrived');?>sort('date_dispatched');?>sort('type');?>Principle(s)PO(s)Jobssort('# Boxes','box_count');?>Box Details
+
sort('date_arrived');?>sort('date_dispatched');?>sort('type');?>Principle(s)PO(s)Jobssort('# Boxes','box_count');?>Box Details
LxWxH (cm) -
Weight (kg)sort('freight_forwarder_id');?>sort('airway_bill');?># InvoicesIssued ByInvoice AmountDeferred GSTApproved?Paid?Date PaidWeight (kg)sort('freight_forwarder_id');?>sort('airway_bill');?># InvoicesIssued ByInvoice AmountDeferred GSTApproved?Paid?Date Paidsort('comments');?>
+ + + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); ?> -
- - + element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); + ?> + - element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived'])); - ?> - - element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched'])); - ?> - + + - - + + link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + else { + echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + ?> - - - link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id'])); - } - else { - echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id'])); - } - ?> +
+ +
+ + link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?> +
+ +
- - link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?> -
- -
+ + link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?> +
+ +
- - link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?> -
- -
+ + - - - + + xx
+ '; + $totalWeight += $box['weight']; ?> + - foreach($shipment['Box'] as $box):?> - xx
- '; - $totalWeight += $box['weight']; ?> - +
1) { + echo $weightString; + echo '
'; - $boxCount = $shipment['Shipment']['box_count']; - if($boxCount > 1) { - echo $weightString; - echo '
'; - - }?> - - kg
- link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> - + link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + - - + + - - Issued By Principle/FF name - + + "; + } + ?> + Invoice amountDeferred GST amount"; + }?> + "; + } + } + ?> + Approved?PaidDate Paidelement('booleanTick', array('bool'=>$si['approved'])); ?>element('booleanTick', array('bool'=>$si['paid'])); ?>element('isEmptyDate', array('date'=>$si['date_paid']));?> - - - -
\ No newline at end of file + + + + + + + + + + + \ No newline at end of file diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css index 6ace6cdd..8d87695c 100755 --- a/webroot/css/quotenik.css +++ b/webroot/css/quotenik.css @@ -1444,7 +1444,7 @@ table.shipments { .invForm { border: 1px solid; - width: 20em; + margin-top: 1em; } diff --git a/webroot/js/add_edit_shipment.js b/webroot/js/add_edit_shipment.js index 2053380c..3fcce710 100644 --- a/webroot/js/add_edit_shipment.js +++ b/webroot/js/add_edit_shipment.js @@ -263,7 +263,7 @@ $(function() { newInvoiceForm.addClass('invForm'); newInvoiceForm.show(); - var invFields = ['currency_id', 'freight_forwarder_id', 'invoice_number', + var invFields = ['currency_id','principle_id', 'freight_forwarder_id', 'invoice_number', 'invoice_amount','gst_amount','deferred_gst', 'deferred_gst_amount','approved', 'paid', 'date_paid','invoice_type']; var div;