From 2b0af091215fcc94bf7d0fab339c1c12d3c12603 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Fri, 16 Jun 2023 15:05:58 +0530 Subject: [PATCH] merged uptodate : ps --- application/controllers/requisitionform.php | 81 ++++++++++--------- application/models/requistion_model.php | 26 +++--- application/views/editrequisitionform.php | 4 +- application/views/requisitionlistapproval.php | 4 +- 4 files changed, 59 insertions(+), 56 deletions(-) diff --git a/application/controllers/requisitionform.php b/application/controllers/requisitionform.php index a64d7f1c..6e8faa16 100644 --- a/application/controllers/requisitionform.php +++ b/application/controllers/requisitionform.php @@ -351,8 +351,9 @@ class requisitionform extends BaseController */ function addNewRequistion() { + // print_r($this->input->post());die(); - log_message('error'," add new Requisition Fns Called"); + 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,15 +362,16 @@ class requisitionform extends BaseController $this->requisition(); } else - { + { log_message('error'," add new Requisition GET[ID] ".$_GET['ID']); - $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' ); + $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' ); + $UpdatedBy = $this->session->userdata ( 'userId' ); $dt = new DateTime('now', new DateTimeZone('Asia/Kolkata')); $createddt = $dt->format('Y-m-d H:i:s'); @@ -378,29 +380,30 @@ class requisitionform extends BaseController $comma_separated = explode(':', $DeletedRow); $serviceSchedule = $this->input->post('serviceSchedule'); - $servicePeriod = $this->input->post('serviceSchedule'); - // $noOfService = $this->input->post('noOfService'); + $servicePeriod = $this->input->post('serviceSchedule'); + // $noOfService = $this->input->post('noOfService'); $noOfService = 1; - $IsExists = $this->requistion_model->RequistionIsExists($Requestedby); - // print_r($IsExists); + $IsExists = $this->requistion_model->RequistionIsExists($Requestedby); + // print_r($IsExists);die(); + // return true; - if(count( $IsExists) == 0) - { + if(count( $IsExists) == 0) + { //echo 'Not Exists'; $Request = array('ReqType'=>$RequestType, 'Requestedby'=>$Requestedby,'ReqDate'=>$createddt,'CostCenterCode'=>$CostCenter,'Status'=>$Status,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'Schedule_Type'=>$serviceSchedule,'NumberOfService'=>$noOfService,'Service_Period'=>$servicePeriod,'RequestedDept'=>$RequestedbyDept); //print_r($Request); $Req = $this->requistion_model->addRequistion($Request); - } - else - { + } + else + { //echo 'Exists'; $Request = array('ReqType'=>$RequestType, 'Requestedby'=>$Requestedby,'ReqDate'=>$createddt,'Status'=>$Status,'CreatedDate'=>$createddt,'CreatedBy'=>$CreateBy,'CostCenterCode'=>$CostCenter,'Schedule_Type'=>$serviceSchedule,'NumberOfService'=>$noOfService,'Service_Period'=>$servicePeriod,'RequestedDept'=>$RequestedbyDept); $UpdateReq = $this->requistion_model->UpdateRequistion($Request,$IsExists[0]['ReqNo']); - } - $ReqNumber = ''; + } + $ReqNumber = ''; if(count($Req)>0) { $ReqNumber = $Req[0]['ReqNo']; @@ -410,12 +413,12 @@ class requisitionform extends BaseController $ReqNumber = $IsExists[0]['ReqNo']; } - $SkipInsert = False; - for ($i = 1; $i <= $RowCount; $i++) - { - $SkipInsert = "False"; - if( count($comma_separated) > 0) - { + $SkipInsert = False; + for ($i = 1; $i <= $RowCount; $i++) + { + $SkipInsert = "False"; + if( count($comma_separated) > 0) + { for($j = 1; $j < count($comma_separated); $j++) { $deletedRow = $comma_separated[$j] ; @@ -427,27 +430,27 @@ class requisitionform extends BaseController } } - } + } - if($SkipInsert == "False") - { + if($SkipInsert == "False") + { $MaterialCode = $this->input->post('MaterialCode'.$i); $Quantity = $this->input->post('Quantity'.$i); $OtherD = $this->input->post('otherD'.$i); - $ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'MaterialDescription'=>$OtherD); - $this->requistion_model->addRequistionDetails($ReqDetails,$ReqNumber); - } + $ReqDetails = array('ReqNo'=>$ReqNumber, 'MaterialCode'=>$MaterialCode,'Quantity'=>$Quantity,'MaterialDescription'=>$OtherD,'UpdatedBy'=>$UpdatedBy); + $this->requistion_model->addRequistionDetails($ReqDetails,$ReqNumber); + } - } - if($Status == REQ_DRAFT) - { - echo 'Successfully Saved the Requistion details.Requistion No is '.$ReqNumber; - } - else - { - echo 'Successfully Created the Requistion details.Requistion No is '.$ReqNumber; - } + } + if($Status == REQ_DRAFT) + { + echo 'Successfully Saved the Requistion details.Requistion No is '.$ReqNumber; + } + else + { + echo 'Successfully Created the Requistion details.Requistion No is '.$ReqNumber; + } } diff --git a/application/models/requistion_model.php b/application/models/requistion_model.php index d693b521..c03ccb9a 100644 --- a/application/models/requistion_model.php +++ b/application/models/requistion_model.php @@ -29,7 +29,7 @@ class requistion_model extends CI_Model return $query->result(); } - /* This function is used to getEditRequistItemList view the information + /* This function is used to getEditRequistItemList view the information * @return array $result : This is result of the query */ function getEditRequistItemList($ReqNo) @@ -52,16 +52,16 @@ class requistion_model extends CI_Model /* $subQuery ='select distinct Req.ReqNo, Req.MaterialCode,Mat.MaterialName,Mat.UOM, Req.Quantity, -ifnull(Po.Quantity,0) as POQTY,sta.StatusName - from T_Requestion_Details Req join T_MaterialMaster Mat on - Req.MaterialCode = Mat.MaterialCode - left join T_PurchaseOrder_LineItem Po on Po.ReqNo = Req.ReqNo - left join T_PurchaseOrder_Master POmast on POmast.PONO=Po.PONO - and Po.MaterialCode = Req.MaterialCode - join T_Status sta on sta.StatusCode = Req.Status + ifnull(Po.Quantity,0) as POQTY,sta.StatusName + from T_Requestion_Details Req join T_MaterialMaster Mat on + Req.MaterialCode = Mat.MaterialCode + left join T_PurchaseOrder_LineItem Po on Po.ReqNo = Req.ReqNo + left join T_PurchaseOrder_Master POmast on POmast.PONO=Po.PONO + and Po.MaterialCode = Req.MaterialCode + join T_Status sta on sta.StatusCode = Req.Status where Req.ReqNo = ? and POmast.Status != ?'; - $query = $this->db->query($subQuery, array($ReqNo,PO_AMENDED)); + $query = $this->db->query($subQuery, array($ReqNo,PO_AMENDED)); // print_r($this->db->last_query()); return $query->result(); */ @@ -395,7 +395,6 @@ ifnull(Po.Quantity,0) as POQTY,sta.StatusName } } - } /** * This function is used to check the Request is in Draft status * @return array $result : This is result of the query @@ -407,11 +406,12 @@ ifnull(Po.Quantity,0) as POQTY,sta.StatusName $this->db->where('Status ',REQ_DRAFT ); $this->db->where('Requestedby ',$ReqBy ); $query = $this->db->get(); - + //print_r($this->db->last_query());die(); if ($query->num_rows > 0) { - //echo $result->num_rows; return $query->result_array(); - } + }else{ + return array(); + } } /** * This function is used to check the Request Line Item is in Draft status diff --git a/application/views/editrequisitionform.php b/application/views/editrequisitionform.php index 72630637..88444633 100644 --- a/application/views/editrequisitionform.php +++ b/application/views/editrequisitionform.php @@ -461,7 +461,7 @@ if(!empty($ReqPOType)) foreach($LineItem as $record) { $index = $index + 1; - $materialdesc=$record->MaterialDescription; + $materialdesc=isset($record->MaterialDescription) ? $record->MaterialDescription :""; //echo $materialdesc; ?> @@ -481,7 +481,7 @@ if(!empty($ReqPOType)) Quantity ; ?> POQTY ; ?> StatusName ;?> - +     diff --git a/application/views/requisitionlistapproval.php b/application/views/requisitionlistapproval.php index 31481ec1..3bd68104 100644 --- a/application/views/requisitionlistapproval.php +++ b/application/views/requisitionlistapproval.php @@ -302,9 +302,9 @@ function saveToDatabase(editableObj,column,ReqId,Index) { success:function(data) { if(data) { - $('#content').loader('hide'); + $('#content').loader('hide'); alert(data); - location.reload(); + location.reload(true); } else {