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/*
|
||||
emails/*
|
||||
nbproject/*
|
||||
processed_vaultmsgs/*
|
||||
vaultmsgs/*
|
||||
|
|
|
|||
|
|
@ -19,41 +19,21 @@ class LineItemsController extends AppController {
|
|||
$this->set('lineItem', $this->LineItem->read(null, $id));
|
||||
}
|
||||
|
||||
function add($quoteid = null) {
|
||||
|
||||
if (!$quoteid && empty($this->data)) {
|
||||
$this->Session->setFlash(__('Invalid Quote ID', true));
|
||||
function add($documentID = null) {
|
||||
$this->layout = 'ajax';
|
||||
if (!$documentID && empty($this->data)) {
|
||||
$this->Session->setFlash(__('Invalid Document ID', true));
|
||||
$this->redirect(array('action'=>'index'));
|
||||
}
|
||||
|
||||
if (!empty($this->data)) {
|
||||
$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)) {
|
||||
$quoteid = $this->data['LineItem']['quote_id'];
|
||||
$documentID = $this->data['LineItem']['document_id'];
|
||||
|
||||
$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 {
|
||||
$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');
|
||||
|
||||
$quote = $this->LineItem->Quote->read(null, $quoteid);
|
||||
$this->set(compact('principles','quote', 'products'));
|
||||
$products = $this->LineItem->Product->find('list');
|
||||
|
||||
$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));
|
||||
|
||||
|
||||
|
||||
$principles = $this->Shipment->Principle->find('list');
|
||||
$freightForwarders = $this->Shipment->FreightForwarder->find('list');
|
||||
$shipmentType = $this->typeOptions(false);
|
||||
|
|
@ -149,14 +149,16 @@ class ShipmentsController extends AppController {
|
|||
}
|
||||
print_r($boxIDs);*/
|
||||
|
||||
$jobIDs = array();
|
||||
foreach($this->data['Job'] as $job) {
|
||||
foreach($job as $index => $id) {
|
||||
$jobIDs[] = $id;
|
||||
if($this->data['Shipment']['type'] > 1) {
|
||||
$jobIDs = array();
|
||||
foreach($this->data['Job'] as $job) {
|
||||
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);
|
||||
|
||||
|
||||
|
|
|
|||
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
|
||||
echo $form->input('item_number');
|
||||
echo $form->input('option');
|
||||
echo $form->input('product_id');
|
||||
echo $form->input('quantity');
|
||||
echo $form->input('title');
|
||||
echo $form->input('description');
|
||||
echo $form->input('document_id');
|
||||
echo $form->input('product_id');
|
||||
echo $form->input('costing_id');
|
||||
echo $form->input('unit_price');
|
||||
echo $form->input('net_price_each');
|
||||
echo $form->input('discount_percent');
|
||||
|
|
@ -22,12 +21,4 @@
|
|||
</fieldset>
|
||||
<?php echo $form->end('Submit');?>
|
||||
</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');
|
||||
shipmentTypeID = parseInt(shipmentTypeID);
|
||||
$(".hiddenDefault").hide();
|
||||
|
||||
$(".moreInfo").show();
|
||||
switch(shipmentTypeID) {
|
||||
case 1: //Import
|
||||
$("#importFields, #principle, #purchaseOrder").show();
|
||||
$("#importFields,#job,#principle, #purchaseOrder").show();
|
||||
$(".moreInfo").hide();
|
||||
showCommonFields();
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,3 @@
|
|||
/*
|
||||
* To change this template, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
$(function () {
|
||||
$("input.nocostinput").change(calcNetPrice); //When inputs of class nocostinput change. Calculate quick prices
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue