From 7dbbf252a338143088224895e706bc1d68c5b7f6 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Fri, 25 Apr 2025 07:37:06 +0000 Subject: [PATCH] tracker id 1595 --- app/Controllers/Inwardgateregister.php | 5 ++++- app/Controllers/Requisitionform.php | 14 +++++--------- app/Models/Inwardgateregister_model.php | 4 ++-- app/Models/Requistion_model.php | 11 ++--------- app/Views/viewinwardgateregister.php | 6 +++--- 5 files changed, 16 insertions(+), 24 deletions(-) diff --git a/app/Controllers/Inwardgateregister.php b/app/Controllers/Inwardgateregister.php index abdc571f..d766856a 100755 --- a/app/Controllers/Inwardgateregister.php +++ b/app/Controllers/Inwardgateregister.php @@ -163,6 +163,7 @@ class Inwardgateregister extends BaseController // $data['PO_NO'] = array_filter($result, function($item) { // return !($item->status === 'ST027' && $item->IsOpenOrder === null); // }); + // dd($result); $data['PO_NO'] = array_filter($result, function($item) { return !($item->status === 'ST027'); }); @@ -1151,6 +1152,8 @@ function viewIGRDetails() $totalReceivedqty = ($ReceivedQuantity-$quantityAsPerInvoice); $POLineItem = array('ReceivedQuantity' => ($totalReceivedqty > 0) ? $totalReceivedqty : 0 ); $this->inwardgateregister_model->UpdatePOLineItem($POLineItem, $PONo, $MaterialCode); + $POMasterStatus = array('Status' => PO_RELEASED); + $this->inwardgateregister_model->UpdatePOMasterStatus($PONo, $POMasterStatus); } # Step 5.3 : Updating IGRlineitem @@ -1393,7 +1396,7 @@ function updateIGRWeight(){ $POMasterStatus = array('Status' => PO_RELEASED); - $this->inwardgateregister_model->UpdatePOMasterOGRStatus($pono, $POMasterStatus); + $this->inwardgateregister_model->UpdatePOMasterStatus($pono, $POMasterStatus); } } diff --git a/app/Controllers/Requisitionform.php b/app/Controllers/Requisitionform.php index e6cd0c8d..7c3605b2 100755 --- a/app/Controllers/Requisitionform.php +++ b/app/Controllers/Requisitionform.php @@ -326,7 +326,7 @@ class Requisitionform extends BaseController $servicePeriod = $this->request->getPost('serviceSchedule'); // $noOfService = $this->request->getPost('noOfService'); $noOfService = 1; - $IsExists = $this->requistion_model->RequistionIsExists($Requestedby); + // $IsExists = $this->requistion_model->RequistionIsExists($Requestedby); $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); @@ -337,14 +337,10 @@ class Requisitionform extends BaseController $Request['ApprovedOn'] = get_current_date_time(); } - if (count($IsExists) == 0) { - $Req = $this->requistion_model->addRequisition($Request); - } else { - $UpdateReq = $this->requistion_model->UpdateRequistion($Request, $IsExists[0]['ReqNo']); - } + $Req = $this->requistion_model->addRequisition($Request); - $ReqNumber = (count($Req) > 0) ? $Req[0]['ReqNo'] - : $IsExists[0]['ReqNo']; + + $ReqNumber = $Req[0]['ReqNo']; $SkipInsert = "false"; for ($i = 1; $i <= $RowCount; $i++) { @@ -372,7 +368,7 @@ class Requisitionform extends BaseController if ($Status == REQ_DRAFT) { $display_message = "Successfully Saved the Requisition details in Draft!\nRequistion Number Is: ". $ReqNumber; // $display_message = "Requistion Saved as Draft!\nRequistion Number Is: ". $ReqNumber; - } else if($Status == REQ_APPROVED) { + }else if($Status == REQ_APPROVED) { $display_message = "Successfully Updated the Requistion details as Approved!\nRequistion Number Is: ". $ReqNumber; // $display_message = "Requistion Created Successfully!\nRequistion Number Is: ". $ReqNumber; }else{ diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index db07f673..b42b979c 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -148,7 +148,7 @@ class Inwardgateregister_model extends Model $query = $builder->get(); $result = $query->getResult(); - // echo $this->db->getLastQuery()->getQuery(); die; + // echo $this->db->getLastQuery()->getQuery(); die; return $result; } @@ -616,7 +616,7 @@ class Inwardgateregister_model extends Model } - function UpdatePOMasterOGRStatus($pono, $POMasterStatuss) + function UpdatePOMasterStatus($pono, $POMasterStatuss) { $this->db->table('t_purchaseorder_master') ->where('PONO', $pono) diff --git a/app/Models/Requistion_model.php b/app/Models/Requistion_model.php index 7bd246fb..aed5d729 100755 --- a/app/Models/Requistion_model.php +++ b/app/Models/Requistion_model.php @@ -380,14 +380,11 @@ class Requistion_model extends Model // } function addRequisition($Requisition) { - $this->db->transStart(); // Start transaction $result = $this->db->table('t_requestion_master')->insert($Requisition); $insert_id = $this->db->insertID(); $affected_rows = $this->db->affectedRows(); - $this->db->transComplete(); // Complete transaction - - try { + if ($affected_rows > 0) { $subQuery = 'SELECT ReqNo FROM t_requestion_master ORDER BY CreatedDate DESC LIMIT 1'; $query = $this->db->query($subQuery); @@ -396,12 +393,8 @@ class Requistion_model extends Model return $query->getResultArray(); } else { - throw new \Exception("Database error occurred, requisition master details not inserted"); + return []; } - } catch (\Exception $e) { - log_message('error', $e->getMessage()); - return false; - } } /** diff --git a/app/Views/viewinwardgateregister.php b/app/Views/viewinwardgateregister.php index f92d5cf8..94f1b19b 100755 --- a/app/Views/viewinwardgateregister.php +++ b/app/Views/viewinwardgateregister.php @@ -1526,7 +1526,7 @@ success: function(data) { alert(data); - // location.reload(); + location.reload(); } }); }); @@ -1609,7 +1609,7 @@ // setTimeout(function () { // $("#Igrshow").modal('hide'); // }, 2000); - // location.reload(); + location.reload(); }, error: function(xhr, status, error) { // Error callback console.error('AJAX Error:', status, error); @@ -1655,7 +1655,7 @@ success: function(data) { alert(data); - // location.reload(); + location.reload(); } }); });