jobs now in shipments register Imports
This commit is contained in:
parent
deb81345c9
commit
8d848c7975
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -12,3 +12,5 @@ vendors/tcpdf/cache/*
|
||||||
tests/*
|
tests/*
|
||||||
emails/*
|
emails/*
|
||||||
nbproject/*
|
nbproject/*
|
||||||
|
processed_vaultmsgs/*
|
||||||
|
vaultmsgs/*
|
||||||
|
|
|
||||||
|
|
@ -19,41 +19,21 @@ class LineItemsController extends AppController {
|
||||||
$this->set('lineItem', $this->LineItem->read(null, $id));
|
$this->set('lineItem', $this->LineItem->read(null, $id));
|
||||||
}
|
}
|
||||||
|
|
||||||
function add($quoteid = null) {
|
function add($documentID = null) {
|
||||||
|
$this->layout = 'ajax';
|
||||||
if (!$quoteid && empty($this->data)) {
|
if (!$documentID && empty($this->data)) {
|
||||||
$this->Session->setFlash(__('Invalid Quote ID', true));
|
$this->Session->setFlash(__('Invalid Document ID', true));
|
||||||
$this->redirect(array('action'=>'index'));
|
$this->redirect(array('action'=>'index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->data)) {
|
if (!empty($this->data)) {
|
||||||
$this->LineItem->create();
|
$this->LineItem->create();
|
||||||
|
|
||||||
if(isset($this->data['LineItem']['product_id'])) {
|
|
||||||
$product = $this->LineItem->Product->findById($this->data['LineItem']['product_id']);
|
|
||||||
|
|
||||||
/* Copy all the data from the Product to the new LineItem */
|
|
||||||
|
|
||||||
$this->data['LineItem']['description'] = $product['Product']['description'];
|
|
||||||
$this->data['LineItem']['title'] = $product['Product']['title'];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// $numberOfItems = $this->LineItem->find('count',
|
|
||||||
// array('conditions' => array('LineItem.quote_id' => $this->data['LineItem']['quote_id'])));
|
|
||||||
|
|
||||||
//$numberOfItems++;
|
|
||||||
|
|
||||||
// $this->data['LineItem']['item_number'] = $numberOfItems;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($this->LineItem->save($this->data)) {
|
if ($this->LineItem->save($this->data)) {
|
||||||
$quoteid = $this->data['LineItem']['quote_id'];
|
$documentID = $this->data['LineItem']['document_id'];
|
||||||
|
|
||||||
$this->Session->setFlash(__('Product Added to Quote Successfully', true));
|
$this->Session->setFlash(__('Product Added to Quote Successfully', true));
|
||||||
$this->redirect(array('controller'=>'quotes', 'action'=>'view', $quoteid));
|
$this->redirect(array('controller'=>'documents', 'action'=>'view', $documentID));
|
||||||
} else {
|
} else {
|
||||||
$this->Session->setFlash(__('The LineItem could not be saved. Please, try again.', true));
|
$this->Session->setFlash(__('The LineItem could not be saved. Please, try again.', true));
|
||||||
}
|
}
|
||||||
|
|
@ -61,9 +41,9 @@ class LineItemsController extends AppController {
|
||||||
|
|
||||||
|
|
||||||
$principles = $this->LineItem->Product->Principle->find('list');
|
$principles = $this->LineItem->Product->Principle->find('list');
|
||||||
|
$products = $this->LineItem->Product->find('list');
|
||||||
$quote = $this->LineItem->Quote->read(null, $quoteid);
|
|
||||||
$this->set(compact('principles','quote', 'products'));
|
$this->set(compact('principles', 'products'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ class ShipmentsController extends AppController {
|
||||||
|
|
||||||
$address = $this->Shipment->Address->find('first', array('conditions'=>array('Address.id'=>$this->data['Shipment']['address_id']),'recursive'=>0));
|
$address = $this->Shipment->Address->find('first', array('conditions'=>array('Address.id'=>$this->data['Shipment']['address_id']),'recursive'=>0));
|
||||||
|
|
||||||
|
|
||||||
$principles = $this->Shipment->Principle->find('list');
|
$principles = $this->Shipment->Principle->find('list');
|
||||||
$freightForwarders = $this->Shipment->FreightForwarder->find('list');
|
$freightForwarders = $this->Shipment->FreightForwarder->find('list');
|
||||||
$shipmentType = $this->typeOptions(false);
|
$shipmentType = $this->typeOptions(false);
|
||||||
|
|
@ -149,14 +149,16 @@ class ShipmentsController extends AppController {
|
||||||
}
|
}
|
||||||
print_r($boxIDs);*/
|
print_r($boxIDs);*/
|
||||||
|
|
||||||
$jobIDs = array();
|
if($this->data['Shipment']['type'] > 1) {
|
||||||
foreach($this->data['Job'] as $job) {
|
$jobIDs = array();
|
||||||
foreach($job as $index => $id) {
|
foreach($this->data['Job'] as $job) {
|
||||||
$jobIDs[] = $id;
|
foreach($job as $index => $id) {
|
||||||
|
$jobIDs[] = $id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
$this->Shipment->Job->updateAll(array('Job.all_sent' => 1), array('Job.id'=>$jobIDs));
|
$this->Shipment->Job->updateAll(array('Job.all_sent' => 1), array('Job.id'=>$jobIDs));
|
||||||
|
}
|
||||||
//print_r($this->data);
|
//print_r($this->data);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
22
models/doc_page.php
Executable file
22
models/doc_page.php
Executable file
|
|
@ -0,0 +1,22 @@
|
||||||
|
<?php
|
||||||
|
class DocPage extends AppModel {
|
||||||
|
|
||||||
|
var $name = 'DocPage';
|
||||||
|
|
||||||
|
//The Associations below have been created with all possible keys, those that are not needed can be removed
|
||||||
|
var $belongsTo = array(
|
||||||
|
'Document' => array(
|
||||||
|
'className' => 'Document',
|
||||||
|
'foreignKey' => 'document_id',
|
||||||
|
'conditions' => '',
|
||||||
|
'fields' => '',
|
||||||
|
'order' => ''
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var $order = 'DocPage.page_number ASC';
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
@ -5,12 +5,11 @@
|
||||||
<?php
|
<?php
|
||||||
echo $form->input('item_number');
|
echo $form->input('item_number');
|
||||||
echo $form->input('option');
|
echo $form->input('option');
|
||||||
|
echo $form->input('product_id');
|
||||||
echo $form->input('quantity');
|
echo $form->input('quantity');
|
||||||
echo $form->input('title');
|
echo $form->input('title');
|
||||||
echo $form->input('description');
|
echo $form->input('description');
|
||||||
echo $form->input('document_id');
|
echo $form->input('document_id');
|
||||||
echo $form->input('product_id');
|
|
||||||
echo $form->input('costing_id');
|
|
||||||
echo $form->input('unit_price');
|
echo $form->input('unit_price');
|
||||||
echo $form->input('net_price_each');
|
echo $form->input('net_price_each');
|
||||||
echo $form->input('discount_percent');
|
echo $form->input('discount_percent');
|
||||||
|
|
@ -22,12 +21,4 @@
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<?php echo $form->end('Submit');?>
|
<?php echo $form->end('Submit');?>
|
||||||
</div>
|
</div>
|
||||||
<div class="actions">
|
|
||||||
<ul>
|
|
||||||
<li><?php echo $html->link(__('List LineItems', true), array('action' => 'index'));?></li>
|
|
||||||
<li><?php echo $html->link(__('List Products', true), array('controller' => 'products', 'action' => 'index')); ?> </li>
|
|
||||||
<li><?php echo $html->link(__('New Product', true), array('controller' => 'products', 'action' => 'add')); ?> </li>
|
|
||||||
<li><?php echo $html->link(__('List Costings', true), array('controller' => 'costings', 'action' => 'index')); ?> </li>
|
|
||||||
<li><?php echo $html->link(__('New Costing', true), array('controller' => 'costings', 'action' => 'add')); ?> </li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
|
||||||
|
|
@ -186,10 +186,11 @@ $(function() {
|
||||||
var shipmentTypeID = getSelectedID('#shipmentType');
|
var shipmentTypeID = getSelectedID('#shipmentType');
|
||||||
shipmentTypeID = parseInt(shipmentTypeID);
|
shipmentTypeID = parseInt(shipmentTypeID);
|
||||||
$(".hiddenDefault").hide();
|
$(".hiddenDefault").hide();
|
||||||
|
$(".moreInfo").show();
|
||||||
switch(shipmentTypeID) {
|
switch(shipmentTypeID) {
|
||||||
case 1: //Import
|
case 1: //Import
|
||||||
$("#importFields, #principle, #purchaseOrder").show();
|
$("#importFields,#job,#principle, #purchaseOrder").show();
|
||||||
|
$(".moreInfo").hide();
|
||||||
showCommonFields();
|
showCommonFields();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,3 @@
|
||||||
/*
|
|
||||||
* To change this template, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$(function () {
|
$(function () {
|
||||||
$("input.nocostinput").change(calcNetPrice); //When inputs of class nocostinput change. Calculate quick prices
|
$("input.nocostinput").change(calcNetPrice); //When inputs of class nocostinput change. Calculate quick prices
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue