Shipment register finished. FUCKING FINALLY

This commit is contained in:
Karl Cordes 2011-05-09 12:31:24 +10:00
parent 1eb297b035
commit 490ba20cce
6 changed files with 37 additions and 23 deletions

View file

@ -103,7 +103,12 @@ class ShipmentsController extends AppController {
$shipmentType = $this->typeOptions(false);
$shipmentTypeShort = $this->typeOptions(true);
$currencies = $this->Shipment->ShipmentInvoice->Currency->find('list');
$this->set(compact('principles', 'freightForwarders', 'shipmentType', 'shipmentTypeShort', 'currencies'));
$invoiceType = $this->invoiceTypeOptions();
$this->set('yesNo', array(0=>'No', 1=>'Yes'));
$this->set(compact('principles', 'freightForwarders', 'shipmentType', 'shipmentTypeShort', 'currencies','invoiceType', 'yesNo'));
}

View file

@ -137,17 +137,19 @@ echo $form->input('id', array('type'=>'hidden'));
<?
echo $form->input("ShipmentInvoice.{$invNo}.id", array('type'=>'hidden'));
echo $form->input("ShipmentInvoice.{$invNo}.shipment_id", array('type'=>'hidden', 'value'=>$this->data['Shipment']['id']));
echo $form->input("ShipmentInvoice.{$invNo}.currency_id");
echo $form->input("ShipmentInvoice.{$invNo}.freight_forwarder_id");
echo $form->input("ShipmentInvoice.{$invNo}.invoice_number");
echo $form->input("ShipmentInvoice.{$invNo}.invoice_amount");
echo $form->input("ShipmentInvoice.{$invNo}.gst_amount");
echo $form->input("ShipmentInvoice.{$invNo}.deferred_gst");
echo $form->input("ShipmentInvoice.{$invNo}.approved");
echo $form->input("ShipmentInvoice.{$invNo}.paid");
echo $form->input("ShipmentInvoice.{$invNo}.date_paid");
echo $form->input("ShipmentInvoice.{$invNo}.invoice_type");
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}.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'));
echo $form->input("ShipmentInvoice.{$invNo}.deferred_gst", array('label'=>'Deferred GST?', 'div'=>'inv_deferred_gst', 'options'=>$yesNo));
echo $form->input("ShipmentInvoice.{$invNo}.deferred_gst_amount", array('label'=>'Deferred GST Amount', 'div'=>'inv_deferred_gst_amount'));
echo $form->input("ShipmentInvoice.{$invNo}.approved", array('label'=>'Approved', 'div'=>'inv_approved', 'options'=>$yesNo));
echo $form->input("ShipmentInvoice.{$invNo}.paid", array('label'=>'Paid', 'div'=>'inv_paid', 'options'=>$yesNo));
echo $form->input("ShipmentInvoice.{$invNo}.date_paid", array('label'=>'Date Paid', 'div'=>'inv_date_paid', 'class'=>'date_paid', 'type'=>'text'));
?>
</div>
<?
$invNo++;
@ -172,15 +174,16 @@ echo $form->input('id', array('type'=>'hidden'));
<div id="invoiceFactory" class="hiddenDefault">
<?
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));
echo $form->input("freight_forwarder_id", array('label'=>'Freight Forwarder', 'div'=>'inv_freight_forwarder_id', 'options'=>$freightForwarders));
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("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'));
echo $form->input("deferred_gst", array('label'=>'Deferred GST?', 'div'=>'inv_deferred_gst', 'options'=>$yesNo));
echo $form->input("deferred_gst_amount", array('label'=>'Deferred GST Amount', 'div'=>'inv_deferred_gst_amount'));
echo $form->input("approved", array('label'=>'Approved', 'div'=>'inv_approved'));
echo $form->input("paid", array('label'=>'Paid', 'div'=>'inv_paid'));
echo $form->input("date_paid", array('label'=>'Date Paid', 'div'=>'inv_date_paid'));
echo $form->input("approved", array('label'=>'Approved', 'div'=>'inv_approved', 'options'=>$yesNo));
echo $form->input("paid", array('label'=>'Paid', 'div'=>'inv_paid', 'options'=>$yesNo));
echo $form->input("date_paid", array('label'=>'Date Paid', 'div'=>'inv_date_paid', 'class'=>'date_paid', 'type'=>'text'));
?>
</div>

View file

@ -1,2 +1,2 @@
<?=$javascript->link('add_edit_shipment');?>
<?=$this->element('add_edit_shipment', array('invoiceType'=>$invoiceType));?>
<?=$this->element('add_edit_shipment');?>

View file

@ -1,5 +1,5 @@
<?=$javascript->link('add_edit_shipment');?>
<?=$this->element('add_edit_shipment', array('invoiceType'=>$invoiceType));?>
<?=$this->element('add_edit_shipment');?>
<?php debug($this->data); ?>

View file

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

View file

@ -23,6 +23,12 @@ $(function() {
altField: '#date_dispatched'
});
$('.date_paid').datepicker({
showButtonPanel: true,
dateFormat: 'yy-mm-dd'
});
/**
* Display the relevent elements depending on this Shipment Type */
$("#shipmentType").change(function() {