- sort('date_arrived');?>
sort('date_dispatched');?>
sort('type');?>
Principle(s)
@@ -28,11 +27,6 @@
Edit
-
- element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived']));
- ?>
-
element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched']));
diff --git a/views/elements/shipment_index_export.ctp b/views/elements/shipment_index_export.ctp
index 6b1069ae..ba77b235 100644
--- a/views/elements/shipment_index_export.ctp
+++ b/views/elements/shipment_index_export.ctp
@@ -1,12 +1,9 @@
- sort('date_arrived');?>
sort('date_dispatched');?>
sort('type');?>
- Principle(s)
- PO(s)
- Jobs
+ Job(s)
sort('# Boxes','box_count');?>
Box Details
LxWxH (cm)
@@ -28,11 +25,6 @@
Edit
-
- element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived']));
- ?>
-
element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched']));
@@ -43,27 +35,6 @@
-
-
- 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']));
- }
- ?>
-
-
-
-
-
-
-
- =$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
-
-
-
-
=$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
diff --git a/views/elements/shipment_index_import.ctp b/views/elements/shipment_index_import.ctp
index 6b1069ae..aef9e8ef 100644
--- a/views/elements/shipment_index_import.ctp
+++ b/views/elements/shipment_index_import.ctp
@@ -2,11 +2,9 @@
sort('date_arrived');?>
- sort('date_dispatched');?>
sort('type');?>
Principle(s)
PO(s)
- Jobs
sort('# Boxes','box_count');?>
Box Details
LxWxH (cm)
@@ -33,11 +31,6 @@
echo $this->element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived']));
?>
-
- element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched']));
- ?>
-
@@ -64,12 +57,6 @@
-
-
- =$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
-
-
-
diff --git a/views/elements/shipment_index_local.ctp b/views/elements/shipment_index_local.ctp
index 6b1069ae..e32ebe9f 100644
--- a/views/elements/shipment_index_local.ctp
+++ b/views/elements/shipment_index_local.ctp
@@ -1,11 +1,8 @@
- sort('date_arrived');?>
sort('date_dispatched');?>
sort('type');?>
- Principle(s)
- PO(s)
Jobs
sort('# Boxes','box_count');?>
Box Details
@@ -28,11 +25,6 @@
Edit
-
- element('isEmptyDate', array('date'=>$shipment['Shipment']['date_arrived']));
- ?>
-
element('isEmptyDate', array('date'=>$shipment['Shipment']['date_dispatched']));
@@ -43,27 +35,6 @@
-
-
- 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']));
- }
- ?>
-
-
-
-
-
-
-
- =$html->link($po['title'], array('controller'=>'purchase_orders', 'action'=>'view', $po['id']));?>
-
-
-
-
=$html->link($job['title'], array('controller'=>'jobs', 'action'=>'view', $job['id']));?>
diff --git a/views/jobs/view.ctp b/views/jobs/view.ctp
index 7252c92e..7bb3d752 100755
--- a/views/jobs/view.ctp
+++ b/views/jobs/view.ctp
@@ -56,11 +56,6 @@
link(__('Edit Job', true), array('action' => 'edit', $job['Job']['id'])); ?>
- link(__('Delete Job', true), array('action' => 'delete', $job['Job']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $job['Job']['id'])); ?>
- link(__('List Jobs', true), array('action' => 'index')); ?>
- link(__('New Job', true), array('action' => 'add')); ?>
- link(__('List Enquiries', true), array('controller' => 'enquiries', 'action' => 'index')); ?>
- link(__('New Enquiry', true), array('controller' => 'enquiries', 'action' => 'add')); ?>
diff --git a/views/jobs/view_report.ctp b/views/jobs/view_report.ctp
index 75123c4c..86fc2256 100644
--- a/views/jobs/view_report.ctp
+++ b/views/jobs/view_report.ctp
@@ -18,6 +18,7 @@
Net Sales AUD
Gross Profit AUD
Net Export Sales Converted to Or Invoiced in AUD
+ Gross Profit Value Export in AUD
GP% Excl Commissions
ATO Exchange Rate
diff --git a/views/shipment_invoices/add.ctp b/views/shipment_invoices/add.ctp
index 15a0d24c..41bd9182 100644
--- a/views/shipment_invoices/add.ctp
+++ b/views/shipment_invoices/add.ctp
@@ -11,6 +11,8 @@
echo $form->input('invoice_amount');
echo $form->input('deferred_gst');
echo $form->input('approved');
+ echo $form->input('paid');
+ echo $form->input('date_paid');
echo $form->input('invoice_type');
?>
@@ -19,13 +21,5 @@
link(__('List ShipmentInvoices', true), array('action' => 'index'));?>
- link(__('List Shipments', true), array('controller' => 'shipments', 'action' => 'index')); ?>
- link(__('New Shipment', true), array('controller' => 'shipments', 'action' => 'add')); ?>
- link(__('List Principles', true), array('controller' => 'principles', 'action' => 'index')); ?>
- link(__('New Principle', true), array('controller' => 'principles', 'action' => 'add')); ?>
- link(__('List Freight Forwarders', true), array('controller' => 'freight_forwarders', 'action' => 'index')); ?>
- link(__('New Freight Forwarder', true), array('controller' => 'freight_forwarders', 'action' => 'add')); ?>
- link(__('List Currencies', true), array('controller' => 'currencies', 'action' => 'index')); ?>
- link(__('New Currency', true), array('controller' => 'currencies', 'action' => 'add')); ?>
diff --git a/views/shipment_invoices/edit.ctp b/views/shipment_invoices/edit.ctp
index 59cccc65..be1d444e 100644
--- a/views/shipment_invoices/edit.ctp
+++ b/views/shipment_invoices/edit.ctp
@@ -12,6 +12,8 @@
echo $form->input('invoice_amount');
echo $form->input('deferred_gst');
echo $form->input('approved');
+ echo $form->input('paid');
+ echo $form->input('date_paid');
echo $form->input('invoice_type');
?>
@@ -21,13 +23,5 @@
link(__('Delete', true), array('action' => 'delete', $form->value('ShipmentInvoice.id')), null, sprintf(__('Are you sure you want to delete # %s?', true), $form->value('ShipmentInvoice.id'))); ?>
link(__('List ShipmentInvoices', true), array('action' => 'index'));?>
- link(__('List Shipments', true), array('controller' => 'shipments', 'action' => 'index')); ?>
- link(__('New Shipment', true), array('controller' => 'shipments', 'action' => 'add')); ?>
- link(__('List Principles', true), array('controller' => 'principles', 'action' => 'index')); ?>
- link(__('New Principle', true), array('controller' => 'principles', 'action' => 'add')); ?>
- link(__('List Freight Forwarders', true), array('controller' => 'freight_forwarders', 'action' => 'index')); ?>
- link(__('New Freight Forwarder', true), array('controller' => 'freight_forwarders', 'action' => 'add')); ?>
- link(__('List Currencies', true), array('controller' => 'currencies', 'action' => 'index')); ?>
- link(__('New Currency', true), array('controller' => 'currencies', 'action' => 'add')); ?>
diff --git a/views/shipment_invoices/index.ctp b/views/shipment_invoices/index.ctp
index 4ac39132..2bdeb62d 100644
--- a/views/shipment_invoices/index.ctp
+++ b/views/shipment_invoices/index.ctp
@@ -17,6 +17,8 @@ echo $paginator->counter(array(
sort('invoice_amount');?>
sort('deferred_gst');?>
sort('approved');?>
+ sort('paid');?>
+ sort('date_paid');?>
sort('invoice_type');?>
@@ -33,16 +35,16 @@ foreach ($shipmentInvoices as $shipmentInvoice):
- link($shipmentInvoice['Shipment']['id'], array('controller' => 'shipments', 'action' => 'view', $shipmentInvoice['Shipment']['id'])); ?>
+
- link($shipmentInvoice['Principle']['name'], array('controller' => 'principles', 'action' => 'view', $shipmentInvoice['Principle']['id'])); ?>
+
- link($shipmentInvoice['Currency']['name'], array('controller' => 'currencies', 'action' => 'view', $shipmentInvoice['Currency']['id'])); ?>
+
- link($shipmentInvoice['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipmentInvoice['FreightForwarder']['id'])); ?>
+
@@ -56,6 +58,12 @@ foreach ($shipmentInvoices as $shipmentInvoice):
+
+
+
+
+
+
@@ -76,13 +84,5 @@ foreach ($shipmentInvoices as $shipmentInvoice):
link(__('New ShipmentInvoice', true), array('action' => 'add')); ?>
- link(__('List Shipments', true), array('controller' => 'shipments', 'action' => 'index')); ?>
- link(__('New Shipment', true), array('controller' => 'shipments', 'action' => 'add')); ?>
- link(__('List Principles', true), array('controller' => 'principles', 'action' => 'index')); ?>
- link(__('New Principle', true), array('controller' => 'principles', 'action' => 'add')); ?>
- link(__('List Freight Forwarders', true), array('controller' => 'freight_forwarders', 'action' => 'index')); ?>
- link(__('New Freight Forwarder', true), array('controller' => 'freight_forwarders', 'action' => 'add')); ?>
- link(__('List Currencies', true), array('controller' => 'currencies', 'action' => 'index')); ?>
- link(__('New Currency', true), array('controller' => 'currencies', 'action' => 'add')); ?>
diff --git a/views/shipment_invoices/view.ctp b/views/shipment_invoices/view.ctp
index b47ba402..c48a0958 100644
--- a/views/shipment_invoices/view.ctp
+++ b/views/shipment_invoices/view.ctp
@@ -6,24 +6,24 @@
- >
+ >
>
- link($shipmentInvoice['Shipment']['id'], array('controller' => 'shipments', 'action' => 'view', $shipmentInvoice['Shipment']['id'])); ?>
+
- >
+ >
>
- link($shipmentInvoice['Principle']['name'], array('controller' => 'principles', 'action' => 'view', $shipmentInvoice['Principle']['id'])); ?>
+
- >
+ >
>
- link($shipmentInvoice['Currency']['name'], array('controller' => 'currencies', 'action' => 'view', $shipmentInvoice['Currency']['id'])); ?>
+
- >
+ >
>
- link($shipmentInvoice['FreightForwarder']['name'], array('controller' => 'freight_forwarders', 'action' => 'view', $shipmentInvoice['FreightForwarder']['id'])); ?>
+
>
@@ -46,6 +46,16 @@
+ >
+ >
+
+
+
+ >
+ >
+
+
+
>
>
@@ -59,13 +69,5 @@
link(__('Delete ShipmentInvoice', true), array('action' => 'delete', $shipmentInvoice['ShipmentInvoice']['id']), null, sprintf(__('Are you sure you want to delete # %s?', true), $shipmentInvoice['ShipmentInvoice']['id'])); ?>
link(__('List ShipmentInvoices', true), array('action' => 'index')); ?>
link(__('New ShipmentInvoice', true), array('action' => 'add')); ?>
- link(__('List Shipments', true), array('controller' => 'shipments', 'action' => 'index')); ?>
- link(__('New Shipment', true), array('controller' => 'shipments', 'action' => 'add')); ?>
- link(__('List Principles', true), array('controller' => 'principles', 'action' => 'index')); ?>
- link(__('New Principle', true), array('controller' => 'principles', 'action' => 'add')); ?>
- link(__('List Freight Forwarders', true), array('controller' => 'freight_forwarders', 'action' => 'index')); ?>
- link(__('New Freight Forwarder', true), array('controller' => 'freight_forwarders', 'action' => 'add')); ?>
- link(__('List Currencies', true), array('controller' => 'currencies', 'action' => 'index')); ?>
- link(__('New Currency', true), array('controller' => 'currencies', 'action' => 'add')); ?>
diff --git a/views/shipments/add.ctp b/views/shipments/add.ctp
index bc083c54..750e30eb 100644
--- a/views/shipments/add.ctp
+++ b/views/shipments/add.ctp
@@ -1,2 +1,2 @@
=$javascript->link('add_edit_shipment');?>
- =$this->element('add_shipment');?>
\ No newline at end of file
+ =$this->element('add_edit_shipment', array('invoiceType'=>$invoiceType));?>
\ No newline at end of file
diff --git a/views/shipments/edit.ctp b/views/shipments/edit.ctp
index 20712d42..ea6e53ed 100644
--- a/views/shipments/edit.ctp
+++ b/views/shipments/edit.ctp
@@ -1,133 +1,5 @@
=$javascript->link('add_edit_shipment');?>
-create('Shipment', array('default'=>false));?>
-input('user_id', array('type'=>'hidden', 'value'=>$currentuser['User']['id']));
-echo $form->input('type', array('options'=>$shipmentType, 'id'=>'shipmentType'));
-echo $form->input('id', array('type'=>'hidden'));
-?>
-
-
- echo $form->input('date_arrived_display', array('label'=>'Date Arrived', 'id'=>'date_arrived_display', 'value'=>$this->element('isEmptyDate', array('date'=>$this->data['Shipment']['date_arrived']))));
- echo $form->input('date_arrived', array('type'=>'hidden', 'id'=>'date_arrived'));
- ?>
-
-
-
-
-
-
-
- echo $form->input('date_dispatched_display', array('label'=>'Date Dispatched', 'id'=>'date_dispatched_display', 'value'=>$this->element('isEmptyDate', array('date'=>$this->data['Shipment']['date_dispatched']))));
-
- echo $form->input('date_dispatched', array('type'=>'hidden', 'id'=>'date_dispatched'));
- ?>
-
-
-
-
- echo $form->input('Principle', array('name'=>'PrincipleSelect', 'type'=>'select', 'multiple'=>false)); ?>
-
Add Principle
-
- data['Principle'] as $principle):?>
-
- X
- =$principle['name'];?>
-
-
-
-
-
-
-
-
-
- echo $form->input('purchase_order', array('id'=>'purchase_order_autocomplete'));?>
-
-
- data['PurchaseOrder'] as $po):?>
-
- X
- =$po['title'];?>
-
-
-
-
-
-
-
-
- echo $form->input('job', array('id'=>'job_autocomplete'));
- ?>
-
-
-
- data['Job'] as $job):?>
-
- X
- =$job['title'];?>
-
-
-
-
-
-
-
-
- =$form->input('customer', array('id'=>'customer_autocomplete', 'label'=>'Customer', 'value'=>$this->data['Customer']['name']));?>
- =$form->input('customer_id', array('type'=>'hidden', 'id'=>'customer_id', 'value'=>$this->data['Shipment']['customer_id']));?>
-
-
-
- Shipping Address:
-
-
- =$form->input('address_id', array('type'=>'hidden', 'id'=>'address_id', 'value'=>$this->data['Shipment']['address_id']));?>
-
-
-
-
-
-
- =$form->input('freight_forwarder_id');?>
-
-
-
- =$form->input('airway_bill');?>
-
-
-
-
Add Box
-
-
- data['Box'] as $box):?>
-
- X
- =$form->input("Box.{$boxNo}.id", array('type'=>'hidden'));?>
- =$form->input("Box.{$boxNo}.shipment_id", array('type'=>'hidden', 'value'=>$this->data['Shipment']['id']));?>
- =$form->input("Box.{$boxNo}.length", array('label'=>'Length (cm)', 'div'=>'length'));?>
- =$form->input("Box.{$boxNo}.width", array('label'=>'Width (cm)', 'div'=>'width'));?>
- =$form->input("Box.{$boxNo}.height", array('label'=>'Height (cm)', 'div'=>'height'));?>
- =$form->input("Box.{$boxNo}.weight", array('label'=>'Weight (kg)', 'div'=>'weight'));?>
-
-
-
-
-
-
-
-end();?>
-
-
- =$form->input('length', array('label'=>'Length (cm)', 'div'=>'length'));?>
- =$form->input('width', array('label'=>'Width (cm)', 'div'=>'width'));?>
- =$form->input('height', array('label'=>'Height (cm)', 'div'=>'height'));?>
- =$form->input('weight', array('label'=>'Weight (kg)', 'div'=>'weight'));?>
-
+ =$this->element('add_edit_shipment', array('invoiceType'=>$invoiceType));?>
data); ?>
\ No newline at end of file
diff --git a/views/shipments/index.ctp b/views/shipments/index.ctp
index aaae22d9..3e57b4fb 100644
--- a/views/shipments/index.ctp
+++ b/views/shipments/index.ctp
@@ -15,7 +15,8 @@
- =$this->element('shipment_index_'.$type);?>
+ //$this->element('shipment_index_'.$type);?>
+ =$this->element('shipment_index_all');?>
diff --git a/webroot/css/quotenik.css b/webroot/css/quotenik.css
index 28f13bff..4153e4e5 100755
--- a/webroot/css/quotenik.css
+++ b/webroot/css/quotenik.css
@@ -1183,45 +1183,6 @@ label span#exchangeConversion {
}
-form.cmxform {
- width: 80%;
-}
-
-form.cmxform input {
- width: auto;
- display: inline;
-}
-
-form.cmxform fieldset ol {
- margin: 0;
- padding: 0;
-}
-form.cmxform fieldset li {
- list-style: none;
- padding: 5px;
- margin: 0;
-}
-form.cmxform fieldset fieldset {
- border: none;
- margin: 3px 0 0;
-}
-form.cmxform fieldset fieldset legend {
- padding: 0 0 5px;
- font-weight: normal;
-}
-form.cmxform fieldset fieldset label {
- display: block;
-
-}
-form.cmxform em {
- font-weight: bold;
- font-style: normal;
- color: #f00;
-}
-
-form.cmxform fieldset fieldset label {
- margin-left: 123px; /* Width plus 3 (html space) */
-}
#sortable { list-style-type: none; margin: 0; padding: 0; }
@@ -1377,7 +1338,7 @@ select.job_status {
.scrollHorizontal {
- height: 800px;
+ height: 500px;
overflow:scroll;
}
@@ -1477,18 +1438,19 @@ table.shipments {
width: 50px;
}
-.boxForm label {
- float: left;
- margin-right: 1em;
- text-align: right;
- width: 8em;
-}
.boxForm div {
}
+.invForm {
+ border: 1px solid;
+ width: 15em;
+ margin-top: 1em;
+}
+
+
span.totalWeight {
-
+
font-weight: bolder;
}
diff --git a/webroot/js/add_edit_shipment.js b/webroot/js/add_edit_shipment.js
index 53259169..df4faadc 100644
--- a/webroot/js/add_edit_shipment.js
+++ b/webroot/js/add_edit_shipment.js
@@ -1,6 +1,9 @@
$(function() {
var addedBoxes = $(".boxForm").length;
+ var addedInvoices = $('.invForm').length;
+
+
$('button').button();
displayReleventFields();
@@ -32,8 +35,33 @@ $(function() {
$(this).parent().remove();
});
+ //Add a new Freight Forwarder.
+ $('.addFreightForwarder').live('click', function() {
+ $('#newFreightForwarderDiv').show();
+ $(this).hide();
+ });
+ //Cancel adding a new Freight Forwarder.
+ $('.cancelNewFF').live('click', function() {
+ $('#newFreightForwarderDiv').hide();
+ $('.addFreightForwarder').show();
+ });
+ //Save the new Freight Forwarder. **TODO : Handle errors **.
+ $('.saveNewFF').live('click', function() {
+
+ $.post('/freight_forwarders/ajax_add', $('#newFreightForwarder'), function(data) {
+ if(data == 'SUCCESS') {
+ $.get('/freight_forwarders/build_options', function(newOptions) {
+ $('#ShipmentFreightForwarderId').html(newOptions);
+ $('#newFreightForwarderDiv').hide();
+ $('.addFreightForwarder').show();
+ });
+ }
+ });
+ });
+
+ //Add a(nother) Principle to this Shipment
$('#addPrinciple').button().click(function() {
var principleID = getSelectedID('#PrinciplePrinciple');
@@ -106,6 +134,17 @@ $(function() {
});
+ $("#addInvoice").button().click(function() {
+ addInvoice(addedInvoices);
+ addedInvoices++;
+ });
+
+ $(".removeInvoice").live('click',function() {
+ $(this).parent().remove();
+ });
+
+
+
$(".selectAddress").live('click', function() {
var ID = $(this).attr('id');
$("#address_id").val(ID);
@@ -147,25 +186,29 @@ $(function() {
switch(shipmentTypeID) {
case 1: //Import
- $("#importFields, #principle, #purchaseOrder, #freight_forwarder, #airway_bill, #boxes").show();
+ $("#importFields, #principle, #purchaseOrder").show();
+ showCommonFields();
break;
case 2: //Direct
- $("#purchaseOrder, #job,#principle, #dateDispatched, #customer, #address, #addressSpan, #freight_forwarder, #airway_bill, #boxes").show();
+ $("#purchaseOrder, #job,#principle, #dateDispatched, #customer, #address, #addressSpan").show();
+ showCommonFields();
break;
case 3: //Export
- $("#job, #dateDispatched, #customer, #address, #addressSpan, #freight_forwarder, #airway_bill, #boxes").show();
+ $("#job, #dateDispatched, #customer, #address, #addressSpan").show();
+ showCommonFields();
break;
case 4: //Local
- $("#job, #dateDispatched, #customer, #address, #addressSpan, #freight_forwarder, #airway_bill, #boxes").show();
-
- break;
-
- default:
-
-
+ $("#job, #dateDispatched, #customer, #address, #addressSpan").show();
+ showCommonFields();
break;
}
+
+ }
+ //Show the fields in the shipment form that are available
+ //for all 4 cases
+ function showCommonFields() {
+ $("#airway_bill, #boxes, #invoices, #freight_forwarder, #comments").show();
}
function addBox(addedBoxes) {
@@ -176,39 +219,24 @@ $(function() {
var boxNo = addedBoxes;
- newBoxForm.attr('id','');
+ newBoxForm.removeAttr('id');
newBoxForm.addClass('boxForm');
newBoxForm.show();
- //Set the appropriate naming for the fields so cake can work its magic.
- //Should refactor into a function.
- var div = newBoxForm.find('.length');
- var ID = getCakeID(model,boxNo,'length');
- var name = getCakeName(model, boxNo, 'length');
- div.children('label').attr('for', ID);
- div.children('input').attr('id', ID).attr('name', name);
-
- div = newBoxForm.find('.width');
- ID = getCakeID(model,boxNo,'width');
- name = getCakeName(model, boxNo, 'width');
- div.children('label').attr('for', ID);
- div.children('input').attr('id', ID).attr('name', name);
-
- div = newBoxForm.find('.height');
- ID = getCakeID(model,boxNo,'height');
- name = getCakeName(model, boxNo, 'height');
- div.children('label').attr('for', ID);
- div.children('input').attr('id', ID).attr('name', name);
-
- div = newBoxForm.find('.weight');
- ID = getCakeID(model,boxNo,'weight');
- name = getCakeName(model, boxNo, 'weight');
- div.children('label').attr('for', ID);
- div.children('input').attr('id', ID).attr('name', name);
-
-
+ var boxFields = ['length', 'width', 'height', 'weight'];
+ var div;
+ var ID;
+ var name;
+
+ $.each(boxFields, function(index, field) {
+ div = newBoxForm.find('.'+field);
+ ID = getCakeID(model,boxNo,field);
+ name = getCakeName(model, boxNo, field);
+ div.children('label').attr('for', ID);
+ div.children('input').attr('id', ID).attr('name', name);
+ });
var closeButton = $('X ');
closeButton.addClass('removeBox');
@@ -220,6 +248,41 @@ $(function() {
}
+ function addInvoice(addedInvoices) {
+ var model = 'ShipmentInvoice';
+ var invoiceNo = addedInvoices;
+
+ var newInvoiceForm = $('#invoiceFactory').clone();
+ newInvoiceForm.removeAttr('id');
+ newInvoiceForm.addClass('invForm');
+ newInvoiceForm.show();
+
+ var invFields = ['currency_id', 'freight_forwarder_id', 'invoice_number',
+ 'invoice_amount','gst_amount','deferred_gst', 'deferred_gst_amount','approved', 'paid', 'date_paid','invoice_type'];
+
+ var div;
+ var ID;
+
+ $.each(invFields, function(index,field) {
+ div = newInvoiceForm.find('.inv_'+field);
+ ID = getCakeID(model,invoiceNo, field);
+ name = getCakeName(model, invoiceNo, field);
+ div.children('label').attr('for', ID);
+ div.children('input').attr('id', ID).attr('name', name);
+
+ });
+
+ var closeButton = $('X ');
+ closeButton.addClass('removeBox');
+ closeButton.button();
+
+ newInvoiceForm.prepend(closeButton);
+ $("#invoices").append(newInvoiceForm);
+
+
+
+ }
+
function getCakeID(model, count, field) {
return model+count+capitalizeFirstLetter(field);
}