Add Freight forwarder select box to PO view

Implement issue #89
This commit is contained in:
Karl Cordes 2024-09-18 14:05:33 +10:00
parent f6d2ae8f5c
commit 8b95717de7
5 changed files with 37 additions and 7 deletions

View file

@ -98,6 +98,21 @@ ENDDETAILS;
)
));
$sql = "SELECT DISTINCT freight_forwarder_text FROM purchase_orders WHERE freight_forwarder_text != '' ORDER BY freight_forwarder_text ASC;";
$previousValues = $this->Document->query($sql);
$ffOptions = array(
"CMC will make the booking with Fedex Economy. We will send you the labels. Please send us the packing list, invoice, weights and dimensions.",
"FEDEX Airfreight Economy service on CMC Account #409368441",
"FEDEX INTERNATIONAL Priority on CMC Account #409368441"
);
foreach($previousValues as $val) {
array_push($ffOptions, $val["purchase_orders"]["freight_forwarder_text"]);
}
asort($ffOptions);
$this->set('freightForwarderSelect', $ffOptions);
break;
case 'orderAck':
$this->set('currencies', $this->Document->OrderAcknowledgement->Currency->find('list'));
@ -1087,10 +1102,6 @@ EOT;
$label = "";
if (count($results) == 0) {
return;
}
if (count($results) > 0) {
$label = $results[0]["po"]["po_title"];
}
@ -1098,9 +1109,9 @@ EOT;
foreach ($results as $result) {
$label .= " / ". $result["j"]["job_title"];
}
$ffText = $po['PurchaseOrder']['freight_forwarder_text'];
echo <<<ENDINSTRUCTIONS
<b>FREIGHT FORWARDER:</b> $ffText<br>
<b>PART SHIPMENT:</b> Not Acceptable - please advise ASAP if production of an Item will Delay the Dispatch of the Complete Order by the Date Required stated above.<br>
<b>INSURANCE:</b> DO NOT INSURE - Insurance effected by CMC<br>
<b>SECURITY:</b> It is essential that the cargo is prepared & handled so as not to compromise its security standing.<br>

View file

@ -2,7 +2,7 @@
echo $javascript->link('ckeditor/ckeditor');
echo $javascript->link('ckeditor/adapters/jquery');
echo $javascript->link('document_add_edit_20240421');
echo $javascript->link('document_add_edit_20240918');
echo $javascript->link('document_attachments');
?>

View file

@ -45,8 +45,21 @@
echo $form->input('PurchaseOrder.dispatch_by');
echo $form->input('PurchaseOrder.deliver_to');
?>
<div class="input select"><label for="freightForwarderSelect">Freight Forwarder</label>
<select name="freightForwarderSelect" id="freightForwarderSelect">
<?php foreach($freightForwarderSelect as $opt) { ?>
<option value="<?php echo $opt; ?>"><?php echo $opt; ?></option>
<?php } ?>
</select>
</div>
<?php
echo $form->input('PurchaseOrder.freight_forwarder_text');
echo $form->input('PurchaseOrder.shipping_instructions');
?>
<button id="generateShippingInstructions">Regenerate shipping instructions</button>
<?php

View file

@ -530,6 +530,11 @@ $(function() {
});
});
// Changing Freight Forwarder text
$("#freightForwarderSelect").live('change', function(d) {
$("#PurchaseOrderFreightForwarderText").val(getSelectedText("#freightForwarderSelect"));
saveDocument('Purchase Order');
});
$("#createOA").click(function() {

View file

@ -0,0 +1 @@
ALTER TABLE purchase_orders ADD COLUMN freight_forwarder_text TEXT NOT NULL default '';