ria/app/Views/trpProductionStockDetails.php
2025-01-30 18:24:19 +05:30

2111 lines
118 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<style type="text/css">
.num {
text-align: right;
}
.fht-table,
.fht-table thead,
.fht-table tfoot,
.fht-table tbody,
.fht-table tr,
.fht-table th,
.fht-table td {
margin: 0;
}
.fht-table td {
text-align: center;
}
.fht-table td:hover {
background-color: #00a65a;
color: #ffffff;
}
.fht-table {
border: 0 none;
height: auto;
width: auto;
border-collapse: collapse;
border-spacing: 0;
/*table-layout: fixed; Algoritmo de distribucion fijo */
white-space: nowrap;
}
.fht-table th,
.fht-table td {
overflow: hidden;
}
.fht-table-wrapper,
.fht-table-wrapper .fht-thead,
.fht-table-wrapper .fht-tfoot,
.fht-table-wrapper .fht-fixed-column .fht-tbody,
.fht-table-wrapper .fht-fixed-body .fht-tbody,
.fht-table-wrapper .fht-tbody {
overflow: hidden;
position: relative;
}
.fht-table-wrapper .fht-fixed-body .fht-tbody,
.fht-table-wrapper .fht-tbody {
overflow: auto;
}
.fht-table-wrapper .fht-table .fht-cell {
overflow: hidden;
height: 1px;
}
.fht-table-wrapper .fht-fixed-column,
.fht-table-wrapper .fht-fixed-body {
top: 0;
left: 0;
position: absolute;
}
.fht-table-wrapper .fht-fixed-column {
z-index: 1;
}
.fht-fixed-body .fht-thead table {
margin-right: 20px;
border: 0 none;
}
/*For Examples*/
.ContenedorTabla {
height: 500px;
margin: 0 auto;
overflow: auto;
width: auto;
position: relative;
}
.header,
.main {
display: inline-block;
height: auto;
width: 100%;
}
.titulosHeader {
border-bottom: 1px solid #e8bb25;
height: auto;
margin-bottom: 10px;
padding-bottom: 8px;
padding-top: 8px;
width: 100%;
}
._Separador {
background-color: #fff;
height: 12px;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
width: 7px;
}
._Separador div {
width: 4px;
}
/*style excel*/
.excel_cell {
border: 1px solid #CCC;
color: #222;
text-align: center;
font-size: 13px;
font-weight: normal;
padding: 4px;
white-space: pre-line;
empty-cells: show;
}
._cell_header {
background-color: #EEE;
}
._cell_Default {
background-color: #FFF;
text-align: left;
}
.excel_cell div {
width: 30px;
height: 20px;
}
.celda_encabezado_general {
background-color: #00a65a;
border: 1px solid #ccc;
color: #ffffff;
font-weight: bold;
padding: 6px 10px;
text-align: center;
}
.celda_encabezado_total {
background-color: #ffffff !important;
border: 1px solid #ffffff;
color: #ffffff !important;
font-weight: bold;
padding: 6px 10px;
text-align: center;
}
.celda_normal {
/*background-color: #fff;*/
/* <!-- ad9271 into ffffff brown-light to green-light --> */
text-align: center;
border: 1px solid #ccc;
padding: 10px 6px;
}
/* Make entire thead sticky */
.fht-table thead {
position: sticky;
top: 0;
z-index: 20;
/* Ensure the entire header stays above table rows */
background-color: #00a65a;
/* Header background color */
}
.dropdown-menu {
z-index: 25;
}
/* Ensure each <th> in thead stays sticky */
.fht-table thead th {
position: sticky;
top: 0;
z-index: 11;
/* Higher than table rows but lower than first column */
background-color: #00a65a;
/* Green background */
color: #ffffff;
border: 1px solid #ddd;
padding: 10px;
}
/* Sticky First Column */
.fht-table th:nth-child(1),
.fht-table td:nth-child(1) {
position: sticky;
left: 0;
background-color: #00a65a;
z-index: 15;
/* Ensures it stays above other cells */
border-right: 2px solid #ddd;
color: #ffffff;
}
/* Table Wrapper for Scrolling */
.table-responsive {
overflow-x: auto;
overflow-y: auto;
max-height: 450px;
/* Adjust as needed */
position: relative;
}
td {
min-width: 100px;
max-width: 100px;
}
</style>
<!-- generating date options -->
<?php
$date = DateTime::createFromFormat('M-Y', $month);
$startDate = $date->modify('first day of this month')->format('Y-m-d');
$endDate = $date->modify('last day of this month')->format('Y-m-d');
$datesInMonth = [];
$period = new DatePeriod(
new DateTime($startDate),
new DateInterval('P1D'),
(new DateTime($endDate))->modify('+1 day')
);
foreach ($period as $day) {
$datesInMonth[] = $day->format('Y-m-d');
}
?>
<!-- generating time options -->
<?php
$timeOptions = [];
foreach (["AM", "PM"] as $meridian) {
for ($hour = 0; $hour < 12; $hour++) {
for ($minute = 0; $minute < 60; $minute += 15) {
$formattedHour = $hour === 0 ? 12 : $hour;
$timeOptions[] = sprintf("%02d:%02d %s", $formattedHour, $minute, $meridian);
}
}
}
$timeOtions[] = "12:00 AM";
?>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Stocks</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title">TRP Production Stock Details </h4>
</li>
</ol>
</div>
</div>
</div>
<div class="col-6 text-right">
<!-- Right-aligned buttons or links can be added here -->
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form action="<?= base_url('trpProductionDetails'); ?>" method="post">
<div class="row">
<div class="col-3">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
</div>
<div class="form-group col-md-2">
<button type="submit" class="btn btn-success"> Change Month </button>
</div>
<div class="col-md-1"></div>
<div class="col-6">
<div class="dropdown float-right">
<a href="#" class="dropdown-toggle arrow-none" data-toggle="dropdown"
aria-expanded="false">
<i class="mdi mdi-dots-vertical m-0 text-muted h3"></i>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" data-toggle="modal" data-target="#bs-example-modal-lg">Navigation</a>
<a class="dropdown-item" href="#">Export</a>
</div>
</div>
</div>
</div>
</form>
<div class="table-responsive">
<table id="trpProductionStockDetailsTableId" class="fht-table table-striped">
<thead class="celda_encabezado_general" style="padding: 10px;">
<tr>
<!-- th:eq(0) -->
<th class="celda_encabezado_general" rowspan="2">Date </th>
<!-- th:eq(1) -->
<th class="celda_encabezado_general" rowspan="2">Opening Time </th>
<!-- th:eq(2) -->
<th class="celda_encabezado_general" rowspan="2">Closing Time </th>
<!-- th:eq(3) -->
<th class="celda_encabezado_general" rowspan="2">Total Hours </th>
<!-- th:eq(4) -->
<th class="celda_encabezado_general" rowspan="2">Cold Start </th>
<!-- th:eq(5) -->
<th class="celda_encabezado_general" rowspan="2">Break Down Hours </th>
<!-- th:eq(6) -->
<th class="celda_encabezado_general" rowspan="2">Burner Firing Hours </th>
<!-- th:eq(7) -->
<th class="celda_encabezado_general" rowspan="2">Sand Feeding Hours </th>
<!-- th:eq(8) -->
<th class="celda_encabezado_general" colspan="2">Gas Receipt </th>
<!-- th:eq(9) -->
<th class="celda_encabezado_general" rowspan="2">Physical Gas Consumption </th>
<!-- th:eq(10) -->
<th class="celda_encabezado_general" rowspan="2">Drier Gas Consumption </th>
<!-- th:eq(11) -->
<th class="celda_encabezado_general" rowspan="2">Coating Gas Consumption </th>
<!-- th:eq(12) -->
<th class="celda_encabezado_general" rowspan="2">TRP plus Drier Gas Consumption </th>
<!-- th:eq(13) -->
<th class="celda_encabezado_general" rowspan="2">TRP Physical Gas Per Ton </th>
<!-- th:eq(14) -->
<th class="celda_encabezado_general" rowspan="2">Panel Gas Consumption </th>
<!-- th:eq(15) -->
<th class="celda_encabezado_general" rowspan="2">Panel Gas Per Ton </th>
<!-- th:eq(16) -->
<th class="celda_encabezado_general" colspan="7">Incoming Sand/ Lump details </th>
<!-- th:eq(17) -->
<th class="celda_encabezado_general" colspan="3">ED details </th>
<!-- th:eq(18) -->
<th class="celda_encabezado_general" colspan="2">TRP Sand </th>
<!-- th:eq(19) -->
<th class="celda_encabezado_general" colspan="6">Usage </th>
<!-- th:eq(20) -->
<th class="celda_encabezado_general" colspan="2">Water </th>
<!-- th:eq(21) -->
<th class="celda_encabezado_general" rowspan="2">EB Reading </th>
<!-- th:eq(22) -->
<th class="celda_encabezado_general" rowspan="2">EB Unit Per Ton </th>
<!-- th:eq(23) -->
<th class="celda_encabezado_general" colspan="4">Working Persons </th>
<!-- th:eq(24) -->
<th class="celda_encabezado_general" colspan="2"> Maintanence Details </th>
<!-- th:eq(25) -->
<th class="celda_encabezado_general" rowspan="2">Description </th>
<!-- th:eq(26) -->
<th class="celda_encabezado_general" rowspan="2">MS Seperation </th>
<!-- th:eq(27) -->
<th class="celda_encabezado_general" rowspan="2">ED Waste </th>
<!-- th:eq(28) -->
<th class="celda_encabezado_general" rowspan="2">Cooler Bags </th>
<!-- th:eq(29) -->
<th class="celda_encabezado_general" rowspan="2">ED +20 Waste </th>
<!-- th:eq(30) -->
<th class="celda_encabezado_general" rowspan="2">Cyclone Waste </th>
<!-- th:eq(31) -->
</tr>
<tr>
<!-- th:eq(0) -->
<th class="celda_encabezado_general" style="z-index:11;">BG</th>
<!-- th:eq(1) -->
<th class="celda_encabezado_general">PG </th>
<!-- th:eq(2) -->
<th class="celda_encabezado_general">AL(S) </th>
<!-- th:eq(3) -->
<th class="celda_encabezado_general">AL(E) </th>
<!-- th:eq(4) -->
<th class="celda_encabezado_general">ME </th>
<!-- th:eq(6) -->
<th class="celda_encabezado_general">SI </th>
<!-- th:eq(7) -->
<th class="celda_encabezado_general">caparo </th>
<!-- th:eq(8) -->
<th class="celda_encabezado_general">Nemak </th>
<!-- th:eq(9) -->
<th class="celda_encabezado_general">DR</th>
<!-- th:eq(10) -->
<th class="celda_encabezado_general">Running Hours </th>
<!-- th:eq(11) -->
<th class="celda_encabezado_general">Production </th>
<!-- th:eq(12) -->
<th class="celda_encabezado_general">Usage </th>
<!-- th:eq(13) -->
<th class="celda_encabezado_general">Production </th>
<!-- th:eq(14) -->
<th class="celda_encabezado_general">Production Per Hour </th>
<!-- th:eq(15) -->
<th class="celda_encabezado_general">Coating </th>
<!-- th:eq(16) -->
<th class="celda_encabezado_general">Hindhuja </th>
<!-- th:eq(17) -->
<th class="celda_encabezado_general">Nemak</th>
<!-- th:eq(18) -->
<th class="celda_encabezado_general">ME </th>
<!-- th:eq(19) -->
<th class="celda_encabezado_general">BI </th>
<!-- th:eq(20) -->
<th class="celda_encabezado_general">Karmen </th>
<!-- th:eq(21) -->
<th class="celda_encabezado_general">Receipt </th>
<!-- th:eq(22) -->
<th class="celda_encabezado_general">Consumption </th>
<!-- th:eq(23) -->
<th class="celda_encabezado_general">Engineers </th>
<!-- th:eq(24) -->
<th class="celda_encabezado_general">Supervisors</th>
<!-- th:eq(25) -->
<th class="celda_encabezado_general">Operators </th>
<!-- th:eq(26) -->
<th class="celda_encabezado_general">Roller Drivers </th>
<!-- th:eq(27) -->
<th class="celda_encabezado_general">Nature Of Maintenance </th>
<!-- th:eq(28) -->
<th class="celda_encabezado_general">Location </th>
</tr>
</thead>
<tbody style="background-color: #fff;">
<?php if (!empty($trpProductionDetails)) {
?>
<?php foreach ($trpProductionDetails as $trpProductionDetailIndex => $trpProductionDetail) {
?>
<tr id="<?= $trpProductionDetail['date'] ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $trpProductionDetail['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
<!-- date -->
<!-- td:eq(0) -->
<td class="celda_normal trpProductionStock date"
data-id="<?= $trpProductionDetail['date'] ?> date">
<?= $dateInMonthDmYFormat ?>
</td>
<!-- openingTime -->
<!-- td:eq(1) -->
<td class="celda_normal trpProductionStock openingTime"
data-id="<?= $trpProductionDetail['date'] ?> openingTime">
<select class="timeDropdown trp_on_time" style="width: 150px;">
<?php
foreach ($timeOptions as $timeOption) {
?>
<option value="<?= $timeOption ?>"
<?php if ($timeOption == $trpProductionDetail['openingTime']) echo "selected"; ?>>
<?= $timeOption ?>
</option>
<?php
}
?>
</select>
</td>
<!-- closingTime -->
<!-- td:eq(2) -->
<td class="celda_normal trpProductionStock closingTime"
data-id="<?= $trpProductionDetail['date'] ?> closingTime">
<select class="timeDropdown trp_off_time" style="width: 150px;">
<?php
foreach ($timeOptions as $timeOption) {
?>
<option value="<?= $timeOption ?>"
<?php if ($timeOption == $trpProductionDetail['closingTime']) echo "selected"; ?>>
<?= $timeOption ?>
</option>
<?php
}
?>
</select>
</td>
<!-- totalHours -->
<!-- td:eq(3) -->
<td class="celda_normal trpProductionStock totalHours"
data-id="<?= $trpProductionDetail['date'] ?> totalHours">
<?= $trpProductionDetail['totalHours'] ?>
</td>
<!-- coldStart -->
<!-- td:eq(4) -->
<td class="celda_normal trpProductionStock coldStart"
data-id="<?= $trpProductionDetail['date'] ?> coldStart"
oninput="trpStockChange(this)"
contenteditable="true">
<?= $trpProductionDetail['coldStart'] ?>
</td>
<!-- breakdownHours -->
<!-- td:eq(5) -->
<td class="celda_normal trpProductionStock breakdownHours"
data-id="<?= $trpProductionDetail['date'] ?> breakdownHours"
oninput="trpStockChange(this)"
contenteditable="true">
<?= $trpProductionDetail['breakdownHours'] ?>
</td>
<!-- burnerFiringHours -->
<!-- td:eq(6) -->
<td class="celda_normal trpProductionStock burnerFiringHours"
data-id="<?= $trpProductionDetail['date'] ?> burnerFiringHours">
<?= $trpProductionDetail['burnerFiringHours'] ?>
</td>
<!-- sandFeedingHours -->
<!-- td:eq(7) -->
<td class="celda_normal trpProductionStock sandFeedingHours"
data-id="<?= $trpProductionDetail['date'] ?> sandFeedingHours">
<?= $trpProductionDetail['sandFeedingHours'] ?>
</td>
<!-- gasReceiptBg -->
<!-- td:eq(8) -->
<td class="celda_normal trpProductionStock gasReceiptBg"
data-id="<?= $trpProductionDetail['date'] ?> gasReceiptBg"
contenteditable="true">
<?= $trpProductionDetail['gasReceiptBg'] ?>
</td>
<!-- gasReceiptPg -->
<!-- td:eq(9) -->
<td class="celda_normal trpProductionStock gasReceiptPg"
data-id="<?= $trpProductionDetail['date'] ?> gasReceiptPg"
contenteditable="true">
<?= $trpProductionDetail['gasReceiptPg'] ?>
</td>
<!-- physicalGasConsumption -->
<!-- td:eq(10) -->
<td class="celda_normal trpProductionStock physicalGasConsumption"
data-id="<?= $trpProductionDetail['date'] ?> physicalGasConsumption"
oninput="trpStockChange(this)"
contenteditable="true">
<?= $trpProductionDetail['physicalGasConsumption'] ?>
</td>
<!-- drierGasConsumption -->
<!-- td:eq(11) -->
<td class="celda_normal trpProductionStock drierGasConsumption"
data-id="<?= $trpProductionDetail['date'] ?> drierGasConsumption">
<?= $trpProductionDetail['drierGasConsumption'] == 0 ? " " : $trpProductionDetail['drierGasConsumption'] ?>
</td>
<!-- coatingGasConsumption -->
<!-- td:eq(12) -->
<td class="celda_normal trpProductionStock coatingGasConsumption"
data-id="<?= $trpProductionDetail['date'] ?> coatingGasConsumption">
<?= $trpProductionDetail['coatingGasConsumption'] ?>
</td>
<!-- trpPlusDrierGasConsumption -->
<!-- td:eq(13) -->
<td class="celda_normal trpProductionStock trpPlusDrierGasConsumption"
data-id="<?= $trpProductionDetail['date'] ?> trpPlusDrierGasConsumption">
<?= $trpProductionDetail['trpPlusDrierGasConsumption'] ?>
</td>
<!-- trpPhysicalGasPerTon -->
<!-- td:eq(14) -->
<td class="celda_normal trpProductionStock trpPhysicalGasPerTon"
data-id="<?= $trpProductionDetail['date'] ?> trpPhysicalGasPerTon">
<?= $trpPhysicalGasPerTon = $trpProductionDetail['trpPhysicalGasPerTon'] ?>
</td>
<!-- panelGasConsumption -->
<!-- td:eq(15) -->
<td class="celda_normal trpProductionStock panelGasConsumption"
data-id="<?= $trpProductionDetail['date'] ?> panelGasConsumption"
oninput="trpStockChange(this)"
contenteditable="true">
<?= $trpProductionDetail['panelGasConsumption'] ?>
</td>
<!-- panelGasPerTon -->
<!-- td:eq(16) -->
<td class="celda_normal trpProductionStock panelGasPerTon"
data-id="<?= $trpProductionDetail['date'] ?> panelGasPerTon">
<?= $trpProductionDetail['panelGasPerTon'] ?>
</td>
<!-- AL(S) -->
<!-- td:eq(17) -->
<td class="celda_normal trpProductionStock ALs_wcs"
data-id="<?= $trpProductionDetail['date'] ?> ALs_wcs">
<?= $trpProductionDetail['ALs_wcs'] == 0 ? " " : $trpProductionDetail['ALs_wcs'] ?>
</td>
<!-- AL(E) -->
<!-- td:eq(18) -->
<td class="celda_normal trpProductionStock ALe_wcs"
data-id="<?= $trpProductionDetail['date'] ?> ALe_wcs">
<?= $trpProductionDetail['ALe_wcs'] == 0 ? " " : $trpProductionDetail['ALe_wcs'] ?>
</td>
<!-- ME -->
<!-- td:eq(19) -->
<td class="celda_normal trpProductionStock ME_wcs"
data-id="<?= $trpProductionDetail['date'] ?> ME_wcs"
contenteditable="true">
<?= $trpProductionDetail['ME_wcs'] == 0 ? " " : $trpProductionDetail['ME_wcs'] ?>
</td>
<!-- SI -->
<!-- td:eq(20) -->
<td class="celda_normal trpProductionStock SI_wcs"
data-id="<?= $trpProductionDetail['date'] ?> SI_wcs">
<?= $trpProductionDetail['SI_wcs'] == 0 ? " " : $trpProductionDetail['SI_wcs'] ?>
</td>
<!-- Caparo -->
<!-- td:eq(21) -->
<td class="celda_normal trpProductionStock caparo_wcs"
data-id="<?= $trpProductionDetail['date'] ?> caparo_wcs">
<?= $trpProductionDetail['caparo_wcs'] == 0 ? " " : $trpProductionDetail['caparo_wcs'] ?>
</td>
<!-- Nemak -->
<!-- td:eq(22) -->
<td class="celda_normal trpProductionStock Nemak_wcs"
data-id="<?= $trpProductionDetail['date'] ?> Nemak_wcs">
<?= $trpProductionDetail['Nemak_wcs'] == 0 ? " " : $trpProductionDetail['Nemak_wcs'] ?>
</td>
<!-- DR -->
<!-- td:eq(23) -->
<td class="celda_normal trpProductionStock DR_wcs"
data-id="<?= $trpProductionDetail['date'] ?> DR_wcs">
<?= $trpProductionDetail['DR_wcs'] == 0 ? " " : $trpProductionDetail['DR_wcs'] ?>
</td>
<!-- edRunningHours -->
<!-- td:eq(24) -->
<td class="celda_normal trpProductionStock edRunningHours"
data-id="<?= $trpProductionDetail['date'] ?> edRunningHours"
contenteditable="true">
<?= $trpProductionDetail['edRunningHours'] ?>
</td>
<!-- edProduction -->
<!-- td:eq(25) -->
<td class="celda_normal trpProductionStock edProduction"
data-id="<?= $trpProductionDetail['date'] ?> edProduction"
contenteditable="true">
<?= $trpProductionDetail['edProduction'] ?>
</td>
<!-- edUsage -->
<!-- td:eq(26) -->
<td class="celda_normal trpProductionStock edUsage"
data-id="<?= $trpProductionDetail['date'] ?> edUsage"
contenteditable="true">
<?= $trpProductionDetail['edUsage'] ?>
</td>
<!-- trpProduction -->
<!-- td:eq(27) -->
<td class="celda_normal trpProductionStock trpProduction"
data-id="<?= $trpProductionDetail['date'] ?> trpProduction"
oninput="trpStockChange(this)"
contenteditable="true">
<?= $trpProductionDetail['trpProduction'] ?>
</td>
<!-- trpProductionPerHour -->
<!-- td:eq(28) -->
<td class="celda_normal trpProductionStock trpProductionPerHour"
data-id="<?= $trpProductionDetail['date'] ?> trpProductionPerHour">
<?= $trpProductionDetail['trpProductionPerHour'] ?>
</td>
<!-- coating -->
<!-- td:eq(29) -->
<td class="celda_normal trpProductionStock coating"
data-id="<?= $trpProductionDetail['date'] ?> coating">
<?= $trpProductionDetail['coating'] == 0 ? " " : $trpProductionDetail['coating'] ?>
</td>
<!-- Hindhuja -->
<!-- td:eq(30) -->
<td class="celda_normal trpProductionStock ALs_crs"
data-id="<?= $trpProductionDetail['date'] ?> ALs_crs">
<?= $trpProductionDetail['ALs_crs'] == 0 ? " " : $trpProductionDetail['ALs_crs'] ?>
</td>
<!-- Nemak -->
<!-- td:eq(31) -->
<td class="celda_normal trpProductionStock Nemak_crs"
data-id="<?= $trpProductionDetail['date'] ?> Nemak_crs">
<?= $trpProductionDetail['Nemak_crs'] == 0 ? " " : $trpProductionDetail['Nemak_crs'] ?>
</td>
<!-- ME -->
<!-- td:eq(32) -->
<td class="celda_normal trpProductionStock ME_crs"
data-id="<?= $trpProductionDetail['date'] ?> ME_crs"
contenteditable="true">
<?= $trpProductionDetail['ME_crs'] == 0 ? " " : $trpProductionDetail['ME_crs'] ?>
</td>
<!-- BI -->
<!-- td:eq(33) -->
<td class="celda_normal trpProductionStock BI_crs"
data-id="<?= $trpProductionDetail['date'] ?> BI_crs"
contenteditable="true">
<?= $trpProductionDetail['BI_crs'] == 0 ? " " : $trpProductionDetail['BI_crs'] ?>
</td>
<!-- Karmen -->
<!-- td:eq(34) -->
<td class="celda_normal trpProductionStock Karmen_crs"
data-id="<?= $trpProductionDetail['date'] ?> Karmen_crs"
contenteditable="true">
<?= $trpProductionDetail['Karmen_crs'] == 0 ? " " : $trpProductionDetail['Karmen_crs'] ?>
</td>
<!-- waterReceipt -->
<!-- td:eq(35) -->
<td class="celda_normal trpProductionStock waterReceipt"
data-id="<?= $trpProductionDetail['date'] ?> waterReceipt"
contenteditable="true">
<?= $trpProductionDetail['waterReceipt'] ?>
</td>
<!-- waterConsumption -->
<!-- td:eq(36) -->
<td class="celda_normal trpProductionStock waterConsumption"
data-id="<?= $trpProductionDetail['date'] ?> waterConsumption"
contenteditable="true">
<?= $trpProductionDetail['waterConsumption'] ?>
</td>
<!-- ebReading -->
<!-- td:eq(37) -->
<td class="celda_normal trpProductionStock ebReading"
data-id="<?= $trpProductionDetail['date'] ?> ebReading"
oninput="trpStockChange(this)"
contenteditable="true">
<?= $trpProductionDetail['ebReading'] ?>
</td>
<!-- ebReadingPerUnitTon -->
<!-- td:eq(38) -->
<td class="celda_normal trpProductionStock ebReadingPerUnitTon"
data-id="<?= $trpProductionDetail['date'] ?> ebReadingPerUnitTon">
<?= $trpProductionDetail['ebReadingPerUnitTon'] ?>
</td>
<!-- workingPersonEngineers -->
<!-- td:eq(39) -->
<td class="celda_normal trpProductionStock workingPersonEngineers"
data-id="<?= $trpProductionDetail['date'] ?> workingPersonEngineers"
contenteditable="true">
<?= $trpProductionDetail['workingPersonEngineers'] ?>
</td>
<!-- workingPersonSupervisiors -->
<!-- td:eq(40) -->
<td class="celda_normal trpProductionStock workingPersonSupervisiors"
data-id="<?= $trpProductionDetail['date'] ?> workingPersonSupervisiors"
contenteditable="true">
<?= $trpProductionDetail['workingPersonSupervisiors'] ?>
</td>
<!-- workingPersonOperators -->
<!-- td:eq(41) -->
<td class="celda_normal trpProductionStock workingPersonOperators"
data-id="<?= $trpProductionDetail['date'] ?> workingPersonOperators"
contenteditable="true">
<?= $trpProductionDetail['workingPersonOperators'] ?>
</td>
<!-- rollerDrivers -->
<!-- td:eq(42) -->
<td class="celda_normal trpProductionStock rollerDrivers"
data-id="<?= $trpProductionDetail['date'] ?> rollerDrivers"
contenteditable="true">
<?= $trpProductionDetail['rollerDrivers'] ?>
</td>
<!-- natureOfMaintenance -->
<!-- td:eq(43) -->
<td class="celda_normal trpProductionStock natureOfMaintenance"
data-id="<?= $trpProductionDetail['date'] ?> natureOfMaintenance"
contenteditable="true">
<?= $trpProductionDetail['natureOfMaintenance'] ?>
</td>
<!-- location -->
<!-- td:eq(44) -->
<td class="celda_normal trpProductionStock location"
data-id="<?= $trpProductionDetail['date'] ?> location"
contenteditable="true">
<?= $trpProductionDetail['location'] ?>
</td>
<!-- description -->
<!-- td:eq(45) -->
<td class="celda_normal trpProductionStock description"
data-id="<?= $trpProductionDetail['date'] ?> description"
contenteditable="true">
<?= $trpProductionDetail['description'] ?>
</td>
<!-- msSeperation -->
<!-- td:eq(46) -->
<td class="celda_normal trpProductionStock msSeperation"
data-id="<?= $trpProductionDetail['date'] ?> msSeperation"
contenteditable="true">
<?= $trpProductionDetail['msSeperation'] ?>
</td>
<!-- edWaste -->
<!-- td:eq(47) -->
<td class="celda_normal trpProductionStock edWaste"
data-id="<?= $trpProductionDetail['date'] ?> edWaste"
contenteditable="true">
<?= $trpProductionDetail['edWaste'] ?>
</td>
<!-- coolerBags -->
<!-- td:eq(48) -->
<td class="celda_normal trpProductionStock coolerBags"
data-id="<?= $trpProductionDetail['date'] ?> coolerBags"
contenteditable="true">
<?= $trpProductionDetail['coolerBags'] ?>
</td>
<!-- edPlus20Waste -->
<!-- td:eq(49) -->
<td class="celda_normal trpProductionStock edPlus20Waste"
data-id="<?= $trpProductionDetail['date'] ?> edPlus20Waste"
contenteditable="true">
<?= $trpProductionDetail['edPlus20Waste'] ?>
</td>
<!--cycloneWaste -->
<!-- td:eq(50) -->
<td class="celda_normal trpProductionStock cycloneWaste"
data-id="<?= $trpProductionDetail['date'] ?> cycloneWaste"
contenteditable="true">
<?= $trpProductionDetail['cycloneWaste'] ?>
</td>
</tr>
<?php
//before closing inner loop we just adding the total values insidde it
$eachDate = $trpProductionDetail['date']; // Unique identifier
// Initialize the date entry if it doesn't exist
if (!isset($summary['totalHours'])) {
$summary = [
'totalHours' => 0,
'coldStart' => 0,
'breakdownHours' => 0,
'burnerFiringHours' => 0,
'sandFeedingHours' => 0,
'gasReceiptBg' => 0,
'gasReceiptPg' => 0,
'physicalGasConsumption' => 0,
'drierGasConsumption' => 0,
'coatingGasConsumption' => 0,
'trpPlusDrierGasConsumption' => 0,
'trpPhysicalGasPerTon' => 0,
'panelGasConsumption' => 0,
'panelGasPerTon' => 0,
'ALs_wcs' => 0,
'ALe_wcs' => 0,
'ME_wcs' => 0,
'SI_wcs' => 0,
'caparo_wcs' => 0,
'Nemak_wcs' => 0,
'DR_wcs' => 0,
'edRunningHours' => 0,
'edProduction' => 0,
'edUsage' => 0,
'trpProduction' => 0,
'trpProductionPerHour' => 0,
'coating' => 0,
'ALs_crs' => 0,
'Nemak_crs' => 0,
'ME_crs' => 0,
'BI_crs' => 0,
'Karmen_crs' => 0,
'waterReceipt' => 0,
'waterConsumption' => 0,
'ebReading' => 0,
'ebReadingPerUnitTon' => 0,
'workingPersonEngineers' => 0,
'workingPersonSupervisiors' => 0,
'workingPersonOperators' => 0,
'msSeperation' => 0,
'edWaste' => 0,
'coolerBags' => 0,
'edPlus20Waste' => 0,
'cycloneWaste' => 0
];
}
// Sum values for the material
$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['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;
$summary['gasReceiptPg'] += is_numeric($trpProductionDetail['gasReceiptPg']) ? $trpProductionDetail['gasReceiptPg'] : 0;
$summary['physicalGasConsumption'] += is_numeric($trpProductionDetail['physicalGasConsumption']) ? $trpProductionDetail['physicalGasConsumption'] : 0;
$summary['drierGasConsumption'] += is_numeric($trpProductionDetail['drierGasConsumption']) ? $trpProductionDetail['drierGasConsumption'] : 0;
$summary['coatingGasConsumption'] += is_numeric($trpProductionDetail['coatingGasConsumption']) ? $trpProductionDetail['coatingGasConsumption'] : 0;
$summary['trpPlusDrierGasConsumption'] += is_numeric($trpProductionDetail['trpPlusDrierGasConsumption'])? $trpProductionDetail['trpPlusDrierGasConsumption'] : 0;
$summary['trpPhysicalGasPerTon'] += is_numeric($trpProductionDetail['trpPhysicalGasPerTon']) ? $trpProductionDetail['trpPhysicalGasPerTon'] : 0;
$summary['panelGasConsumption'] += is_numeric($trpProductionDetail['panelGasConsumption']) ? $trpProductionDetail['panelGasConsumption'] : 0;
$summary['panelGasPerTon'] += is_numeric($trpProductionDetail['panelGasPerTon']) ? $trpProductionDetail['panelGasPerTon'] : 0;
$summary['ALs_wcs'] += is_numeric($trpProductionDetail['ALs_wcs']) ? $trpProductionDetail['ALs_wcs'] : 0;
$summary['ALe_wcs'] += is_numeric($trpProductionDetail['ALe_wcs']) ? $trpProductionDetail['ALe_wcs'] : 0;
$summary['ME_wcs'] += is_numeric($trpProductionDetail['ME_wcs']) ? $trpProductionDetail['ME_wcs'] : 0;
$summary['SI_wcs'] += is_numeric($trpProductionDetail['SI_wcs']) ? $trpProductionDetail['SI_wcs'] : 0;
$summary['caparo_wcs'] += is_numeric($trpProductionDetail['caparo_wcs']) ? $trpProductionDetail['caparo_wcs'] : 0;
$summary['Nemak_wcs'] += is_numeric($trpProductionDetail['Nemak_wcs']) ? $trpProductionDetail['Nemak_wcs'] : 0;
$summary['DR_wcs'] += is_numeric($trpProductionDetail['DR_wcs']) ? $trpProductionDetail['DR_wcs'] : 0;
$summary['edRunningHours'] += is_numeric($trpProductionDetail['edRunningHours']) ? $trpProductionDetail['edRunningHours'] : 0;
$summary['edProduction'] += is_numeric($trpProductionDetail['edProduction']) ? $trpProductionDetail['edProduction'] : 0;
$summary['edUsage'] += is_numeric($trpProductionDetail['edUsage']) ? $trpProductionDetail['edUsage'] : 0;
$summary['trpProduction'] += is_numeric($trpProductionDetail['trpProduction']) ? $trpProductionDetail['trpProduction'] : 0;
$summary['trpProductionPerHour'] += is_numeric($trpProductionDetail['trpProductionPerHour']) ? $trpProductionDetail['trpProductionPerHour'] : 0;
$summary['coating'] += is_numeric($trpProductionDetail['coating']) ? $trpProductionDetail['coating'] : 0;
$summary['ALs_crs'] += is_numeric($trpProductionDetail['ALs_crs']) ? $trpProductionDetail['ALs_crs'] : 0;
$summary['Nemak_crs'] += is_numeric($trpProductionDetail['Nemak_crs']) ? $trpProductionDetail['Nemak_crs'] : 0;
$summary['ME_crs'] += is_numeric($trpProductionDetail['ME_crs']) ? $trpProductionDetail['ME_crs'] : 0;
$summary['BI_crs'] += is_numeric($trpProductionDetail['BI_crs']) ? $trpProductionDetail['BI_crs'] : 0;
$summary['Karmen_crs'] += is_numeric($trpProductionDetail['Karmen_crs']) ? $trpProductionDetail['Karmen_crs'] : 0;
$summary['waterReceipt'] += is_numeric($trpProductionDetail['waterReceipt']) ? $trpProductionDetail['waterReceipt'] : 0;
$summary['waterConsumption'] += is_numeric($trpProductionDetail['waterConsumption']) ? $trpProductionDetail['waterConsumption'] : 0;
$summary['ebReading'] += is_numeric($trpProductionDetail['ebReading']) ? $trpProductionDetail['ebReading'] : 0;
$summary['ebReadingPerUnitTon'] += is_numeric($trpProductionDetail['ebReadingPerUnitTon']) ? $trpProductionDetail['ebReadingPerUnitTon'] : 0;
$summary['workingPersonEngineers'] += is_numeric($trpProductionDetail['workingPersonEngineers']) ? $trpProductionDetail['workingPersonEngineers'] : 0;
$summary['workingPersonSupervisiors'] += is_numeric($trpProductionDetail['workingPersonSupervisiors']) ? $trpProductionDetail['workingPersonSupervisiors'] : 0;
$summary['workingPersonOperators'] += is_numeric($trpProductionDetail['workingPersonOperators']) ? $trpProductionDetail['workingPersonOperators'] : 0;
$summary['msSeperation'] += is_numeric($trpProductionDetail['msSeperation']) ? $trpProductionDetail['msSeperation'] : 0;
$summary['edWaste'] += is_numeric($trpProductionDetail['edWaste']) ? $trpProductionDetail['edWaste'] : 0;
$summary['coolerBags'] += is_numeric($trpProductionDetail['coolerBags']) ? $trpProductionDetail['coolerBags'] : 0;
$summary['edPlus20Waste'] += is_numeric($trpProductionDetail['edPlus20Waste']) ? $trpProductionDetail['edPlus20Waste'] : 0;
$summary['cycloneWaste'] += is_numeric($trpProductionDetail['cycloneWaste']) ? $trpProductionDetail['cycloneWaste'] : 0;
} ?>
<table id="trpProductionStockSummaryTableId" class="fht-table table-striped">
<thead class="celda_encabezado_general" style="padding: 10px;">
<tr>
<!-- th:eq(0) -->
<th class="celda_encabezado_total" rowspan="2">Date </th>
<!-- th:eq(1) -->
<th class="celda_encabezado_total" rowspan="2">Opening Time </th>
<!-- th:eq(2) -->
<th class="celda_encabezado_total" rowspan="2">Closing Time </th>
<!-- th:eq(3) -->
<th class="celda_encabezado_total" rowspan="2">Total Hours </th>
<!-- th:eq(4) -->
<th class="celda_encabezado_total" rowspan="2">Cold Start </th>
<!-- th:eq(5) -->
<th class="celda_encabezado_total" rowspan="2">Break Down Hours </th>
<!-- th:eq(6) -->
<th class="celda_encabezado_total" rowspan="2">Burner Firing Hours </th>
<!-- th:eq(7) -->
<th class="celda_encabezado_total" rowspan="2">Sand Feeding Hours </th>
<!-- th:eq(8) -->
<th class="celda_encabezado_total" colspan="2">Gas Receipt </th>
<!-- th:eq(9) -->
<th class="celda_encabezado_total" rowspan="2">Physical Gas Consumption </th>
<!-- th:eq(10) -->
<th class="celda_encabezado_total" rowspan="2">Drier Gas Consumption </th>
<!-- th:eq(11) -->
<th class="celda_encabezado_total" rowspan="2">Coating Gas Consumption </th>
<!-- th:eq(12) -->
<th class="celda_encabezado_total" rowspan="2">TRP plus Drier Gas Consumption </th>
<!-- th:eq(13) -->
<th class="celda_encabezado_total" rowspan="2">TRP Physical Gas Per Ton </th>
<!-- th:eq(14) -->
<th class="celda_encabezado_total" rowspan="2">Panel Gas Consumption </th>
<!-- th:eq(15) -->
<th class="celda_encabezado_total" rowspan="2">Panel Gas Per Ton </th>
<!-- th:eq(16) -->
<th class="celda_encabezado_total" colspan="7">Incoming Sand/ Lump details </th>
<!-- th:eq(17) -->
<th class="celda_encabezado_total" colspan="3">ED details </th>
<!-- th:eq(18) -->
<th class="celda_encabezado_total" colspan="2">TRP Sand </th>
<!-- th:eq(19) -->
<th class="celda_encabezado_total" colspan="6">Usage </th>
<!-- th:eq(20) -->
<th class="celda_encabezado_total" colspan="2">Water </th>
<!-- th:eq(21) -->
<th class="celda_encabezado_total" rowspan="2">EB Reading </th>
<!-- th:eq(22) -->
<th class="celda_encabezado_total" rowspan="2">EB Unit Per Ton </th>
<!-- th:eq(23) -->
<th class="celda_encabezado_total" colspan="4">Working Persons </th>
<!-- th:eq(24) -->
<th class="celda_encabezado_total" colspan="2"> Maintanence Details </th>
<!-- th:eq(25) -->
<th class="celda_encabezado_total" rowspan="2">Description </th>
<!-- th:eq(26) -->
<th class="celda_encabezado_total" rowspan="2">MS Seperation </th>
<!-- th:eq(27) -->
<th class="celda_encabezado_total" rowspan="2">ED Waste </th>
<!-- th:eq(28) -->
<th class="celda_encabezado_total" rowspan="2">Cooler Bags </th>
<!-- th:eq(29) -->
<th class="celda_encabezado_total" rowspan="2">ED +20 Waste </th>
<!-- th:eq(30) -->
<th class="celda_encabezado_total" rowspan="2">Cyclone Waste </th>
<!-- th:eq(31) -->
</tr>
<tr>
<!-- th:eq(0) -->
<th class="celda_encabezado_total" style="z-index:11;">BG</th>
<!-- th:eq(1) -->
<th class="celda_encabezado_total">PG </th>
<!-- th:eq(2) -->
<th class="celda_encabezado_total">AL(S) </th>
<!-- th:eq(3) -->
<th class="celda_encabezado_total">AL(E) </th>
<!-- th:eq(4) -->
<th class="celda_encabezado_total">ME </th>
<!-- th:eq(6) -->
<th class="celda_encabezado_total">SI </th>
<!-- th:eq(7) -->
<th class="celda_encabezado_total">caparo </th>
<!-- th:eq(8) -->
<th class="celda_encabezado_total">Nemak </th>
<!-- th:eq(9) -->
<th class="celda_encabezado_total">DR</th>
<!-- th:eq(10) -->
<th class="celda_encabezado_total">Running Hours </th>
<!-- th:eq(11) -->
<th class="celda_encabezado_total">Production </th>
<!-- th:eq(12) -->
<th class="celda_encabezado_total">Usage </th>
<!-- th:eq(13) -->
<th class="celda_encabezado_total">Production </th>
<!-- th:eq(14) -->
<th class="celda_encabezado_total">Production Per Hour </th>
<!-- th:eq(15) -->
<th class="celda_encabezado_total">Coating </th>
<!-- th:eq(16) -->
<th class="celda_encabezado_total">Hindhuja </th>
<!-- th:eq(17) -->
<th class="celda_encabezado_total">Nemak</th>
<!-- th:eq(18) -->
<th class="celda_encabezado_total">ME </th>
<!-- th:eq(19) -->
<th class="celda_encabezado_total">BI </th>
<!-- th:eq(20) -->
<th class="celda_encabezado_total">Karmen </th>
<!-- th:eq(21) -->
<th class="celda_encabezado_total">Receipt </th>
<!-- th:eq(22) -->
<th class="celda_encabezado_total">Consumption </th>
<!-- th:eq(23) -->
<th class="celda_encabezado_total">Engineers </th>
<!-- th:eq(24) -->
<th class="celda_encabezado_total">Supervisors</th>
<!-- th:eq(25) -->
<th class="celda_encabezado_total">Operators </th>
<!-- th:eq(26) -->
<th class="celda_encabezado_total">Roller Drivers </th>
<!-- th:eq(27) -->
<th class="celda_encabezado_total">Nature Of Maintenance </th>
<!-- th:eq(28) -->
<th class="celda_encabezado_total">Location </th>
</tr>
</thead>
<tbody style="background-color: #fff;">
<tr>
<!-- date -->
<!-- td:eq(0) -->
<td class="celda_normal">
</td>
<!-- openingTime -->
<!-- td:eq(1) -->
<td class="celda_normal">
</td>
<!-- closingTime -->
<!-- td:eq(2) -->
<td class="celda_normal">
</td>
<!-- totalHours -->
<!-- td:eq(3) -->
<td class="celda_normal ">
<?= $summary['totalHours'] ?>
</td>
<!-- coldStart -->
<!-- td:eq(4) -->
<td class="celda_normal">
<?=$summary['coldStart']?>
</td>
<!-- breakdownHours -->
<!-- td:eq(5) -->
<td class="celda_normal">
<?=$summary['breakdownHours']?>
</td>
<!-- burnerFiringHours -->
<!-- td:eq(6) -->
<td class="celda_normal ">
<?= $summary['burnerFiringHours'] ?>
</td>
<!-- sandFeedingHours -->
<!-- td:eq(7) -->
<td class="celda_normal">
<?=$summary['sandFeedingHours'] ?>
</td>
<!-- gasReceiptBg -->
<!-- td:eq(8) -->
<td class="celda_normal">
<?=$summary['gasReceiptBg'] ?>
</td>
<!-- gasReceiptPg -->
<!-- td:eq(9) -->
<td class="celda_normal">
<?=$summary['gasReceiptPg'] ?>
</td>
<!-- physicalGasConsumption -->
<!-- td:eq(10) -->
<td class="celda_normal">
<?=$summary['physicalGasConsumption']?>
</td>
<!-- drierGasConsumption -->
<!-- td:eq(11) -->
<td class="celda_normal">
<?=$summary['drierGasConsumption']?>
</td>
<!-- coatingGasConsumption -->
<!-- td:eq(12) -->
<td class="celda_normal">
<?=$summary['coatingGasConsumption'] ?>
</td>
<!-- trpPlusDrierGasConsumption -->
<!-- td:eq(13) -->
<td class="celda_normal">
<?=$summary['trpPlusDrierGasConsumption']?>
</td>
<!-- trpPhysicalGasPerTon -->
<!-- td:eq(14) -->
<td class="celda_normal">
<?=$summary['trpPhysicalGasPerTon']?>
</td>
<!-- panelGasConsumption -->
<!-- td:eq(15) -->
<td class="celda_normal">
<?= $summary['panelGasConsumption'] ?>
</td>
<!-- panelGasPerTon -->
<!-- td:eq(16) -->
<td class="celda_normal">
<?=$summary['panelGasPerTon']?>
</td>
<!-- AL(S) -->
<!-- td:eq(17) -->
<td class="celda_normal">
<?= $summary['ALs_wcs']?>
</td>
<!-- AL(E) -->
<!-- td:eq(18) -->
<td class="celda_normal">
<?=$summary['ALe_wcs']?>
</td>
<!-- ME -->
<!-- td:eq(19) -->
<td class="celda_normal">
<?=$summary['ME_wcs'] ?>
</td>
<!-- SI -->
<!-- td:eq(20) -->
<td class="celda_normal">
<?= $summary['SI_wcs']?>
</td>
<!-- Caparo -->
<!-- td:eq(21) -->
<td class="celda_normal">
<?=$summary['caparo_wcs']?>
</td>
<!-- Nemak -->
<!-- td:eq(22) -->
<td class="celda_normal">
<?= $summary['Nemak_wcs']?>
</td>
<!-- DR -->
<!-- td:eq(23) -->
<td class="celda_normal">
<?= $summary['DR_wcs']?>
</td>
<!-- edRunningHours -->
<!-- td:eq(24) -->
<td class="celda_normal">
<?= $summary['edRunningHours']?>
</td>
<!-- edProduction -->
<!-- td:eq(25) -->
<td class="celda_normal">
<?= $summary['edProduction'] ?>
</td>
<!-- edUsage -->
<!-- td:eq(26) -->
<td class="celda_normal">
<?=$summary['edUsage'] ?>
</td>
<!-- trpProduction -->
<!-- td:eq(27) -->
<td class="celda_normal">
<?=$summary['trpProduction'] ?>
</td>
<!-- trpProductionPerHour -->
<!-- td:eq(28) -->
<td class="celda_normal">
<?=$summary['trpProductionPerHour'] ?>
</td>
<!-- coating -->
<!-- td:eq(29) -->
<td class="celda_normal">
<?=$summary['coating'] ?>
</td>
<!-- Hindhuja -->
<!-- td:eq(30) -->
<td class="celda_normal">
<?= $summary['ALs_crs'] ?>
</td>
<!-- Nemak -->
<!-- td:eq(31) -->
<td class="celda_normal">
<?=$summary['Nemak_crs'] ?>
</td>
<!-- ME -->
<!-- td:eq(32) -->
<td class="celda_normal">
<?=$summary['ME_crs'] ?>
</td>
<!-- BI -->
<!-- td:eq(33) -->
<td class="celda_normal">
<?=$summary['BI_crs'] ?>
</td>
<!-- Karmen -->
<!-- td:eq(34) -->
<td class="celda_normal">
<?=$summary['Karmen_crs'] ?>
</td>
<!-- waterReceipt -->
<!-- td:eq(35) -->
<td class="celda_normal">
<?=$summary['waterReceipt'] ?>
</td>
<!-- waterConsumption -->
<!-- td:eq(36) -->
<td class="celda_normal">
<?=$summary['waterConsumption'] ?>
</td>
<!-- ebReading -->
<!-- td:eq(37) -->
<td class="celda_normal">
<?=$summary['ebReading'] ?>
</td>
<!-- ebReadingPerUnitTon -->
<!-- td:eq(38) -->
<td class="celda_normal">
<?=$summary['ebReadingPerUnitTon'] ?>
</td>
<!-- workingPersonEngineers -->
<!-- td:eq(39) -->
<td class="celda_normal">
<?=$summary['workingPersonEngineers'] ?>
</td>
<!-- workingPersonSupervisiors -->
<!-- td:eq(40) -->
<td class="celda_normal">
<?=$summary['workingPersonSupervisiors'] ?>
</td>
<!-- workingPersonOperators -->
<!-- td:eq(41) -->
<td class="celda_normal">
<?=$summary['workingPersonOperators'] ?>
</td>
<!-- rollerDrivers -->
<!-- td:eq(42) -->
<td class="celda_normal">
<?=" " ?>
</td>
<!-- natureOfMaintenance -->
<!-- td:eq(43) -->
<td class="celda_normal">
<?=" " ?>
</td>
<!-- location -->
<!-- td:eq(44) -->
<td class="celda_normal">
<?=" "?>
</td>
<!-- description -->
<!-- td:eq(45) -->
<td class="celda_normal">
<?=" " ?>
</td>
<!-- msSeperation -->
<!-- td:eq(46) -->
<td class="celda_normal">
<?=$summary['msSeperation'] ?>
</td>
<!-- edWaste -->
<!-- td:eq(47) -->
<td class="celda_normal">
<?=$summary['edWaste'] ?>
</td>
<!-- coolerBags -->
<!-- td:eq(48) -->
<td class="celda_normal">
<?=$summary['coolerBags'] ?>
</td>
<!-- edPlus20Waste -->
<!-- td:eq(49) -->
<td class="celda_normal">
<?=$summary['edPlus20Waste'] ?>
</td>
<!--cycloneWaste -->
<!-- td:eq(50) -->
<td class="celda_normal">
<?=$summary['cycloneWaste'] ?>
</td>
</tr>
</tbody>
</table>
<?php } ?>
</tbody>
</table>
</div>
<div class="row">
<div class="col-md-12 text-right">
<input type="button" class="btn btn-success" id="saveId" value="save">
</div>
</div>
</div>
</div> <!-- End card-body -->
</div> <!-- End card -->
</div> <!-- End col -->
</div> <!-- End row -->
</div>
</div> <!-- End container-fluid -->
</div>
</div>
<div>
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Navigation Options</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- Date Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="dateDropdown">Select Date</label>
<select id="dateDropdown" class="form-control">
<?php foreach ($datesInMonth as $selectDate): ?>
<?php $selectDate = DateTime::createFromFormat('Y-m-d', $selectDate)->format('d-m-Y'); ?>
<option value="<?= $selectDate ?>"><?= $selectDate ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<button class="btn btn-primary float-right" onclick="navigateToResin()">Navigate</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<!-- JAVASCRIPT CODE -->
<script type="text/javascript">
$(document).ready(function() {
$('#saveId').click(function() {
//table to json function
var updateTrpProductionDetails = tableToJson();
alert('Updation may take a while, And we appreciate your patience..!!');
$('#loader').show();
$.ajax({
data: {
updateTrpProductionDetails
},
type: "POST",
url: "<?php echo base_url();?>updateTrpProductionDetails",
success: function(data) {
if (data) {
$('#loader').hide();
console.log(data);
alert(data);
}
},
error: function(xhr, status, error) {
alert("An error occurred while processing the request. Please try again.");
console.error("Error Code:", xhr.status);
console.error("Error Message:", error);
console.error("Response Text:", xhr.responseText);
},
complete: function() {
$('#loader').hide();
}
});
});
});
</script>
<script>
function tableToJson() {
const table = $('#trpProductionStockDetailsTableId');
const rows = [];
//this table to json is customized for bagstock not for all
table.find('tbody tr').each(function() {
const rowCells = $(this).find('td');
const date = rowCells.eq(0).text().trim(); //dmY format
let dateInYmD = `${date.split("-")[2]}-${date.split("-")[1]}-${date.split("-")[0]}`; //Ymd format
let openingDataId = `${dateInYmD} openingTime`;
let closingDataId = `${dateInYmD} closingTime`;
let openingTime = $(this).find(`td[data-id='${openingDataId}'] select.trp_on_time`).val();
let closingTime = $(this).find(`td[data-id='${closingDataId}'] select.trp_off_time`).val();
const rowData = {
Date : rowCells.eq(0).text().trim() ,
openingTime : openingTime ,
closingTime : closingTime ,
totalHours : rowCells.eq(3).text().trim() ,
coldStart : rowCells.eq(4).text().trim() ,
breakdownHours : rowCells.eq(5).text().trim() ,
burnerFiringHours : rowCells.eq(6).text().trim() ,
sandFeedingHours : rowCells.eq(7).text().trim() ,
gasReceiptBg : rowCells.eq(8).text().trim() ,
gasReceiptPg : rowCells.eq(9).text().trim() ,
physicalGasConsumption : rowCells.eq(10).text().trim() ,
trpPlusDrierGasConsumption : rowCells.eq(13).text().trim() ,
trpPhysicalGasPerTon : rowCells.eq(14).text().trim() ,
panelGasConsumption : rowCells.eq(15).text().trim() ,
panelGasPerTon : rowCells.eq(16).text().trim() ,
edRunningHours : rowCells.eq(24).text().trim() ,
edProduction : rowCells.eq(25).text().trim() ,
edUsage : rowCells.eq(26).text().trim() ,
waterConsumption : rowCells.eq(26).text().trim() ,
trpProduction : rowCells.eq(27).text().trim() ,
trpProductionPerHour : rowCells.eq(28).text().trim() ,
waterReceipt : rowCells.eq(35).text().trim() ,
ebReading : rowCells.eq(37).text().trim() ,
ebReadingPerUnitTon : rowCells.eq(38).text().trim() ,
workingPersonEngineers : rowCells.eq(39).text().trim() ,
workingPersonSupervisiors : rowCells.eq(40).text().trim() ,
workingPersonOperators : rowCells.eq(41).text().trim() ,
rollerDrivers : rowCells.eq(42).text().trim() ,
natureOfMaintenance : rowCells.eq(43).text().trim() ,
location : rowCells.eq(44).text().trim() ,
description : rowCells.eq(45).text().trim() ,
msSeperation : rowCells.eq(46).text().trim() ,
edWaste : rowCells.eq(47).text().trim() ,
coolerBags : rowCells.eq(48).text().trim() ,
edPlus20Waste : rowCells.eq(49).text().trim() ,
cycloneWaste : rowCells.eq(50).text().trim()
};
rows.push(rowData);
});
return JSON.stringify(rows, null, 2);
}
</script>
<script>
function calculateSandFeedingHours(totalHours, coldStart, breakdownHours) {
let [totalHoursF, coldStartF, breakdownHoursF] = [totalHours, coldStart, breakdownHours].map((time) => {
if (time === "" || time == null) return "0.00";
if (typeof time === "number") return time.toFixed(2);
if (!time.includes(".")) return `${time}.00`;
return time;
});
let sandFeedingHours = 0;
let totalHoursInt = milliSecondsFormat((totalHoursF));
let coldStartInt = milliSecondsFormat(coldStartF);
let breakdownHoursInt = milliSecondsFormat(breakdownHoursF);
let burnerFiringHoursInt = totalHoursInt - breakdownHoursInt;
sandFeedingHours = milliSecondsToHourMinuteFormat(burnerFiringHoursInt - coldStartInt);
burnerFiringHours = milliSecondsToHourMinuteFormat(burnerFiringHoursInt);
return [sandFeedingHours, burnerFiringHours];
}
function milliSecondsFormat(givenCustomHourMinuteFormat) {
let hoursInMilliSeconds = givenCustomHourMinuteFormat.split(".")[0] * 60 * 60 * 1000;
let minutesInMilliseconds = givenCustomHourMinuteFormat.split(".")[1] * 60 * 1000;
totalMilliSeconds = hoursInMilliSeconds + minutesInMilliseconds;
return totalMilliSeconds;
}
function milliSecondsDifference(a, b) {
return a > b ? a - b : b - a;
}
function milliSecondsToHourMinuteFormat(givenMilliSeconds) {
const hours = parseInt(givenMilliSeconds / (1000 * 60 * 60));
const hoursInMilliSeconds = hours * 60 * 60 * 1000;
const minutesInMilliseconds = givenMilliSeconds - hoursInMilliSeconds;
const minutes = parseInt(minutesInMilliseconds / (1000 * 60));
const totalHours = hours + "." + minutes;
return totalHours;
}
function trpStockChange(tdElement) {
try {
let tr = $(tdElement).closest('tr');
let totalHours = validateInput(tr.find('td:eq(3)').text().trim()) ?? 0;
let coldStart = validateInput(tr.find('td:eq(4)').text().trim()) ?? 0;
let breakdownHours = validateInput(tr.find('td:eq(5)').text().trim()) ?? 0;
let burnerFiringHours = tr.find('td:eq(6)').text().trim() ?? 0;
let sandFeedingHours = tr.find('td:eq(7)').text().trim() ?? 0;
let gasReceiptBg = tr.find('td:eq(8)').text().trim() ?? 0;
let gasReceiptPg = tr.find('td:eq(9)').text().trim() ?? 0;
let physicalGasConsumption = validateInput(tr.find('td:eq(10)').text().trim()) ?? 0;
let drierGasConsumption = validateInput(tr.find('td:eq(11)').text().trim()) ?? 0;
let coatingGasConsumption = validateInput(tr.find('td:eq(12)').text().trim()) ?? 0;
let trpPlusDrierGasConsumption = tr.find('td:eq(13)').text().trim() ?? 0;
let trpPhysicalGasPerTon = tr.find('td:eq(14)').text().trim() ?? 0;
let panelGasConsumption = (tr.find('td:eq(15)').text().trim()) ?? 0;
let panelGasPerTon = tr.find('td:eq(16)').text().trim() ?? 0;
let edRunningHours = tr.find('td:eq(24)').text().trim() ?? 0;
let edProduction = tr.find('td:eq(25)').text().trim() ?? 0;
let edUsage = tr.find('td:eq(26)').text().trim() ?? 0;
let trpProduction = validateInput(tr.find('td:eq(27)').text().trim()) ?? 0;
let trpProductionPerHour = tr.find('td:eq(28)').text().trim() ?? 0;
let coating = tr.find('td:eq(29)').text().trim() ?? 0;
let ebReading = tr.find('td:eq(37)').text().trim() ?? 0;
let ebReadingPerUnitTon = tr.find('td:eq(38)').text().trim() ?? 0;
let result = calculateSandFeedingHours(totalHours, coldStart, breakdownHours, burnerFiringHours);
sandFeedingHours = result[0];
burnerFiringHours = result[1];
trpPlusDrierGasConsumption = parseInt(parseFloat(physicalGasConsumption) -
(parseFloat(drierGasConsumption) + parseFloat(coatingGasConsumption)));
trpPhysicalGasPerTon = trpProduction == 0 ? " " : parseFloat(trpPlusDrierGasConsumption) / (parseFloat(trpProduction) / 1000);
panelGasPerTon = parseFloat(panelGasConsumption) / (parseFloat(trpProduction) / 1000);
trpProductionPerHour = sandFeedingHours == 0 ? " " : parseFloat(trpProduction) / parseFloat(sandFeedingHours);
ebReadingPerUnitTon = trpProduction == 0 ? " " : parseFloat(ebReading) / (parseFloat(trpProduction) / 1000);
// Final updation of value into td
tr.find('td:eq(7)').text(Number.isNaN(sandFeedingHours) ? " " : sandFeedingHours);
tr.find('td:eq(6)').text(Number.isNaN(burnerFiringHours) ? " " : burnerFiringHours);
tr.find('td:eq(13)').text(Number.isNaN(trpPlusDrierGasConsumption) ? " " : (trpPlusDrierGasConsumption).toFixed(2));
tr.find('td:eq(14)').text(Number.isNaN(trpPhysicalGasPerTon) ? " " : (trpPhysicalGasPerTon).toFixed(2));
tr.find('td:eq(16)').text(Number.isNaN(panelGasPerTon) ? " " : (panelGasPerTon.toFixed(2)));
tr.find('td:eq(28)').text(Number.isNaN(trpProductionPerHour) ? " " : (trpProductionPerHour).toFixed(2));
tr.find('td:eq(38)').text(Number.isNaN(ebReadingPerUnitTon) ? " " : (ebReadingPerUnitTon).toFixed(2));
} catch (error) {
console.error("There is an error updating stock ..!!" + error);
}
}
</script>
<script>
$(document).ready(function() {
$('.timeDropdown').select2({
placeholder: "Select",
});
$('.timeDropdown').change(function() {
var tr = $(this).closest('tr');
var trpOnTime = tr.find('.trp_on_time').val();
var trpOffTime = tr.find('.trp_off_time').val();
if (trpOnTime != '' && trpOffTime != '') {
const startDate = new Date(`1970-01-01T${convertTo24Hour(trpOnTime)}`);
const endDate = new Date(`1970-01-01T${convertTo24Hour(trpOffTime)}`);
// Handle the case where end time is on the next day
if (endDate < startDate) {
endDate.setDate(endDate.getDate() + 1);
}
// Calculate the difference in milliseconds
const totalDiffInMs = endDate - startDate;
// Convert milliseconds to hours and minutes 3,600,000
const hours = parseInt(totalDiffInMs / (1000 * 60 * 60));
const hoursInMilliSeconds = hours * 60 * 60 * 1000;
const minutesInMilliseconds = totalDiffInMs - hoursInMilliSeconds;
const minutes = parseInt(minutesInMilliseconds / (1000 * 60));
const totalHours = hours + "." + minutes;
tr.find('td:eq(3)').text(totalHours);
trpStockChange(this);
}
}
);
})
function convertTo24Hour(time) {
const [timePart, modifier] = time.split(" ");
let [hours, minutes] = timePart.split(":");
// Convert hours to a number
hours = parseInt(hours, 10);
// Adjust hours based on AM/PM
if (modifier === "PM" && hours < 12) {
hours += 12;
} else if (modifier === "AM" && hours === 12) {
hours = 0;
}
return `${String(hours).padStart(2, '0')}:${minutes}`;
}
</script>
<script>
function validateInput(input) {
if (input == '' || input == ' ' || input == '-') {
return 0;
}
if (typeof input === 'string' && input.split('').map(char => char.charCodeAt(0))[0] == 10) {
return 0;
}
// Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0;
}
return input;
}
</script>
<script>
// !caution!
// !caution!
// !caution!
// !caution!
// !caution!
// !caution!
// dont delete this commented code , this is used for refernce in getting td values
// let openingTime = tr.find('td:eq(1)').text().trim();
// let closingTime = tr.find('td:eq(2)').text().trim();
// let totalHours = tr.find('td:eq(3)').text().trim();
// let coldStart = tr.find('td:eq(4)').text().trim();
// let breakdownHours = tr.find('td:eq(5)').text().trim();
// let burnerFiringHours = tr.find('td:eq(6)').text().trim();
// let sandFeedingHours = tr.find('td:eq(7)').text().trim();
// let gasReceiptBg = tr.find('td:eq(8)').text().trim();
// let gasReceiptPg = tr.find('td:eq(9)').text().trim();
// let physicalGasConsumption = tr.find('td:eq(10)').text().trim();
// let drierGasConsumption = tr.find('td:eq(11)').text().trim();
// let coatingGasConsumption = tr.find('td:eq(12)').text().trim();
// let trpPlusDrierGasConsumption = tr.find('td:eq(13)').text().trim();
// let trpPhysicalGasPerTon = tr.find('td:eq(14)').text().trim();
// let panelGasConsumption = tr.find('td:eq(15)').text().trim();
// let panelGasPerTon = tr.find('td:eq(16)').text().trim();
// let isolAls = tr.find('td:eq(17)').text().trim();
// let isolAle = tr.find('td:eq(18)').text().trim();
// let isolMe = tr.find('td:eq(19)').text().trim();
// let isolSi = tr.find('td:eq(20)').text().trim();
// let isolCaparo = tr.find('td:eq(21)').text().trim();
// let isolNemak = tr.find('td:eq(22)').text().trim();
// let isolDr = tr.find('td:eq(23)').text().trim();
// let edRunningHours = tr.find('td:eq(24)').text().trim();
// let edProduction = tr.find('td:eq(25)').text().trim();
// let edUsage = tr.find('td:eq(26)').text().trim();
// let trpProduction = tr.find('td:eq(27)').text().trim();
// let trpProductionPerHour = tr.find('td:eq(28)').text().trim();
// let coating = tr.find('td:eq(29)').text().trim();
// let usageHindhuja = tr.find('td:eq(30)').text().trim();
// let usageNemak = tr.find('td:eq(31)').text().trim();
// let usageMe = tr.find('td:eq(32)').text().trim();
// let usageBi = tr.find('td:eq(33)').text().trim();
// let usageKarmen = tr.find('td:eq(34)').text().trim();
// let waterReceipt = tr.find('td:eq(35)').text().trim();
// let waterConsumption = tr.find('td:eq(36)').text().trim();
// let ebReading = tr.find('td:eq(37)').text().trim();
// let ebReadingPerUnitTon = tr.find('td:eq(38)').text().trim();
// let workingPersonEngineers = tr.find('td:eq(39)').text().trim();
// let workingPersonSupervisiors = tr.find('td:eq(40)').text().trim();
// let workingPersonOperators = tr.find('td:eq(41)').text().trim();
// let rollerDrivers = tr.find('td:eq(42)').text().trim();
// let natureOfMaintenance = tr.find('td:eq(43)').text().trim();
// let location = tr.find('td:eq(44)').text().trim();
// let description = tr.find('td:eq(45)').text().trim();
// let msSeperation = tr.find('td:eq(46)').text().trim();
// let edWaste = tr.find('td:eq(47)').text().trim();
// let coolerBags = tr.find('td:eq(48)').text().trim();
// let edPlus20Waste = tr.find('td:eq(49)').text().trim();
// let cycloneWaste = tr.find('td:eq(50)').text().trim();
// !caution!
// !caution!
// !caution!
// !caution!
// !caution!
// !caution!
// dont delete this commented code , this is used for refernce in getting td values
</script>