From 75110ae438f7bf14bc579ed956fcc5a8102c8fa5 Mon Sep 17 00:00:00 2001 From: VE10-Sanjeev Date: Tue, 15 Apr 2025 06:02:32 +0000 Subject: [PATCH] Raised trackers issues --- app/Config/Routes.php | 1 + app/Controllers/Requisitionform.php | 84 +++++++++++-------------- app/Models/Rawmaterialdetails_model.php | 9 +-- app/Models/Requistion_model.php | 18 ++++-- app/Views/editrequisitionform.php | 62 ++++++++++++++++-- app/Views/inwardgateregister.php | 4 +- app/Views/requisitionform.php | 78 ++++++++++++++++------- 7 files changed, 171 insertions(+), 85 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 929c4b0b..110b49d4 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -251,6 +251,7 @@ $routes->post('EditRequisition', 'Requisitionform::EditRequisition'); $routes->post('addNewRequisition', 'Requisitionform::addNewRequisition'); $routes->post('getMaterialCode', 'Requisitionform::getMaterialCode'); $routes->post('getMaterialDetails', 'Requisitionform::getMaterialDetails'); +$routes->post('getCategoryDetails', 'Requisitionform::getCategoryDetails'); $routes->post('DeleteRequistionForm', 'Requisitionform::DeleteRequistionForm'); // recheck it used or not. $routes->post('requisitionform/ApproveRequest', 'Requisitionform::ApproveRequest'); $routes->post('requisitionform/DeleteReqNo', 'Requisitionform::DeleteReqNo'); diff --git a/app/Controllers/Requisitionform.php b/app/Controllers/Requisitionform.php index df083ed1..39f1d4e3 100755 --- a/app/Controllers/Requisitionform.php +++ b/app/Controllers/Requisitionform.php @@ -204,49 +204,6 @@ class Requisitionform extends BaseController $this->loadViews("requisitionlistapproval", $this->global, $data, NULL); } - /** - * This function used to load the Employee details based on the EmpID selection - */ - function GetSelectedEmpDetails() - { - $ReqType = $_GET['ReqType']; - $EmpID = $this->request->getPost('id'); - $empDetails = $this->requistion_model->GetEmployeeDetails($EmpID); - $DeptCode = $empDetails[0]['DEPCode']; - $CostList = $this->requistion_model->GetCostCenterByDept($DeptCode); - $HTML = ""; - $BudAmount = ""; - if (count($CostList) > 0) { - for ($j = 0; $j < count($CostList); $j++) { - $Code = $CostList[$j]['CostCenterCode']; - $Name = $CostList[$j]['CostCenterName']; - $HTML .= ""; - } - } - if (count($CostList) == 1) { - - $FYStart = ''; - $FYEnd = ''; - $FiscalYear = $this->costcenter_model->getFiscalYear(); - if (!empty($FiscalYear)) { - foreach ($FiscalYear as $Fy) { - $FYStart = $Fy->StartYear; - $FYEnd = $Fy->EndYear; - } - } - - $FYdt = $FYStart . " - " . $FYEnd; - - - $result = $this->purchaseorder_model->GetAvailableBudgetAmount($CostCode, $FYdt, $ReqType); - //print_r($result); - $AvilBudAmt = '0'; - if (count($result) > 0) { - $BudAmount = $result[0]['BudgetAmount'] - $result[0]['Totalvalue']; - } - } - die(json_encode(array('emp' => $empDetails, 'Cost' => $HTML, 'AvlAmount' => $BudAmount))); - } function getAvailableBudAmount() { @@ -277,8 +234,9 @@ class Requisitionform extends BaseController { $ReqType = $this->request->getPost('id'); + $CatType = $this->request->getPost('cid'); - $MaterialCode = $this->requistion_model->GetMaterialCode($ReqType); + $MaterialCode = $this->requistion_model->GetMaterialCode($ReqType,$CatType); $MaterialName = ""; $UOM = ""; $HTML = ""; @@ -310,6 +268,28 @@ class Requisitionform extends BaseController return $this->response->setJSON(['MatDetail' => $MaterialDetails]); } + + function getCategoryDetails() + { + + $CategoryDetails = $this->requistion_model->getmaterialCategory(); + $HTML = ""; + + if (count($CategoryDetails) > 0) { + for ($j = 0; $j < count($CategoryDetails); $j++) { + $Code = $CategoryDetails[$j]['Key']; + $Name = $CategoryDetails[$j]['ConfigValue']; + + $HTML .= ""; + + } + + } + + $response = ['Category' => $HTML]; + return $this->response->setJSON($response); + } + /** * To Insert the Requistion Details to Database */ @@ -390,9 +370,13 @@ class Requisitionform extends BaseController } if ($Status == REQ_DRAFT) { - $display_message = 'Successfully Saved the Requistion details.Requistion No is ' . $ReqNumber; - } else { - $display_message = 'Successfully Created the Requistion details.Requistion No is ' . $ReqNumber; + $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) { + $display_message = "Successfully Updated the Requistion details as Approved!\nRequistion Number Is: ". $ReqNumber; + // $display_message = "Requistion Created Successfully!\nRequistion Number Is: ". $ReqNumber; + }else{ + $display_message = "Successfully Created the Requistion details!\nRequistion Number Is: ". $ReqNumber; } return $this->response->setJSON([$display_message]); @@ -459,7 +443,8 @@ class Requisitionform extends BaseController } } } - $display_message = 'Successfully Updated the Requistion details.Requistion No is ' . $ReqNumber; + + $display_message = "Successfully Updated the Requistion details as Created!\nRequistion Number Is: ". $ReqNumber; return $this->response->setJSON([$display_message]); } @@ -592,7 +577,8 @@ class Requisitionform extends BaseController $Request = array('Status' => $Status, 'Comments' => $Remarks, 'ApprovedOn' => $ApprovedDate, 'Approvedby' => $ApprovedBy); $this->requistion_model->UpdateRequistion($Request, $ReqNo); - return $this->response->setJSON(['message' => "Successfully Updated the Requisition No: " . $ReqNo]); + + return $this->response->setJSON(['message' => "Requistion Updated Successfully!\nRequistion Number Is: ".$ReqNo]); } } diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index 8017f97e..469884c6 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -74,16 +74,16 @@ class Rawmaterialdetails_model extends Model } //This function used to get the material category using configdetails table - function getmaterialCategory($MaterialCategory = '') + function getmaterialCategory() { $Config_ID = 'C023'; $builder = $this->db->table('t_configdetails') ->select('Key,Config_ID,ConfigValue') ->where('isActive', 1) ->where('Config_id', $Config_ID); - if ($MaterialCategory != '') { - $builder->where('ConfigValue !=', $MaterialCategory); - } + // if ($MaterialCategory != '') { + // $builder->where('ConfigValue !=', $MaterialCategory); + // } $query = $builder->get(); return $query->getResult(); @@ -143,6 +143,7 @@ class Rawmaterialdetails_model extends Model return $query->getResult(); } + function getAllSilicaRawMaterialCode(){ $builder = $this->db->table('t_materialmaster') diff --git a/app/Models/Requistion_model.php b/app/Models/Requistion_model.php index d2fe8011..897c3df8 100755 --- a/app/Models/Requistion_model.php +++ b/app/Models/Requistion_model.php @@ -172,14 +172,13 @@ class Requistion_model extends Model * This function is used to get the Material details for the Request type * @return array $result : This is result of the query */ - function GetMaterialCode($ReqType,$NotArray='') + function GetMaterialCode($ReqType,$CatType,$NotArray='') { $builder = $this->db->table('t_materialmaster') ->select('MaterialCode, MaterialName,UOM,material_rate,HSNCODE') - - ->where('IsActive',1); + ->where('IsActive',1) + ->where('Category',$CatType); //->where('MaterialType',$ReqType ); - $query = $builder->get(); if($NotArray == '') { @@ -594,6 +593,17 @@ class Requistion_model extends Model return $categoryName; } + function getmaterialCategory() + { + $Config_ID = 'C023'; + $builder = $this->db->table('t_configdetails') + ->select('Key,Config_ID,ConfigValue') + ->where('isActive', 1) + ->where('Config_id', $Config_ID); + $query = $builder->get(); + return $query->getResultArray(); + } + } \ No newline at end of file diff --git a/app/Views/editrequisitionform.php b/app/Views/editrequisitionform.php index 68f64d22..8fe49172 100755 --- a/app/Views/editrequisitionform.php +++ b/app/Views/editrequisitionform.php @@ -322,6 +322,17 @@ td { aria-hidden="true">×