From f75cbb9f87504b7a460b50957d7e71d5669f81ae Mon Sep 17 00:00:00 2001 From: gandhimathi Bharathirajan Date: Fri, 5 May 2017 16:16:09 +0530 Subject: [PATCH] Cost center --- application/controllers/CostCenter.php | 47 +++++++++++--------------- 1 file changed, 19 insertions(+), 28 deletions(-) diff --git a/application/controllers/CostCenter.php b/application/controllers/CostCenter.php index a275be53..9b5cef01 100644 --- a/application/controllers/CostCenter.php +++ b/application/controllers/CostCenter.php @@ -46,12 +46,13 @@ class CostCenter extends BaseController $data['searchText'] = $searchText; - $count = $this->costcenter_model->costListingCount($searchText); + $count = $this->costcenter_model->CostListingCount($searchText); $returns = $this->paginationCompress ( "costListing/", $count, 5 ); - $data['userRecords'] = $this->costcenter_model->costListing($searchText, $returns["page"], $returns["segment"]); - + $data['userRecords'] = $this->costcenter_model->CostListing($searchText, $returns["page"], $returns["segment"]); + + //print_r( $data) ; $this->global['pageTitle'] = 'Siddharth : Test List'; $this->loadViews("costListing", $this->global, $data, NULL); @@ -75,6 +76,20 @@ class CostCenter extends BaseController } + function Dep_SelectedDepartment($selectValue) +{ + //echo 'select_validate method called'; + // 'none' is the first option and the text says something like "-Choose one-" + if(strlen($SelectedDepartment) <= 0 ) + { + $this->form_validation->set_message('Dep_SelectedDepartment', 'Please Select Department.'); + return false; + } + else // user picked something + { + return true; + } +} /** * This function is used to add new Cost to the system @@ -85,31 +100,7 @@ class CostCenter extends BaseController $this->form_validation->set_rules('CostCode','CostCode','trim|required'); $this->form_validation->set_rules('CostName','CostName','trim|required'); - - $SelectedDepartment = $this->input->post('txtSelectedDepartment'); - $ApproverName = $this->input->post('ApprovedBy'); - //print_r($ApproverName); - $Deptlist = explode(':', $SelectedDepartment); - - if(strlen($SelectedDepartment) <= 0 ) - { - print_r('Please select Department'); - return; - } - - $RowCount = $this->input->post('txtRowCount'); - - if($RowCount <= 0 ) - { - print_r('Please Add Budget'); - return; - } - - if($ApproverName == "-1" ) - { - print_r('Please Select Approver'); - return; - } + if($this->form_validation->run() == FALSE) { $this->addCostCenter();