diff --git a/controllers/jobs_controller.php b/controllers/jobs_controller.php
index 383f7f79..cedd468c 100755
--- a/controllers/jobs_controller.php
+++ b/controllers/jobs_controller.php
@@ -166,6 +166,17 @@ class JobsController extends AppController {
}
+ function getFinancialYears() {
+
+ }
+
+
+
+ function getFirstFYday($year) {
+
+ }
+
+
/**
* Build an array of Years/Months with Jobs.
*
diff --git a/controllers/shipments_controller.php b/controllers/shipments_controller.php
index 03dfc8a2..f25c2230 100644
--- a/controllers/shipments_controller.php
+++ b/controllers/shipments_controller.php
@@ -106,7 +106,7 @@ class ShipmentsController extends AppController {
$invoiceType = $this->invoiceTypeOptions();
$this->set('yesNo', array(0=>'No', 1=>'Yes'));
-
+
$this->set(compact('principles', 'freightForwarders', 'shipmentType', 'shipmentTypeShort', 'currencies','invoiceType', 'yesNo'));
@@ -122,9 +122,18 @@ class ShipmentsController extends AppController {
if(!empty($this->data)) {
//$this->Shipment->create($this->data);
+ $shipment_id = $this->data['Shipment']['id'];
+
+ $this->Shipment->Box->deleteAll(array('shipment_id'=>$shipment_id));
+ $this->Shipment->ShipmentInvoice->deleteAll(array('shipment_id'=>$shipment_id));
+
+
if ($this->Shipment->saveAll($this->data)) {
- $boxIDs = array();
+ $this->Shipment->Box->updateCounterCache(array('shipment_id'=>$shipment_id));
+ $this->Shipment->ShipmentInvoice->updateCounterCache(array('shipment_id'=>$shipment_id));
+
+ /*$boxIDs = array();
foreach($this->data['Box'] as $box) {
$boxIDs[] = $box['id'];
@@ -134,8 +143,15 @@ class ShipmentsController extends AppController {
foreach($this->data['ShipmentInvoice'] as $si) {
$invoiceIDs[] = $si['id'];
}
- print_r($boxIDs);
+ print_r($boxIDs);*/
+ /*foreach($this->data['Job'] as $job) {
+ foreach($job as $index => $id) {
+ echo $id."\n";
+ }
+ }*/
+
+ print_r($this->data);
echo "SUCCESS";
@@ -160,6 +176,7 @@ class ShipmentsController extends AppController {
if ($this->Shipment->saveAll($this->data)) {
echo "SUCCESS";
+ print_r($this->data);
}
else {
echo "FAILURE";
@@ -174,6 +191,11 @@ class ShipmentsController extends AppController {
}
+ function markJobsSent() {
+
+ }
+
+
/* Moved the Views for Adding/Editing to elements. Called from the Index.
*
* function add($action = 'add') {
diff --git a/views/elements/add_edit_shipment.ctp b/views/elements/add_edit_shipment.ctp
index ab6ed829..261f1953 100644
--- a/views/elements/add_edit_shipment.ctp
+++ b/views/elements/add_edit_shipment.ctp
@@ -55,9 +55,9 @@ echo $form->input('id', array('type'=>'hidden'));
- echo $form->input('job', array('id'=>'job_autocomplete'));
+ echo $form->input('job', array('id'=>'job_autocomplete', array('label'=>'Job (start typing and select from the list)')));
?>
-
+
Jobs in this Shipment will be updated as "sent"
data['Job'] as $job):?>
@@ -72,7 +72,7 @@ echo $form->input('id', array('type'=>'hidden'));
- =$form->input('customer', array('id'=>'customer_autocomplete', 'label'=>'Customer', 'value'=>$this->data['Customer']['name']));?>
+ =$form->input('customer', array('id'=>'customer_autocomplete', 'label'=>'Customer (start typing and select from the list)', 'value'=>$this->data['Customer']['name']));?>
=$form->input('customer_id', array('type'=>'hidden', 'id'=>'customer_id', 'value'=>$this->data['Shipment']['customer_id']));?>
diff --git a/views/elements/shipment_index_all.ctp b/views/elements/shipment_index_all.ctp
index 879a23a1..e0787c1f 100644
--- a/views/elements/shipment_index_all.ctp
+++ b/views/elements/shipment_index_all.ctp
@@ -121,7 +121,8 @@
=$shipment['Shipment']['shipment_invoice_count'];?>
|
-
+ foreach($shipment['ShipmentInvoice'] as $si) {
if(!empty($si['principle_id'])) {
echo $principles[$si['principle_id']];
}
@@ -144,18 +145,31 @@
}?>
|
- if($si['deferred_gst'] == 1) {
- foreach($shipment['ShipmentInvoice'] as $si) {
+
+ foreach($shipment['ShipmentInvoice'] as $si) {
+
+ if($si['deferred_gst'] == 1) {
echo $currencies[$si['currency_id']]." ".$si['deferred_gst_amount']." ";
}
}
?>
|
- =$this->element('booleanTick', array('bool'=>$si['approved'])); ?> |
- =$this->element('booleanTick', array('bool'=>$si['paid'])); ?> |
- =$this->element('isEmptyDate', array('date'=>$si['date_paid']));?> |
+
+ foreach($shipment['ShipmentInvoice'] as $si) {
+ echo $this->element('booleanTick', array('bool'=>$si['approved'])); }
+ ?>
+ |
+ foreach($shipment['ShipmentInvoice'] as $si) {
+ echo $this->element('booleanTick', array('bool'=>$si['paid']));
+ }?>
+ |
+ foreach($shipment['ShipmentInvoice'] as $si) {
+ echo $this->element('isEmptyDate', array('date'=>$si['date_paid']));
+ }
+ ?>
+ |
|
diff --git a/webroot/js/shipment_index.js b/webroot/js/shipment_index.js
index c0dce791..2edc9c3c 100644
--- a/webroot/js/shipment_index.js
+++ b/webroot/js/shipment_index.js
@@ -45,7 +45,7 @@ $(function() {
$.post('/shipments/ajax_edit', thisShipmentInputs, function(data) {
$( "#edit-form" ).dialog('close');
- window.location.reload(); //Change this to fetch a new copy of the table and update a .
+ // window.location.reload(); //Change this to fetch a new copy of the table and update a
.
});
},
@@ -69,9 +69,10 @@ $(function() {
$.get('/shipments/add/', false, function(data) {
$("#add-form").html(data);
+ $( "#add-form" ).dialog( "open" );
} );
- $( "#add-form" ).dialog( "open" );
+
});
@@ -83,9 +84,10 @@ $(function() {
$.get('/shipments/edit/'+id, false, function(data) {
$("#edit-form").html(data);
+ $( "#edit-form" ).dialog( "open" );
} );
- $( "#edit-form" ).dialog( "open" );
+
});