diff --git a/app/Controllers/StockController.php b/app/Controllers/StockController.php index 3dc91d30..fe8173f9 100644 --- a/app/Controllers/StockController.php +++ b/app/Controllers/StockController.php @@ -1326,13 +1326,17 @@ class StockController extends BaseController $dbData = [ - 'date' => $data['date'], - 'opening' => $data['opening'], - 'purchaseBharath' => $data['purchaseBharath'], - 'purchaseIndian' => $data['purchaseIndian'], - 'total' => $data['total'], - 'consumption' => $data['consumption'], - 'balanceStock' => $data['balanceStock'], + 'date' => $data['date'] , + 'opening' => $data['opening'] , + 'purchaseBharath' => $data['purchaseBharath'] , + 'purchaseIndian' => $data['purchaseIndian'] , + 'total' => $data['total'] , + 'consumption' => $data['consumption'] , + 'balanceStock' => $data['balanceStock'] , + 'trp_panel_gas_consumption' => $data['trpPanelGasConsumption'] , + 'trp_physical_gas_consumption' => $data['trpPhysicalGasConsumption'] , + 'trp_sand_production' => $data['trpSandProduction'] , + 'rotary_drier_consumption' => $data['rotaryDrierConsumption'] ]; $resultExists = $this->gasStockDetails_model diff --git a/app/Models/GasStockModel.php b/app/Models/GasStockModel.php index e809c7e8..1f95543d 100644 --- a/app/Models/GasStockModel.php +++ b/app/Models/GasStockModel.php @@ -13,7 +13,8 @@ class GasStockModel extends Model protected $useSoftDeletes = false; protected $protectFields = true; protected $allowedFields = ['date','opening','purchaseBharath','purchaseIndian', - 'total','consumption','balanceStock']; + 'total','consumption','balanceStock', + 'trp_panel_gas_consumption','trp_physical_gas_consumption','trp_sand_production','rotary_drier_consumption']; protected bool $allowEmptyInserts = false; protected bool $updateOnlyChanged = true; diff --git a/app/Views/stock/gasStockDetails.php b/app/Views/stock/gasStockDetails.php index cb2accc2..5c35f6a0 100644 --- a/app/Views/stock/gasStockDetails.php +++ b/app/Views/stock/gasStockDetails.php @@ -147,7 +147,11 @@ color: #ffffff; font-weight: bold; padding: 6px 10px; - text-align: center; + min-width: 120px; + max-width: 120px; + white-space: normal; /* Allows text to wrap */ + word-wrap: break-word; /* Breaks long words if needed */ + text-align: center; /* Centers text for better alignment */ } .celda_encabezado_total { @@ -213,8 +217,8 @@ } td{ - min-width: 100px; - max-width: 100px; + min-width: 150px; + max-width: 150px; } @@ -302,7 +306,7 @@ Sand Dried Coating Machine Sand Coated - Trp Machine + Trp Machine Sand TRP Rotary Drier @@ -319,7 +323,8 @@ ton Consumption ton - Consumption + Panel Consumption + Physical Consumption ton Consumption @@ -344,65 +349,227 @@ ?> > + + + oninput="openingStockChange(this)" data-id="" - > + > + + + + contenteditable="true"> + + + contenteditable="true"> + + + > + + + + > + + + + > + + + - - + > + + + + + + + - - - + + - + + + + + + - - - - + + + + + + + + + + + + - + + + - "-" , + 'purchaseBharath' => 0 , + 'purchaseIndian' => 0 , + 'total' => 0 , + 'consumption' => 0 , + 'balanceStock' => 0 , + 'drierMachineGasConsumption'=>0, + 'sandDried' => 0, + 'coatingMachineGasconsumption'=>0, + 'coatedSand' => 0, + 'trp_panel_gas_consumption' => 0, + 'trp_physical_gas_consumption' => 0, + 'trp_sand_production' => 0, + 'rotary_drier_consumption' => 0 + ]; + } + + // + + // Sum values for the material + + $summary["opening"] = 0 ; + $summary["purchaseBharath"] = is_numeric($gasStockDetail['purchaseBharath']) ? $gasStockDetail['purchaseBharath'] : 0 ; + $summary["purchaseIndian"] += is_numeric($gasStockDetail['purchaseIndian']) ? $gasStockDetail['purchaseIndian'] : 0 ; + $summary["total"] += is_numeric($gasStockDetail['total']) ? $gasStockDetail['total'] : 0 ; + $summary["consumption"] += is_numeric($gasStockDetail['consumption']) ? $gasStockDetail['consumption'] : 0 ; + $summary["balanceStock"] += is_numeric($gasStockDetail['balanceStock']) ? $gasStockDetail['balanceStock'] : 0 ; + + $summary["drierMachineGasConsumption"] = is_numeric( $gasStockDetail['drierMachineGasConsumption']) ? $gasStockDetail['drierMachineGasConsumption'] : 0 ; + $summary["sandDried"] = is_numeric( $gasStockDetail['sandDried']) ? $gasStockDetail['sandDried'] : 0 ; + $summary["coatingMachineGasconsumption"] += is_numeric($gasStockDetail['coatingMachineGasconsumption']) ? $gasStockDetail['coatingMachineGasconsumption'] : 0 ; + $summary["coatedSand"] += is_numeric($gasStockDetail['coatedSand']) ? $gasStockDetail['coatedSand'] : 0 ; + $summary["trp_panel_gas_consumption"] += is_numeric($gasStockDetail['trp_panel_gas_consumption']) ? $gasStockDetail['trp_panel_gas_consumption'] : 0 ; + $summary["trp_physical_gas_consumption"] += is_numeric($gasStockDetail['trp_physical_gas_consumption']) ? $gasStockDetail['trp_physical_gas_consumption'] : 0 ; + + $summary["trp_sand_production"] += is_numeric($gasStockDetail['trp_sand_production']) ? $gasStockDetail['trp_sand_production'] : 0 ; + $summary["rotary_drier_consumption"] += is_numeric($gasStockDetail['rotary_drier_consumption']) ? $gasStockDetail['rotary_drier_consumption'] : 0 ; + + + + + + + } ?> + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Date Opening StockPurchase(Bharath)Purchase(Indian)TotalConsumption Balance StockConsumption ton Consumptionton Panel ConsumptionPhysical Consumptionton Consumption
+ Total +
+
+ + + + modify('first day of this month')->format('Y-m-d'); @@ -468,24 +635,34 @@ - + - - - + + + + + + + + + contenteditable="true" > @@ -675,7 +852,11 @@ purchaseIndian: rowCells.eq(3).text().trim()|| ' ', total: rowCells.eq(4).text().trim()|| ' ', consumption: rowCells.eq(5).text().trim()|| ' ', - balanceStock: rowCells.eq(6).text().trim()|| ' ' + balanceStock: rowCells.eq(6).text().trim()|| ' ', + trpPanelGasConsumption : rowCells.eq(11).text().trim()|| ' ', + trpPhysicalGasConsumption: rowCells.eq(12).text().trim()|| ' ', + trpSandProduction : rowCells.eq(13).text().trim()|| ' ', + rotaryDrierConsumption : rowCells.eq(14).text().trim()|| ' ', }; rows.push(rowData); @@ -771,12 +952,14 @@ let date = dataId; //total gas consumption - let tenTonGasConsumption = validateInput(document.querySelector(`td.tenTonGasConsumption[data-id="${dataId}"]`).innerText); - let coatingGasConsumption = validateInput(document.querySelector(`td.coatingGasConsumption[data-id="${dataId}"]`).innerText); - let trpGasConsumption = validateInput(document.querySelector(`td.trpGasConsumption[data-id="${dataId}"]`).innerText); - let rotaryGasConsumption = validateInput(document.querySelector(`td.rotaryGasConsumption[data-id="${dataId}"]`).innerText); - - let toatalGasConsumption = Number(tenTonGasConsumption) + Number (coatingGasConsumption) + Number(trpGasConsumption) + Number(rotaryGasConsumption) ; + let tenTonGasConsumption = validateInput(document.querySelector(`td.tenTonGasConsumption[data-id="${dataId}"]`).innerText); + let coatingGasConsumption = validateInput(document.querySelector(`td.coatingGasConsumption[data-id="${dataId}"]`).innerText); + let trpPanelGasConsumption = validateInput(document.querySelector(`td.trpPanelGasConsumption[data-id="${dataId}"]`).innerText); + let trpPhysicalGasConsumption = validateInput(document.querySelector(`td.trpPhysicalGasConsumption[data-id="${dataId}"]`).innerText); + let rotaryGasConsumption = validateInput(document.querySelector(`td.rotaryGasConsumption[data-id="${dataId}"]`).innerText); + + let toatalGasConsumption = Number(tenTonGasConsumption) + Number (coatingGasConsumption) + Number(trpPhysicalGasConsumption) + + Number(trpPanelGasConsumption) + Number(rotaryGasConsumption) ; //total gas purchase and opening addition @@ -790,9 +973,9 @@ document.querySelector(`td.total[data-id="${dataId}"]`).innerText = totalGas; document.querySelector(`td.consumption[data-id="${dataId}"]`).innerText = toatalGasConsumption ; - document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock; + document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText = currentBalanceStock ; - updateStockValue( date,currentBalanceStock ) + updateStockValue( date,currentBalanceStock) } catch(error){ console.error("There is an error updating stock ..!!" + error);