From 1b6b2e0f218f05b0c0afc0aefde633b7e8954f2e Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Tue, 26 Nov 2024 12:16:12 +0530 Subject: [PATCH] changes in amendment purchase order-1 vadivel J 26-11-2024 --- app/Controllers/Amendmentpurchaseorder.php | 34 +++++++++++++++------- app/Models/Purchaseorder_model.php | 8 ++++- app/Views/editImportAmendPO.php | 4 +-- app/Views/editRevenueAmendPO.php | 4 +-- app/Views/editServiceAmendPO.php | 4 +-- 5 files changed, 36 insertions(+), 18 deletions(-) diff --git a/app/Controllers/Amendmentpurchaseorder.php b/app/Controllers/Amendmentpurchaseorder.php index ed56d7c3..3cfc359c 100755 --- a/app/Controllers/Amendmentpurchaseorder.php +++ b/app/Controllers/Amendmentpurchaseorder.php @@ -346,9 +346,13 @@ class Amendmentpurchaseorder extends BaseController $NewPO = ""; } - // $PODetail = array('Status' => PO_AMENDED); //TO SET PARENT PO AS AMENDMENT STATUS + if( $changeStatus == "ST026" || $changeStatus == "ST014"){ + $PODetail = array('Status' => PO_AMENDED); //TO SET PARENT PO AS AMENDMENT STATUS - // $APO = $this->purchaseorder_model->updateAmendPOMaster($PONO, $PODetail); + $APO = $this->purchaseorder_model->updateAmendPOMaster($PONO, $PODetail); + } + + $LineItemStatus = REQITEM_NEW; @@ -703,9 +707,11 @@ class Amendmentpurchaseorder extends BaseController } - // $PODetail = array('Status' => PO_AMENDED); //TO SET PARENT PO AS AMENDMENT STATUS + if( $changeStatus == "ST026" || $changeStatus == "ST014"){ + $PODetail = array('Status' => PO_AMENDED); //TO SET PARENT PO AS AMENDMENT STATUS - // $APO = $this->purchaseorder_model->updateAmendPOMaster($PONO, $PODetail); + $APO = $this->purchaseorder_model->updateAmendPOMaster($PONO, $PODetail); + } $LineItemStatus = REQITEM_NEW; @@ -1024,9 +1030,11 @@ class Amendmentpurchaseorder extends BaseController $NewPO = $LastPO[0]['PONO']; } - //$PODetail = array('Status' => PO_AMENDED); //TO SET PARENT PO AS AMENDMENT STATUS + if( $changeStatus == "ST026" || $changeStatus == "ST014"){ + $PODetail = array('Status' => PO_AMENDED); //TO SET PARENT PO AS AMENDMENT STATUS - // $APO = $this->purchaseorder_model->updateAmendPOMaster($PONO, $PODetail); + $APO = $this->purchaseorder_model->updateAmendPOMaster($PONO, $PODetail); + } $LineItemStatus = REQITEM_NEW; @@ -1412,12 +1420,16 @@ class Amendmentpurchaseorder extends BaseController $LastPO = $this->purchaseorder_model->addAmendPOMaster($POMaster, $CreateBy, $PONO); $NewPO = ''; - foreach ($LastPO as $PO) : - $NewPO = $PO['PONO']; - endforeach; - // $PODetail = array('Status' => PO_AMENDED); //TO SET PARENT PO AS AMENDMENT STATUS + if (count($LastPO) > 0) { + $NewPO = $LastPO[0]['PONO']; + } - // $APO = $this->purchaseorder_model->updateAmendPOMaster($PONO, $PODetail); + if( $changeStatus == "ST026" || $changeStatus == "ST014"){ + + $PODetail = array('Status' => PO_AMENDED); //TO SET PARENT PO AS AMENDMENT STATUS + + $APO = $this->purchaseorder_model->updateAmendPOMaster($PONO, $PODetail); + } $LineItemStatus = REQITEM_NEW; diff --git a/app/Models/Purchaseorder_model.php b/app/Models/Purchaseorder_model.php index 8f4f7f18..43b7a111 100755 --- a/app/Models/Purchaseorder_model.php +++ b/app/Models/Purchaseorder_model.php @@ -840,14 +840,20 @@ mstr.CourierNo,pom.Status,pom.POType') //,bill.BillNo,bill.FilePath, $insert_id = $this->db->affectedRows(); $this->db->transComplete(); + // print_r($insert_id);die; + if ($insert_id > 0) { $subQuery = 'select PONO from t_purchaseorder_master where CreatedBy=? and ParentPO=? order by CreatedDate desc limit 1'; $query = $this->db->query($subQuery, array($CreatedBy, $ParentPO)); - return $query->getResultArray(); + $result = $query->getResultArray(); + + //print_r($result);die; + + return $result; } else { return []; } diff --git a/app/Views/editImportAmendPO.php b/app/Views/editImportAmendPO.php index dcc10abe..1f43901d 100755 --- a/app/Views/editImportAmendPO.php +++ b/app/Views/editImportAmendPO.php @@ -2929,10 +2929,10 @@ if (!empty($RequistionDetails)) { var formData = new FormData($('.ImportPO')[0]); if (status == 0) { // for draft - formData.append('changeStatus','STO14'); + formData.append('changeStatus','ST014'); }; if (status == 1) { // for approve - formData.append('changeStatus','STO26'); + formData.append('changeStatus','ST026'); }; $.ajax({ diff --git a/app/Views/editRevenueAmendPO.php b/app/Views/editRevenueAmendPO.php index c01568fa..c5c468a0 100755 --- a/app/Views/editRevenueAmendPO.php +++ b/app/Views/editRevenueAmendPO.php @@ -2567,10 +2567,10 @@ if (!empty($INRSYMBOL)) { var formData = new FormData($('.CreatePO')[0]); if (status == 0) { // for draft - formData.append('changeStatus','STO14'); + formData.append('changeStatus','ST014'); }; if (status == 1) { // for approve - formData.append('changeStatus','STO26'); + formData.append('changeStatus','ST026'); }; $('#loader').show(); diff --git a/app/Views/editServiceAmendPO.php b/app/Views/editServiceAmendPO.php index 3c8c4e23..5de1e357 100755 --- a/app/Views/editServiceAmendPO.php +++ b/app/Views/editServiceAmendPO.php @@ -2216,10 +2216,10 @@ foreach ($PaymentTerms as $TER) { // $('#content').loader('show'); var formData = new FormData($('.ServicePO')[0]); if (status == 0) { // for draft - formData.append('changeStatus','STO14'); + formData.append('changeStatus','ST014'); }; if (status == 1) { // for approve - formData.append('changeStatus','STO26'); + formData.append('changeStatus','ST026'); }; $('#loader').show(); $.ajax({