From 4f4d2747e9f030319dc30de1cb391b1cef6efde2 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Wed, 11 Dec 2024 18:46:30 +0530 Subject: [PATCH] stock module changes-1 vadivel J 11-12-2024 --- app/Config/Routes.php | 2 +- app/Controllers/StockController.php | 80 ++++- app/Models/Inwardgateregister_model.php | 14 +- app/Models/Rawmaterialdetails_model.php | 3 +- app/Views/CoatingMachineDetail.php | 2 +- app/Views/incomingSilicaSandDetails.php | 418 ++++++++++++++++++++---- 6 files changed, 435 insertions(+), 84 deletions(-) diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 8ace46cf..aa81e5b6 100755 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -461,7 +461,7 @@ $routes->match(['GET', 'POST', 'PUT', 'DELETE'], 'addOrEditPowerConsumptionDetai //incoming Silica Sand Detaails $routes->match(['GET', 'POST'], 'incomingSilicaSandDetails', 'StockController::loadView_incomingSilicaSandDetails'); $routes->post('updateIncomingSilicaSandDetails', 'StockController::updateIncomingSilicaSandDetails'); - +$routes->post('updateLabReport','StockController::updateLabReport'); //Bag stock details $routes->match(['GET', 'POST'], 'bagStockDetails', 'StockController::loadView_bagStockDetails'); diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 80b4416b..cf131bd1 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -334,12 +334,12 @@ class StockController extends BaseController $incomingSilicaSandDetailsData = json_decode($postData['incomingSilicaSandDetailsData'], true); + $inserts = []; + $updates = []; foreach ($incomingSilicaSandDetailsData as $data) { - $IGRNO = $data['IGR No']; - $materialCode = $data['MaterialCode']; - + $id = $data['id']; $dbData = [ 'igrNo_fk' => $data['IGR No'], @@ -373,31 +373,81 @@ class StockController extends BaseController ]; + + $resultExists = $this->incomingSilicaSandDetails_model - ->where('igrNo_fk', $IGRNO) - ->where('materialCode', $materialCode) + ->where('id', $id) ->first(); + !empty($resultExists) ? $updates[] = $dbData : $inserts[] = $dbData; - if (!empty($resultExists)) { + } - $updated = $this->incomingSilicaSandDetails_model - ->where('igrNo_fk', $IGRNO) - ->where('materialCode', $materialCode) - ->set($dbData) - ->update(); - - } else { - $inserted = $this->incomingSilicaSandDetails_model->insert($dbData); - } + if(!empty($updates)){ + $updated = $this->incomingSilicaSandDetails_model->updateBatch($updates,'id'); + } + if(!empty($inserts)){ + $inserted = $this->incomingSilicaSandDetails_model->insertBatch($inserts); } echo "Data Saved Successfully"; } + public function updateLabReport(){ + + $postData = $this->request->getPost(); + + $id = $postData['id']; + + $dbData = [ + 'igrNo_fk' =>$postData['igrNo'], + 'materialCode' => $postData['materialCode'], + '_10' => $postData['10Mm'], + '_20' => $postData['20Mm'], + '_30' => $postData['30Mm'], + '_40' => $postData['40Mm'], + '_50' => $postData['50Mm'], + '_70' => $postData['70Mm'], + '_100' => $postData['100Mm'], + '_140' => $postData['140Mm'], + '_200' => $postData['200Mm'], + '_300' => $postData['300Mm'], + 'pan' => $postData['pan'], + 'total' => $postData['total'], + 'plus20loss' => $postData['plus20Loss'], + 'plus30Loss' => $postData['plus30Loss'], + 'moistureSpec' => $postData['moistureSpec'], + 'moistureActual' => $postData['moistureActual'], + 'moistureLoss' => $postData['moistureLoss'], + 'moistureLossQty'=> $postData['moistureLossQty'], + 'sieveLossQty' => $postData['sieveLossQty'], + 'salableQty' => $postData['salableQty'], + + ]; + + $resultExists = $this->incomingSilicaSandDetails_model + ->where('id', $id) + ->first(); + if($resultExists){ + $updated = $this->incomingSilicaSandDetails_model + ->update($id,$dbData); + }else{ + $updated = $this->incomingSilicaSandDetails_model + ->insert($dbData); + } + + + if($updated){ + return redirect()->back()->with('success','Data Saved Successfully..!!'); + }else{ + return redirect()->back()->with('error','Error Saving Data..!!'); + } + + } + // Bag Stock details starts public function loadView_bagStockDetails() diff --git a/app/Models/Inwardgateregister_model.php b/app/Models/Inwardgateregister_model.php index ee992195..d4b3bb56 100755 --- a/app/Models/Inwardgateregister_model.php +++ b/app/Models/Inwardgateregister_model.php @@ -1034,20 +1034,20 @@ class Inwardgateregister_model extends Model public function findIgrDetailsForIncomingSilicaSand($materialCodes, $month) { $builder = $this->db->table('t_igr_details') - ->select( - 't_igr_details.IGRNO, - t_igr_details.Remarks, - t_igr_details.MaterialCode, + ->select( + 't_igr_details.IGRNO, + t_igr_details.Remarks, + t_igr_details.MaterialCode, igrMast.DeliveryChellanOrInvoiceNo as invoiceNo, - igrMast.DeliveryChellanDate as invoiceDate, + igrMast.DeliveryChellanDate as invoiceDate, igrMast.MaterialRcvdDate as materialRecievedDate, igrMast.VehicleNo, supplierDetails.SupplierName, t_igr_details.QuantityAsPerInvoice as Qty, - issd.* ') + issd.*') ->whereIn('t_igr_details.MaterialCode', $materialCodes) ->like('t_igr_details.CreatedDate', $month, 'after') - ->groupBy('t_igr_details.IGRNO, t_igr_details.MaterialCode') + ->groupBy('t_igr_details.IGRNO, t_igr_details.MaterialCode') ->join('t_igr_master igrMast', 'igrMast.IGRNO = t_igr_details.IGRNO') ->join('t_incomingSilicaSandDetails issd', 'issd.igrNo_fk = t_igr_details.IGRNO AND issd.materialCode = t_igr_details.MaterialCode','left') diff --git a/app/Models/Rawmaterialdetails_model.php b/app/Models/Rawmaterialdetails_model.php index 344b5d1e..82396724 100755 --- a/app/Models/Rawmaterialdetails_model.php +++ b/app/Models/Rawmaterialdetails_model.php @@ -141,8 +141,7 @@ class Rawmaterialdetails_model extends Model function getAllSilicaRawMaterialCode(){ $builder = $this->db->table('t_materialmaster') - ->select('MaterialCode') - ->where('IsActive', 1) + ->select('MaterialCode') ->like('LOWER(MaterialName)', 'silica sand') ->orderBy('CreatedDate', 'desc'); $query = $builder->get(); diff --git a/app/Views/CoatingMachineDetail.php b/app/Views/CoatingMachineDetail.php index d8185b2f..be3771dc 100644 --- a/app/Views/CoatingMachineDetail.php +++ b/app/Views/CoatingMachineDetail.php @@ -730,7 +730,7 @@ var row = $(this).closest('tr'); // Get values from the row - + var date = row.find('td:eq(0)').text().split('-'); date=`${date[2]}-${date[1]}-${date[0]}`; var shift = row.find('td:eq(1)').text(); diff --git a/app/Views/incomingSilicaSandDetails.php b/app/Views/incomingSilicaSandDetails.php index ec91f65b..6d227d73 100644 --- a/app/Views/incomingSilicaSandDetails.php +++ b/app/Views/incomingSilicaSandDetails.php @@ -155,9 +155,7 @@ height: 20px; } - .modal { - padding-right: 30% ! important; - } +
@@ -185,6 +183,28 @@
+ getFlashdata('error'); + if ($error) { + ?> +
+ + getFlashdata('error'); ?> +
+ + getFlashdata('success'); + if ($success) { + ?> +
+ + getFlashdata('success'); ?> +
+ + + +
@@ -207,6 +227,9 @@
+ + + @@ -225,18 +248,18 @@ Grade Condition Vehicle No Qty - ___10___ - ___20___ - ___30___ - ___40___ - ___50___ - ___70___ - ___100___ - ___140___ - ___200___ - ___300___ - PAN - Total + ___10___ + ___20___ + ___30___ + ___40___ + ___50___ + ___70___ + ___100___ + ___140___ + ___200___ + ___300___ + PAN + Total AFS Spec AFS Actual Plus 20 loss% @@ -244,11 +267,13 @@ Moisture % Spec Moisture Actual Moisture Loss - Moisture loss Qty - Sieve Loss Qty - Salable Qty + Moisture loss Qty + Sieve Loss Qty + Salable Qty Remark MaterialCode + Update Lab Report + id @@ -260,6 +285,7 @@ @@ -322,80 +348,67 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -410,14 +423,12 @@ - + - + @@ -434,26 +445,22 @@ - + - + - + - + @@ -466,6 +473,17 @@ + + + + + + + + + + @@ -506,9 +524,292 @@ + + + + + + + + + +