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');
|
||||
$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'));
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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'));
|
||||
|
|
|
|||
|
|
@ -1,142 +1,169 @@
|
|||
<table cellpadding="0" cellspacing="0" class="shipments">
|
||||
<tr>
|
||||
<th class="actions"><?php __('Actions');?></th>
|
||||
<th><?php echo $paginator->sort('date_arrived');?></th>
|
||||
<th><?php echo $paginator->sort('date_dispatched');?></th>
|
||||
<th><?php echo $paginator->sort('type');?></th>
|
||||
<th>Principle(s)</th>
|
||||
<th>PO(s)</th>
|
||||
<th>Jobs</th>
|
||||
<th><?php echo $paginator->sort('# Boxes','box_count');?></th>
|
||||
<th>Box Details<br>
|
||||
<tr>
|
||||
<th class="actions"><?php __('Actions');?></th>
|
||||
<th><?php echo $paginator->sort('date_arrived');?></th>
|
||||
<th><?php echo $paginator->sort('date_dispatched');?></th>
|
||||
<th><?php echo $paginator->sort('type');?></th>
|
||||
<th>Principle(s)</th>
|
||||
<th>PO(s)</th>
|
||||
<th>Jobs</th>
|
||||
<th><?php echo $paginator->sort('# Boxes','box_count');?></th>
|
||||
<th>Box Details<br>
|
||||
LxWxH (cm)
|
||||
</th>
|
||||
<th>Weight (kg)</th>
|
||||
<th><?php echo $paginator->sort('freight_forwarder_id');?></th>
|
||||
<th><?php echo $paginator->sort('airway_bill');?></th>
|
||||
<th># Invoices</th>
|
||||
<th>Issued By</th>
|
||||
<th>Invoice Amount</th>
|
||||
<th>Deferred GST</th>
|
||||
<th>Approved?</th>
|
||||
<th>Paid?</th>
|
||||
<th>Date Paid</th>
|
||||
|
||||
</th>
|
||||
<th>Weight (kg)</th>
|
||||
<th><?php echo $paginator->sort('freight_forwarder_id');?></th>
|
||||
<th><?php echo $paginator->sort('airway_bill');?></th>
|
||||
<th># Invoices</th>
|
||||
<th>Issued By</th>
|
||||
<th>Invoice Amount</th>
|
||||
<th>Deferred GST</th>
|
||||
<th>Approved?</th>
|
||||
<th>Paid?</th>
|
||||
<th>Date Paid</th>
|
||||
|
||||
<th><?php echo $paginator->sort('comments');?></th>
|
||||
<th class="actions"><?php __('Actions');?></th>
|
||||
</tr>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($shipments as $shipment):
|
||||
|
||||
<th><?php echo $paginator->sort('comments');?></th>
|
||||
<th class="actions"><?php __('Actions');?></th>
|
||||
</tr>
|
||||
<?php
|
||||
$i = 0;
|
||||
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 class="actions">
|
||||
<button id="<?=$shipment['Shipment']['id']?>" class="editButton">Edit</button>
|
||||
</td>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
echo $this->element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched']));
|
||||
?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php
|
||||
echo $this->element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived']));
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
echo $this->element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched']));
|
||||
?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $shipmentTypeShort[$shipment['Shipment']['type']]; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $shipmentTypeShort[$shipment['Shipment']['type']]; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php foreach($shipment['Principle'] as $principle):?>
|
||||
<? 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>
|
||||
<?php foreach($shipment['Principle'] as $principle):?>
|
||||
<? 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']));
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
<?php endforeach;?>
|
||||
</td>
|
||||
|
||||
<br>
|
||||
<?php endforeach;?>
|
||||
</td>
|
||||
<td>
|
||||
<?php foreach($shipment['PurchaseOrder'] as $po):?>
|
||||
<?=$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
|
||||
<br>
|
||||
<?endforeach;?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php foreach($shipment['PurchaseOrder'] as $po):?>
|
||||
<?=$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
|
||||
<br>
|
||||
<?endforeach;?>
|
||||
</td>
|
||||
<td>
|
||||
<?php foreach($shipment['Job'] as $job):?>
|
||||
<?=$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
|
||||
<br>
|
||||
<?endforeach;?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php foreach($shipment['Job'] as $job):?>
|
||||
<?=$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
|
||||
<br>
|
||||
<?endforeach;?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $shipment['Shipment']['box_count']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $shipment['Shipment']['box_count']; ?>
|
||||
</td>
|
||||
<td class="boxDimensions">
|
||||
|
||||
<td class="boxDimensions">
|
||||
<?php
|
||||
|
||||
<?php
|
||||
$totalWeight = 0;
|
||||
$weightString = '';
|
||||
|
||||
$totalWeight = 0;
|
||||
$weightString = '';
|
||||
foreach($shipment['Box'] as $box):?>
|
||||
<?=$box['length']?>x<?=$box['width']?>x<?=$box['height']?><br>
|
||||
<?
|
||||
$weightString .= $box['weight'].' kg <br>';
|
||||
$totalWeight += $box['weight']; ?>
|
||||
<?php endforeach;?>
|
||||
|
||||
foreach($shipment['Box'] as $box):?>
|
||||
<?=$box['length']?>x<?=$box['width']?>x<?=$box['height']?><br>
|
||||
<?
|
||||
$weightString .= $box['weight'].' kg <br>';
|
||||
$totalWeight += $box['weight']; ?>
|
||||
<?php endforeach;?>
|
||||
</td>
|
||||
|
||||
</td>
|
||||
<td> <?
|
||||
|
||||
<td> <?
|
||||
$boxCount = $shipment['Shipment']['box_count'];
|
||||
if($boxCount > 1) {
|
||||
echo $weightString;
|
||||
echo '<hr>';
|
||||
|
||||
$boxCount = $shipment['Shipment']['box_count'];
|
||||
if($boxCount > 1) {
|
||||
echo $weightString;
|
||||
echo '<hr>';
|
||||
|
||||
}?>
|
||||
<? if($boxCount != 0): ?>
|
||||
<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>
|
||||
}?>
|
||||
<? if($boxCount != 0): ?>
|
||||
<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>
|
||||
<?php echo $shipment['Shipment']['airway_bill']; ?>
|
||||
</td>
|
||||
<td>
|
||||
<?php echo $shipment['Shipment']['airway_bill']; ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?=$shipment['Shipment']['shipment_invoice_count'];?>
|
||||
</td>
|
||||
<td>Issued By Principle/FF name
|
||||
</td>
|
||||
<td>
|
||||
<?=$shipment['Shipment']['shipment_invoice_count'];?>
|
||||
</td>
|
||||
<td><?foreach($shipment['ShipmentInvoice'] as $si) {
|
||||
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>Deferred GST amount</td>
|
||||
<td class="boxDimensions"><? foreach($shipment['ShipmentInvoice'] as $si) {
|
||||
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>Paid</td>
|
||||
<td>Date Paid</td>
|
||||
<td><?=$this->element('booleanTick', array('bool'=>$si['approved'])); ?></td>
|
||||
<td><?=$this->element('booleanTick', array('bool'=>$si['paid'])); ?></td>
|
||||
<td><?=$this->element('isEmptyDate', array('date'=>$si['date_paid']));?></td>
|
||||
|
||||
<td>
|
||||
<?php echo $shipment['Shipment']['comments']; ?>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<button id="<?=$shipment['Shipment']['id']?>" class="editButton">Edit</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
<td>
|
||||
<?php echo $shipment['Shipment']['comments']; ?>
|
||||
</td>
|
||||
<td class="actions">
|
||||
<button id="<?=$shipment['Shipment']['id']?>" class="editButton">Edit</button>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</table>
|
||||
|
||||
<?php debug($currencies); ?>
|
||||
|
|
@ -1444,7 +1444,7 @@ table.shipments {
|
|||
|
||||
.invForm {
|
||||
border: 1px solid;
|
||||
width: 20em;
|
||||
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue