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')); echo $form->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('date_arrived');?> | -sort('date_dispatched');?> | -sort('type');?> | -Principle(s) | -PO(s) | -Jobs | -sort('# Boxes','box_count');?> | -Box Details + | |||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| + | sort('date_arrived');?> | +sort('date_dispatched');?> | +sort('type');?> | +Principle(s) | +PO(s) | +Jobs | +sort('# Boxes','box_count');?> | +Box Details LxWxH (cm) - |
- Weight (kg) | -sort('freight_forwarder_id');?> | -sort('airway_bill');?> | -# Invoices | -Issued By | -Invoice Amount | -Deferred GST | -Approved? | -Paid? | -Date Paid | - + +Weight (kg) | +sort('freight_forwarder_id');?> | +sort('airway_bill');?> | +# Invoices | +Issued By | +Invoice Amount | +Deferred GST | +Approved? | +Paid? | +Date Paid | -sort('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'])); - ?> - | ++ + | -- - | ++ + if(!empty($principle['short_name'])) { + echo $html->link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + else { + echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id'])); + } + ?> - |
-
- if(!empty($principle['short_name'])) {
- echo $html->link($principle['short_name'], array('controller'=>'principles','action'=>'view',$principle['id']));
- }
- else {
- echo $html->link($principle['name'], array('controller'=>'principles','action'=>'view',$principle['id']));
- }
- ?>
+ + + |
-
+
+ =$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
+ + + |
-
-
- =$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
- - - |
+
+
+ =$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
+ + + |
-
-
- =$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
- - - |
+ + + | -- - | +- |
+
+ =$box['length']?>x=$box['width']?>x=$box['height']?> + + $weightString .= $box['weight'].' kg '; + $totalWeight += $box['weight']; ?> + - foreach($shipment['Box'] as $box):?> - =$box['length']?>x=$box['width']?>x=$box['height']?> - - $weightString .= $box['weight'].' kg '; - $totalWeight += $box['weight']; ?> - + |
-
+ - |
+ $boxCount = $shipment['Shipment']['box_count'];
+ if($boxCount > 1) {
+ echo $weightString;
+ echo ' '; - $boxCount = $shipment['Shipment']['box_count']; - if($boxCount > 1) { - echo $weightString; - echo ' '; - - }?> - if($boxCount != 0): ?> - =$totalWeight;?> kg |
- endif;?>
- - link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> - | + }?> + if($boxCount != 0): ?> + =$totalWeight;?> kg + endif;?> ++ link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?> + | -- - | ++ + | -- =$shipment['Shipment']['shipment_invoice_count'];?> - | -Issued By Principle/FF name - | ++ =$shipment['Shipment']['shipment_invoice_count'];?> + | +"; + } + ?> + | -Invoice amount | -Deferred GST amount | + foreach($shipment['ShipmentInvoice'] as $si) {
+ echo $currencies[$si['currency_id']]." ".$si['invoice_amount']." "; + }?> + |
+
+ if($si['deferred_gst'] == 1) {
+ foreach($shipment['ShipmentInvoice'] as $si) {
+ echo $currencies[$si['currency_id']]." ".$si['deferred_gst_amount']." "; + } + } + ?> + |
- Approved? | -Paid | -Date Paid | +=$this->element('booleanTick', array('bool'=>$si['approved'])); ?> | +=$this->element('booleanTick', array('bool'=>$si['paid'])); ?> | +=$this->element('isEmptyDate', array('date'=>$si['date_paid']));?> | -- - | -- - | -