From f5a07bae4e552868da80bffbcfd1466d5219992f Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Sun, 5 May 2013 18:42:35 +1000 Subject: [PATCH] Misc costing work. Going to try to generate Excel costings --- app/controllers/costings_controller.php | 26 +++++++++++++----------- app/controllers/documents_controller.php | 2 ++ app/views/costings/add.ctp | 1 + app/webroot/js/add_costing.js | 4 +--- 4 files changed, 18 insertions(+), 15 deletions(-) diff --git a/app/controllers/costings_controller.php b/app/controllers/costings_controller.php index 6db944fb..fe2cd478 100755 --- a/app/controllers/costings_controller.php +++ b/app/controllers/costings_controller.php @@ -27,21 +27,23 @@ class CostingsController extends AppController { $this->Session->setFlash(__('The Costing could not be saved. Please, try again.', true)); } } - if(isset($this->params['named']['productid'])) { - $product = $this->Costing->Product->findById($this->params['named']['productid']); - - $this->set('product', $product); - } + if(isset($this->params['named']['productid'])) { + $product = $this->Costing->Product->findById($this->params['named']['productid']); - if(isset($this->params['named']['lineitemid'])) { - $line_item = $this->Costing->LineItem->findById($this->params['named']['lineitem']); - - $this->set('line_item', $line_item); + $this->set('type', 'product'); + $this->set('product', $product); + } + + if(isset($this->params['named']['line_item_id'])) { + $line_item = $this->Costing->LineItem->findById($this->params['named']['line_item_id']); + + $this->set('type', 'line_item'); + $this->set('line_item', $line_item); + die(print_r($line_item)); + } - } - $purchaseCurrencies = $this->Costing->PurchaseCurrency->find('list'); $saleCurrencies = $this->Costing->SaleCurrency->find('list'); $this->set(compact('purchaseCurrencies', 'saleCurrencies')); @@ -82,4 +84,4 @@ class CostingsController extends AppController { } } -?> \ No newline at end of file +?> diff --git a/app/controllers/documents_controller.php b/app/controllers/documents_controller.php index 565fef0d..ba7bd23b 100755 --- a/app/controllers/documents_controller.php +++ b/app/controllers/documents_controller.php @@ -727,6 +727,8 @@ class DocumentsController extends AppController { } + function costing() { + } } diff --git a/app/views/costings/add.ctp b/app/views/costings/add.ctp index 9c64cffa..96e76ec4 100755 --- a/app/views/costings/add.ctp +++ b/app/views/costings/add.ctp @@ -10,6 +10,7 @@ elseif(isset($line_item)) { $form->input('line_item_id', array('type'=>'hidden', 'value'=>$line_item['LineItem']['id'])); + print_r($line_item); } ?> diff --git a/app/webroot/js/add_costing.js b/app/webroot/js/add_costing.js index 42e04068..f32c5e85 100755 --- a/app/webroot/js/add_costing.js +++ b/app/webroot/js/add_costing.js @@ -10,8 +10,6 @@ $(document).ready(function () { $(":input").change(buildup) - - }); @@ -168,4 +166,4 @@ function checkNaN(value) { else { return value; } -} \ No newline at end of file +}