ria/app/Views/trpProductionStockDetails.php
2025-01-08 13:48:11 +05:30

1149 lines
54 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

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

<style type="text/css">
.num {
text-align: right;
}
.fht-table,
.fht-table thead,
.fht-table tfoot,
.fht-table tbody,
.fht-table tr,
.fht-table th,
.fht-table td {
margin: 0;
}
.fht-table td {
text-align: center;
}
.fht-table td:hover {
background-color: #00a65a;
color: #ffffff;
}
.fht-table {
border: 0 none;
height: auto;
width: auto;
border-collapse: collapse;
border-spacing: 0;
/*table-layout: fixed; Algoritmo de distribucion fijo */
white-space: nowrap;
}
.fht-table th,
.fht-table td {
overflow: hidden;
}
.fht-table-wrapper,
.fht-table-wrapper .fht-thead,
.fht-table-wrapper .fht-tfoot,
.fht-table-wrapper .fht-fixed-column .fht-tbody,
.fht-table-wrapper .fht-fixed-body .fht-tbody,
.fht-table-wrapper .fht-tbody {
overflow: hidden;
position: relative;
}
.fht-table-wrapper .fht-fixed-body .fht-tbody,
.fht-table-wrapper .fht-tbody {
overflow: auto;
}
.fht-table-wrapper .fht-table .fht-cell {
overflow: hidden;
height: 1px;
}
.fht-table-wrapper .fht-fixed-column,
.fht-table-wrapper .fht-fixed-body {
top: 0;
left: 0;
position: absolute;
}
.fht-table-wrapper .fht-fixed-column {
z-index: 1;
}
.fht-fixed-body .fht-thead table {
margin-right: 20px;
border: 0 none;
}
/*For Examples*/
.ContenedorTabla {
height: 500px;
margin: 0 auto;
overflow: auto;
width: auto;
position: relative;
}
.header,
.main {
display: inline-block;
height: auto;
width: 100%;
}
.titulosHeader {
border-bottom: 1px solid #e8bb25;
height: auto;
margin-bottom: 10px;
padding-bottom: 8px;
padding-top: 8px;
width: 100%;
}
.celda_encabezado_general {
background-color: #00a65a;
border: 1px solid #ccc;
color: #ffffff;
font-weight: bold;
padding: 6px 10px;;
text-align: center;
}
._Separador {
background-color: #fff;
height: 12px;
border-left: 1px solid #ccc;
border-right: 1px solid #ccc;
width: 7px;
}
._Separador div {
width: 4px;
}
.celda_normal {
/*background-color: #fff;*/
/* <!-- ad9271 into ffffff brown-light to green-light --> */
text-align: center;
border: 1px solid #ccc;
padding: 2px 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;
}
#trpProductionStockDetailsTableId th:nth-child(1),
#trpProductionStockDetailsTableId td:nth-child(1) {
position: sticky;
left: 0;
background-color: #00a65a;
z-index: 2;
border-right: 2px solid #ddd;
color: #ffffff;
}
.modal {
padding-right: 30% ! important;
}
</style>
<?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');
}
?>
<div class="content-page">
<div class="content">
<!-- Start Content-->
<div class="container-fluid">
<!-- start page title -->
<div>
<div class="row">
<div class="col-6">
<div class="page-title-box page-title-box-alt">
<div class="page-title-right">
<ol class="breadcrumb m-0">
<li class="breadcrumb-item"><a href="javascript: void(0);">Stocks</a></li>
<li class="breadcrumb-item active">
<h4 class="page-title">TRP Production Stock Details </h4>
</li>
</ol>
</div>
</div>
</div>
<div class="col-6 text-right">
<!-- Right-aligned buttons or links can be added here -->
</div>
</div>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<form action="<?= base_url('resinStockDetails'); ?>" method="post">
<div class="row">
<div class="col-3">
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1">
</div>
<div class="form-group col-md-2">
<button type="submit" class="btn btn-success"> Change Month </button>
</div>
<div class="col-md-1"></div>
<div class="col-6">
<div class="dropdown float-right">
<a href="#" class="dropdown-toggle arrow-none" data-toggle="dropdown"
aria-expanded="false">
<i class="mdi mdi-dots-vertical m-0 text-muted h3"></i>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" data-toggle="modal" data-target="#bs-example-modal-lg">Navigation</a>
<a class="dropdown-item" href="#">Export</a>
</div>
</div>
</div>
</div>
</form>
<div class="table-responsive">
<table id="trpProductionStockDetailsTableId" class="fht-table table-striped">
<thead class="celda_encabezado_general" style="padding: 10px;">
<tr>
<!-- th:eq(0) -->
<th class="celda_encabezado_general" rowspan="2">Date </th>
<!-- th:eq(1) -->
<th class="celda_encabezado_general" rowspan="2">Opening Time </th>
<!-- th:eq(2) -->
<th class="celda_encabezado_general" rowspan="2">Closing Time </th>
<!-- th:eq(3) -->
<th class="celda_encabezado_general" rowspan="2">Total Hours </th>
<!-- th:eq(4) -->
<th class="celda_encabezado_general" rowspan="2">Cold Start </th>
<!-- th:eq(5) -->
<th class="celda_encabezado_general" rowspan="2">Break Down Hours </th>
<!-- th:eq(6) -->
<th class="celda_encabezado_general" rowspan="2">Burner Firing Hours </th>
<!-- th:eq(7) -->
<th class="celda_encabezado_general" rowspan="2">Sand Feeding Hours </th>
<!-- th:eq(8) -->
<th class="celda_encabezado_general" colspan="2">Gas Receipt </th>
<!-- th:eq(9) -->
<th class="celda_encabezado_general" rowspan="2">Physical Gas Consumption </th>
<!-- th:eq(10) -->
<th class="celda_encabezado_general" rowspan="2">Drier Gas Consumption </th>
<!-- th:eq(11) -->
<th class="celda_encabezado_general" rowspan="2">Coating Gas Consumption </th>
<!-- th:eq(12) -->
<th class="celda_encabezado_general" rowspan="2">TRP plus Drier Gas Consumption </th>
<!-- th:eq(13) -->
<th class="celda_encabezado_general" rowspan="2">TRP Physical Gas Per Ton </th>
<!-- th:eq(14) -->
<th class="celda_encabezado_general" rowspan="2">Panel Gas Consumption </th>
<!-- th:eq(15) -->
<th class="celda_encabezado_general" rowspan="2">Panel Gas Per Ton </th>
<!-- th:eq(16) -->
<th class="celda_encabezado_general" colspan="7">Incoming Sand/ Lump details </th>
<!-- th:eq(17) -->
<th class="celda_encabezado_general" colspan="3">ED details </th>
<!-- th:eq(18) -->
<th class="celda_encabezado_general" colspan="2">TRP Sand </th>
<!-- th:eq(19) -->
<th class="celda_encabezado_general" colspan="6">Usage </th>
<!-- th:eq(20) -->
<th class="celda_encabezado_general" colspan="2">Water </th>
<!-- th:eq(21) -->
<th class="celda_encabezado_general" rowspan="2">EB Reading </th>
<!-- th:eq(22) -->
<th class="celda_encabezado_general" rowspan="2">EB Unit Per Ton </th>
<!-- th:eq(23) -->
<th class="celda_encabezado_general" colspan="4">Working Persons </th>
<!-- th:eq(24) -->
<th class="celda_encabezado_general" colspan="2"> Maintanence Details </th>
<!-- th:eq(25) -->
<th class="celda_encabezado_general" rowspan="2">Description </th>
<!-- th:eq(26) -->
<th class="celda_encabezado_general" rowspan="2">MS Seperation </th>
<!-- th:eq(27) -->
<th class="celda_encabezado_general" rowspan="2">ED Waste </th>
<!-- th:eq(28) -->
<th class="celda_encabezado_general" rowspan="2">Cooler Bags </th>
<!-- th:eq(29) -->
<th class="celda_encabezado_general" rowspan="2">ED +20 Waste </th>
<!-- th:eq(30) -->
<th class="celda_encabezado_general" rowspan="2">Cyclone Waste </th>
<!-- th:eq(31) -->
</tr>
<tr>
<!-- th:eq(0) -->
<th class="celda_encabezado_general" >BG</th>
<!-- th:eq(1) -->
<th class="celda_encabezado_general" >PG </th>
<!-- th:eq(2) -->
<th class="celda_encabezado_general" >AL(S) </th>
<!-- th:eq(3) -->
<th class="celda_encabezado_general" >AL(E) </th>
<!-- th:eq(4) -->
<th class="celda_encabezado_general" >ME </th>
<!-- th:eq(6) -->
<th class="celda_encabezado_general" >SI </th>
<!-- th:eq(7) -->
<th class="celda_encabezado_general" >caparo </th>
<!-- th:eq(8) -->
<th class="celda_encabezado_general" >Nemak </th>
<!-- th:eq(9) -->
<th class="celda_encabezado_general" >DR</th>
<!-- th:eq(10) -->
<th class="celda_encabezado_general" >Running Hours </th>
<!-- th:eq(11) -->
<th class="celda_encabezado_general" >Production </th>
<!-- th:eq(12) -->
<th class="celda_encabezado_general" >Usage </th>
<!-- th:eq(13) -->
<th class="celda_encabezado_general" >Production </th>
<!-- th:eq(14) -->
<th class="celda_encabezado_general" >Production Per Hour </th>
<!-- th:eq(15) -->
<th class="celda_encabezado_general" >Coating </th>
<!-- th:eq(16) -->
<th class="celda_encabezado_general" >Hindhuja </th>
<!-- th:eq(17) -->
<th class="celda_encabezado_general" >Nemak</th>
<!-- th:eq(18) -->
<th class="celda_encabezado_general" >ME </th>
<!-- th:eq(19) -->
<th class="celda_encabezado_general" >BI </th>
<!-- th:eq(20) -->
<th class="celda_encabezado_general" >Karmen </th>
<!-- th:eq(21) -->
<th class="celda_encabezado_general" >Receipt </th>
<!-- th:eq(22) -->
<th class="celda_encabezado_general" >Consumption </th>
<!-- th:eq(23) -->
<th class="celda_encabezado_general" >Engineers </th>
<!-- th:eq(24) -->
<th class="celda_encabezado_general" >Supervisors</th>
<!-- th:eq(25) -->
<th class="celda_encabezado_general" >Operators </th>
<!-- th:eq(26) -->
<th class="celda_encabezado_general" >Roller Drivers </th>
<!-- th:eq(27) -->
<th class="celda_encabezado_general" >Nature Of Maintenance </th>
<!-- th:eq(28) -->
<th class="celda_encabezado_general" >Location </th>
</tr>
</thead>
<tbody style="background-color: #fff;" >
<?php if(!empty($trpProductionStockDetails))
{ ?>
<!-- this else condition work if groupedBagStockDetails is empty and creating new records
with initial values 0 for entire month -->
<?php } else { ?>
<?php foreach($datesInMonth as $datesInMonthIndex => $dateInMonth)
{
?>
<tr id="<?= $dateInMonth ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat= DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) { echo 'style="background: #cef0ad;"';}
?>
>
<!-- date -->
<!-- td:eq(0) -->
<td class="celda_normal trpProductionStock date"
data-id="<?= $dateInMonth ?> date">
<?= $dateInMonthDmYFormat ?>
</td>
<!-- openingTime -->
<!-- td:eq(1) -->
<td class="celda_normal trpProductionStock openingTime"
data-id="<?= $dateInMonth ?> openingTime"
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- closingTime -->
<!-- td:eq(2) -->
<td class="celda_normal trpProductionStock closingTime"
data-id="<?= $dateInMonth ?> closingTime"
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- totalHours -->
<!-- td:eq(3) -->
<td class="celda_normal trpProductionStock totalHours"
data-id="<?= $dateInMonth ?> totalHours">
0
</td>
<!-- coldStart -->
<!-- td:eq(4) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- breakdownHours -->
<!-- td:eq(5) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- burnerFiringHours -->
<!-- td:eq(6) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- sandFeedingHours -->
<!-- td:eq(7) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- gasReceiptBg -->
<!-- td:eq(8) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- gasReceiptPg -->
<!-- td:eq(9) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- physicalGasConsumption -->
<!-- td:eq(10) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- drierGasConsumption -->
<!-- td:eq(11) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- coatingGasConsumption -->
<!-- td:eq(12) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- trpPlusDrierGasConsumption -->
<!-- td:eq(13) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- trpPhysicalGasPerTon -->
<!-- td:eq(14) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- panelGasConsumption -->
<!-- td:eq(15) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- panelGasPerTon -->
<!-- td:eq(16) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- AL(S) -->
<!-- td:eq(17) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- AL(E) -->
<!-- td:eq(18) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- ME -->
<!-- td:eq(19) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- SI -->
<!-- td:eq(20) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- Caparo -->
<!-- td:eq(21) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- Nemak -->
<!-- td:eq(22) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- DR -->
<!-- td:eq(23) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- edRunningHours -->
<!-- td:eq(24) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- edProduction -->
<!-- td:eq(25) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- edUsage -->
<!-- td:eq(26) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- trpProduction -->
<!-- td:eq(27) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- trpProductionPerHour -->
<!-- td:eq(28) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- coating -->
<!-- td:eq(29) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- Hindhuja -->
<!-- td:eq(30) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- Nemak -->
<!-- td:eq(31) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- ME -->
<!-- td:eq(32) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- BI -->
<!-- td:eq(33) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- Karmen -->
<!-- td:eq(34) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- waterReceipt -->
<!-- td:eq(35) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- waterConsumption -->
<!-- td:eq(36) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- ebReading -->
<!-- td:eq(37) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- ebReadingPerUnitTon -->
<!-- td:eq(38) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- workingPersonEngineers -->
<!-- td:eq(39) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- workingPersonSupervisiors -->
<!-- td:eq(40) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- workingPersonOperators -->
<!-- td:eq(41) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- rollerDrivers -->
<!-- td:eq(42) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- natureOfMaintenance -->
<!-- td:eq(43) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- location -->
<!-- td:eq(44) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- description -->
<!-- td:eq(45) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- msSeperation -->
<!-- td:eq(46) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- edWaste -->
<!-- td:eq(47) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- coolerBags -->
<!-- td:eq(48) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!-- edPlus20Waste -->
<!-- td:eq(49) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
<!--cycloneWaste -->
<!-- td:eq(50) -->
<td class="celda_normal trpProductionStock"
data-id=""
contenteditable="true">
0
</td>
</tr>
<?php }?>
<?php }?>
</tbody>
</table>
</div>
<div class="row">
<div class="col-md-12 text-right">
<input type="button" class="btn btn-success" id="saveId" value="save">
</div>
</div>
</div>
</div> <!-- End card-body -->
</div> <!-- End card -->
</div> <!-- End col -->
</div> <!-- End row -->
</div>
</div> <!-- End container-fluid -->
</div>
</div>
<div >
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md" >
<div class="modal-content" >
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Navigation Options</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- Date Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="dateDropdown">Select Date</label>
<select id="dateDropdown" class="form-control">
<?php foreach($datesInMonth as $selectDate): ?>
<?php $selectDate=DateTime::createFromFormat('Y-m-d', $selectDate)->format('d-m-Y'); ?>
<option value="<?=$selectDate?>"><?=$selectDate?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<button class="btn btn-primary float-right" onclick="navigateToResin()">Navigate</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<script>
function navigateToResin() {
$('.close').click();
const resinDropdown = document.getElementById('resinDropdown');
const dateDropdown = document.getElementById('dateDropdown');
const selectedResin = resinDropdown.value;
const selectedDate = dateDropdown.value;
const table = document.getElementById('trpProductionStockDetailsTableId');
const headerCells = table.querySelectorAll('thead tr:nth-child(1) th');
const rows = table.querySelectorAll('tbody tr');
let targetColumnIndex = -1;
headerCells.forEach((header, index) => {
if ((header.innerText.trim()) === selectedResin.trim()) {
targetColumnIndex = index;
return;
}
});
if (targetColumnIndex === -1) {
console.log("Resin column not found.");
return;
}
let targetRow = null;
rows.forEach(row => {
const dateCell = row.querySelector('td:first-child');
if (dateCell && dateCell.textContent.trim() === selectedDate) {
targetRow = row;
}
});
if (!targetRow) {
console.log("Date row not found.");
return;
}
console.log(targetColumnIndex);
console.log(targetRow);
targetColumnIndex = targetColumnIndex * 7;
targetRow.cells[targetColumnIndex].scrollIntoView({
behavior: 'smooth',
inline: 'center',
block: 'center'
});
const highlightDuration = 10000;
for (let i = targetColumnIndex-4 ; i <= targetColumnIndex ; i++) {
const cell = targetRow.cells[i];
if (cell) {
cell.style.transition = "background-color 0.5s";
cell.style.backgroundColor = "#df9675";
setTimeout(() => {
cell.style.backgroundColor = "";
}, highlightDuration);
}
}
}
</script>
<script type="text/javascript">
$(document).ready(function () {
$('#saveId').click(function () {
//table to json function
var updateResinStockDetails = tableToJson();
alert('Updation may take a while, And we appreciate your patience..!!');
$('#loader').show();
$.ajax({
data: {
updateResinStockDetails
},
type: "POST",
url: "<?php echo base_url() ?>updateResinStockDetails",
success: function (data) {
if (data) {
$('#loader').hide();
console.log(data);
alert(data);
}
},
error: function(xhr, status, error) {
alert("An error occurred while processing the request. Please try again.");
console.error("Error Code:", xhr.status);
console.error("Error Message:", error);
console.error("Response Text:", xhr.responseText);
},
complete: function() {
$('#loader').hide();
}
});
});
});
</script>
<script>
function tableToJson() {
const table = $('#trpProductionStockDetailsTableId');
const rows = [];
//this table to json is customized for bagstock not for all
table.find('tbody tr').each(function() {
const rowCells = $(this).find('td');
const date = rowCells.eq(0).text().trim();
/** we get eight entries against a material so we loop from 1 to 7 and so on
in a single row **/
for (let i = 1; i < rowCells.length; i += 7) {
const rowData = {
date: rowCells.eq(i).text().trim(),
materialCode: rowCells.eq(i+1).text().trim(),
customer: rowCells.eq(i+2).text().trim(),
opening: rowCells.eq(i+3).text().trim(),
receipt: rowCells.eq(i+4).text().trim(),
used: rowCells.eq(i+5).text().trim(),
balanceStock: rowCells.eq(i + 6).text().trim()
};
rows.push(rowData);
}
});
return JSON.stringify(rows, null, 2);
}
</script>
<script>
function trpStockChange(tdElement) {
try{
let tr = $(tdElement).closest('tr');
let openingTime = tr.find('td:eq(1)').text().trim();
let closingTime = tr.find('td:eq(2)').text().trim();
let totalHours = tr.find('td:eq(3)').text().trim();
let coldStart = tr.find('td:eq(4)').text().trim();
let breakdownHours = tr.find('td:eq(5)').text().trim();
let burnerFiringHours = tr.find('td:eq(6)').text().trim();
let sandFeedingHours = tr.find('td:eq(7)').text().trim();
let gasReceiptBg = tr.find('td:eq(8)').text().trim();
let gasReceiptPg = tr.find('td:eq(9)').text().trim();
let physicalGasConsumption = tr.find('td:eq(10)').text().trim();
let drierGasConsumption =tr.find('td:eq(11)').text().trim();
let coatingGasConsumption =tr.find('td:eq(12)').text().trim();
let trpPlusDrierGasConsumption = tr.find('td:eq(13)').text().trim();
let trpPhysicalGasPerTon = tr.find('td:eq(14)').text().trim();
let panelGasConsumption = tr.find('td:eq(15)').text().trim();
let panelGasPerTon =tr.find('td:eq(16)').text().trim();
let als = tr.find('td:eq(17)').text().trim();
let ale = tr.find('td:eq(18)').text().trim();
let me = tr.find('td:eq(19)').text().trim();
let si = tr.find('td:eq(20)').text().trim();
let caparo = tr.find('td:eq(21)').text().trim();
let nemak = tr.find('td:eq(22)').text().trim();
let dr = tr.find('td:eq(23)').text().trim();
let edRunningHours = tr.find('td:eq(24)').text().trim();
tr.find('td:eq(25)').text().trim();
tr.find('td:eq(26)').text().trim();
tr.find('td:eq(27)').text().trim();
tr.find('td:eq(28)').text().trim();
tr.find('td:eq(29)').text().trim();
tr.find('td:eq(30)').text().trim();
tr.find('td:eq(31)').text().trim();
tr.find('td:eq(32)').text().trim();
tr.find('td:eq(33)').text().trim();
tr.find('td:eq(34)').text().trim();
tr.find('td:eq(35)').text().trim();
tr.find('td:eq(36)').text().trim();
tr.find('td:eq(37)').text().trim();
tr.find('td:eq(38)').text().trim();
tr.find('td:eq(39)').text().trim();
tr.find('td:eq(40)').text().trim();
tr.find('td:eq(41)').text().trim();
tr.find('td:eq(42)').text().trim();
tr.find('td:eq(43)').text().trim();
tr.find('td:eq(44)').text().trim();
tr.find('td:eq(45)').text().trim();
tr.find('td:eq(46)').text().trim();
tr.find('td:eq(47)').text().trim();
tr.find('td:eq(48)').text().trim();
tr.find('td:eq(49)').text().trim();
tr.find('td:eq(50)').text().trim();
console.log(panelGasConsumption);
} catch(error){
console.error("There is an error updating stock ..!!" + error);
}
}
</script>