ria/app/Views/stock/trpProductionStockDetails.php
2025-04-24 17:43:24 +05:30

3080 lines
176 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: rgb(170, 222, 167);
color: rgb(2, 2, 2);
transform: scale(1.25);
/* Increases size by 25% */
transition: transform 0.5s ease-in-out;
/* Smooth scaling effect */
}
.fht-table tr:hover {
background-color: rgb(170, 222, 167);
color: rgb(2, 2, 2);
}
.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: #50bbd9;
border: 1px solid #ccc;
color: #ffffff;
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: 5px 6px;
}
#abstractTableId tbody td.celda_normal {
/*background-color: #fff;*/
/* <!-- ad9271 into ffffff brown-light to green-light --> */
text-align: center;
border: 1px solid #ccc;
padding: 12px 4px;
}
#trpProductionStockDetailsTableId tfoot tr td.celda_normal {
/*background-color: #fff;*/
/* <!-- ad9271 into ffffff brown-light to green-light --> */
text-align: center;
border: 1px solid #ccc;
padding: 6px 4px;
}
/* Make entire thead sticky */
.fht-table thead {
position: sticky;
top: 0;
z-index: 20;
/* Ensure the entire header stays above table rows */
background-color: #50bbd9;
/* 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: #50bbd9;
/* Green background */
color: #ffffff;
border: 2px solid;
white-space: normal;
/* Allows text to wrap */
word-wrap: break-word;
/* Breaks long words if needed */
text-align: center;
/* Centers text for better alignment */
}
/* Sticky First Column */
.fht-table th:nth-child(1),
.fht-table td:nth-child(1) {
position: sticky;
left: 0;
background-color: #50bbd9;
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: 500px;
max-width: 100%;
position: relative;
}
/* Adjust heights based on screen zoom */
@media only screen and (min-height: 1400px) {
/* Approximate Zoom < 100% */
.table-responsive {
max-height: 425px;
}
}
@media only screen and (min-height: 1200px) {
/* Approximate Zoom ~ 90% */
.table-responsive {
max-height: 500px;
}
}
@media only screen and (min-height: 1000px) {
/* Approximate Zoom ~ 80% */
.table-responsive {
max-height: 600px;
}
}
@media only screen and (min-height: 800px) {
/* Approximate Zoom ~ 75% */
.table-responsive {
max-height: 650px;
}
}
td {
min-width: 100px;
max-width: 100px;
}
.location {
min-width: 200px;
min-height: 200px;
}
.description {
min-width: 400px;
min-height: 200px;
}
tfoot tr {
background-color: rgb(235, 236, 203);
}
body[data-layout-mode=horizontal] .container-fluid {
max-width: 100%;
}
.card-body {
padding-top: 0;
padding-bottom: 0;
}
.card {
margin-bottom: 5px;
}
#trpProductionStockDetailsTableId {
/* Replace with your table's actual ID or selector */
border-collapse: collapse;
}
.hidden-row {
display: none;
}
</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" id="fullscreenDiv">
<div class="card-body">
<div id="successMessage"
style="
display: none;
position: absolute;
top: 10px;
left: 50%;
transform: translateX(-50%);
background: green;
color: white;
padding: 10px;
border-radius: 5px;
z-index: 1000;">
</div>
<form id="changeMonthForm" action="<?= base_url('trpProductionDetails'); ?>" method="post">
<div class="row">
<?php $today = date('M-Y'); ?>
<div class="col-2 mt-2">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control " readonly
style="max-width: 175px;">
</div>
<div class="col-10 text-right d-flex" style="justify-content: end;">
<input type="text" id="searchInput" placeholder="Search..."
class="mt-2"
style="padding: 8px;margin-bottom: 10px;width: 150px;border: 2px solid rgb(123, 11, 214);
border-radius: 5px;margin-right:15px;">
<i class="fa fa-table btn-lg mt-2"
title="Date Range Filter"
style="font-size: x-large; cursor:pointer; color:rgb(95, 102, 105)"
data-toggle="modal"
data-target="#filterModalId">
</i>
<i class="fa fa-download btn-lg mt-2"
title="Excel Download"
style="font-size: x-large; cursor:pointer; color: #0b7cba"
id="trpProductionDetailsExport">
</i>
<i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen"
style="font-size: x-large; cursor:pointer; color:rgb(241, 9, 136)"
onclick="toggleDivFullscreen()">
</i>
<i class="fa fa-save btn-lg mt-2 auditor-restricted-btn"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="saveId">
</i>
</div>
</div>
</form>
<!-- filter modal -->
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="filterModalLabelId">Filter Options</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<?php
$currentDateInDmY = date('d-m-Y');
?>
<?php
$startDate = DateTime::createFromFormat('M-Y', $month);
if ($startDate) {
$startDate->modify('first day of this month');
$daysInMonth = $startDate->format('t');
$dateArray = [];
for ($i = 0; $i < $daysInMonth; $i++) {
$dateArray[] = $startDate->format('d-m-Y');
$startDate->modify('+1 day');
}
} else {
echo "Invalid date format.";
}
?>
<!-- From Date Filter -->
<div class="col-md-6">
<div class="form-group">
<label for="fromDateFilter">Select From Date</label>
<select id="fromDateFilter" name="fromDateFilter" class="form-control select2">
<?php if (!empty($dateArray)) : ?>
<?php foreach ($dateArray as $index => $date) : ?>
<option value="<?= $date ?>"><?= $date ?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
</div>
<!-- To Date Filter -->
<div class="col-md-6">
<div class="form-group">
<label for="toDateFilter">Select Date</label>
<select id="toDateFilter" name="toDateFilter" class="form-control select2">
<?php if (!empty($dateArray)) : ?>
<?php foreach ($dateArray as $date) : ?>
<option value="<?= $date ?>" <?= ($date == $currentDateInDmY) || ($date == $dateArray[9]) ? "selected" : " " ?>><?= $date ?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
</div>
</div>
<button class="btn btn-primary float-right" onclick="customFilterDate()">Filter</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- end modal section -->
<div class="table-responsive" id="table-responsive">
<table id="trpProductionStockDetailsTableId" class="fht-table ">
<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) -->
<?php if (count($wcsSupplierList) > 0) { ?>
<th class="celda_encabezado_general" colspan="<?= count($wcsSupplierList) ?>">Incoming Sand/ Lump details </th>
<?php } ?>
<!-- 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 class="celda_encabezado_general" rowspan="2">Coating </th>
<!-- th:eq(19) -->
<?php if (count($crsClientList) > 0) { ?>
<th class="celda_encabezado_general" colspan="<?= count($crsClientList) ?>">Usage </th>
<?php } ?>
<!-- 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>
</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>
<!-- dynamic loop wcs-->
<?php foreach ($wcsSupplierList as $supplier) { ?>
<th class="celda_encabezado_general" style="min-width:200px !important;"><?= $supplier ?> </th>
<?php } ?>
<!-- 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) -->
<!-- dynamic loop crs -->
<?php foreach ($crsClientList as $client) { ?>
<th class="celda_encabezado_general" style="min-width:200px !important;"><?= $client ?> </th>
<?php } ?>
<!-- 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)) {
$totalWcsReceived = 0;
$totalCrsReceived = 0;
?>
<?php foreach ($trpProductionDetails as $trpProductionDetailIndex => $trpProductionDetail) {
$currentDate = date('Y-m-d');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $trpProductionDetail['date'])->format('d-m-Y');
?>
<tr id="<?= $trpProductionDetail['date'] ?>" class="<?=$trpProductionDetail['date'] > $currentDate ? "hidden-row" : "" ?>"
<?php
if ($trpProductionDetail['date'] === $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 select2" 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 select2" 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"
oninput="trpStockChange(this)">
<?= $trpProductionDetail['gasReceiptBg'] ?>
</td>
<!-- gasReceiptPg -->
<!-- td:eq(9) -->
<td class="celda_normal trpProductionStock gasReceiptPg"
data-id="<?= $trpProductionDetail['date'] ?> gasReceiptPg"
contenteditable="true"
oninput="trpStockChange(this)">
<?= $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"
oninput="trpStockChange(this)"
contenteditable="true">
<?= $trpProductionDetail['drierGasConsumption'] == 0 ? " " : $trpProductionDetail['drierGasConsumption'] ?>
</td>
<!-- coatingGasConsumption -->
<!-- td:eq(12) -->
<td class="celda_normal trpProductionStock coatingGasConsumption"
data-id="<?= $trpProductionDetail['date'] ?> coatingGasConsumption">
<?= $trpProductionDetail['coatingGasConsumption'] == 0 ? " " : $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>
<!-- loop for wcs supplier list -->
<?php foreach ($wcsSupplierList as $supplier) { ?>
<!-- td:eq(17) -->
<td class="celda_normal trpProductionStock <?= $supplier ?>"
data-id="<?= $trpProductionDetail['date'] ?> <?= $supplier ?>">
<?= $trpProductionDetail[$supplier] == 0 ? " " : $trpProductionDetail[$supplier] ?>
</td>
<?php } ?>
<!-- edRunningHours -->
<!-- td:eq(24) -->
<td class="celda_normal trpProductionStock edRunningHours"
data-id="<?= $trpProductionDetail['date'] ?> edRunningHours"
contenteditable="true"
oninput="trpStockChange(this)">
<?= $trpProductionDetail['edRunningHours'] ?>
</td>
<!-- edProduction -->
<!-- td:eq(25) -->
<td class="celda_normal trpProductionStock edProduction"
data-id="<?= $trpProductionDetail['date'] ?> edProduction"
contenteditable="true"
oninput="trpStockChange(this)">
<?= $trpProductionDetail['edProduction'] ?>
</td>
<!-- edUsage -->
<!-- td:eq(26) -->
<td class="celda_normal trpProductionStock edUsage"
data-id="<?= $trpProductionDetail['date'] ?> edUsage"
contenteditable="true"
oninput="trpStockChange(this)">
<?= $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>
<!-- loop for crs client ..!! -->
<?php foreach ($crsClientList as $client) { ?>
<!-- td:eq(17) -->
<td class="celda_normal trpProductionStock <?= $client ?>"
data-id="<?= $trpProductionDetail['date'] ?> <?= $client ?>">
<?= $trpProductionDetail[$client] == 0 ? " " : $trpProductionDetail[$client] ?>
</td>
<?php } ?>
<!-- waterReceipt -->
<!-- td:eq(35) -->
<td class="celda_normal trpProductionStock waterReceipt"
data-id="<?= $trpProductionDetail['date'] ?> waterReceipt"
contenteditable="true"
oninput="trpStockChange(this)">
<?= $trpProductionDetail['waterReceipt'] ?>
</td>
<!-- waterConsumption -->
<!-- td:eq(36) -->
<td class="celda_normal trpProductionStock waterConsumption"
data-id="<?= $trpProductionDetail['date'] ?> waterConsumption"
contenteditable="true"
oninput="trpStockChange(this)">
<?= $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"
style="text-align: left;padding-left: 10px;"
data-id="<?= $trpProductionDetail['date'] ?> location"
contenteditable="true">
<?= $trpProductionDetail['location'] ?>
</td>
<!-- description -->
<!-- td:eq(45) -->
<td class="celda_normal trpProductionStock description"
style="text-align: left;padding-left: 10px;"
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"
oninput="trpStockChange(this)">
<?= $trpProductionDetail['msSeperation'] ?>
</td>
<!-- edWaste -->
<!-- td:eq(47) -->
<td class="celda_normal trpProductionStock edWaste"
data-id="<?= $trpProductionDetail['date'] ?> edWaste"
contenteditable="true"
oninput="trpStockChange(this)">
<?= $trpProductionDetail['edWaste'] ?>
</td>
<!-- coolerBags -->
<!-- td:eq(48) -->
<td class="celda_normal trpProductionStock coolerBags"
data-id="<?= $trpProductionDetail['date'] ?> coolerBags"
contenteditable="true"
oninput="trpStockChange(this)">
<?= $trpProductionDetail['coolerBags'] ?>
</td>
<!-- edPlus20Waste -->
<!-- td:eq(49) -->
<td class="celda_normal trpProductionStock edPlus20Waste"
data-id="<?= $trpProductionDetail['date'] ?> edPlus20Waste"
contenteditable="true"
oninput="trpStockChange(this)">
<?= $trpProductionDetail['edPlus20Waste'] ?>
</td>
<!--cycloneWaste -->
<!-- td:eq(50) -->
<td class="celda_normal trpProductionStock cycloneWaste"
data-id="<?= $trpProductionDetail['date'] ?> cycloneWaste"
contenteditable="true"
oninput="trpStockChange(this)">
<?= $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,
'edRunningHours' => 0,
'edProduction' => 0,
'edUsage' => 0,
'trpProduction' => 0,
'trpProductionPerHour' => 0,
'coating' => 0,
'waterReceipt' => 0,
'waterConsumption' => 0,
'ebReading' => 0,
'noOfEbReadingDays' => 0,
'ebReadingPerUnitTon' => 0,
'workingPersonEngineers' => 0,
'workingPersonSupervisiors' => 0,
'workingPersonOperators' => 0,
'msSeperation' => 0,
'edWaste' => 0,
'coolerBags' => 0,
'edPlus20Waste' => 0,
'cycloneWaste' => 0
];
foreach ($crsClientList as $client) {
$summary[$client] = 0;
}
foreach ($wcsSupplierList as $supplier) {
$summary[$supplier] = 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;
//total of all incoming waste core sand
foreach ($wcsSupplierList as $supplier) {
$summary[$supplier] += is_numeric($trpProductionDetail[$supplier]) ? $trpProductionDetail[$supplier] : 0;
$totalWcsReceived += is_numeric($trpProductionDetail[$supplier]) ? $trpProductionDetail[$supplier] : 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;
// total of all core reclaimed sand
foreach ($crsClientList as $client) {
$summary[$client] += is_numeric($trpProductionDetail[$client]) ? $trpProductionDetail[$client] : 0;
$totalCrsReceived += is_numeric($trpProductionDetail[$client]) ? $trpProductionDetail[$client] : 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['noOfEbReadingDays'] += is_numeric($trpProductionDetail['ebReading'])
&& $trpProductionDetail['ebReading'] != 0 ? 1 : 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;
} ?>
<tfoot>
<tr>
<!-- Total -->
<!-- td:eq(0) -->
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<!-- openingTime -->
<!-- td:eq(1) -->
<td class="celda_normal openingTime"
data-id="footer openingTime">
</td>
<!-- closingTime -->
<!-- td:eq(2) -->
<td class="celda_normal closingTime"
data-id="footer closingTime">
</td>
<!-- totalHours -->
<!-- td:eq(3) -->
<td class="celda_normal totalHours"
data-id="footer totalHours">
<?= $summary['totalHours'] ?>
</td>
<!-- coldStart -->
<!-- td:eq(4) -->
<td class="celda_normal coldStart"
data-id="footer coldStart">
<?= $summary['coldStart'] ?>
</td>
<!-- breakdownHours -->
<!-- td:eq(5) -->
<td class="celda_normal breakdownHours"
data-id="footer breakdownHours">
<?= $summary['breakdownHours'] ?>
</td>
<!-- burnerFiringHours -->
<!-- td:eq(6) -->
<td class="celda_normal burnerFiringHours"
data-id="footer burnerFiringHours">
<?= $summary['burnerFiringHours'] ?>
</td>
<!-- sandFeedingHours -->
<!-- td:eq(7) -->
<td class="celda_normal sandFeedingHours"
data-id="footer sandFeedingHours">
<?= $summary['sandFeedingHours'] ?>
</td>
<!-- gasReceiptBg -->
<!-- td:eq(8) -->
<td class="celda_normal gasReceiptBg"
data-id="footer gasReceiptBg">
<?= $summary['gasReceiptBg'] ?>
</td>
<!-- gasReceiptPg -->
<!-- td:eq(9) -->
<td class="celda_normal gasReceiptPg"
data-id="footer gasReceiptPg">
<?= $summary['gasReceiptPg'] ?>
</td>
<!-- physicalGasConsumption -->
<!-- td:eq(10) -->
<td class="celda_norma physicalGasConsumption"
data-id="footer physicalGasConsumption">
<?= $summary['physicalGasConsumption'] ?>
</td>
<!-- drierGasConsumption -->
<!-- td:eq(11) -->
<td class="celda_normal drierGasConsumption"
data-id="footer drierGasConsumption">
<?= $summary['drierGasConsumption'] ?>
</td>
<!-- coatingGasConsumption -->
<!-- td:eq(12) -->
<td class="celda_normal coatingGasConsumption"
data-id="footer coatingGasConsumption">
<?= $summary['coatingGasConsumption'] ?>
</td>
<!-- trpPlusDrierGasConsumption -->
<!-- td:eq(13) -->
<td class="celda_normal trpPlusDrierGasConsumption"
data-id="footer trpPlusDrierGasConsumption">
<?= $summary['trpPlusDrierGasConsumption'] ?>
</td>
<!-- trpPhysicalGasPerTon -->
<!-- td:eq(14) -->
<td class="celda_normal trpPhysicalGasPerTon"
data-id="footer trpPhysicalGasPerTon">
<?= $summary['trpPhysicalGasPerTon'] ?>
</td>
<!-- panelGasConsumption -->
<!-- td:eq(15) -->
<td class="celda_normal panelGasConsumption"
data-id="footer panelGasConsumption">
<?= $summary['panelGasConsumption'] ?>
</td>
<!-- panelGasPerTon -->
<!-- td:eq(16) -->
<td class="celda_normal panelGasPerTon"
data-id="footer panelGasPerTon">
<?= $summary['panelGasPerTon'] ?>
</td>
<?php
foreach ($wcsSupplierList as $supplier) { ?>
<td class="celda_normal <?= $supplier ?>"
data-id="footer <?= $supplier ?>">
<?= $summary[$supplier] ?>
</td>
<?php } ?>
<!-- edRunningHours -->
<!-- td:eq(24) -->
<td class="celda_normal edRunningHours"
data-id="footer edRunningHours">
<?= $summary['edRunningHours'] ?>
</td>
<!-- edProduction -->
<!-- td:eq(25) -->
<td class="celda_normal edProduction"
data-id="footer edProduction">
<?= $summary['edProduction'] ?>
</td>
<!-- edUsage -->
<!-- td:eq(26) -->
<td class="celda_normal edUsage"
data-id="footer edUsage">
<?= $summary['edUsage'] ?>
</td>
<!-- trpProduction -->
<!-- td:eq(27) -->
<td class="celda_normal trpProduction"
data-id="footer trpProduction">
<?= $summary['trpProduction'] ?>
</td>
<!-- trpProductionPerHour -->
<!-- td:eq(28) -->
<td class="celda_normal trpProductionPerHour"
data-id="footer trpProductionPerHour">
<?= $summary['trpProductionPerHour'] ?>
</td>
<!-- coating -->
<!-- td:eq(29) -->
<td class="celda_normal coating"
data-id="footer coating">
<?= $summary['coating'] ?>
</td>
<?php
foreach ($crsClientList as $client) { ?>
<td class="celda_normal <?= $client ?>"
data-id="footer <?= $client ?>">
<?= $summary[$client] ?>
</td>
<?php } ?>
<!-- waterReceipt -->
<!-- td:eq(35) -->
<td class="celda_normal waterReceipt"
data-id="footer waterReceipt">
<?= $summary['waterReceipt'] ?>
</td>
<!-- waterConsumption -->
<!-- td:eq(36) -->
<td class="celda_normal waterConsumption "
data-id="footer waterConsumption">
<?= $summary['waterConsumption'] ?>
</td>
<!-- ebReading -->
<!-- td:eq(37) -->
<td class="celda_normal ebReading"
data-id="footer ebReading">
<?= $summary['ebReading'] ?>
</td>
<!-- ebReadingPerUnitTon -->
<!-- td:eq(38) -->
<td class="celda_normal ebReadingPerUnitTon"
data-id="footer ebReadingPerUnitTon">
<?= number_format($summary['ebReadingPerUnitTon'] / ($summary['noOfEbReadingDays'] == 0 ? 1 : $summary['noOfEbReadingDays'] ),2) ?>
</td>
<!-- workingPersonEngineers -->
<!-- td:eq(39) -->
<td class="celda_normal workingPersonEngineers"
data-id="footer workingPersonEngineers">
<?= $summary['workingPersonEngineers'] ?>
</td>
<!-- workingPersonSupervisiors -->
<!-- td:eq(40) -->
<td class="celda_normal workingPersonSupervisiors"
data-id="footer workingPersonSupervisiors">
<?= $summary['workingPersonSupervisiors'] ?>
</td>
<!-- workingPersonOperators -->
<!-- td:eq(41) -->
<td class="celda_normal workingPersonOperators"
data-id="footer workingPersonOperators">
<?= $summary['workingPersonOperators'] ?>
</td>
<!-- rollerDrivers -->
<!-- td:eq(42) -->
<td class="celda_normal rollerDrivers"
data-id="footer rollerDrivers">
<?= " " ?>
</td>
<!-- natureOfMaintenance -->
<!-- td:eq(43) -->
<td class="celda_normal">
<?= " " ?>
</td>
<!-- location -->
<!-- td:eq(44) -->
<td class="celda_normal location">
<?= " " ?>
</td>
<!-- description -->
<!-- td:eq(45) -->
<td class="celda_normal description">
<?= " " ?>
</td>
<!-- msSeperation -->
<!-- td:eq(46) -->
<td class="celda_normal msSeperation"
data-id="footer msSeperation">
<?= $summary['msSeperation'] ?>
</td>
<!-- edWaste -->
<!-- td:eq(47) -->
<td class="celda_normal edWaste"
data-id="footer edWaste">
<?= $summary['edWaste'] ?>
</td>
<!-- coolerBags -->
<!-- td:eq(48) -->
<td class="celda_normal coolerBags"
data-id="footer coolerBags">
<?= $summary['coolerBags'] ?>
</td>
<!-- edPlus20Waste -->
<!-- td:eq(49) -->
<td class="celda_normal edPlus20Waste"
data-id="footer edPlus20Waste">
<?= $summary['edPlus20Waste'] ?>
</td>
<!--cycloneWaste -->
<!-- td:eq(50) -->
<td class="celda_normal cycloneWaste"
data-id="footer cycloneWaste">
<?= $summary['cycloneWaste'] ?>
</td>
</tr>
</tfoot>
<?php } ?>
</tbody>
</table>
</div>
</div>
<br>
</div> <!-- End card-body -->
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<div class="row">
<div class="col-2">
</div>
<div class="col">
<!-- right now client is not using this -->
<!-- <a class="dropdown-item" data-toggle="modal" data-target="#bs-example-modal-lg">Navigation</a> -->
<h4 class="mt-3" style="text-align:center">Abstract for the month <?= $month ?></h4>
</div>
<div class="col-2">
<i class="fa fa-download btn-lg mt-2"
style="font-size: x-large; color: #0b7cba"
id="trpAbstractDetailsExport">
</i>
<i class="fas fa-save btn-lg auditor-restricted-btn"
title="Save"
style="font-size: x-large; cursor:pointer; color:rgb(31, 132, 3)"
id="abstractSaveId">
</i>
</div>
<div class="col-1">
</div>
</div>
<div class="table-responsive" align="center">
<table id="abstractTableId" class="fht-table ">
<thead class="celda_encabezado_general" style="padding: 10px ;">
<tr>
<th class="celda_encabezado_general" style="width: 200px;">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" style="width: 200px;">Remarks</th>
</tr>
</thead>
<tbody>
<?php
if (!empty($trpAbstract)) {
// <tfoot
$abstractForCurrentMonth = [
[
'absDate' => $trpAbstract["Incoming Raw Sand Details"]['date'],
'absParticulars' => "Incoming Raw Sand Details",
'absRunningHrs' => "",
'absPerHour' => "",
'absOpeningStock' => (int)$trpAbstract["Incoming Raw Sand Details"]['opening_stock'],
'absReceipt' => $totalWcsReceived,
'absTotal' => (int)$trpAbstract["Incoming Raw Sand Details"]['opening_stock'] + $totalWcsReceived,
'absConsumption' => $summary['edProduction']== 0 ? " " : $summary['edProduction'],
'absClosingStock' => ((int)$trpAbstract["Incoming Raw Sand Details"]['opening_stock'] + $totalWcsReceived) - $summary['edProduction'] == 0 ? " " : ((int)$trpAbstract["Incoming Raw Sand Details"]['opening_stock'] + $totalWcsReceived) - $summary['edProduction'],
'absPhysicalStock' => (int)$trpAbstract["Incoming Raw Sand Details"]['physical_stock']== 0 ? " " : (int)$trpAbstract["Incoming Raw Sand Details"]['physical_stock'],
'absRemarks' => $trpAbstract["Incoming Raw Sand Details"]['remarks'] == 0 ? " " : $trpAbstract["Incoming Raw Sand Details"]['remarks'],
],
[
'absDate' => $trpAbstract["ED Details"]['date'],
'absParticulars' => "ED Details",
'absRunningHrs' => $summary['edRunningHours'] == 0 ? " " : $summary['edRunningHours'],
'absPerHour' => number_format($summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']), 2) == 0 ? " " : number_format($summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']), 2),
'absOpeningStock' => (int)$trpAbstract["ED Details"]['opening_stock'] == 0 ? " " : (int)$trpAbstract["ED Details"]['opening_stock'],
'absReceipt' => $summary['edProduction'] == 0 ? " " : $summary['edProduction'],
'absTotal' => (int)$trpAbstract["ED Details"]['opening_stock'] + $summary['edProduction'] == 0 ? " " : (int)$trpAbstract["ED Details"]['opening_stock'] + $summary['edProduction'],
'absConsumption' => $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250) == 0 ? " " : $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250),
'absClosingStock' => (int)$trpAbstract["ED Details"]['opening_stock'] + $summary['edProduction'] - ($summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250)) == 0 ? " " : (int)$trpAbstract["ED Details"]['opening_stock'] + $summary['edProduction'] - ($summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250)),
'absPhysicalStock' => (int)$trpAbstract["ED Details"]['physical_stock'] == 0 ? " " : (int)$trpAbstract["ED Details"]['physical_stock'],
'absRemarks' => $trpAbstract["ED Details"]['remarks'],
],
[
'absDate' => $trpAbstract["TRP Total Sand"]['date'],
'absParticulars' => "TRP Total Sand",
'absRunningHrs' => $summary['sandFeedingHours'] == 0 ? " " : $summary['sandFeedingHours'],
'absPerHour' => $summary['trpProductionPerHour'] == 0 ? " " : $summary['trpProductionPerHour'],
'absOpeningStock' => (int)$trpAbstract["TRP Total Sand"]['opening_stock'] == 0 ? " " : (int)$trpAbstract["TRP Total Sand"]['opening_stock'],
'absReceipt' => $summary['trpProduction'] == 0 ? " " : $summary['trpProduction'],
'absTotal' => (int)$trpAbstract["TRP Total Sand"]['opening_stock'] + $summary['trpProduction'] == 0 ? " " : (int)$trpAbstract["TRP Total Sand"]['opening_stock'] + $summary['trpProduction'],
'absConsumption' => $totalCrsReceived == 0 ? " " : $totalCrsReceived,
'absClosingStock' => (int)$trpAbstract["TRP Total Sand"]['opening_stock'] + $summary['trpProduction'] - $totalCrsReceived == 0 ? " " : (int)$trpAbstract["TRP Total Sand"]['opening_stock'] + $summary['trpProduction'] - $totalCrsReceived,
'absPhysicalStock' => (int)$trpAbstract["TRP Total Sand"]['physical_stock'] == 0 ? " " : (int)$trpAbstract["TRP Total Sand"]['physical_stock'],
'absRemarks' => $trpAbstract["TRP Total Sand"]['remarks'],
],
[
'absDate' => $trpAbstract["Trp Physical Gas Consumption"]['date'],
'absParticulars' => "Trp Physical Gas Consumption",
'absRunningHrs' => "",
'absPerHour' => number_format(($summary['trpPlusDrierGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2, '.', '') == 0 ? " " : number_format(($summary['trpPlusDrierGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2, '.', ''),
'absOpeningStock' => (int)$trpAbstract["Trp Physical Gas Consumption"]['opening_stock'] == 0 ? " " : (int)$trpAbstract["Trp Physical Gas Consumption"]['opening_stock'],
'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'],
'absTotal' => (int)$trpAbstract["Trp Physical Gas Consumption"]['opening_stock'] + $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : (int)$trpAbstract["Trp Physical Gas Consumption"]['opening_stock'] + $summary['gasReceiptBg'] + $summary['gasReceiptPg'],
'absConsumption' => $summary['physicalGasConsumption'] == 0 ? " " : $summary['physicalGasConsumption'],
'absClosingStock' => (int)$trpAbstract["Trp Physical Gas Consumption"]['opening_stock'] + $summary['gasReceiptBg'] + $summary['gasReceiptPg'] - $summary['physicalGasConsumption'] == 0 ? " " : (int)$trpAbstract["Trp Physical Gas Consumption"]['opening_stock'] + $summary['gasReceiptBg'] + $summary['gasReceiptPg'] - $summary['physicalGasConsumption'],
'absPhysicalStock' => (int)$trpAbstract["Trp Physical Gas Consumption"]['physical_stock'] == 0 ? " " : (int)$trpAbstract["Trp Physical Gas Consumption"]['physical_stock'],
'absRemarks' => $trpAbstract["Trp Physical Gas Consumption"]['remarks'] ,
],
[
'absDate' => $trpAbstract["Trp Panel Gas Consumption"]['date'],
'absParticulars' => "Trp Panel Gas Consumption",
'absRunningHrs' => "",
'absPerHour' => number_format(($summary['panelGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2) == 0 ? " " : number_format(($summary['panelGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2),
'absOpeningStock' => (int)$trpAbstract["Trp Panel Gas Consumption"]['opening_stock'] == 0 ? " " : (int)$trpAbstract["Trp Panel Gas Consumption"]['opening_stock'],
'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'],
'absTotal' => (int)$trpAbstract["Trp Panel Gas Consumption"]['opening_stock'] + $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : (int)$trpAbstract["Trp Panel Gas Consumption"]['opening_stock'] + $summary['gasReceiptBg'] + $summary['gasReceiptPg'],
'absConsumption' => $summary['panelGasConsumption'] == 0 ? " " : $summary['panelGasConsumption'],
'absClosingStock' => (int)$trpAbstract["Trp Panel Gas Consumption"]['opening_stock'] + $summary['gasReceiptBg'] + $summary['gasReceiptPg'] - $summary['panelGasConsumption'] == 0 ? " " : (int)$trpAbstract["Trp Panel Gas Consumption"]['opening_stock'] + $summary['gasReceiptBg'] + $summary['gasReceiptPg'] - $summary['panelGasConsumption'],
'absPhysicalStock' => (int)$trpAbstract["Trp Panel Gas Consumption"]['physical_stock'],
'absRemarks' => $trpAbstract["Trp Panel Gas Consumption"]['remarks'],
],
[
'absDate' => $trpAbstract["Water Consumption"]['date'],
'absParticulars' => "Water Consumption",
'absRunningHrs' => "",
'absPerHour' => "",
'absOpeningStock' => (int)$trpAbstract["Water Consumption"]['opening_stock'] == 0 ? " " : (int)$trpAbstract["Water Consumption"]['opening_stock'],
'absReceipt' => $summary['waterReceipt'] == 0 ? " " : $summary['waterReceipt'],
'absTotal' => (int)$trpAbstract["Water Consumption"]['opening_stock'] + $summary['waterReceipt'] == 0 ? " " : (int)$trpAbstract["Water Consumption"]['opening_stock'] + $summary['waterReceipt'],
'absConsumption' => $summary['waterConsumption'] == 0 ? " " : $summary['waterConsumption'],
'absClosingStock' => (int)$trpAbstract["Water Consumption"]['opening_stock'] + $summary['waterReceipt'] - $summary['waterConsumption'] == 0 ? " " : (int)$trpAbstract["Water Consumption"]['opening_stock'] + $summary['waterReceipt'] - $summary['waterConsumption'],
'absPhysicalStock' => (int)$trpAbstract["Water Consumption"]['physical_stock'] == 0 ? " " : (int)$trpAbstract["Water Consumption"]['physical_stock'],
'absRemarks' => $trpAbstract["Water Consumption"]['remarks'] ,
],
[
'absDate' => $trpAbstract["Power Consumption"]['date'],
'absParticulars' => "Power Consumption",
'absRunningHrs' => $summary['ebReadingPerUnitTon'] / ($summary['noOfEbReadingDays'] == 0 ? 1 : $summary['noOfEbReadingDays'] ) == 0 ? " " : number_format($summary['ebReadingPerUnitTon'] / ($summary['noOfEbReadingDays'] == 0 ? 1 : $summary['noOfEbReadingDays'] ),2),
'absPerHour' => "",
'absOpeningStock' => (int)$trpAbstract["Power Consumption"]['opening_stock'] == 0 ? " " : (int)$trpAbstract["Power Consumption"]['opening_stock'],
'absReceipt' => '',
'absTotal' => '',
'absConsumption' => $summary['ebReading'] == 0 ? " " : $summary['ebReading'],
'absClosingStock' => '',
'absPhysicalStock' => (int)$trpAbstract["Power Consumption"]['physical_stock'] == 0 ? " " : (int)$trpAbstract["Power Consumption"]['physical_stock'],
'absRemarks' => $trpAbstract["Power Consumption"]['remarks'],
]
];
?>
<?php foreach ($abstractForCurrentMonth as $abstract) {
$absDate = DateTime::createFromFormat('M-Y', $month)->format('Y-m');
$absDate = "$absDate-01";
?>
<tr>
<!-- particulars -->
<td class="celda_normal absParticulars"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absParticulars'] ?> </td>
<!-- running hours no need -->
<td class="celda_normal absRunningHrs"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absRunningHrs'] ?></td>
<!-- per hour no need -->
<td class="celda_normal absPerHour"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absPerHour'] ?></td>
<!-- opening stock be -->
<td class="celda_normal absOpeningStock"
oninput="absOpeningStockChange(this)"
contenteditable="true"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absOpeningStock'] ?></td>
<!-- receipt total of all incoming waste core sand-->
<td class="celda_normal absReceipt"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absReceipt'] ?> </td>
<!-- Total fe -->
<td class="celda_normal absTotal"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absTotal'] ?></td>
<!-- consumption fe-->
<td class="celda_normal absConsumption"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absConsumption'] ?></td>
<!-- closing stock fe -->
<td class="celda_normal absClosingStock"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absClosingStock'] ?> </td>
<!-- physical stock be -->
<td class="celda_normal absPhysicalStock"
contenteditable="true"
data-id="<?= $abstract['absParticulars'] ?>"> <?= $abstract['absPhysicalStock'] ?> </td>
<!-- remarks be -->
<td class="celda_normal absRemarks"
contenteditable="true"
data-id="<?= $abstract['absParticulars'] ?>"> <?= $abstract['absRemarks'] ?> </td>
<!-- absDate -->
<td class="absDate" style="display:none"> <?= $absDate; ?> </td>
</tr>
<?php } ?>
<?php } else {
$abstractForCurrentMonth = [
[
'absParticulars' => "Incoming Raw Sand Details",
'absRunningHrs' => "",
'absPerHour' => "",
'absOpeningStock' => '',
'absReceipt' => $totalWcsReceived == 0 ? " " : $totalWcsReceived,
'absTotal' => $totalWcsReceived == 0 ? " " : $totalWcsReceived,
'absConsumption' => $summary['edProduction'] == 0 ? " " : $summary['edProduction'],
'absClosingStock' => ($totalWcsReceived) - $summary['edProduction'] == 0 ? " " : $totalWcsReceived - $summary['edProduction'],
'absPhysicalStock' => '',
'absRemarks' => '',
],
[
'absParticulars' => "ED Details",
'absRunningHrs' => $summary['edRunningHours'] == 0 ? " " : $summary['edRunningHours'],
'absPerHour' => number_format($summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']), 2) == 0 ? " " : number_format($summary['edProduction'] / ($summary['edRunningHours'] == 0 ? 1 : $summary['edRunningHours']), 2),
'absOpeningStock' => '',
'absReceipt' => $summary['edProduction'] == 0 ? " " : $summary['edProduction'],
'absTotal' => $summary['edProduction'] == 0 ? " " : $summary['edProduction'],
'absConsumption' => $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250) == 0 ? " " : $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250),
'absClosingStock' => $summary['edProduction'] - $summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250) == 0 ? " " : $summary['edProduction'] - ($summary['edUsage'] + ($summary['coolerBags'] * 1250) + ($summary['cycloneWaste'] * 1250) + ($summary['edWaste'] * 1250)),
'absPhysicalStock' => '',
'absRemarks' => '',
],
[
'absParticulars' => "TRP Total Sand",
'absRunningHrs' => $summary['sandFeedingHours'] == 0 ? " " : $summary['sandFeedingHours'],
'absPerHour' => $summary['trpProductionPerHour'] == 0 ? " " : $summary['trpProductionPerHour'],
'absOpeningStock' => '',
'absReceipt' => $summary['trpProduction'] == 0 ? " " : $summary['trpProduction'],
'absTotal' => $summary['trpProduction'] == 0 ? " " : $summary['trpProduction'],
'absConsumption' => $totalCrsReceived == 0 ? " " : $totalCrsReceived,
'absClosingStock' => $summary['trpProduction'] - $totalCrsReceived == 0 ? " " : $summary['trpProduction'] - $totalCrsReceived,
'absPhysicalStock' => '',
'absRemarks' => '',
],
[
'absParticulars' => "Trp Physical Gas Consumption",
'absRunningHrs' => "",
'absPerHour' => number_format(($summary['trpPlusDrierGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2, '.', '') == 0 ? " " : number_format(($summary['trpPlusDrierGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2, '.', ''),
'absOpeningStock' => '',
'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'],
'absTotal' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'],
'absConsumption' => $summary['physicalGasConsumption'] == 0 ? " " : $summary['physicalGasConsumption'],
'absClosingStock' => ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['physicalGasConsumption'] == 0 ? " " : ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['physicalGasConsumption'],
'absPhysicalStock' => '',
'absRemarks' => '',
],
[
'absParticulars' => "Trp Panel Gas Consumption",
'absRunningHrs' => "",
'absPerHour' => number_format(($summary['panelGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2) == 0 ? " " : number_format(($summary['panelGasConsumption']) / (($summary['trpProduction'] == 0 ? 1000 : $summary['trpProduction']) / 1000), 2),
'absOpeningStock' => '',
'absReceipt' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'],
'absTotal' => $summary['gasReceiptBg'] + $summary['gasReceiptPg'] == 0 ? " " : $summary['gasReceiptBg'] + $summary['gasReceiptPg'],
'absConsumption' => $summary['panelGasConsumption'] == 0 ? " " : $summary['panelGasConsumption'],
'absClosingStock' => ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['panelGasConsumption'] == 0 ? " " : ($summary['gasReceiptBg'] + $summary['gasReceiptPg']) - $summary['panelGasConsumption'],
'absPhysicalStock' => '',
'absRemarks' => '',
],
[
'absParticulars' => "Water Consumption",
'absRunningHrs' => "",
'absPerHour' => "",
'absOpeningStock' => '',
'absReceipt' => $summary['waterReceipt'] == 0 ? " " : $summary['waterReceipt'],
'absTotal' => $summary['waterReceipt'] == 0 ? " " : $summary['waterReceipt'],
'absConsumption' => $summary['waterReceipt'] - $summary['waterConsumption'] == 0 ? " " : $summary['waterReceipt'] - $summary['waterConsumption'],
'absClosingStock' => '',
'absPhysicalStock' => '',
'absRemarks' => '',
],
[
'absParticulars' => "Power Consumption",
'absRunningHrs' => $summary['ebReadingPerUnitTon'] / ($summary['noOfEbReadingDays'] == 0 ? 1 : $summary['noOfEbReadingDays'] ) == 0 ? " " : number_format($summary['ebReadingPerUnitTon'] / ($summary['noOfEbReadingDays'] == 0 ? 1 : $summary['noOfEbReadingDays'] ) , 2),
'absPerHour' => "",
'absOpeningStock' => '',
'absReceipt' => '',
'absTotal' => '',
'absConsumption' => $summary['ebReading'] == 0 ? " " : $summary['ebReading'],
'absClosingStock' => '',
'absPhysicalStock' => '',
'absRemarks' => '',
],
]
?>
<?php foreach ($abstractForCurrentMonth as $abstract) {
$absDate = DateTime::createFromFormat('M-Y', $month)->format('Y-m');
$absDate = "$absDate-01";
?>
<tr>
<!-- particulars -->
<td class="celda_normal absParticulars"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absParticulars'] ?></td>
<!-- running hours no need -->
<td class="celda_normal absRunningHrs"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absRunningHrs'] ?></td>
<!-- per hour no need -->
<td class="celda_normal absPerHour"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absPerHour'] ?></td>
<!-- opening stock be -->
<td class="celda_normal absOpeningStock"
oninput="absOpeningStockChange(this)"
contenteditable="true"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absOpeningStock'] ?></td>
<!-- receipt total of all incoming waste core sand-->
<td class="celda_normal absReceipt"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absReceipt'] ?> </td>
<!-- Total fe -->
<td class="celda_normal absTotal"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absTotal'] ?></td>
<!-- consumption fe-->
<td class="celda_normal absConsumption"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absConsumption'] ?></td>
<!-- closing stock fe -->
<td class="celda_normal absClosingStock"
data-id="<?= $abstract['absParticulars'] ?>"><?= $abstract['absClosingStock'] ?> </td>
<!-- physical stock be -->
<td class="celda_normal absPhysicalStock"
contenteditable="true"
data-id="<?= $abstract['absParticulars'] ?>"> <?= $abstract['absPhysicalStock'] ?> </td>
<!-- remarks be -->
<td class="celda_normal absRemarks"
contenteditable="true"
data-id="<?= $abstract['absParticulars'] ?>"> <?= $abstract['absRemarks'] ?> </td>
<!-- absDate -->
<td class="absDate" style="display:none"> <?= $absDate; ?> </td>
</tr>
<?php } ?>
<?php }
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div> <!-- End card -->
</div> <!-- End col -->
</div> <!-- End row -->
</div>
</div> <!-- End container-fluid -->
</div>
</div>
<!-- navigation to trp production is in hold -->
<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 select2" 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 = tableToJsonTrp();
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);
window.location.reload();
}
},
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 tableToJsonTrp() {
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: $(this).find(`td[data-id='${dateInYmD} totalHours']`).text().trim(),
coldStart: $(this).find(`td[data-id='${dateInYmD} coldStart']`).text().trim(),
breakdownHours: $(this).find(`td[data-id='${dateInYmD} breakdownHours']`).text().trim(),
burnerFiringHours: $(this).find(`td[data-id='${dateInYmD} burnerFiringHours']`).text().trim(),
sandFeedingHours: $(this).find(`td[data-id='${dateInYmD} sandFeedingHours']`).text().trim(),
gasReceiptBg: $(this).find(`td[data-id='${dateInYmD} gasReceiptBg']`).text().trim(),
gasReceiptPg: $(this).find(`td[data-id='${dateInYmD} gasReceiptPg']`).text().trim(),
physicalGasConsumption: $(this).find(`td[data-id='${dateInYmD} physicalGasConsumption']`).text().trim(),
drierGasConsumption: $(this).find(`td[data-id='${dateInYmD} drierGasConsumption']`).text().trim(),
trpPlusDrierGasConsumption: $(this).find(`td[data-id='${dateInYmD} trpPlusDrierGasConsumption']`).text().trim(),
trpPhysicalGasPerTon: $(this).find(`td[data-id='${dateInYmD} trpPhysicalGasPerTon']`).text().trim(),
panelGasConsumption: $(this).find(`td[data-id='${dateInYmD} panelGasConsumption']`).text().trim(),
panelGasPerTon: $(this).find(`td[data-id='${dateInYmD} panelGasPerTon']`).text().trim(),
edRunningHours: $(this).find(`td[data-id='${dateInYmD} edRunningHours']`).text().trim(),
edProduction: $(this).find(`td[data-id='${dateInYmD} edProduction']`).text().trim(),
edUsage: $(this).find(`td[data-id='${dateInYmD} edUsage']`).text().trim(),
waterConsumption: $(this).find(`td[data-id='${dateInYmD} waterConsumption']`).text().trim(),
trpProduction: $(this).find(`td[data-id='${dateInYmD} trpProduction']`).text().trim(),
trpProductionPerHour: $(this).find(`td[data-id='${dateInYmD} trpProductionPerHour']`).text().trim(),
waterReceipt: $(this).find(`td[data-id='${dateInYmD} waterReceipt']`).text().trim(),
ebReading: $(this).find(`td[data-id='${dateInYmD} ebReading']`).text().trim(),
ebReadingPerUnitTon: $(this).find(`td[data-id='${dateInYmD} ebReadingPerUnitTon']`).text().trim(),
workingPersonEngineers: $(this).find(`td[data-id='${dateInYmD} workingPersonEngineers']`).text().trim(),
workingPersonSupervisiors: $(this).find(`td[data-id='${dateInYmD} workingPersonSupervisiors']`).text().trim(),
workingPersonOperators: $(this).find(`td[data-id='${dateInYmD} workingPersonOperators']`).text().trim(),
rollerDrivers: $(this).find(`td[data-id='${dateInYmD} rollerDrivers']`).text().trim(),
natureOfMaintenance: $(this).find(`td[data-id='${dateInYmD} natureOfMaintenance']`).text().trim(),
location: $(this).find(`td[data-id='${dateInYmD} location']`).text().trim(),
description: $(this).find(`td[data-id='${dateInYmD} description']`).text().trim(),
msSeperation: $(this).find(`td[data-id='${dateInYmD} msSeperation']`).text().trim(),
edWaste: $(this).find(`td[data-id='${dateInYmD} edWaste']`).text().trim(),
coolerBags: $(this).find(`td[data-id='${dateInYmD} coolerBags']`).text().trim(),
edPlus20Waste: $(this).find(`td[data-id='${dateInYmD} edPlus20Waste']`).text().trim(),
cycloneWaste: $(this).find(`td[data-id='${dateInYmD} cycloneWaste']`).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,timeValue="") {
try {
let basicCheck =checkIsNumber(tdElement.innerText.trim());
if(basicCheck == 0 && timeValue == ""){
console.log(tdElement.innerText.trim());
alert("Kindly Enter Numbers only..!!");
return ;
}
let tr = $(tdElement).closest('tr');
let date = tr.find('td:eq(0)').text().trim();
date = `${date.split('-')[2]}-${date.split('-')[1]}-${date.split('-')[0]}`;
let totalHours = validateInput(document.querySelector(`td.totalHours[data-id="${date} totalHours"]`).innerText) ?? 0;
let coldStart = validateInput(document.querySelector(`td.coldStart[data-id="${date} coldStart"]`).innerText) ?? 0;
let breakdownHours = validateInput(document.querySelector(`td.breakdownHours[data-id="${date} breakdownHours"]`).innerText) ?? 0;
let burnerFiringHours = validateInput(document.querySelector(`td.burnerFiringHours[data-id="${date} burnerFiringHours"]`).innerText) ?? 0;
let sandFeedingHours = validateInput(document.querySelector(`td.sandFeedingHours[data-id="${date} sandFeedingHours"]`).innerText) ?? 0;
let gasReceiptBg = validateInput(document.querySelector(`td.gasReceiptBg[data-id="${date} gasReceiptBg"]`).innerText) ?? 0;
let gasReceiptPg = validateInput(document.querySelector(`td.gasReceiptPg[data-id="${date} gasReceiptPg"]`).innerText) ?? 0;
let physicalGasConsumption = validateInput(document.querySelector(`td.physicalGasConsumption[data-id="${date} physicalGasConsumption"]`).innerText) ?? 0;
let drierGasConsumption = validateInput(document.querySelector(`td.drierGasConsumption[data-id="${date} drierGasConsumption"]`).innerText) ?? 0;
let coatingGasConsumption = validateInput(document.querySelector(`td.coatingGasConsumption[data-id="${date} coatingGasConsumption"]`).innerText) ?? 0;
let trpPlusDrierGasConsumption = validateInput(document.querySelector(`td.trpPlusDrierGasConsumption[data-id="${date} trpPlusDrierGasConsumption"]`).innerText) ?? 0;
let trpPhysicalGasPerTon = validateInput(document.querySelector(`td.trpPhysicalGasPerTon[data-id="${date} trpPhysicalGasPerTon"]`).innerText) ?? 0;
let panelGasConsumption = validateInput(document.querySelector(`td.panelGasConsumption[data-id="${date} panelGasConsumption"]`).innerText) ?? 0;
let panelGasPerTon = validateInput(document.querySelector(`td.panelGasPerTon[data-id="${date} panelGasPerTon"]`).innerText) ?? 0;
let edRunningHours = validateInput(document.querySelector(`td.edRunningHours[data-id="${date} edRunningHours"]`).innerText) ?? 0;
let edProduction = validateInput(document.querySelector(`td.edProduction[data-id="${date} edProduction"]`).innerText) ?? 0;
let edUsage = validateInput(document.querySelector(`td.edUsage[data-id="${date} edUsage"]`).innerText) ?? 0;
let trpProduction = validateInput(document.querySelector(`td.trpProduction[data-id="${date} trpProduction"]`).innerText) ?? 0;
let trpProductionPerHour = validateInput(document.querySelector(`td.trpProductionPerHour[data-id="${date} trpProductionPerHour"]`).innerText) ?? 0;
let coating = validateInput(document.querySelector(`td.coating[data-id="${date} coating"]`).innerText) ?? 0;
let ebReading = validateInput(document.querySelector(`td.ebReading[data-id="${date} ebReading"]`).innerText) ?? 0;
let ebReadingPerUnitTon = validateInput(document.querySelector(`td.ebReadingPerUnitTon[data-id="${date} ebReadingPerUnitTon"]`).innerText) ?? 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 ? 0 : parseFloat(trpPlusDrierGasConsumption) / (parseFloat(trpProduction) / 1000);
panelGasPerTon = parseFloat(panelGasConsumption) / (parseFloat(trpProduction) / 1000);
trpProductionPerHour = sandFeedingHours == 0 ? 0 : parseFloat(trpProduction) / parseFloat(sandFeedingHours);
ebReadingPerUnitTon = trpProduction == 0 ? 0 : parseFloat(ebReading) / (parseFloat(trpProduction) / 1000);
// Final updation of value into td
document.querySelector(`td.sandFeedingHours[data-id="${date} sandFeedingHours"]`).innerText = isFinite(sandFeedingHours) ? sandFeedingHours : " ";
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.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) : " ";
// currently onchange total calculation for trp is in hold
// let classArray = Array.from(tdElement.classList);
// let table = document.getElementById('trpProductionStockDetailsTableId');
// let column1 = `${classArray[2]}`;
// let column2 = 'totalHours';
// let column3 = 'burnerFiringHours';
// let column4 = 'sandFeedingHours';
// calculateTotal(table, column1);
// calculateTotal(table, column2);
// calculateTotal(table, column3);
// calculateTotal(table, column4);
// calculateAbstractTotal();
} catch (error) {
console.error("There is an error updating stock ..!!" + error);
}
}
function checkIsNumber(input) {
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
return 0;
}
}
</script>
<script>
$(document).ready(function() {
$('.select2').select2({
placeholder: "Select",
});
$('.timeDropdown').change(function() {
var tr = $(this).closest('tr');
let date = tr.find('td:eq(0)').text().trim();
date = `${date.split('-')[2]}-${date.split('-')[1]}-${date.split('-')[0]}`;
var trpOnTime = tr.find('.trp_on_time').val();
var trpOffTime = tr.find('.trp_off_time').val();
if (trpOnTime != '' && trpOffTime != '') {
if (trpOnTime == trpOffTime) {
document.querySelector(`td.totalHours[data-id="${date} totalHours"]`).innerText = '24.0';
return;
}
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;
document.querySelector(`td.totalHours[data-id="${date} totalHours"]`).innerText = totalHours;
trpStockChange(this,"timeValue");
}
}
);
})
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) {
return 0;
}
return input;
}
</script>
<script>
function absOpeningStockChange(element) {
let row = $(element).closest('tr'); // Get the current row
let openingStockTd = row.find('td.absOpeningStock').text().trim() ?? '';
let receiptTd = row.find('td.absReceipt').text().trim() ?? '';
let consumptionTd = row.find('td.absConsumption').text().trim() ?? '';
// Convert to numbers for calculations
let openingStock = validateInput(openingStockTd) || 0;
let receipt = validateInput(receiptTd) || 0;
let consumption = validateInput(consumptionTd) || 0;
// Calculate values
let totalStock = parseFloat(openingStock) + parseFloat(receipt);
let closingStock = parseFloat(totalStock) - parseFloat(consumption);
// Update the table cells
row.find('td.absTotal').text(parseFloat(totalStock).toFixed(2));
row.find('td.absClosingStock').text(parseFloat(closingStock).toFixed(2));
}
</script>
<script type="text/javascript">
$(document).ready(function() {
$('#abstractSaveId').click(function() {
//table to json function
var updateAbstractDetails = tableToJsonAbstract();
alert('Updation may take a while, And we appreciate your patience..!!');
$('#loader').show();
$.ajax({
data: {
updateAbstractDetails
},
type: "POST",
url: "<?php echo base_url(); ?>updateAbstractDetails",
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 tableToJsonAbstract() {
const table = $("#abstractTableId");
const rows = [];
//this table to json is customized for bagstock not for all
table.find('tbody tr').each(function() {
const rowData = {
particulars: $(this).find(`td.absParticulars`).text().trim(),
opening_stock: $(this).find(`td.absOpeningStock`).text(),
physical_stock: $(this).find(`td.absPhysicalStock`).text(),
remarks: $(this).find(`td.absRemarks`).text(),
date: $(this).find(`td.absDate`).text()
};
rows.push(rowData);
});
return JSON.stringify(rows, null, 2);
}
</script>
<script>
//excel export for trp production sheet
$(document).ready(function() {
function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID);
let cloneTable = table.cloneNode(true); // Clone the table to modify
// Remove hidden rows
$(cloneTable).find('tr').filter(function() {
return $(this).css('display') === 'none';
}).remove();
// Remove hidden columns
$(cloneTable).find('th, td').each(function() {
if ($(this).css('display') === 'none') {
$(this).remove();
}
});
$(cloneTable).find('tbody tr').each(function() {
let firstTd = $(this).find('td').eq(0); // Get the first column (Date)
let openingTimeTd = $(this).find('td').eq(1);
let closingTimeTd = $(this).find('td').eq(2);
let openingTime = $(this).find('td select.trp_on_time').val(); // No space before `.trp_on_time`
let closingTime = $(this).find('td select.trp_off_time').val(); // No space before `.trp_off_time`
// Convert Date Format (Assuming it's in YYYY-MM-DD format)
let originalDate = firstTd.text().trim(); // Get the text value
let parts = originalDate.split('-'); // Split into [YYYY, MM, DD]
if (parts.length === 3) {
let formattedDate = `${parts[2]}-${parts[1]}-${parts[0]}`; // Rearrange to DD-MM-YYYY
firstTd.text(formattedDate); // Update the cell value
}
// Apply left alignment to the date column
firstTd.css("text-align", "left");
openingTimeTd.text(openingTime);
closingTimeTd.text(closingTime);
});
let ws = XLSX.utils.table_to_sheet(cloneTable); // Convert modified table to sheet
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
}
let tableId = 'trpProductionStockDetailsTableId';
document.getElementById('trpProductionDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'Trp Production Details<?= $month ?>.xlsx');
})
})
</script>
<script>
//excel export for trp abstract sheet
$(document).ready(function() {
function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID);
let cloneTable = table.cloneNode(true); // Clone the table to modify
// Remove hidden rows
$(cloneTable).find('tr').filter(function() {
return $(this).css('display') === 'none';
}).remove();
// Remove hidden columns
$(cloneTable).find('th, td').each(function() {
if ($(this).css('display') === 'none') {
$(this).remove();
}
});
let ws = XLSX.utils.table_to_sheet(cloneTable);
// Set column width to 10 for all columns
let colCount = 0;
$(cloneTable).find('tr').each(function() {
let count = $(this).find('th, td').length;
if (count > colCount) colCount = count;
});
let wscols = [];
for (let i = 0; i < colCount; i++) {
wscols.push({ wch: 10 }); // Set width of 10 for all columns
}
ws['!cols'] = wscols;
let wb = XLSX.utils.book_new(); // Create a new workbook
XLSX.utils.book_append_sheet(wb, ws, 'Sheet1'); // Append sheet to workbook
XLSX.writeFile(wb, filename || 'export.xlsx'); // Save the file
}
let tableId = 'abstractTableId';
document.getElementById('trpAbstractDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId, 'Trp Abstract Details<?= $month ?>.xlsx');
})
})
</script>
<script>
$('#month').change(function() {
$('#changeMonthForm').submit();
})
$('#month').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script>
<script>
function toggleDivFullscreen() {
let div = document.getElementById("fullscreenDiv");
let tableResponsive = document.getElementById("table-responsive"); // Select the table container inside div
if (!document.fullscreenElement) {
div.requestFullscreen().then(() => {
div.style.width = "100vw"; // Full viewport width
div.style.height = "100vh"; // Full viewport height
// If .table-responsive exists, set its height to 90vh
if (tableResponsive) {
tableResponsive.style.maxHeight = "90vh";
tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed
}
}).catch(err => console.log("Error enabling fullscreen:", err));
} else {
document.exitFullscreen().then(() => {
div.style.width = "100%";
div.style.height = "auto";
// Reset .table-responsive height when exiting fullscreen
// If .table-responsive exists, set its height to 90vh
if (tableResponsive) {
tableResponsive.style.maxHeight = "450px";
tableResponsive.style.overflowY = "auto"; // Allow scrolling if needed
}
}).catch(err => console.log("Error exiting fullscreen:", err));
}
}
$("#searchInput").on("keyup", function() {
let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search
$(".table-responsive tbody tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
});
});
</script>
<script>
$(document).ready(function() {
$('.select2').select2({
dropdownParent: $('#fullscreenDiv')
});
// Initialize Select2 when the modal is shown inside full screen
$('#filterModalId,').on('shown.bs.modal', function() {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
});
</script>
<script>
//getting modal backdrop inside full screen
$(document).ready(function() {
function moveModalBackdropToFullscreen() {
setTimeout(() => {
$('.modal-backdrop').appendTo('#fullscreenDiv'); // Move backdrop inside fullscreen
}, 10); // Small delay ensures backdrop is created first
}
// Move the modal backdrop when a modal opens
$('#filterModalId').on('show.bs.modal', function() {
moveModalBackdropToFullscreen();
});
// Ensure modals work properly in fullscreen mode
document.addEventListener("fullscreenchange", function() {
setTimeout(() => {
$('.modal-backdrop').remove(); // Remove any existing backdrops
moveModalBackdropToFullscreen();
}, 200);
});
});
</script>
<script>
function customFilterDate() {
let fromDate = $('#fromDateFilter').val(); //01-12-2024
let toDate = $('#toDateFilter').val(); //05-12-2024
$('#trpProductionStockDetailsTableId').find('tbody tr').each(function() {
const rowCells = $(this).find('td');
let tableDate = rowCells.eq(0).text();
let result = checkDateRange(fromDate, toDate, tableDate);
if (result) {
$(this).show();
} else {
$(this).hide();
}
});
$('#filterModalId').modal('hide');
}
function checkDateRange(fromDate, toDate, tableDate) {
// Convert the dates to a comparable format (YYYY-MM-DD)
let from = convertToDate(fromDate);
let to = convertToDate(toDate);
let table = convertToDate(tableDate);
// Return true if the table date is within the range
return table >= from && table <= to;
}
function convertToDate(dateString) {
// Convert from DD-MM-YYYY to YYYY-MM-DD for comparison
let parts = dateString.split('-');
return new Date(parts[2], parts[1] - 1, parts[0]); // Year, Month (0-based), Day
}
</script>
<script>
function showMessage(msg) {
let msgBox = document.getElementById("successMessage");
msgBox.innerText = msg; // Set API message
msgBox.style.display = "block";
// Hide message after 3 seconds
setTimeout(() => {
msgBox.style.display = "none";
}, 5000);
}
</script>
<script>
function calculateTotal(table, column) {
let columnTotal = 0;
let rows = table.querySelectorAll('tbody tr');
console.log(column);
rows.forEach(row => {
let date = row.querySelector('td:first-child').innerText.trim().split('-');
date = date[2] + "-" + date[1] + "-" + date[0]; // Convert to YYYY-MM-DD format
let cell = row.querySelector(`td.${column}[data-id="${date} ${column}"]`);
if (cell) {
let value = parseFloat(cell.innerText.trim()) || 0;
columnTotal += value;
}
});
// Update the total cell in the footer
let footerColumn = table.querySelector(`tfoot tr td.${column}[data-id="footer ${column}"]`);
if (footerColumn) {
footerColumn.innerText = columnTotal == 0 ? " " : columnTotal.toFixed(2); // Set to 2 decimal places
}
let footerTotalHours = validateInput(document.querySelector(`tfoot tr td.totalHours[data-id="footer totalHours"]`).innerText) ?? 0;
let footerColdStart = validateInput(document.querySelector(`tfoot tr td.coldStart[data-id="footer coldStart"]`).innerText) ?? 0;
let footerBreakdownHours = validateInput(document.querySelector(`tfoot tr td.breakdownHours[data-id="footer breakdownHours"]`).innerText) ?? 0;
let footerBurnerFiringHours = validateInput(document.querySelector(`tfoot tr td.burnerFiringHours[data-id="footer burnerFiringHours"]`).innerText) ?? 0;
let footerSandFeedingHours = validateInput(document.querySelector(`tfoot tr td.sandFeedingHours[data-id="footer sandFeedingHours"]`).innerText) ?? 0;
let footerPhysicalGasConsumption = validateInput(document.querySelector(`tfoot tr td.physicalGasConsumption[data-id="footer physicalGasConsumption"]`).innerText) ?? 0;
let footerDrierGasConsumption = validateInput(document.querySelector(`tfoot tr td.drierGasConsumption[data-id="footer drierGasConsumption"]`).innerText) ?? 0;
let footerCoatingGasConsumption = validateInput(document.querySelector(`tfoot tr td.coatingGasConsumption[data-id="footer coatingGasConsumption"]`).innerText) ?? 0;
let footerTrpPlusDrierGasConsumption = validateInput(document.querySelector(`tfoot tr td.trpPlusDrierGasConsumption[data-id="footer trpPlusDrierGasConsumption"]`).innerText) ?? 0;
let footerTrpPhysicalGasPerTon = validateInput(document.querySelector(`tfoot tr td.trpPhysicalGasPerTon[data-id="footer trpPhysicalGasPerTon"]`).innerText) ?? 0;
let footerPanelGasConsumption = validateInput(document.querySelector(`tfoot tr td.panelGasConsumption[data-id="footer panelGasConsumption"]`).innerText) ?? 0;
let footerPanelGasPerTon = validateInput(document.querySelector(`tfoot tr td.panelGasPerTon[data-id="footer panelGasPerTon"]`).innerText) ?? 0;
let footerEdRunningHours = validateInput(document.querySelector(`tfoot tr td.edRunningHours[data-id="footer edRunningHours"]`).innerText) ?? 0;
let footerEdProduction = validateInput(document.querySelector(`tfoot tr td.edProduction[data-id="footer edProduction"]`).innerText) ?? 0;
let footerEdUsage = validateInput(document.querySelector(`tfoot tr td.edUsage[data-id="footer edUsage"]`).innerText) ?? 0;
let footerTrpProduction = validateInput(document.querySelector(`tfoot tr td.trpProduction[data-id="footer trpProduction"]`).innerText) ?? 0;
let footerTrpProductionPerHour = validateInput(document.querySelector(`tfoot tr td.trpProductionPerHour[data-id="footer trpProductionPerHour"]`).innerText) ?? 0;
let footerCoating = validateInput(document.querySelector(`tfoot tr td.coating[data-id="footer coating"]`).innerText) ?? 0;
let footerEbReading = validateInput(document.querySelector(`tfoot tr td.ebReading[data-id="footer ebReading"]`).innerText) ?? 0;
let footerEbReadingPerUnitTon = validateInput(document.querySelector(`tfoot tr td.ebReadingPerUnitTon[data-id="footer ebReadingPerUnitTon"]`).innerText) ?? 0;
let result = calculateSandFeedingHours(footerTotalHours, footerColdStart, footerBreakdownHours, footerBurnerFiringHours);
footerSandFeedingHours = result[0];
footerBurnerFiringHours = result[1];
footerTrpPlusDrierGasConsumption = parseInt(parseFloat(footerPhysicalGasConsumption) - (parseFloat(footerDrierGasConsumption) + parseFloat(footerCoatingGasConsumption)));
footerTrpPhysicalGasPerTon = footerTrpProduction == 0 ? 0 : parseFloat(footerTrpPlusDrierGasConsumption) / (parseFloat(footerTrpProduction) / 1000);
footerPanelGasPerTon = parseFloat(footerPanelGasConsumption) / (parseFloat(footerTrpProduction) / 1000);
footerTrpProductionPerHour = footerSandFeedingHours == 0 ? 0 : parseFloat(footerTrpProduction) / parseFloat(footerSandFeedingHours);
footerEbReadingPerUnitTon = footerTrpProduction == 0 ? 0 : parseFloat(footerEbReading) / (parseFloat(footerTrpProduction) / 1000);
// Final updation of value into td
document.querySelector(`tfoot tr td.sandFeedingHours[data-id="footer sandFeedingHours"]`).innerText = isFinite(footerSandFeedingHours) ? footerSandFeedingHours : " ";
document.querySelector(`tfoot tr td.burnerFiringHours[data-id="footer burnerFiringHours"]`).innerText = isFinite(footerBurnerFiringHours) ? footerBurnerFiringHours : " ";
document.querySelector(`tfoot tr td.trpPlusDrierGasConsumption[data-id="footer trpPlusDrierGasConsumption"]`).innerText = isFinite(footerTrpPlusDrierGasConsumption) ? footerTrpPlusDrierGasConsumption : " ";
document.querySelector(`tfoot tr td.trpPhysicalGasPerTon[data-id="footer trpPhysicalGasPerTon"]`).innerText = isFinite(footerTrpPhysicalGasPerTon) ? (footerTrpPhysicalGasPerTon).toFixed(2) : " ";
document.querySelector(`tfoot tr td.panelGasPerTon[data-id="footer panelGasPerTon"]`).innerText = isFinite(footerPanelGasPerTon) ? (footerPanelGasPerTon).toFixed(2) : " ";
document.querySelector(`tfoot tr td.trpProductionPerHour[data-id="footer trpProductionPerHour"]`).innerText = isFinite(footerTrpProductionPerHour) ? (footerTrpProductionPerHour).toFixed(2) : " ";
document.querySelector(`tfoot tr td.ebReadingPerUnitTon[data-id="footer ebReadingPerUnitTon"]`).innerText = isFinite(footerEbReadingPerUnitTon) ? (footerEbReadingPerUnitTon).toFixed(2) : " ";
}
function calculateAbstractTotal(){
let trpTable = $('#trpProductionStockDetailsTableId');
let absTable = $('#abstractTableId');
let totalWcsReceived = <?= (int)$totalWcsReceived;?>;
let totalCrsReceived = <?= (int)$totalCrsReceived;?>;
let totalSandFeedingHours = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.sandFeedingHours').innerText.trim();
let gasReceiptBg = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.gasReceiptBg').innerText.trim();
let gasReceiptPg = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.gasReceiptPg').innerText.trim();
let physicalGasConsumption = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.physicalGasConsumption').innerText.trim();
let trpPlusDrierGasConsumption = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.trpPlusDrierGasConsumption').innerText.trim();
let trpPhysicalGasPerTon = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.trpPhysicalGasPerTon').innerText.trim();
let panelGasConsumption = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.panelGasConsumption').innerText.trim();
let panelGasPerTon = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.panelGasPerTon').innerText.trim();
let edRunningHours = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.edRunningHours').innerText.trim();
let edProduction = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.edProduction').innerText.trim();
let edUsage = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.edUsage').innerText.trim();
let trpProduction = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.trpProduction').innerText.trim();
let trpProductionPerHour = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.trpProductionPerHour').innerText.trim();
let waterReceipt = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.waterReceipt').innerText.trim();
let waterConsumption = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.waterConsumption').innerText.trim();
let ebReading = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.ebReading').innerText.trim();
let ebReadingPerUnitTon = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.ebReadingPerUnitTon').innerText.trim();
let edWaste = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.edWaste').innerText.trim();
let coolerBags = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.coolerBags').innerText.trim();
let cycloneWaste = document.querySelector('#trpProductionStockDetailsTableId tfoot tr td.cycloneWaste').innerText.trim();
<?php foreach($abstractForCurrentMonth as $index => $abstract){ ?>
// <tfoot
if($abstract['absParticulars'] == 'Incoming Raw Sand Details'){
document.querySelector('#abstractTableId tfoot tr td.absOpeningStock data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absReceipt data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absTotal data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absConsumption data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absClosingStock data-id[<?=$abstract['absParticulars']?>]')
}
if($abstract['absParticulars'] == 'ED Details'){
document.querySelector('#abstractTableId tfoot tr td.absRunningHrs data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absperHour data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absOpeningStock data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absReceipt data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absTotal data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absConsumption data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absClosingStock data-id[<?=$abstract['absParticulars']?>]')
}
if($abstract['absParticulars'] == 'TRP Total Sand'){
document.querySelector('#abstractTableId tfoot tr td.absRunningHrs data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absperHour data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absOpeningStock data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absReceipt data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absTotal data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absConsumption data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absClosingStock data-id[<?=$abstract['absParticulars']?>]')
}
if($abstract['absParticulars'] == 'Trp Physical Gas Consumption'){
document.querySelector('#abstractTableId tfoot tr td.absRunningHrs data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absperHour data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absOpeningStock data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absReceipt data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absTotal data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absConsumption data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absClosingStock data-id[<?=$abstract['absParticulars']?>]')
}
if($abstract['absParticulars'] == 'Trp Panel Gas Consumption'){
document.querySelector('#abstractTableId tfoot tr td.absRunningHrs data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absperHour data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absOpeningStock data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absReceipt data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absTotal data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absConsumption data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absClosingStock data-id[<?=$abstract['absParticulars']?>]')
}
if($abstract['absParticulars'] == 'Water Consumption'){
document.querySelector('#abstractTableId tfoot tr td.absRunningHrs data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absperHour data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absOpeningStock data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absReceipt data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absTotal data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absConsumption data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absClosingStock data-id[<?=$abstract['absParticulars']?>]')
}
if($abstract['absParticulars'] == 'Power Consumption'){
document.querySelector('#abstractTableId tfoot tr td.absRunningHrs data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absperHour data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absOpeningStock data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absReceipt data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absTotal data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absConsumption data-id[<?=$abstract['absParticulars']?>]')
document.querySelector('#abstractTableId tfoot tr td.absClosingStock data-id[<?=$abstract['absParticulars']?>]')
}
<?php }?>
}
</script>