stock module latest today vadivel J 10-1-2025
This commit is contained in:
parent
6f6a12d301
commit
fa4cda1196
1031
api_test.http
1031
api_test.http
File diff suppressed because it is too large
Load Diff
@ -1294,10 +1294,12 @@ class StockController extends BaseController
|
||||
|
||||
$month = $formattedDate;
|
||||
} else {
|
||||
$month = new DateTime('2024-11-01');
|
||||
$month = $month->format('Y-m');
|
||||
|
||||
// $month = new DateTime('2024-10-01');
|
||||
// $month = $month->format('Y-m');
|
||||
|
||||
// $month = date('Y-m');
|
||||
$month = date('Y-m');
|
||||
|
||||
}
|
||||
|
||||
$data = [];
|
||||
@ -1309,13 +1311,25 @@ class StockController extends BaseController
|
||||
$startDate = "$month-01";
|
||||
$endDate = date("Y-m-t", strtotime($startDate));
|
||||
|
||||
$trpProductionMaintenanceData = $this->TrpProductionMaintenance_model
|
||||
->where('date >=', $startDate)
|
||||
->where('date <=', $endDate)
|
||||
->find();
|
||||
|
||||
if(empty($trpProductionMaintenanceData)){
|
||||
|
||||
$inserts = [];
|
||||
|
||||
$inserts = $this->generateDummyData($startDate, $endDate);
|
||||
|
||||
$data['trpProductionMaintenanceData'] = $this->updateTrpProductionDetails($inserts);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$data['trpProductionDetails'] = $this->TrpProduction_model->trpProductionDetails($startDate,$endDate);
|
||||
|
||||
if(!empty($data['trpProductionDetails'])){
|
||||
// $data['trpProductionDetails'] = $this->supplierArrangement($data['trpProductionDetails']);
|
||||
}
|
||||
|
||||
// dd($data['trpProductionDetails']);
|
||||
|
||||
@ -1328,68 +1342,33 @@ class StockController extends BaseController
|
||||
|
||||
$data['month'] = $formattedDate;
|
||||
|
||||
return $this->response->setJSON($data);
|
||||
|
||||
// return $this->loadViews("trpProductionStockDetails", $this->global, $data, NULL);
|
||||
return $this->loadViews("trpProductionStockDetails", $this->global, $data, NULL);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function supplierArrangement($dataArray)
|
||||
{
|
||||
|
||||
foreach ($dataArray as $key => $data) {
|
||||
|
||||
|
||||
|
||||
$reclamationSuppliers = explode(',', $data['reclamationSuppliers']);
|
||||
$TotalRsQuantities = explode(',', $data['TotalRsQuantities']);
|
||||
|
||||
$wasteCoreSuppliers = explode(',', $data['wasteCoreSuppliers']);
|
||||
$TotalQuantities = explode(',', $data['TotalQuantities']);
|
||||
|
||||
$result = [];
|
||||
|
||||
|
||||
$data['reclamationSuppliers'] = $this->mapSuppliersToQuantities($reclamationSuppliers, $TotalRsQuantities);
|
||||
|
||||
$data['wasteCoreSuppliers'] = $this->mapSuppliersToQuantities($wasteCoreSuppliers, $TotalQuantities);
|
||||
|
||||
unset($data['TotalRsQuantities'], $data['TotalQuantities']);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $data;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
private function mapSuppliersToQuantities($suppliers, $quantities)
|
||||
{
|
||||
$result = [];
|
||||
|
||||
foreach ($suppliers as $index => $supplier) {
|
||||
$result[$supplier] = $quantities[$index];
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public function updateTrpProductionDetails() {
|
||||
public function updateTrpProductionDetails($inserts) {
|
||||
|
||||
$postData = $this->request->getPost();
|
||||
|
||||
$postData = $this->request->getJSON(true); // Converts JSON to an associative array
|
||||
|
||||
if(empty($postData)){
|
||||
if(empty($inserts)){
|
||||
return $this->response->setJSON(['error' => 'No data found to update']);
|
||||
}else{
|
||||
$postData['updateTrpProductionDetails'] = $inserts;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$updateTrpProductionDetails = json_decode($postData['updateTrpProductionDetails'], true);
|
||||
$updateTrpProductionDetails = $postData['updateTrpProductionDetails'];
|
||||
|
||||
$updateProduction = [];
|
||||
$updateMaintanence = [];
|
||||
@ -1520,6 +1499,66 @@ class StockController extends BaseController
|
||||
|
||||
|
||||
|
||||
public function generateDummyData($startDate, $endDate)
|
||||
{
|
||||
$datesInMonth = [];
|
||||
$inserts = [];
|
||||
|
||||
$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');
|
||||
}
|
||||
|
||||
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
|
||||
|
||||
$inserts[] = [
|
||||
'Date' => $dateInMonth,
|
||||
'openingTime' => '00:00',
|
||||
'closingTime' => '00:00',
|
||||
'totalHours' => '00:00',
|
||||
'coldStart' => '00:00',
|
||||
'breakdownHours' => '00:00',
|
||||
'burnerFiringHours' => '00:00',
|
||||
'sandFeedingHours' => '00:00',
|
||||
'workingPersonEngineers' => 0,
|
||||
'workingPersonSupervisiors' => 0,
|
||||
'workingPersonOperators' => 0,
|
||||
'rollerDrivers' => 0,
|
||||
'natureOfMaintenance' => '',
|
||||
'location' => '',
|
||||
'description' => '',
|
||||
'gasReceiptBg' => 0,
|
||||
'gasReceiptPg' => 0,
|
||||
'physicalGasConsumption' => 0,
|
||||
'trpPlusDrierGasConsumption' => 0,
|
||||
'trpPhysicalGasPerTon' => 0,
|
||||
'panelGasConsumption' => 0,
|
||||
'panelGasPerTon' => 0,
|
||||
'edRunningHours' => 0,
|
||||
'edProduction' => 0,
|
||||
'edUsage' => 0,
|
||||
'trpProduction' => 0,
|
||||
'trpProductionPerHour' => 0,
|
||||
'waterReceipt' => 0,
|
||||
'waterConsumption' => 0,
|
||||
'ebReading' => 0,
|
||||
'ebReadingPerUnitTon' => 0,
|
||||
'msSeperation' => 0,
|
||||
'edWaste' => 0,
|
||||
'coolerBags' => 0,
|
||||
'edPlus20Waste' => 0,
|
||||
'cycloneWaste' => 0
|
||||
];
|
||||
}
|
||||
|
||||
return $inserts;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -54,6 +54,9 @@ class TrpProductionModel extends Model
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Subquery definition
|
||||
$subquery = $this->db->table('t_materialmaster')
|
||||
->select('materialCode')
|
||||
@ -119,12 +122,10 @@ class TrpProductionModel extends Model
|
||||
|
||||
tsu.total_kgs as coating,
|
||||
|
||||
invItems.client_name as coreReclamationSupplier,
|
||||
invItems.TotalRsQuantity,
|
||||
invItems.*,
|
||||
|
||||
|
||||
tigrd.SupplierName as wasteCoreSupplier,
|
||||
tigrd.TotalQuantityAsPerInvoice
|
||||
tigrdot.*
|
||||
|
||||
|
||||
FROM
|
||||
@ -144,37 +145,65 @@ class TrpProductionModel extends Model
|
||||
|
||||
LEFT JOIN
|
||||
(
|
||||
Select
|
||||
clients.client_name,
|
||||
invItems.item_date_added,
|
||||
SUM(invItems.item_quantity) AS TotalRsQuantity
|
||||
|
||||
from ip_invoice_items invItems
|
||||
SELECT
|
||||
invItems.item_date_added,
|
||||
SUM(CASE WHEN clients.client_name = 'ASHOK LEYLAND LIMITED (FOUNDRY DIVISION-SRIPERUMBUDUR)' THEN invItems.item_quantity ELSE 0 END) AS
|
||||
`ALs_crs`,
|
||||
SUM(CASE WHEN clients.client_name = 'NEMAK ALUMINIUM CASTING INDIA PVT LTD' THEN invItems.item_quantity ELSE 0 END) AS
|
||||
`Nemak_crs`,
|
||||
SUM(CASE WHEN clients.client_name = 'MADRAS ENGINEERING INDUSTRIES PRIVATE LIMITED' THEN invItems.item_quantity ELSE 0 END) AS
|
||||
`ME_crs`,
|
||||
SUM(CASE WHEN clients.client_name = 'BRAKES INDIA PRIVATE LIMITED' THEN invItems.item_quantity ELSE 0 END) AS
|
||||
`BI_crs`,
|
||||
SUM(CASE WHEN clients.client_name = 'KARMEN INTERNATIONAL PVT LTD' THEN invItems.item_quantity ELSE 0 END) AS
|
||||
`Karmen_crs`
|
||||
|
||||
-- All joins to get client name thats it
|
||||
LEFT JOIN
|
||||
ip_invoices inv
|
||||
ON inv.invoice_id = invItems.invoice_id
|
||||
|
||||
LEFT JOIN
|
||||
ip_clients clients
|
||||
ON clients.client_id = inv.client_id
|
||||
|
||||
-- getting core reclamation sand
|
||||
Where invItems.item_name = 'Core Sand Reclaimed'
|
||||
FROM
|
||||
ip_invoice_items invItems
|
||||
LEFT JOIN
|
||||
ip_invoices inv ON inv.invoice_id = invItems.invoice_id
|
||||
LEFT JOIN
|
||||
ip_clients clients ON clients.client_id = inv.client_id
|
||||
WHERE
|
||||
invItems.item_name = 'Core Sand Reclaimed'
|
||||
|
||||
AND
|
||||
invItems.item_date_added >= '$startDate'
|
||||
|
||||
AND
|
||||
invItems.item_date_added <= '$endDate'
|
||||
|
||||
GROUP BY
|
||||
invItems.item_date_added
|
||||
|
||||
-- grouping Client who provides reclamation sand on a particular date with 1 or more invoices
|
||||
Group By invItems.item_date_added , clients.client_name
|
||||
|
||||
) invItems
|
||||
ON invItems.item_date_added = tpmd.date
|
||||
|
||||
|
||||
|
||||
LEFT JOIN
|
||||
LEFT JOIN
|
||||
(
|
||||
Select tigrd.CreatedDate ,tigrd.MaterialCode , tigrd.IGRNo , ts.SupplierName,
|
||||
SUM(QuantityAsPerInvoice) AS TotalQuantityAsPerInvoice
|
||||
|
||||
Select
|
||||
|
||||
tigrd.CreatedDate ,
|
||||
|
||||
SUM(CASE WHEN ts.SupplierName = 'ASHOK LEYLAND LIMITED FOUNDRY DIVN - SPU' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||
`ALs_wcs`,
|
||||
SUM(CASE WHEN ts.SupplierName = 'ASHOK LEYLAND LIMITED FOUNDRY DIVN - ENU' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||
`ALe_wcs`,
|
||||
SUM(CASE WHEN ts.SupplierName = 'MADRAS ENGINEERING INDUSTRIES PRIVATE LIMITED' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||
`ME_wcs`,
|
||||
SUM(CASE WHEN ts.SupplierName = 'SIDDHARTH INDUSTRIES' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||
`SI_wcs`,
|
||||
SUM(CASE WHEN ts.SupplierName = 'Caparo Engineering India Limited' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||
`caparo_wcs`,
|
||||
SUM(CASE WHEN ts.SupplierName = 'NEMAK ALUMINIUM CASTING INDIA PVT LTD' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||
`Nemak_wcs`,
|
||||
SUM(CASE WHEN ts.SupplierName = 'DR AXION INDIA PRIVATE LIMITED' THEN tigrd.QuantityAsPerInvoice ELSE 0 END) AS
|
||||
`DR_wcs`
|
||||
|
||||
from t_igr_details tigrd
|
||||
|
||||
@ -192,13 +221,21 @@ class TrpProductionModel extends Model
|
||||
ON tpom.SupplierID = ts.SupplierID
|
||||
|
||||
-- getting waste core sands using three distinct material codes
|
||||
Where tigrd.MaterialCode IN ($materialCodesString)
|
||||
Where
|
||||
tigrd.MaterialCode IN ($materialCodesString)
|
||||
|
||||
AND
|
||||
tigrd.CreatedDate >= '$startDate'
|
||||
|
||||
AND
|
||||
tigrd.CreatedDate <= '$endDate'
|
||||
|
||||
-- grouping supplier who provides waste core on a particular date with 1 or more IGRS
|
||||
Group By Date(tigrd.CreatedDate) , ts.SupplierName
|
||||
Group By Date(tigrd.CreatedDate)
|
||||
|
||||
) tigrd
|
||||
ON DATE(tigrd.CreatedDate) = tpmd.date
|
||||
) tigrdot
|
||||
|
||||
ON DATE(tigrdot.CreatedDate) = tpmd.date
|
||||
|
||||
|
||||
|
||||
@ -214,89 +251,6 @@ class TrpProductionModel extends Model
|
||||
|
||||
|
||||
|
||||
// "SELECT
|
||||
// tpmd.date,
|
||||
// tpmd.openingTime,
|
||||
// tpmd.closingTime,
|
||||
// tpmd.totalHours,
|
||||
// tpmd.coldStart,
|
||||
// tpmd.breakdownHours,
|
||||
// tpmd.burnerFiringHours,
|
||||
// tpmd.sandFeedingHours,
|
||||
// tpmd.workingPersonEngineers,
|
||||
// tpmd.workingPersonSupervisiors,
|
||||
// tpmd.workingPersonOperators,
|
||||
// tpmd.rollerDrivers,
|
||||
// tpmd.natureOfMaintenance,
|
||||
// tpmd.location,
|
||||
// tpmd.description,
|
||||
|
||||
// tpd.gasReceiptBg,
|
||||
// tpd.gasReceiptPg,
|
||||
// tpd.physicalGasConsumption,
|
||||
// tpd.trpPlusDrierGasConsumption,
|
||||
// tpd.trpPhysicalGasPerTon,
|
||||
// tpd.panelGasConsumption,
|
||||
// tpd.panelGasPerTon,
|
||||
// tpd.edRunningHours,
|
||||
// tpd.edProduction,
|
||||
// tpd.edUsage,
|
||||
// tpd.trpProduction,
|
||||
// tpd.trpProductionPerHour,
|
||||
// tpd.waterReceipt,
|
||||
// tpd.waterConsumption,
|
||||
// tpd.ebReading,
|
||||
// tpd.ebReadingPerUnitTon,
|
||||
|
||||
// tpwd.msSeperation,
|
||||
// tpwd.edWaste,
|
||||
// tpwd.coolerBags,
|
||||
// tpwd.edPlus20Waste,
|
||||
// tpwd.cycloneWaste,
|
||||
|
||||
// tcmd.totalGasConsumption AS coatingGasConsumption,
|
||||
// tdmd.total_gas_consumption AS drierGasConsumption,
|
||||
// tsu.total_kgs AS coating,
|
||||
|
||||
// -- Aggregated values for Reclaimed Sand
|
||||
// (SELECT GROUP_CONCAT(CONCAT(clients.client_name, ':', invItems.item_quantity) SEPARATOR '; ')
|
||||
// FROM ip_invoice_items invItems
|
||||
// LEFT JOIN ip_invoices inv ON inv.invoice_id = invItems.invoice_id
|
||||
// LEFT JOIN ip_clients clients ON clients.client_id = inv.client_id
|
||||
// WHERE invItems.item_name = 'Core Sand Reclaimed' AND invItems.item_date_added = tpmd.date
|
||||
// ) AS reclaimedSandDetails,
|
||||
|
||||
// -- Aggregated values for Waste Core
|
||||
// (SELECT GROUP_CONCAT(CONCAT(ts.SupplierName, ':', tigrd.QuantityAsPerInvoice) SEPARATOR '; ')
|
||||
// FROM t_igr_details tigrd
|
||||
// LEFT JOIN t_igr_master tigm ON tigm.IGRNo = tigrd.IGRNo
|
||||
// LEFT JOIN t_purchaseorder_master tpom ON tpom.PONO = tigm.PONO
|
||||
// LEFT JOIN t_supplierdetailsn ts ON tpom.SupplierID = ts.SupplierID
|
||||
// WHERE tigrd.MaterialCode IN ($materialCodesString) AND DATE(tigrd.CreatedDate) = tpmd.date
|
||||
// ) AS wasteCoreDetails
|
||||
|
||||
// FROM
|
||||
// t_trpProductionMaintenanceDetails tpmd
|
||||
// JOIN
|
||||
// t_trpProductionDetails tpd ON tpd.date = tpmd.date
|
||||
// JOIN
|
||||
// t_trpProductionWasteDetails tpwd ON tpwd.date = tpmd.date
|
||||
// LEFT JOIN
|
||||
// t_coatingMachineDetails tcmd ON tcmd.date = tpmd.date
|
||||
// LEFT JOIN
|
||||
// t_drierMachineDetails tdmd ON tdmd.date = tpmd.date
|
||||
// LEFT JOIN
|
||||
// t_trp_sand_use tsu ON tsu.date = tpmd.date
|
||||
|
||||
// WHERE
|
||||
// tpmd.date >= ?
|
||||
// AND
|
||||
// tpmd.date <= ?
|
||||
|
||||
// ORDER BY
|
||||
// tpmd.date ASC;
|
||||
// "
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -254,7 +254,7 @@
|
||||
<div class="card-body">
|
||||
|
||||
|
||||
<form action="<?= base_url('resinStockDetails'); ?>" method="post">
|
||||
<form action="<?= base_url('trpProductionDetails'); ?>" method="post">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-3">
|
||||
@ -424,39 +424,22 @@
|
||||
|
||||
<tbody style="background-color: #fff;" >
|
||||
|
||||
<?php if(!empty($trpProductionStockDetails))
|
||||
{ ?>
|
||||
|
||||
|
||||
<?php if(!empty($trpProductionDetails))
|
||||
{
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 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)
|
||||
<?php foreach($trpProductionDetails as $trpProductionDetailIndex => $trpProductionDetail)
|
||||
{
|
||||
|
||||
?>
|
||||
|
||||
<tr id="<?= $dateInMonth ?>"
|
||||
<tr id="<?= $trpProductionDetail['date'] ?>"
|
||||
|
||||
<?php
|
||||
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat= DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
|
||||
$dateInMonthDmYFormat= DateTime::createFromFormat('Y-m-d', $trpProductionDetail['date'])->format('d-m-Y');
|
||||
if ($dateInMonthDmYFormat === $currentDate) { echo 'style="background: #cef0ad;"';}
|
||||
?>
|
||||
|
||||
@ -465,14 +448,14 @@
|
||||
<!-- date -->
|
||||
<!-- td:eq(0) -->
|
||||
<td class="celda_normal trpProductionStock date"
|
||||
data-id="<?= $dateInMonth ?> date">
|
||||
data-id="<?= $trpProductionDetail['date'] ?> date">
|
||||
<?= $dateInMonthDmYFormat ?>
|
||||
</td>
|
||||
|
||||
<!-- openingTime -->
|
||||
<!-- td:eq(1) -->
|
||||
<td class="celda_normal trpProductionStock openingTime"
|
||||
data-id="<?= $dateInMonth ?> openingTime" >
|
||||
data-id="<?= $trpProductionDetail['date'] ?> openingTime" >
|
||||
|
||||
<select class="timeDropdown trp_on_time" style="width: 150px;"
|
||||
>
|
||||
@ -480,7 +463,9 @@
|
||||
foreach($timeOptions as $timeOption)
|
||||
{
|
||||
?>
|
||||
<option value="<?= $timeOption ?>">
|
||||
<option value="<?= $timeOption ?>"
|
||||
<?php if($timeOption == $trpProductionDetail['openingTime']) echo "selected"; ?>
|
||||
>
|
||||
<?= $timeOption ?>
|
||||
</option>
|
||||
|
||||
@ -493,7 +478,7 @@
|
||||
<!-- closingTime -->
|
||||
<!-- td:eq(2) -->
|
||||
<td class="celda_normal trpProductionStock closingTime"
|
||||
data-id="<?= $dateInMonth ?> closingTime" >
|
||||
data-id="<?= $trpProductionDetail['date'] ?> closingTime" >
|
||||
|
||||
<select class="timeDropdown trp_off_time" style="width: 150px;"
|
||||
>
|
||||
@ -501,7 +486,9 @@
|
||||
foreach($timeOptions as $timeOption)
|
||||
{
|
||||
?>
|
||||
<option value="<?= $timeOption ?>">
|
||||
<option value="<?= $timeOption ?>"
|
||||
<?php if($timeOption == $trpProductionDetail['closingTime']) echo "selected"; ?>
|
||||
>
|
||||
<?= $timeOption ?>
|
||||
</option>
|
||||
|
||||
@ -514,8 +501,8 @@
|
||||
<!-- totalHours -->
|
||||
<!-- td:eq(3) -->
|
||||
<td class="celda_normal trpProductionStock totalHours"
|
||||
data-id="<?= $dateInMonth ?> totalHours">
|
||||
0
|
||||
data-id="<?= $trpProductionDetail['date'] ?> totalHours">
|
||||
<?= $trpProductionDetail['totalHours'] ?>
|
||||
</td>
|
||||
|
||||
<!-- coldStart -->
|
||||
@ -524,7 +511,7 @@
|
||||
data-id=""
|
||||
oninput="trpStockChange(this)"
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['coldStart'] ?>
|
||||
</td>
|
||||
|
||||
<!-- breakdownHours -->
|
||||
@ -533,21 +520,21 @@
|
||||
data-id=""
|
||||
oninput="trpStockChange(this)"
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['breakdownHours'] ?>
|
||||
</td>
|
||||
|
||||
<!-- burnerFiringHours -->
|
||||
<!-- td:eq(6) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['burnerFiringHours'] ?>
|
||||
</td>
|
||||
|
||||
<!-- sandFeedingHours -->
|
||||
<!-- td:eq(7) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['sandFeedingHours'] ?>
|
||||
</td>
|
||||
|
||||
<!-- gasReceiptBg -->
|
||||
@ -555,7 +542,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['gasReceiptBg'] ?>
|
||||
</td>
|
||||
|
||||
<!-- gasReceiptPg -->
|
||||
@ -563,7 +550,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['gasReceiptPg'] ?>
|
||||
</td>
|
||||
|
||||
|
||||
@ -574,7 +561,7 @@
|
||||
data-id=""
|
||||
oninput="trpStockChange(this)"
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['physicalGasConsumption'] ?>
|
||||
</td>
|
||||
|
||||
|
||||
@ -583,14 +570,14 @@
|
||||
<!-- td:eq(11) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['drierGasConsumption'] ?>
|
||||
</td>
|
||||
|
||||
<!-- coatingGasConsumption -->
|
||||
<!-- td:eq(12) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['coatingGasConsumption'] ?>
|
||||
</td>
|
||||
|
||||
|
||||
@ -598,14 +585,14 @@
|
||||
<!-- td:eq(13) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['trpPlusDrierGasConsumption'] ?>
|
||||
</td>
|
||||
|
||||
<!-- trpPhysicalGasPerTon -->
|
||||
<!-- td:eq(14) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?php $trpPhysicalGasPerTon = $trpProductionDetail['trpPhysicalGasPerTon'] ?>
|
||||
</td>
|
||||
|
||||
|
||||
@ -615,28 +602,28 @@
|
||||
data-id=""
|
||||
oninput="trpStockChange(this)"
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['panelGasConsumption'] ?>
|
||||
</td>
|
||||
|
||||
<!-- panelGasPerTon -->
|
||||
<!-- td:eq(16) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['panelGasPerTon'] ?>
|
||||
</td>
|
||||
|
||||
<!-- AL(S) -->
|
||||
<!-- td:eq(17) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['ALs_wcs'] ?>
|
||||
</td>
|
||||
|
||||
<!-- AL(E) -->
|
||||
<!-- td:eq(18) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['ALe_wcs'] ?>
|
||||
</td>
|
||||
|
||||
<!-- ME -->
|
||||
@ -644,21 +631,21 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['ME_wcs'] ?>
|
||||
</td>
|
||||
|
||||
<!-- SI -->
|
||||
<!-- td:eq(20) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['SI_wcs'] ?>
|
||||
</td>
|
||||
|
||||
<!-- Caparo -->
|
||||
<!-- td:eq(21) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<? $trpProductionDetail['caparo_wcs'] ?>
|
||||
</td>
|
||||
|
||||
|
||||
@ -666,14 +653,14 @@
|
||||
<!-- td:eq(22) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['Nemak_wcs'] ?>
|
||||
</td>
|
||||
|
||||
<!-- DR -->
|
||||
<!-- td:eq(23) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['DR_wcs'] ?>
|
||||
</td>
|
||||
|
||||
<!-- edRunningHours -->
|
||||
@ -681,7 +668,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['edRunningHours'] ?>
|
||||
</td>
|
||||
|
||||
|
||||
@ -691,7 +678,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['edProduction'] ?>
|
||||
</td>
|
||||
|
||||
<!-- edUsage -->
|
||||
@ -699,7 +686,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['edUsage'] ?>
|
||||
</td>
|
||||
|
||||
<!-- trpProduction -->
|
||||
@ -708,56 +695,56 @@
|
||||
data-id=""
|
||||
oninput="trpStockChange(this)"
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['trpProduction'] ?>
|
||||
</td>
|
||||
|
||||
<!-- trpProductionPerHour -->
|
||||
<!-- td:eq(28) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['trpProductionPerHour'] ?>
|
||||
</td>
|
||||
|
||||
<!-- coating -->
|
||||
<!-- td:eq(29) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['coating'] ?>
|
||||
</td>
|
||||
|
||||
<!-- Hindhuja -->
|
||||
<!-- td:eq(30) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<? $trpProductionDetail['Als_crs'] ?>
|
||||
</td>
|
||||
|
||||
<!-- Nemak -->
|
||||
<!-- td:eq(31) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['Nemak_crs'] ?>
|
||||
</td>
|
||||
<!-- ME -->
|
||||
<!-- td:eq(32) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<? $trpProductionDetail['ME_crs'] ?>
|
||||
</td>
|
||||
<!-- BI -->
|
||||
<!-- td:eq(33) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<? $trpProductionDetail['BI_crs'] ?>
|
||||
</td>
|
||||
<!-- Karmen -->
|
||||
<!-- td:eq(34) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<? $trpProductionDetail['Karmen_crs'] ?>
|
||||
</td>
|
||||
|
||||
<!-- waterReceipt -->
|
||||
@ -765,7 +752,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['waterReceipt'] ?>
|
||||
</td>
|
||||
|
||||
<!-- waterConsumption -->
|
||||
@ -773,7 +760,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['waterConsumption'] ?>
|
||||
</td>
|
||||
|
||||
<!-- ebReading -->
|
||||
@ -781,14 +768,14 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['ebReading'] ?>
|
||||
</td>
|
||||
|
||||
<!-- ebReadingPerUnitTon -->
|
||||
<!-- td:eq(38) -->
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id="">
|
||||
0
|
||||
<?= $trpProductionDetail['ebReadingPerUnitTon'] ?>
|
||||
</td>
|
||||
|
||||
|
||||
@ -797,7 +784,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['workingPersonEngineers'] ?>
|
||||
</td>
|
||||
|
||||
<!-- workingPersonSupervisiors -->
|
||||
@ -805,7 +792,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['workingPersonSupervisiors'] ?>
|
||||
</td>
|
||||
|
||||
<!-- workingPersonOperators -->
|
||||
@ -813,7 +800,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['workingPersonOperators'] ?>
|
||||
</td>
|
||||
|
||||
<!-- rollerDrivers -->
|
||||
@ -821,7 +808,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['rollerDrivers'] ?>
|
||||
</td>
|
||||
|
||||
<!-- natureOfMaintenance -->
|
||||
@ -829,7 +816,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['natureOfMaintenance'] ?>
|
||||
</td>
|
||||
|
||||
<!-- location -->
|
||||
@ -837,7 +824,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['location'] ?>
|
||||
</td>
|
||||
|
||||
<!-- description -->
|
||||
@ -845,7 +832,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['description'] ?>
|
||||
</td>
|
||||
|
||||
|
||||
@ -854,7 +841,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['msSeperation'] ?>
|
||||
</td>
|
||||
|
||||
<!-- edWaste -->
|
||||
@ -862,7 +849,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['edWaste'] ?>
|
||||
</td>
|
||||
|
||||
<!-- coolerBags -->
|
||||
@ -870,7 +857,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['coolerBags'] ?>
|
||||
</td>
|
||||
|
||||
<!-- edPlus20Waste -->
|
||||
@ -878,7 +865,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['edPlus20Waste'] ?>
|
||||
</td>
|
||||
|
||||
<!--cycloneWaste -->
|
||||
@ -886,7 +873,7 @@
|
||||
<td class="celda_normal trpProductionStock"
|
||||
data-id=""
|
||||
contenteditable="true">
|
||||
0
|
||||
<?= $trpProductionDetail['cycloneWaste'] ?>
|
||||
</td>
|
||||
|
||||
|
||||
@ -957,6 +944,31 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- JAVASCRIPT CODE -->
|
||||
|
||||
<script>
|
||||
function navigateToResin() {
|
||||
$('.close').click();
|
||||
@ -1095,13 +1107,13 @@
|
||||
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()
|
||||
date: rowCells.eq(i).text().trim() ?? 0,
|
||||
materialCode: rowCells.eq(i+1).text().trim() ?? 0,
|
||||
customer: rowCells.eq(i+2).text().trim() ?? 0,
|
||||
opening: rowCells.eq(i+3).text().trim() ?? 0,
|
||||
receipt: rowCells.eq(i+4).text().trim() ?? 0,
|
||||
used: rowCells.eq(i+5).text().trim() ?? 0,
|
||||
balanceStock: rowCells.eq(i + 6).text().trim() ?? 0
|
||||
};
|
||||
|
||||
rows.push(rowData);
|
||||
@ -1116,6 +1128,72 @@
|
||||
|
||||
<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((totalHours));
|
||||
let coldStartInt = milliSecondsFormat(coldStart);
|
||||
let breakdownHoursInt = milliSecondsFormat(breakdownHours);
|
||||
|
||||
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) {
|
||||
|
||||
|
||||
@ -1156,7 +1234,7 @@
|
||||
|
||||
|
||||
|
||||
let result = sandFeedingHours(totalHours,coldStart,breakdownHours,burnerFiringHours);
|
||||
let result = calculateSandFeedingHours(totalHours,coldStart,breakdownHours,burnerFiringHours);
|
||||
|
||||
sandFeedingHours = result[0];
|
||||
|
||||
@ -1290,74 +1368,7 @@
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
function sandFeedingHours(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((totalHours));
|
||||
let coldStartInt = milliSecondsFormat(coldStart);
|
||||
let breakdownHoursInt = milliSecondsFormat(breakdownHours);
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user