From 22f0df4cf120bee39060ec42f80ffdeafdc13b8b Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Mon, 12 Jun 2023 17:43:44 +0530 Subject: [PATCH] Requisition Form Fixes : ps --- application/controllers/requisitionform.php | 12 +++++++++--- application/models/requistion_model.php | 21 +++++++++------------ 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/application/controllers/requisitionform.php b/application/controllers/requisitionform.php index 51397b27..926dedfd 100644 --- a/application/controllers/requisitionform.php +++ b/application/controllers/requisitionform.php @@ -29,6 +29,7 @@ class requisitionform extends BaseController */ function requisitionlisting() { + log_message('error'," Requisition Listing Fns Called"); $this->global['pageTitle'] = 'Siddharth : Requisition Listing'; $userID = $this->session->userdata ( 'userId' ); @@ -38,9 +39,9 @@ class requisitionform extends BaseController $data['TotNoOfLine'] =$this->requistion_model->getRequistionList($userID); - +// print_r($data['TotNoOfLine']); - $this->loadViews("requisitionlisting", $this->global, $data, NULL); + $this->loadViews("requisitionlisting", $this->global, $data, NULL); @@ -51,6 +52,7 @@ class requisitionform extends BaseController function requisition() { + log_message('error'," Raise Requisition Fns Called"); $this->global['pageTitle'] = 'Siddharth : Raise Requisition'; $data['RequestType'] = $this->requistion_model->getConfigValue('C020'); @@ -58,6 +60,7 @@ class requisitionform extends BaseController $data['EmpList'] = $this->requistion_model->getAllEmployees(); $data['ServiceOption'] = $this->requistion_model->getConfigValue('C022'); $userID = $this->session->userdata ( 'userId' ); + log_message('error'," Raise Requisition userId ".$userID); $data['Emp'] = $this->requistion_model->getEmpIdByUserID($userID); @@ -352,6 +355,7 @@ class requisitionform extends BaseController function addNewRequistion() { + log_message('error'," add new Requisition Fns Called"); $this->form_validation->set_rules('RequestType','RequestType','trim|required'); $this->form_validation->set_rules('EmpID','EmpID','trim|required'); @@ -361,9 +365,11 @@ class requisitionform extends BaseController } else { - $Status= $_GET['ID']; + log_message('error'," add new Requisition (Code of REQ_DRAFT) GET[ID] ".$_GET['ID']);REQ_DRAFT + $Status= $_GET['ID']; $RequestType = strtoupper(trim($this->input->post('RequestType'))); $Requestedby = strtoupper(trim($this->input->post('EmpID'))); + log_message('error'," add new Requisition empid ".$Requestedby); $RequestedbyDept = $this->session->userdata ( 'DEPCode' ); $CostCenter = $this->input->post('CostCenter'); $CreateBy = $this->session->userdata ( 'userId' ); diff --git a/application/models/requistion_model.php b/application/models/requistion_model.php index 6cc69326..0493f820 100644 --- a/application/models/requistion_model.php +++ b/application/models/requistion_model.php @@ -359,21 +359,18 @@ ifnull(Po.Quantity,0) as POQTY,sta.StatusName */ function addRequistion($Requistion) { - // $this->db->trans_start(); - // $this->db->insert('T_Requestion_Master', $Requistion); - // $insert_id = $this->db->affected_rows(); - // $this->db->trans_complete(); - $insert_id = 1; + $this->db->trans_start(); + $this->db->insert('T_Requestion_Master', $Requistion); + $insert_id = $this->db->affected_rows(); + $this->db->trans_complete(); + log_message('error','add new Requisition affected rows = '.$insert_id); if($insert_id>0) { - // $subQuery = 'select max(ReqNo) as ReqNo from T_Requestion_Master'; - $subQuery = 'select ReqNo from T_Requestion_Master order by CreatedDate desc limit 1'; - - $query = $this->db->query($subQuery); - - return $query->result_array(); + // $subQuery = 'select max(ReqNo) as ReqNo from T_Requestion_Master'; + $subQuery = 'select ReqNo from T_Requestion_Master order by CreatedDate desc limit 1'; + $query = $this->db->query($subQuery); + return $query->result_array(); } - } /** * This function is used to check the Request is in Draft status