stock module latest today vadivel J 08-1-2025

This commit is contained in:
vadivelJ96 2025-01-08 13:48:11 +05:30
parent 9ec31b265b
commit 92bb35b995
3 changed files with 336 additions and 394 deletions

View File

@ -1321,9 +1321,9 @@ class StockController extends BaseController
$data['month'] = $formattedDate;
return $this->response->setJSON($data);
// return $this->response->setJSON($data);
// return $this->loadViews("trpProductionStockDetails", $this->global, $data, NULL);
return $this->loadViews("trpProductionStockDetails", $this->global, $data, NULL);
@ -1335,7 +1335,7 @@ class StockController extends BaseController
$updateTrpProductionDetails = json_decode($postData['updateTrpProductionDetails'], true);
$updateProduction = [];
$updateProduction = [];
$updateMaintanence = [];
$updateWaste = [];

View File

@ -119,13 +119,9 @@ class TrpProductionModel extends Model
tsu.total_kgs as coating,
invItems.item_date_added,
invItems.client_name,
invItems.TotalRsQuantity,
tigrd.SupplierName,
tigrd.TotalQuantityAsPerInvoice,
tigrd.CreatedDate
tigrd.TotalQuantityAsPerInvoice
FROM

View File

@ -156,8 +156,8 @@
height: 20px;
}
#resinStockDetailsTableId th:nth-child(1),
#resinStockDetailsTableId td:nth-child(1) {
#trpProductionStockDetailsTableId th:nth-child(1),
#trpProductionStockDetailsTableId td:nth-child(1) {
position: sticky;
left: 0;
background-color: #00a65a;
@ -260,7 +260,7 @@
<div class="table-responsive">
<table id="resinStockDetailsTableId" class="fht-table table-striped">
<table id="trpProductionStockDetailsTableId" class="fht-table table-striped">
<thead class="celda_encabezado_general" style="padding: 10px;">
@ -421,214 +421,217 @@
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 receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
54465656
<td class="celda_normal trpProductionStock date"
data-id="<?= $dateInMonth ?> date">
<?= $dateInMonthDmYFormat ?>
</td>
<!-- openingTime -->
<!-- td:eq(1) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
<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 receiptStock"
data-id=""
oninput="receiptStockChange(this)"
<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 receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
<td class="celda_normal trpProductionStock totalHours"
data-id="<?= $dateInMonth ?> totalHours">
0
</td>
<!-- coldStart -->
<!-- td:eq(4) -->
<td class="celda_normal receiptStock"
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- breakdownHours -->
<!-- td:eq(5) -->
<td class="celda_normal receiptStock"
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- burnerFiringHours -->
<!-- td:eq(6) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- sandFeedingHours -->
<!-- td:eq(7) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- workingPersonEngineers -->
<!-- td:eq(8) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- workingPersonSupervisiors -->
<!-- td:eq(9) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- workingPersonOperators -->
<!-- td:eq(10) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- rollerDrivers -->
<!-- td:eq(11) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- natureOfMaintenance -->
<!-- td:eq(12) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- location -->
<!-- td:eq(13) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- description -->
<!-- td:eq(14) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- gasReceiptBg -->
<!-- td:eq(15) -->
<td class="celda_normal receiptStock"
<!-- td:eq(8) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
</td>
<!-- gasReceiptPg -->
<!-- td:eq(16) -->
<td class="celda_normal receiptStock"
<!-- 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="receiptStockChange(this)"
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- physicalGasConsumption -->
<!-- td:eq(17) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
<!-- 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(18) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
<!-- td:eq(13) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- trpPhysicalGasPerTon -->
<!-- td:eq(19) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
<!-- td:eq(14) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- panelGasConsumption -->
<!-- td:eq(20) -->
<td class="celda_normal receiptStock"
<!-- td:eq(15) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- panelGasPerTon -->
<!-- td:eq(21) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
<!-- 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(22) -->
<td class="celda_normal receiptStock"
<!-- td:eq(24) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
@ -636,249 +639,216 @@
<!-- edProduction -->
<!-- td:eq(23) -->
<td class="celda_normal receiptStock"
<!-- td:eq(25) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!--edUsage -->
<!-- td:eq(24) -->
<td class="celda_normal receiptStock"
<!-- edUsage -->
<!-- td:eq(26) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- trpProduction -->
<!-- td:eq(25) -->
<td class="celda_normal receiptStock"
<!-- td:eq(27) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
oninput="trpStockChange(this)"
contenteditable="true">
0
</td>
<!-- trpProductionPerHour -->
<!-- td:eq(26) -->
<td class="celda_normal receiptStock"
<!-- 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=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- waterReceipt -->
<!-- td:eq(27) -->
<td class="celda_normal receiptStock"
<!-- td:eq(35) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- waterConsumption -->
<!-- td:eq(28) -->
<td class="celda_normal receiptStock"
<!-- td:eq(36) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- ebReading -->
<!-- td:eq(29) -->
<td class="celda_normal receiptStock"
<!-- td:eq(37) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- ebReadingPerUnitTon -->
<!-- td:eq(30) -->
<td class="celda_normal receiptStock"
<!-- td:eq(38) -->
<td class="celda_normal trpProductionStock"
data-id="">
0
</td>
<!-- workingPersonEngineers -->
<!-- td:eq(39) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- msSeperation -->
<!-- td:eq(31) -->
<td class="celda_normal receiptStock"
<!-- 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=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- edWaste -->
<!-- td:eq(32) -->
<td class="celda_normal receiptStock"
<!-- td:eq(47) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- coolerBags -->
<!-- td:eq(33) -->
<td class="celda_normal receiptStock"
<!-- td:eq(48) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- edPlus20Waste -->
<!-- td:eq(34) -->
<td class="celda_normal receiptStock"
<!-- td:eq(49) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!--cycloneWaste -->
<!-- td:eq(35) -->
<td class="celda_normal receiptStock"
<!-- td:eq(50) -->
<td class="celda_normal trpProductionStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- coatingGasConsumption -->
<!-- td:eq(36) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- drierGasConsumption -->
<!-- td:eq(37) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- coating -->
<!-- td:eq(38) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- TotalQuantityAsPerInvoice -->
<!-- td:eq(39) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- TotalRsQuantity -->
<!-- td:eq(40) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- td:eq(41) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- td:eq(42) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- td:eq(43) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- td:eq(44) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- td:eq(45) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- td:eq(46) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- td:eq(47) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- td:eq(48) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- td:eq(49) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
<!-- td:eq(50) -->
<td class="celda_normal receiptStock"
data-id=""
oninput="receiptStockChange(this)"
contenteditable="true">
0
</td>
</tr>
<?php }?>
<?php }?>
@ -947,7 +917,7 @@
const selectedResin = resinDropdown.value;
const selectedDate = dateDropdown.value;
const table = document.getElementById('resinStockDetailsTableId');
const table = document.getElementById('trpProductionStockDetailsTableId');
const headerCells = table.querySelectorAll('thead tr:nth-child(1) th');
const rows = table.querySelectorAll('tbody tr');
@ -1063,7 +1033,7 @@
<script>
function tableToJson() {
const table = $('#resinStockDetailsTableId');
const table = $('#trpProductionStockDetailsTableId');
const rows = [];
//this table to json is customized for bagstock not for all
@ -1098,38 +1068,70 @@
<script>
function openingStockChange(tdElement) {
try{
let dataId = tdElement.getAttribute('data-id');
let [date,materialCode] = tdElement.getAttribute('data-id').split(' ');
let openingStock = tdElement.innerText;
let usedStock = document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText;
let receiptStock = document.querySelector(`td.receiptStock[data-id="${dataId}"]`).innerText;
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
updateStockValue( date,materialCode,currentBalanceStock )
} catch(error){
console.error("There is an error updating stock ..!!" + error);
}
}
function receiptStockChange(tdElement) {
function trpStockChange(tdElement) {
try{
let dataId = tdElement.getAttribute('data-id');
let [date,materialCode] = tdElement.getAttribute('data-id').split(' ');
let openingStock = document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText;
let receiptStock = tdElement.innerText;
let usedStock = document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText;
let currentBalanceStock = (Number(openingStock) + Number(receiptStock)) - Number(usedStock);
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
updateStockValue( date,materialCode,currentBalanceStock )
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){
@ -1140,63 +1142,7 @@
}
function usedStockChange(tdElement) {
try {
let dataId = tdElement.getAttribute('data-id');
let [date,materialCode] = tdElement.getAttribute('data-id').split(' ');
let openingStock = document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText;
let receiptStock = document.querySelector(`td.receiptStock[data-id="${dataId}"]`).innerText;
let usedStock = tdElement.innerText;
let currentBalanceStock = ( Number(openingStock) + Number(receiptStock) ) - Number(usedStock);
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
updateStockValue( date,materialCode,currentBalanceStock )
} catch (error) {
console.error("There is an error updating stock ..!!" + error);
}
}
</script>
<script>
function updateStockValue( date, materialCode, currentBalanceStock ){
const table = $('#resinStockDetailsTableId');
const rows = [];
table.find('tbody tr').each(function() {
const rowCells = $(this).find('td');
const otherDate = rowCells.eq(1).text().trim();
if( new Date(otherDate) > new Date(date) ){ //other records present after it
/**this data-id ,openingStock ,used stock , current Balance Stock
is for changing subsequent dates not the earlier one **/
let dataId = `${otherDate} ${materialCode}`;
document.querySelector(`td.openingStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
let usedStock = document.querySelector(`td.usedStock[data-id="${dataId}"]`).innerText;
let receiptStock = document.querySelector(`td.receiptStock[data-id="${dataId}"]`).innerText;
currentBalanceStock = (Number(currentBalanceStock) + Number(receiptStock)) - Number(usedStock);
document.querySelector(`td.balanceStock[data-id="${dataId}"]`).innerText=currentBalanceStock;
}
})
}
</script>