Shipment Register going live
This commit is contained in:
parent
490ba20cce
commit
726d5f4c72
|
|
@ -66,9 +66,9 @@ class ShipmentsController extends AppController {
|
||||||
$freightForwarders = $this->Shipment->FreightForwarder->find('list');
|
$freightForwarders = $this->Shipment->FreightForwarder->find('list');
|
||||||
$shipmentType = $this->typeOptions(false);
|
$shipmentType = $this->typeOptions(false);
|
||||||
$shipmentTypeShort = $this->typeOptions(true);
|
$shipmentTypeShort = $this->typeOptions(true);
|
||||||
$currencies = $this->Shipment->ShipmentInvoice->Currency->find('list');
|
$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'));
|
$this->set(compact('principles', 'freightForwarders', 'shipmentType', 'shipmentTypeShort', 'currencies', 'principles'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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}.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}.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}.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_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}.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'));
|
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("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("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_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("invoice_amount", array('label'=>'Invoice Amount', 'div'=>'inv_invoice_amount'));
|
||||||
echo $form->input("gst_amount", array('label'=>'GST Amount', 'div'=>'inv_gst_amount'));
|
echo $form->input("gst_amount", array('label'=>'GST Amount', 'div'=>'inv_gst_amount'));
|
||||||
|
|
|
||||||
|
|
@ -1,142 +1,169 @@
|
||||||
<table cellpadding="0" cellspacing="0" class="shipments">
|
<table cellpadding="0" cellspacing="0" class="shipments">
|
||||||
<tr>
|
<tr>
|
||||||
<th class="actions"><?php __('Actions');?></th>
|
<th class="actions"><?php __('Actions');?></th>
|
||||||
<th><?php echo $paginator->sort('date_arrived');?></th>
|
<th><?php echo $paginator->sort('date_arrived');?></th>
|
||||||
<th><?php echo $paginator->sort('date_dispatched');?></th>
|
<th><?php echo $paginator->sort('date_dispatched');?></th>
|
||||||
<th><?php echo $paginator->sort('type');?></th>
|
<th><?php echo $paginator->sort('type');?></th>
|
||||||
<th>Principle(s)</th>
|
<th>Principle(s)</th>
|
||||||
<th>PO(s)</th>
|
<th>PO(s)</th>
|
||||||
<th>Jobs</th>
|
<th>Jobs</th>
|
||||||
<th><?php echo $paginator->sort('# Boxes','box_count');?></th>
|
<th><?php echo $paginator->sort('# Boxes','box_count');?></th>
|
||||||
<th>Box Details<br>
|
<th>Box Details<br>
|
||||||
LxWxH (cm)
|
LxWxH (cm)
|
||||||
</th>
|
</th>
|
||||||
<th>Weight (kg)</th>
|
<th>Weight (kg)</th>
|
||||||
<th><?php echo $paginator->sort('freight_forwarder_id');?></th>
|
<th><?php echo $paginator->sort('freight_forwarder_id');?></th>
|
||||||
<th><?php echo $paginator->sort('airway_bill');?></th>
|
<th><?php echo $paginator->sort('airway_bill');?></th>
|
||||||
<th># Invoices</th>
|
<th># Invoices</th>
|
||||||
<th>Issued By</th>
|
<th>Issued By</th>
|
||||||
<th>Invoice Amount</th>
|
<th>Invoice Amount</th>
|
||||||
<th>Deferred GST</th>
|
<th>Deferred GST</th>
|
||||||
<th>Approved?</th>
|
<th>Approved?</th>
|
||||||
<th>Paid?</th>
|
<th>Paid?</th>
|
||||||
<th>Date Paid</th>
|
<th>Date Paid</th>
|
||||||
|
|
||||||
|
|
||||||
<th><?php echo $paginator->sort('comments');?></th>
|
<th><?php echo $paginator->sort('comments');?></th>
|
||||||
<th class="actions"><?php __('Actions');?></th>
|
<th class="actions"><?php __('Actions');?></th>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($shipments as $shipment):
|
foreach ($shipments as $shipment):
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td class="actions">
|
||||||
|
<button id="<?=$shipment['Shipment']['id']?>" class="editButton">Edit</button>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<?php
|
||||||
|
echo $this->element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived']));
|
||||||
?>
|
?>
|
||||||
<tr>
|
</td>
|
||||||
<td class="actions">
|
<td>
|
||||||
<button id="<?=$shipment['Shipment']['id']?>" class="editButton">Edit</button>
|
<?php
|
||||||
</td>
|
echo $this->element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched']));
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php echo $shipmentTypeShort[$shipment['Shipment']['type']]; ?>
|
||||||
echo $this->element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived']));
|
</td>
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<?php
|
|
||||||
echo $this->element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched']));
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $shipmentTypeShort[$shipment['Shipment']['type']]; ?>
|
<?php foreach($shipment['Principle'] as $principle):?>
|
||||||
</td>
|
<? 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']));
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
<td>
|
<br>
|
||||||
<?php foreach($shipment['Principle'] as $principle):?>
|
<?php endforeach;?>
|
||||||
<? if(!empty($principle['short_name'])) {
|
</td>
|
||||||
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']));
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
|
|
||||||
<br>
|
<td>
|
||||||
<?php endforeach;?>
|
<?php foreach($shipment['PurchaseOrder'] as $po):?>
|
||||||
</td>
|
<?=$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
|
||||||
|
<br>
|
||||||
|
<?endforeach;?>
|
||||||
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php foreach($shipment['PurchaseOrder'] as $po):?>
|
<?php foreach($shipment['Job'] as $job):?>
|
||||||
<?=$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
|
<?=$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
|
||||||
<br>
|
<br>
|
||||||
<?endforeach;?>
|
<?endforeach;?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php foreach($shipment['Job'] as $job):?>
|
<?php echo $shipment['Shipment']['box_count']; ?>
|
||||||
<?=$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
|
</td>
|
||||||
<br>
|
|
||||||
<?endforeach;?>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
<td class="boxDimensions">
|
||||||
<?php echo $shipment['Shipment']['box_count']; ?>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td class="boxDimensions">
|
<?php
|
||||||
|
|
||||||
<?php
|
$totalWeight = 0;
|
||||||
|
$weightString = '';
|
||||||
|
|
||||||
$totalWeight = 0;
|
foreach($shipment['Box'] as $box):?>
|
||||||
$weightString = '';
|
<?=$box['length']?>x<?=$box['width']?>x<?=$box['height']?><br>
|
||||||
|
<?
|
||||||
|
$weightString .= $box['weight'].' kg <br>';
|
||||||
|
$totalWeight += $box['weight']; ?>
|
||||||
|
<?php endforeach;?>
|
||||||
|
|
||||||
foreach($shipment['Box'] as $box):?>
|
</td>
|
||||||
<?=$box['length']?>x<?=$box['width']?>x<?=$box['height']?><br>
|
|
||||||
<?
|
|
||||||
$weightString .= $box['weight'].' kg <br>';
|
|
||||||
$totalWeight += $box['weight']; ?>
|
|
||||||
<?php endforeach;?>
|
|
||||||
|
|
||||||
</td>
|
<td> <?
|
||||||
|
|
||||||
<td> <?
|
$boxCount = $shipment['Shipment']['box_count'];
|
||||||
|
if($boxCount > 1) {
|
||||||
|
echo $weightString;
|
||||||
|
echo '<hr>';
|
||||||
|
|
||||||
$boxCount = $shipment['Shipment']['box_count'];
|
}?>
|
||||||
if($boxCount > 1) {
|
<? if($boxCount != 0): ?>
|
||||||
echo $weightString;
|
<span class="totalWeight"><?=$totalWeight;?> kg</span></td>
|
||||||
echo '<hr>';
|
<? endif;?>
|
||||||
|
<td>
|
||||||
}?>
|
<?php echo $html->link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?>
|
||||||
<? if($boxCount != 0): ?>
|
</td>
|
||||||
<span class="totalWeight"><?=$totalWeight;?> kg</span></td>
|
|
||||||
<? endif;?>
|
|
||||||
<td>
|
|
||||||
<?php echo $html->link($shipment['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipment['FreightForwarder']['id'])); ?>
|
|
||||||
</td>
|
|
||||||
|
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $shipment['Shipment']['airway_bill']; ?>
|
<?php echo $shipment['Shipment']['airway_bill']; ?>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?=$shipment['Shipment']['shipment_invoice_count'];?>
|
<?=$shipment['Shipment']['shipment_invoice_count'];?>
|
||||||
</td>
|
</td>
|
||||||
<td>Issued By Principle/FF name
|
<td><?foreach($shipment['ShipmentInvoice'] as $si) {
|
||||||
</td>
|
if(!empty($si['principle_id'])) {
|
||||||
|
echo $principles[$si['principle_id']];
|
||||||
|
}
|
||||||
|
else if(!empty($si['freight_forwarder_id'])) {
|
||||||
|
echo $freightForwarders[$si['freight_forwarder_id']];
|
||||||
|
}
|
||||||
|
else if($si['invoice_type'] == 2) {
|
||||||
|
echo "CUSTOMS";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "";
|
||||||
|
}
|
||||||
|
echo "<br>";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
|
||||||
<td>Invoice amount</td>
|
<td class="boxDimensions"><? foreach($shipment['ShipmentInvoice'] as $si) {
|
||||||
<td>Deferred GST amount</td>
|
echo $currencies[$si['currency_id']]." ".$si['invoice_amount']."<br />";
|
||||||
|
}?>
|
||||||
|
</td>
|
||||||
|
<td><?
|
||||||
|
if($si['deferred_gst'] == 1) {
|
||||||
|
foreach($shipment['ShipmentInvoice'] as $si) {
|
||||||
|
echo $currencies[$si['currency_id']]." ".$si['deferred_gst_amount']."<br />";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</td>
|
||||||
|
|
||||||
<td>Approved?</td>
|
<td><?=$this->element('booleanTick', array('bool'=>$si['approved'])); ?></td>
|
||||||
<td>Paid</td>
|
<td><?=$this->element('booleanTick', array('bool'=>$si['paid'])); ?></td>
|
||||||
<td>Date Paid</td>
|
<td><?=$this->element('isEmptyDate', array('date'=>$si['date_paid']));?></td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
<?php echo $shipment['Shipment']['comments']; ?>
|
<?php echo $shipment['Shipment']['comments']; ?>
|
||||||
</td>
|
</td>
|
||||||
<td class="actions">
|
<td class="actions">
|
||||||
<button id="<?=$shipment['Shipment']['id']?>" class="editButton">Edit</button>
|
<button id="<?=$shipment['Shipment']['id']?>" class="editButton">Edit</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
<?php debug($currencies); ?>
|
||||||
|
|
@ -1444,7 +1444,7 @@ table.shipments {
|
||||||
|
|
||||||
.invForm {
|
.invForm {
|
||||||
border: 1px solid;
|
border: 1px solid;
|
||||||
width: 20em;
|
|
||||||
margin-top: 1em;
|
margin-top: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -263,7 +263,7 @@ $(function() {
|
||||||
newInvoiceForm.addClass('invForm');
|
newInvoiceForm.addClass('invForm');
|
||||||
newInvoiceForm.show();
|
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'];
|
'invoice_amount','gst_amount','deferred_gst', 'deferred_gst_amount','approved', 'paid', 'date_paid','invoice_type'];
|
||||||
|
|
||||||
var div;
|
var div;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue