Shipment Register going live

This commit is contained in:
Karl Cordes 2011-05-09 14:12:00 +10:00
parent 490ba20cce
commit 726d5f4c72
5 changed files with 153 additions and 124 deletions

View file

@ -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'));
} }

View file

@ -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'));

View file

@ -121,15 +121,40 @@
<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) {
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>
<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']; ?>
@ -139,4 +164,6 @@
</td> </td>
</tr> </tr>
<?php endforeach; ?> <?php endforeach; ?>
</table> </table>
<?php debug($currencies); ?>

View file

@ -1444,7 +1444,7 @@ table.shipments {
.invForm { .invForm {
border: 1px solid; border: 1px solid;
width: 20em;
margin-top: 1em; margin-top: 1em;
} }

View file

@ -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;