From 1f81b6e1dd9b7617267f4986f692bbecae99abf8 Mon Sep 17 00:00:00 2001 From: vadivelJ96 Date: Tue, 8 Apr 2025 11:02:13 +0530 Subject: [PATCH] stock changes 08-04-2025 --- app/Controllers/StockController.php | 133 +++++++++++++----------- app/Views/stock/drierMachineDetails.php | 58 +++++++---- 2 files changed, 112 insertions(+), 79 deletions(-) diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 8d423624..1597b50f 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -1344,21 +1344,6 @@ class StockController extends BaseController 'machine_category' => "diesel", 'machine_id' => $customisedMachineCode ]; - - - //checking filtered material code present in table , if not create dummy one for whole month - $findMachineCode = $this->factoryVehicleDieselDetails_model - ->where('date >=', $startDate) - ->where('date <=', $endDate) - ->where('machine_id',$customisedMachineCode) - ->findAll(); - - //check any material code is not present in stock table but applied in filter - if(empty($findMachineCode)){ - - //create dummy entry for this - $this->createDummyEntryForDieselMachine($customisedMachineCode,$startDate,$endDate); - } } @@ -1396,6 +1381,24 @@ class StockController extends BaseController $machineCodeList = array_column($existingCustomMachineCodes, 'id'); + foreach($machineCodeList as $index => $machineCode){ + + //checking filtered present in table , if not create dummy one for whole month + $findMachineCode = $this->factoryVehicleDieselDetails_model + ->where('date >=', $startDate) + ->where('date <=', $endDate) + ->where('machine_id',$machineCode) + ->findAll(); + + + //check any material code is not present in stock table but applied in filter + if(empty($findMachineCode)){ + //create dummy entry for this + $this->createDummyEntryForDieselMachine($machineCode,$startDate,$endDate); + } + + } + $dieselMachines = $existingCustomMachineCodes; $data['activeDieselMachines'] = $this->factoryMachine_model->getAllActiveDieselMachines(); @@ -1761,23 +1764,6 @@ class StockController extends BaseController 'machine_category' => "electric", 'machine_id' => $customisedMachineCode ]; - - - //checking filtered material code present in table , if not create dummy one for whole month - $findMachineCode = $this->powerConsumptionDetails_model - ->where('date >=', $startDate) - ->where('date <=', $endDate) - ->where('machine_id',$customisedMachineCode) - ->findAll(); - - - //check any material code is not present in stock table but applied in filter - if(empty($findMachineCode)){ - - - //create dummy entry for this - $this->createDummyEntryForElectricMachine($customisedMachineCode,$startDate,$endDate); - } } @@ -1811,9 +1797,28 @@ class StockController extends BaseController + //this existingCustomMachineCodes gets its machine after visiting factory machine master table $machineCodeList = array_column($existingCustomMachineCodes, 'id'); + foreach($machineCodeList as $index => $machineCode){ + + //checking filtered material code present in table , if not create dummy one for whole month + $findMachineCode = $this->powerConsumptionDetails_model + ->where('date >=', $startDate) + ->where('date <=', $endDate) + ->where('machine_id',$machineCode) + ->findAll(); + + + //check any material code is not present in stock table but applied in filter + if(empty($findMachineCode)){ + //create dummy entry for this + $this->createDummyEntryForElectricMachine($machineCode,$startDate,$endDate); + } + + } + $electricMachines = $existingCustomMachineCodes; $data['activeElectricMachines'] = $this->factoryMachine_model->getAllActiveElectricMachines(); @@ -2284,19 +2289,6 @@ class StockController extends BaseController 'stock_category' => "resin", 'materialCode' => $customisedMaterialCode ]; - - //checking filtered material code present in table , if not create dummy one for whole month - $findMaterialCode = $this->resinStockDetails_model - ->where('date >=', $startDate) - ->where('date <=', $endDate) - ->where('materialCode',$customisedMaterialCode) - ->findAll(); - - //check any material code is not present in stock table but applied in filter - if(empty($findMaterialCode)){ - //create dummy entry for that - $this->createDummyEntryForResin($customisedMaterialCode,$startDate,$endDate); - } } @@ -2329,6 +2321,25 @@ class StockController extends BaseController $materialCodeList = array_column($existingCustomMaterialCodes, 'MaterialCode'); + foreach($materialCodeList as $index => $materialCode){ + + + //checking filtered material code present in table , if not create dummy one for whole month + $findMachineCode = $this->resinStockDetails_model + ->where('date >=', $startDate) + ->where('date <=', $endDate) + ->where('materialCode',$materialCode) + ->findAll(); + + + //check any material code is not present in stock table but applied in filter + if(empty($findMachineCode)){ + //create dummy entry for this + $this->createDummyEntryForResin($materialCode,$startDate,$endDate); + } + + } + $resinMaterials = $existingCustomMaterialCodes ; $data['activeResinMaterials'] = $this->rawmaterialdetails_model->getAllResinMaterialCode(); @@ -2663,19 +2674,6 @@ class StockController extends BaseController 'stock_category' => "packing_material", 'materialCode' => $customisedMaterialCode ]; - - //checking filtered material code present in table , if not create dummy one for whole month - $findMaterialCode = $this->bagStockDetails_model - ->where('date >=', $startDate) - ->where('date <=', $endDate) - ->where('materialCode',$customisedMaterialCode) - ->findAll(); - - //check any material code is not present in stock table but applied in filter - if(empty($findMaterialCode)){ - //create dummy entry for that - $this->createDummyEntryForBag($customisedMaterialCode,$startDate,$endDate); - } } @@ -2709,6 +2707,25 @@ class StockController extends BaseController $materialCodeList = array_column($existingCustomMaterialCodes, 'MaterialCode'); + foreach($materialCodeList as $index => $materialCode){ + + + //checking filtered material code present in table , if not create dummy one for whole month + $findMachineCode = $this->bagStockDetails_model + ->where('date >=', $startDate) + ->where('date <=', $endDate) + ->where('materialCode',$materialCode) + ->findAll(); + + + //check any material code is not present in stock table but applied in filter + if(empty($findMachineCode)){ + //create dummy entry for this + $this->createDummyEntryForBag($materialCode,$startDate,$endDate); + } + + } + $bagMaterials = $existingCustomMaterialCodes ; $data['activeBagMaterials'] = $this->rawmaterialdetails_model->getAllBagMaterialCode(); diff --git a/app/Views/stock/drierMachineDetails.php b/app/Views/stock/drierMachineDetails.php index 79ac5c1f..5e441fec 100644 --- a/app/Views/stock/drierMachineDetails.php +++ b/app/Views/stock/drierMachineDetails.php @@ -471,12 +471,13 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+ *
- + * @@ -512,6 +513,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+ *
@@ -531,6 +534,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+ *
@@ -539,6 +543,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+ *
@@ -552,13 +557,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+ *
- +
@@ -566,7 +572,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
- +
@@ -587,6 +593,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+ *
@@ -594,6 +601,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+ *
@@ -627,13 +635,14 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+ *
- - @@ -644,8 +653,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
- - @@ -668,7 +677,8 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
- $value) { ?> @@ -679,15 +689,17 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
- + + * + type="text" class="form-control" id="editEntryInputSandQtyId" name="input_sand_qty" value="" required>
- + * +
@@ -695,8 +707,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+ * + type="text" class="form-control" id="editEntrySandDriedQtyId" name="sand_dried_qty" value="" required>
@@ -708,21 +721,22 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
+ * + type="text" class="form-control" id="editEntryTotalGasConsumptionId" name="total_gas_consumption" value="" required>
- - Gas / Ton +
- +
@@ -731,7 +745,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
-
@@ -743,14 +757,16 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
- + * +
- + * +