From 44026e53d989be789bb721c289c18a97d987f982 Mon Sep 17 00:00:00 2001 From: Karl Cordes Date: Mon, 21 Apr 2014 15:35:39 +1000 Subject: [PATCH] Fixed indents --- app/controllers/line_items_controller.php | 170 +++++++++++----------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/app/controllers/line_items_controller.php b/app/controllers/line_items_controller.php index b401a30c..ad8fc147 100755 --- a/app/controllers/line_items_controller.php +++ b/app/controllers/line_items_controller.php @@ -1,111 +1,111 @@ layout = 'ajax'; - if(!empty($this->data)) { - $this->LineItem->create($this->data); + function ajax_add() { + $this->layout = 'ajax'; + if(!empty($this->data)) { + $this->LineItem->create($this->data); - if ($this->LineItem->save($this->data)) { - echo "SUCCESS"; - } - else { - echo "FAILURE"; + if ($this->LineItem->save($this->data)) { + echo "SUCCESS"; + } + else { + echo "FAILURE"; + + //print_r($this->data); + } + } + else { + echo "NO-DATA"; + } - //print_r($this->data); - } - } - else { - echo "NO-DATA"; } - } + function ajax_edit() { + $this->layout = 'ajax'; + if(!empty($this->data)) { - function ajax_edit() { - $this->layout = 'ajax'; - if(!empty($this->data)) { + if ($this->LineItem->save($this->data)) { + echo "SUCCESS"; + } + else { + echo "FAILURE"; + } + } + else { + echo "NO-DATA"; + } - if ($this->LineItem->save($this->data)) { - echo "SUCCESS"; - } - else { - echo "FAILURE"; - } - } - else { - echo "NO-DATA"; } - } - - function ajax_delete($id = null) { - $this->layout = 'ajax'; - if($id == null) { - echo "FAILURE"; + function ajax_delete($id = null) { + $this->layout = 'ajax'; + if($id == null) { + echo "FAILURE"; + } + else { + if ($this->LineItem->del($id)) { + echo "SUCCESS"; + } + else { + echo "FAILURE"; + } + } } - else { - if ($this->LineItem->del($id)) { - echo "SUCCESS"; - } - else { - echo "FAILURE"; - } + + /** + * Get the products table with prices (for quotes, invoices etc) + * @param $documentID + */ + function getTable($documentID = null) { + $this->layout = 'ajax'; + if($documentID == null) { + echo "INVALID DOCUMENT ID"; + } + else { + $document = $this->LineItem->Document->find('first',array('conditions'=>array('Document.id'=>$documentID))); + $this->set('document',$document); + + $enquiry = $this->LineItem->Document->getEnquiry($document); + $this->set('enquiry', $enquiry); + $gst = $this->LineItem->Document->gstApplies($enquiry); + $this->set('gst',$gst); + + $this->set('totals', $this->calculateTotals($document, $gst)); + + $currency = $this->LineItem->Document->getCurrency($document); + $this->set('currencyCode', $currency['Currency']['iso4217']); + $this->set('currencySymbol', $currency['Currency']['symbol']); + } } - } - /** - * Get the products table with prices (for quotes, invoices etc) - * @param $documentID - */ - function getTable($documentID = null) { - $this->layout = 'ajax'; - if($documentID == null) { - echo "INVALID DOCUMENT ID"; + function edit($id = null) { + $this->layout = 'ajax'; + + $this->data = $this->LineItem->read(null,$id); + $this->set('yesNo', array(0=>'No', 1=>'Yes')); + $this->set('principles', $this->LineItem->Product->Principle->find('list')); + + + } - else { - $document = $this->LineItem->Document->find('first',array('conditions'=>array('Document.id'=>$documentID))); - $this->set('document',$document); - $enquiry = $this->LineItem->Document->getEnquiry($document); - $this->set('enquiry', $enquiry); - $gst = $this->LineItem->Document->gstApplies($enquiry); - $this->set('gst',$gst); - - $this->set('totals', $this->calculateTotals($document, $gst)); - - $currency = $this->LineItem->Document->getCurrency($document); - $this->set('currencyCode', $currency['Currency']['iso4217']); - $this->set('currencySymbol', $currency['Currency']['symbol']); + function add($documentID = null) { + $this->layout = 'ajax'; + $document = $this->LineItem->Document->read(null, $documentID); + $this->set('document', $document); + $this->set('yesNo', array(0=>'No', 1=>'Yes')); + $this->set('principles', $this->LineItem->Product->Principle->find('list')); } - } - - function edit($id = null) { - $this->layout = 'ajax'; - - $this->data = $this->LineItem->read(null,$id); - $this->set('yesNo', array(0=>'No', 1=>'Yes')); - $this->set('principles', $this->LineItem->Product->Principle->find('list')); - - - - } - - function add($documentID = null) { - $this->layout = 'ajax'; - $document = $this->LineItem->Document->read(null, $documentID); - $this->set('document', $document); - $this->set('yesNo', array(0=>'No', 1=>'Yes')); - $this->set('principles', $this->LineItem->Product->Principle->find('list')); - } } ?>