stock module latest today vadivel J 19-02-2025

This commit is contained in:
vadivelJ96 2025-02-19 18:14:56 +05:30
parent 7429251ec5
commit 8e576f626a
4 changed files with 236 additions and 56 deletions

View File

@ -17,6 +17,8 @@ use App\Models\BagStockDetailsModel;
use App\Models\DustAndRoughModel;
use App\Models\ResinStockModel;
use App\Models\GasStockModel;
use App\Models\TrpAbstract;
use App\Models\TrpAbstractParticulars;
use App\Models\TrpSandUseStockModel;
use App\Models\TrpProductionModel;
use App\Models\TrpProductionMaintenanceModel;
@ -27,6 +29,7 @@ use App\Models\PowerConsumptionSummaryModel;
use CodeIgniter\HTTP\ResponseInterface;
use DateTime;
use DatePeriod;
@ -65,6 +68,11 @@ class StockController extends BaseController
protected $employeedetails_model;
protected $trpAbstractParticularsModel ;
protected $trpAbstractModel ;
/**
* This is default constructor of the class
*/
@ -113,6 +121,10 @@ class StockController extends BaseController
$this->powerConsumptionSummary_model = new PowerConsumptionSummaryModel();
$this->trpAbstractParticularsModel = new TrpAbstractParticulars();
$this->trpAbstractModel = new TrpAbstract();
$this->session = session();
helper('form');
@ -1749,11 +1761,9 @@ class StockController extends BaseController
{
$postData = json_decode($this->request->getPost('updateTrpProductionDetails'));
//converting std class object to associative array..
$postData['updateTrpProductionDetails'] = json_decode(json_encode($postData), true);
$postData['updateTrpProductionDetails'] = json_decode($this->request->getPost('updateTrpProductionDetails'),true);
if (empty($postData['updateTrpProductionDetails'])) {
if (empty($inserts)) {
@ -1907,6 +1917,7 @@ class StockController extends BaseController
{
$datesInMonth = [];
$inserts = [];
$trpAbstract = [] ;
$period = new DatePeriod(
new DateTime($startDate),
@ -1920,6 +1931,25 @@ class StockController extends BaseController
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
if($datesInMonthIndex == 0){
$trpAbstractParticulars =$this->trpAbstractParticularsModel->findAll();
foreach($trpAbstractParticulars as $index => $trpAbstractParticular){
$trpAbstract[] = [
'date' => $dateInMonth ,
'abs_opening_stock' => 0 ,
'abs_physical_stock'=> 0 ,
'abs_remarks' => " " ,
'abs_particular_id' => $trpAbstractParticular['id'],
];
}
}
$inserts[] = [
'Date' => $dateInMonth,
'openingTime' => " ",

View File

@ -0,0 +1,46 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class TrpAbstract extends Model
{
protected $table = 't_trp_abstract';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['abs_opening_stock','abs_physical_stock','abs_remarks','abs_particular_id'];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -0,0 +1,46 @@
<?php
namespace App\Models;
use CodeIgniter\Model;
class TrpAbstractParticulars extends Model
{
protected $table = 't_trp_abstract_particulars';
protected $primaryKey = 'id';
protected $useAutoIncrement = true;
protected $returnType = 'array';
protected $useSoftDeletes = false;
protected $protectFields = true;
protected $allowedFields = ['particular'];
protected bool $allowEmptyInserts = false;
protected bool $updateOnlyChanged = true;
protected array $casts = [];
protected array $castHandlers = [];
// Dates
protected $useTimestamps = false;
protected $dateFormat = 'datetime';
protected $createdField = 'created_at';
protected $updatedField = 'updated_at';
protected $deletedField = 'deleted_at';
// Validation
protected $validationRules = [];
protected $validationMessages = [];
protected $skipValidation = false;
protected $cleanValidationRules = true;
// Callbacks
protected $allowCallbacks = true;
protected $beforeInsert = [];
protected $afterInsert = [];
protected $beforeUpdate = [];
protected $afterUpdate = [];
protected $beforeFind = [];
protected $afterFind = [];
protected $beforeDelete = [];
protected $afterDelete = [];
}

View File

@ -191,7 +191,6 @@
background-color: #50bbd9; /* Green background */
color: #ffffff;
border: 1px solid #ddd;
padding: 1px;
white-space: normal; /* Allows text to wrap */
word-wrap: break-word; /* Breaks long words if needed */
text-align: center; /* Centers text for better alignment */
@ -951,7 +950,7 @@ $timeOtions[] = "12:00 AM";
$summary['totalHours'] += is_numeric($trpProductionDetail['totalHours']) ? $trpProductionDetail['totalHours'] : 0;
$summary['coldStart'] += is_numeric($trpProductionDetail['coldStart']) ? $trpProductionDetail['coldStart'] : 0;
$summary['breakdownHours'] += is_numeric($trpProductionDetail['breakdownHours']) ? $trpProductionDetail['breakDownHours'] : 0;
$summary['breakdownHours'] += is_numeric($trpProductionDetail['breakdownHours']) ? $trpProductionDetail['breakdownHours'] : 0;
$summary['burnerFiringHours'] += is_numeric($trpProductionDetail['burnerFiringHours']) ? $trpProductionDetail['burnerFiringHours'] : 0;
$summary['sandFeedingHours'] += is_numeric($trpProductionDetail['sandFeedingHours']) ? $trpProductionDetail['sandFeedingHours'] : 0;
$summary['gasReceiptBg'] += is_numeric($trpProductionDetail['gasReceiptBg']) ? $trpProductionDetail['gasReceiptBg'] : 0;
@ -1412,23 +1411,24 @@ $timeOtions[] = "12:00 AM";
</tbody>
</table>
<br><br><br>
<?php } ?>
</tbody>
</table>
</div>
<br>
<div class="row">
<div class="col-md-12 text-center">
<input type="button" class="btn btn-success px-4" id="saveId" value="save">
@ -1437,6 +1437,64 @@ $timeOtions[] = "12:00 AM";
</div>
<br><br><br>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<?php $abstractDetails = [
] ?>
<h4 style="text-align:center">Abstract for the month <?=$month?></h4>
<div class="table-responsive">
<table id="abstractTableId" class="fht-table table-striped">
<thead class="celda_encabezado_general" style="padding: 10px ;">
<tr>
<th class="celda_encabezado_general">Particulars</th>
<th class="celda_encabezado_general">Running Hours</th>
<th class="celda_encabezado_general">Per Hour</th>
<th class="celda_encabezado_general">Opening Stock</th>
<th class="celda_encabezado_general">Receipt</th>
<th class="celda_encabezado_general">Total</th>
<th class="celda_encabezado_general">Consumption</th>
<th class="celda_encabezado_general">Closing Stock</th>
<th class="celda_encabezado_general">Physical Stock</th>
<th class="celda_encabezado_general">Remarks</th>
</tr>
</thead>
<tbody>
<tr>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
<td class="celda_normal"> dummy</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div> <!-- End card-body -->
</div> <!-- End card -->
</div> <!-- End col -->
@ -1561,50 +1619,52 @@ $timeOtions[] = "12:00 AM";
Date : rowCells.eq(0).text().trim() ,
openingTime : openingTime ,
closingTime : closingTime ,
totalHours : $(this).find(`td[data-id='${dateInYmD} totalHours']`),
coldStart : $(this).find(`td[data-id='${dateInYmD} coldStart']`) ,
breakdownHours : $(this).find(`td[data-id='${dateInYmD} breakdownHours']`) ,
burnerFiringHours : $(this).find(`td[data-id='${dateInYmD} burnerFiringHours']`) ,
sandFeedingHours : $(this).find(`td[data-id='${dateInYmD} sandFeedingHours']`) ,
gasReceiptBg : $(this).find(`td[data-id='${dateInYmD} gasReceiptBg']`) ,
gasReceiptPg : $(this).find(`td[data-id='${dateInYmD} gasReceiptPg']`) ,
physicalGasConsumption : $(this).find(`td[data-id='${dateInYmD} physicalGasConsumption']`) ,
trpPlusDrierGasConsumption : $(this).find(`td[data-id='${dateInYmD} trpPlusDrierGasConsumption']`) ,
trpPhysicalGasPerTon : $(this).find(`td[data-id='${dateInYmD} trpPhysicalGasPerTon']`) ,
panelGasConsumption : $(this).find(`td[data-id='${dateInYmD} panelGasConsumption']`) ,
panelGasPerTon : $(this).find(`td[data-id='${dateInYmD} panelGasPerTon']`) ,
edRunningHours : $(this).find(`td[data-id='${dateInYmD} edRunningHours']`) ,
edProduction : $(this).find(`td[data-id='${dateInYmD} edProduction']`) ,
edUsage : $(this).find(`td[data-id='${dateInYmD} edUsage']`) ,
waterConsumption : $(this).find(`td[data-id='${dateInYmD} waterConsumption']`) ,
trpProduction : $(this).find(`td[data-id='${dateInYmD} trpProduction']`) ,
trpProductionPerHour : $(this).find(`td[data-id='${dateInYmD} trpProductionPerHour']`) ,
waterReceipt : $(this).find(`td[data-id='${dateInYmD} waterReceipt']`) ,
ebReading : $(this).find(`td[data-id='${dateInYmD} ebReading']`) ,
ebReadingPerUnitTon : $(this).find(`td[data-id='${dateInYmD} ebReadingPerUnitTon']`) ,
workingPersonEngineers : $(this).find(`td[data-id='${dateInYmD} workingPersonEngineers']`) ,
workingPersonSupervisiors : $(this).find(`td[data-id='${dateInYmD} workingPersonSupervisiors']`) ,
workingPersonOperators : $(this).find(`td[data-id='${dateInYmD} workingPersonOperators']`) ,
rollerDrivers : $(this).find(`td[data-id='${dateInYmD} rollerDrivers']`) ,
natureOfMaintenance : $(this).find(`td[data-id='${dateInYmD} natureOfMaintenance']`) ,
location : $(this).find(`td[data-id='${dateInYmD} location']`) ,
description : $(this).find(`td[data-id='${dateInYmD} description']`) ,
msSeperation : $(this).find(`td[data-id='${dateInYmD} msSeperation']`) ,
edWaste : $(this).find(`td[data-id='${dateInYmD} edWaste']`) ,
coolerBags : $(this).find(`td[data-id='${dateInYmD} coolerBags']`) ,
edPlus20Waste : $(this).find(`td[data-id='${dateInYmD} edPlus20Waste']`) ,
cycloneWaste : $(this).find(`td[data-id='${dateInYmD} cycloneWaste']`) ,
totalHours : $(this).find(`td[data-id='${dateInYmD} totalHours']`).text(),
coldStart : $(this).find(`td[data-id='${dateInYmD} coldStart']`).text() ,
breakdownHours : $(this).find(`td[data-id='${dateInYmD} breakdownHours']`).text() ,
burnerFiringHours : $(this).find(`td[data-id='${dateInYmD} burnerFiringHours']`).text() ,
sandFeedingHours : $(this).find(`td[data-id='${dateInYmD} sandFeedingHours']`).text() ,
gasReceiptBg : $(this).find(`td[data-id='${dateInYmD} gasReceiptBg']`).text() ,
gasReceiptPg : $(this).find(`td[data-id='${dateInYmD} gasReceiptPg']`).text() ,
physicalGasConsumption : $(this).find(`td[data-id='${dateInYmD} physicalGasConsumption']`).text() ,
trpPlusDrierGasConsumption : $(this).find(`td[data-id='${dateInYmD} trpPlusDrierGasConsumption']`).text() ,
trpPhysicalGasPerTon : $(this).find(`td[data-id='${dateInYmD} trpPhysicalGasPerTon']`).text() ,
panelGasConsumption : $(this).find(`td[data-id='${dateInYmD} panelGasConsumption']`).text() ,
panelGasPerTon : $(this).find(`td[data-id='${dateInYmD} panelGasPerTon']`).text() ,
edRunningHours : $(this).find(`td[data-id='${dateInYmD} edRunningHours']`).text() ,
edProduction : $(this).find(`td[data-id='${dateInYmD} edProduction']`).text() ,
edUsage : $(this).find(`td[data-id='${dateInYmD} edUsage']`) .text() ,
waterConsumption : $(this).find(`td[data-id='${dateInYmD} waterConsumption']`) .text() ,
trpProduction : $(this).find(`td[data-id='${dateInYmD} trpProduction']`) .text() ,
trpProductionPerHour : $(this).find(`td[data-id='${dateInYmD} trpProductionPerHour']`).text() ,
waterReceipt : $(this).find(`td[data-id='${dateInYmD} waterReceipt']`) .text() ,
ebReading : $(this).find(`td[data-id='${dateInYmD} ebReading']`) .text() ,
ebReadingPerUnitTon : $(this).find(`td[data-id='${dateInYmD} ebReadingPerUnitTon']`) .text() ,
workingPersonEngineers : $(this).find(`td[data-id='${dateInYmD} workingPersonEngineers']`).text() ,
workingPersonSupervisiors : $(this).find(`td[data-id='${dateInYmD} workingPersonSupervisiors']`).text() ,
workingPersonOperators : $(this).find(`td[data-id='${dateInYmD} workingPersonOperators']`).text() ,
rollerDrivers : $(this).find(`td[data-id='${dateInYmD} rollerDrivers']`).text() ,
natureOfMaintenance : $(this).find(`td[data-id='${dateInYmD} natureOfMaintenance']`).text() ,
location : $(this).find(`td[data-id='${dateInYmD} location']`).text() ,
description : $(this).find(`td[data-id='${dateInYmD} description']`).text() ,
msSeperation : $(this).find(`td[data-id='${dateInYmD} msSeperation']`).text() ,
edWaste : $(this).find(`td[data-id='${dateInYmD} edWaste']`).text() ,
coolerBags : $(this).find(`td[data-id='${dateInYmD} coolerBags']`).text() ,
edPlus20Waste : $(this).find(`td[data-id='${dateInYmD} edPlus20Waste']`).text() ,
cycloneWaste : $(this).find(`td[data-id='${dateInYmD} cycloneWaste']`).text() ,
};
rows.push(rowData);
});
return JSON.stringify(rows, null, 2);
}
</script>
</script>
<script>
function calculateSandFeedingHours(totalHours, coldStart, breakdownHours) {
@ -1741,13 +1801,13 @@ $timeOtions[] = "12:00 AM";
trpPlusDrierGasConsumption = parseInt(parseFloat(physicalGasConsumption) -
(parseFloat(drierGasConsumption) + parseFloat(coatingGasConsumption)));
trpPhysicalGasPerTon = trpProduction == 0 ? " " : parseFloat(trpPlusDrierGasConsumption) / (parseFloat(trpProduction) / 1000);
trpPhysicalGasPerTon = trpProduction == 0 ? 0 : parseFloat(trpPlusDrierGasConsumption) / (parseFloat(trpProduction) / 1000);
panelGasPerTon = parseFloat(panelGasConsumption) / (parseFloat(trpProduction) / 1000);
trpProductionPerHour = sandFeedingHours == 0 ? " " : parseFloat(trpProduction) / parseFloat(sandFeedingHours);
trpProductionPerHour = sandFeedingHours == 0 ? 0 : parseFloat(trpProduction) / parseFloat(sandFeedingHours);
ebReadingPerUnitTon = trpProduction == 0 ? " " : parseFloat(ebReading) / (parseFloat(trpProduction) / 1000);
ebReadingPerUnitTon = trpProduction == 0 ? 0 : parseFloat(ebReading) / (parseFloat(trpProduction) / 1000);
@ -1758,14 +1818,12 @@ $timeOtions[] = "12:00 AM";
document.querySelector(`td.burnerFiringHours[data-id="${date} burnerFiringHours"]`).innerText = isFinite(burnerFiringHours) ? burnerFiringHours : " ";
document.querySelector(`td.trpPlusDrierGasConsumption[data-id="${date} trpPlusDrierGasConsumption"]`).innerText = isFinite(trpPlusDrierGasConsumption) ? trpPlusDrierGasConsumption : " ";
document.querySelector(`td.trpPhysicalGasPerTon[data-id="${date} trpPhysicalGasPerTon"]`).innerText = isFinite(trpPhysicalGasPerTon) ? (trpPhysicalGasPerTon).toFixed(2) : " ";
document.querySelector(`td.sandFeedingHours[data-id="${date} sandFeedingHours"]`).innerText = isFinite(sandFeedingHours) ? sandFeedingHours : " ";
document.querySelector(`td.panelGasPerTon[data-id="${date} panelGasPerTon"]`).innerText = isFinite(panelGasPerTon) ? (panelGasPerTon).toFixed(2) : " ";
document.querySelector(`td.trpProductionPerHour[data-id="${date} trpProductionPerHour"]`).innerText = isFinite(trpProductionPerHour) ? trpProductionPerHour : " ";
document.querySelector(`td.panelGasPerTon[data-id="${date} panelGasPerTon"]`).innerText = isFinite(panelGasPerTon) ? (panelGasPerTon).toFixed(2) : " ";
document.querySelector(`td.trpProductionPerHour[data-id="${date} trpProductionPerHour"]`).innerText = isFinite(trpProductionPerHour) ? (trpProductionPerHour).toFixed(2) : " ";
document.querySelector(`td.ebReadingPerUnitTon[data-id="${date} ebReadingPerUnitTon"]`).innerText = isFinite(ebReadingPerUnitTon) ? (ebReadingPerUnitTon).toFixed(2) : " ";