stock changes 21-04-2025
This commit is contained in:
parent
31a3022c0a
commit
cff3e58f6d
File diff suppressed because it is too large
Load Diff
32
app/Helpers/stock_helper.php
Normal file
32
app/Helpers/stock_helper.php
Normal file
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use CodeIgniter\HTTP\IncomingRequest;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve and store stock month based on request method.
|
||||
*
|
||||
* @param IncomingRequest $request
|
||||
* @return string
|
||||
*/
|
||||
function getStockMonth(IncomingRequest $request): string
|
||||
{
|
||||
$session = session();
|
||||
|
||||
if ($request->getMethod() === 'POST') {
|
||||
$monthInput = $request->getPost('month');
|
||||
$date = DateTime::createFromFormat('d-M-Y', '01-' . $monthInput);
|
||||
$formattedDate = $date ? $date->format('Y-m') : date('Y-m');
|
||||
$session->set('stock_month', $formattedDate);
|
||||
$month = $formattedDate;
|
||||
} else {
|
||||
$month = $session->get('stock_month');
|
||||
if (empty($month)) {
|
||||
$month = date('Y-m');
|
||||
}
|
||||
}
|
||||
|
||||
return $month;
|
||||
}
|
||||
@ -45,4 +45,47 @@ class CoatingMachineDetailsModel extends Model
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
public function coatingMachineDetails($startDate,$endDate){
|
||||
$result = $this->db->table('t_coatingmachinedetails')
|
||||
->select('t_coatingmachinedetails.*,
|
||||
JSON_ARRAYAGG(
|
||||
JSON_OBJECT(
|
||||
"client_given_name", t_batchcard_files.client_file_name,
|
||||
"filename", t_batchcard_files.filename,
|
||||
"batchCardId" , t_batchcard_files.id,
|
||||
"coating_id", t_batchcard_files.coating_id
|
||||
)
|
||||
) as batchcard_files')
|
||||
->join('t_batchcard_files', 't_batchcard_files.coating_id = t_coatingmachinedetails.id', 'left')
|
||||
->where('t_coatingmachinedetails.date >=', $startDate)
|
||||
->where('t_coatingmachinedetails.date <=', $endDate)
|
||||
->groupBy('t_coatingmachinedetails.id')
|
||||
->orderBy('t_coatingmachinedetails.date', 'asc')
|
||||
->get()
|
||||
->getResultArray();
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function isShiftExists($date, $shift)
|
||||
{
|
||||
$result = $this->db->table('t_coatingmachinedetails')
|
||||
->where('date', $date)
|
||||
->where('shift', $shift)
|
||||
->where('is_active', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -45,4 +45,57 @@ class GasStockModel extends Model
|
||||
protected $afterFind = [];
|
||||
protected $beforeDelete = [];
|
||||
protected $afterDelete = [];
|
||||
|
||||
|
||||
public function gasStockDetails($startDate,$endDate){
|
||||
|
||||
$result = $this->db->table('t_gasstockdetails')
|
||||
|
||||
->select(
|
||||
't_gasstockdetails.*,
|
||||
drier_summary.drierMachineGasconsumption AS drierMachineGasConsumption,
|
||||
drier_summary.driedSand AS sandDried,
|
||||
coating_summary.coatingMachineGasconsumption,
|
||||
coating_summary.coatedSand'
|
||||
)
|
||||
// Subquery with early date filtering
|
||||
->join(
|
||||
'(SELECT date,
|
||||
SUM(totalGasconsumption) AS coatingMachineGasconsumption,
|
||||
SUM(totalCoatingSandInKg) AS coatedSand
|
||||
FROM t_coatingmachinedetails
|
||||
WHERE is_active = 1
|
||||
AND date >= ' . $this->db->escape($startDate) . '
|
||||
AND date <= ' . $this->db->escape($endDate) . '
|
||||
GROUP BY date
|
||||
) AS coating_summary',
|
||||
'coating_summary.date = t_gasstockdetails.date',
|
||||
'left'
|
||||
)
|
||||
->join(
|
||||
'(SELECT date,
|
||||
SUM(total_gas_consumption) AS drierMachineGasconsumption,
|
||||
SUM(sand_dried_qty) AS driedSand
|
||||
FROM t_driermachinedetails
|
||||
WHERE date >= ' . $this->db->escape($startDate) . '
|
||||
AND date <= ' . $this->db->escape($endDate) . '
|
||||
GROUP BY date
|
||||
) AS drier_summary',
|
||||
'drier_summary.date = t_gasstockdetails.date',
|
||||
'left'
|
||||
)
|
||||
|
||||
->where('t_gasstockdetails.date >=', $startDate)
|
||||
->where('t_gasstockdetails.date <=', $endDate)
|
||||
->groupBy('t_gasstockdetails.date')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
return $result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -614,15 +614,14 @@ foreach ($period as $day) {
|
||||
|
||||
foreach ($groupedBagStockDetails as $groupedBagStockDetailsIndex => $bagStockDetails) {
|
||||
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $bagStockDetails[0]['date'])->format('d-m-Y');
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
?>
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$bagStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
|
||||
|
||||
<?php
|
||||
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
if ($bagStockDetails[0]['date'] === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>>
|
||||
@ -737,22 +736,19 @@ foreach ($period as $day) {
|
||||
<!-- this else condition work if groupedBagStockDetails is empty and creating new records
|
||||
with initial values 0 for entire month -->
|
||||
<?php } else {
|
||||
// dd($bagMaterials);
|
||||
// dd($previousMonthBagStockDetails);
|
||||
?>
|
||||
|
||||
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
|
||||
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
?>
|
||||
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
|
||||
|
||||
<?php
|
||||
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
if ($dateInMonth === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
|
||||
|
||||
@ -601,14 +601,13 @@ foreach ($period as $day) {
|
||||
|
||||
foreach ($groupedDieselMachineStockDetails as $rowIndex => $dieselStockDetails) {
|
||||
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dieselStockDetails[0]['date'])->format('d-m-Y');
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
?>
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$dieselStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
|
||||
|
||||
<?php
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
if ($dieselStockDetails[0]['date'] === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>
|
||||
@ -851,21 +850,20 @@ foreach ($period as $day) {
|
||||
|
||||
<!-- this else condition work if groupeddieselStockDetails is empty and creating new records
|
||||
with initial values 0 for entire month -->
|
||||
<?php } else { ?>
|
||||
<?php } else {?>
|
||||
|
||||
|
||||
|
||||
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
|
||||
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
|
||||
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
|
||||
|
||||
<?php
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
if ($dateInMonth === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>>
|
||||
|
||||
@ -529,13 +529,12 @@
|
||||
$summary = [];
|
||||
|
||||
foreach ($dustAndRoughStockDetails as $dustAndRoughStockDetailsIndex => $dustAndRoughStockDetail) {
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dustAndRoughStockDetail['date'])->format('d-m-Y');
|
||||
$currentDate = date('Y-m-d');
|
||||
?>
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$dustAndRoughStockDetail['date'] > $currentDate ? "hidden-row" : "" ?>"
|
||||
<?php
|
||||
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
if ($dustAndRoughStockDetail['date'] === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>>
|
||||
@ -609,13 +608,11 @@
|
||||
}
|
||||
|
||||
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat = date("d-m-Y", strtotime($dateInMonth));
|
||||
$currentDate = date('Y-m-d');
|
||||
?>
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
|
||||
<?php
|
||||
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
if ($dateInMonth === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>
|
||||
|
||||
@ -507,15 +507,15 @@
|
||||
|
||||
<?php if (!empty($gasStockDetails)) {
|
||||
foreach ($gasStockDetails as $index => $gasStockDetail) {
|
||||
$currentDate = date('d-m-Y');
|
||||
$date = Datetime::createFromFormat('Y-m-d', $gasStockDetail['date'])->format('d-m-Y')
|
||||
$currentDate = date('Y-m-d');
|
||||
$date = Datetime::createFromFormat('Y-m-d', $gasStockDetail['date'])->format('d-m-Y');
|
||||
?>
|
||||
|
||||
<!-- implementing date highlighter -->
|
||||
|
||||
<tr class="<?=$date > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$gasStockDetail['date'] > $currentDate ? "hidden-row" : "" ?>"
|
||||
<?php
|
||||
if ($date === $currentDate) {
|
||||
if ($gasStockDetail['date'] === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>
|
||||
@ -737,12 +737,12 @@
|
||||
?>
|
||||
|
||||
<!-- implementing date highlighter -->
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
if ($dateInMonth === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>>
|
||||
|
||||
@ -610,18 +610,17 @@ foreach ($period as $day) {
|
||||
|
||||
foreach ($groupedPowerConsumptionStockDetails as $groupedIndex => $powerStockDetails) {
|
||||
|
||||
$currentDate = date('d-m-Y');
|
||||
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $powerStockDetails[0]['date'])->format('d-m-Y');
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
?>
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$powerStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
|
||||
|
||||
<?php
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>>
|
||||
if ($powerStockDetails[0]['date'] === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>
|
||||
>
|
||||
|
||||
|
||||
<?php
|
||||
@ -870,218 +869,217 @@ foreach ($period as $day) {
|
||||
|
||||
<!-- this else condition work if groupedpowerStockDetails is empty and creating new records
|
||||
with initial values 0 for entire month -->
|
||||
<?php } else { ?>
|
||||
<?php } else { ?>
|
||||
|
||||
|
||||
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
|
||||
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
|
||||
|
||||
?>
|
||||
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<?php
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>
|
||||
>
|
||||
|
||||
<?php
|
||||
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
|
||||
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
|
||||
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
?>
|
||||
|
||||
<td class="celda_normal">
|
||||
<?= $startDate ?>
|
||||
</td>
|
||||
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
|
||||
<?php
|
||||
if ($dateInMonth === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>
|
||||
>
|
||||
|
||||
<?php
|
||||
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
|
||||
|
||||
?>
|
||||
|
||||
<td class="celda_normal">
|
||||
<?= $startDate ?>
|
||||
</td>
|
||||
|
||||
|
||||
<td class="celda_normal openingTP"
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
<td class="celda_normal openingTP"
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
|
||||
<?php if ($datesInMonthIndex == 0) { ?>
|
||||
<?php if ($datesInMonthIndex == 0) { ?>
|
||||
|
||||
oninput="openingTPStockChange(this)"
|
||||
contenteditable="true"
|
||||
oninput="openingTPStockChange(this)"
|
||||
contenteditable="true"
|
||||
|
||||
<?php } ?>>
|
||||
<?php
|
||||
if (empty($previousMonthTotalPowerMachineStockDetails)) {
|
||||
echo " ";
|
||||
} else {
|
||||
echo $previousMonthTotalPowerMachineStockDetails[0]['final_reading'];
|
||||
}
|
||||
<?php } ?>>
|
||||
<?php
|
||||
if (empty($previousMonthTotalPowerMachineStockDetails)) {
|
||||
echo " ";
|
||||
} else {
|
||||
echo $previousMonthTotalPowerMachineStockDetails[0]['final_reading'];
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
|
||||
</td>
|
||||
</td>
|
||||
|
||||
|
||||
|
||||
<td class="celda_normal finalTP"
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
<td class="celda_normal finalTP"
|
||||
data-id="<?= $dateInMonth ?>"
|
||||
|
||||
oninput="finalTPStockChange(this)"
|
||||
contenteditable="true">
|
||||
oninput="finalTPStockChange(this)"
|
||||
contenteditable="true">
|
||||
|
||||
<?php
|
||||
if (empty($previousMonthTotalPowerMachineStockDetails)) {
|
||||
echo " ";
|
||||
} else {
|
||||
echo $previousMonthTotalPowerMachineStockDetails[0]['final_reading'];
|
||||
}
|
||||
<?php
|
||||
if (empty($previousMonthTotalPowerMachineStockDetails)) {
|
||||
echo " ";
|
||||
} else {
|
||||
echo $previousMonthTotalPowerMachineStockDetails[0]['final_reading'];
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
</td>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal totalReadingTP"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
<td class="celda_normal totalReadingTP"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
|
||||
<td class="celda_normal totalUnitsTP"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
<td class="celda_normal totalUnitsTP"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
|
||||
<td class="celda_normal averagePfTP" contenteditable="true"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
<td class="celda_normal presentPfTP" contenteditable="true"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
<td class="celda_normal averagePfTP" contenteditable="true"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
<td class="celda_normal presentPfTP" contenteditable="true"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
|
||||
<td class="celda_normal mdTP" contenteditable="true"
|
||||
oninput="mdTPStockChange(this)"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
<td class="celda_normal mdTP" contenteditable="true"
|
||||
oninput="mdTPStockChange(this)"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
|
||||
<td class="celda_normal mfTP"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
<td class="celda_normal mfTP"
|
||||
data-id="<?= $dateInMonth ?>"> </td>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
foreach ($electricMachines as $powerMachineIndex => $powerMachine) {
|
||||
?>
|
||||
<!-- this will loop till machines present -->
|
||||
<?php
|
||||
foreach ($electricMachines as $powerMachineIndex => $powerMachine) {
|
||||
?>
|
||||
<!-- this will loop till machines present -->
|
||||
|
||||
|
||||
|
||||
<td class="celda_normal" style="display:none">
|
||||
<?= $dateInMonth ?>
|
||||
</td>
|
||||
<td class="celda_normal" style="display:none">
|
||||
<?= $dateInMonth ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal" style="display:none"
|
||||
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>">
|
||||
<?= $powerMachine['id'] ?>
|
||||
</td>
|
||||
<td class="celda_normal" style="display:none"
|
||||
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>">
|
||||
<?= $powerMachine['id'] ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal openingUnits"
|
||||
<td class="celda_normal openingUnits"
|
||||
|
||||
<?php if ($datesInMonthIndex == 0) { ?>
|
||||
oninput="openingUnitsChange(this)"
|
||||
contenteditable="true"
|
||||
<?php } ?>
|
||||
|
||||
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>">
|
||||
|
||||
|
||||
<?php
|
||||
foreach ($previousMonthPowerConsumptionStockDetails as $index => $previousMonthPowerConsumptionStockDetail) {
|
||||
if ($previousMonthPowerConsumptionStockDetail['machine_id'] == $powerMachine['id']) {
|
||||
echo $previousMonthPowerConsumptionStockDetail['closing_units'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="celda_normal closingUnits"
|
||||
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>"
|
||||
oninput="closingUnitsChange(this)"
|
||||
contenteditable="true">
|
||||
|
||||
<?php
|
||||
foreach ($previousMonthPowerConsumptionStockDetails as $index => $previousMonthPowerConsumptionStockDetail) {
|
||||
if ($previousMonthPowerConsumptionStockDetail['machine_id'] == $powerMachine['id']) {
|
||||
echo $previousMonthPowerConsumptionStockDetail['closing_units'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="celda_normal totalUnits"
|
||||
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>"
|
||||
contenteditable="true"> </td>
|
||||
|
||||
<?php if ($datesInMonthIndex == 0) { ?>
|
||||
oninput="openingUnitsChange(this)"
|
||||
contenteditable="true"
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>">
|
||||
|
||||
|
||||
<?php
|
||||
foreach ($previousMonthPowerConsumptionStockDetails as $index => $previousMonthPowerConsumptionStockDetail) {
|
||||
if ($previousMonthPowerConsumptionStockDetail['machine_id'] == $powerMachine['id']) {
|
||||
echo $previousMonthPowerConsumptionStockDetail['closing_units'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="celda_normal closingUnits"
|
||||
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>"
|
||||
oninput="closingUnitsChange(this)"
|
||||
contenteditable="true">
|
||||
|
||||
<?php
|
||||
foreach ($previousMonthPowerConsumptionStockDetails as $index => $previousMonthPowerConsumptionStockDetail) {
|
||||
if ($previousMonthPowerConsumptionStockDetail['machine_id'] == $powerMachine['id']) {
|
||||
echo $previousMonthPowerConsumptionStockDetail['closing_units'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="celda_normal totalUnits"
|
||||
data-id="<?= $dateInMonth ?> <?= $powerMachine['id'] ?>"
|
||||
contenteditable="true"> </td>
|
||||
|
||||
<?php } ?>
|
||||
</tr>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
|
||||
<?php } ?>
|
||||
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
|
||||
<b> Total </b>
|
||||
</td>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td class="celda_normal openingTP"
|
||||
data-id="footer openingTP">
|
||||
</td>
|
||||
|
||||
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
|
||||
<b> Total </b>
|
||||
</td>
|
||||
<td class="celda_normal finalTP"
|
||||
data-id="footer finalTP">
|
||||
</td>
|
||||
|
||||
<td class="celda_normal openingTP"
|
||||
data-id="footer openingTP">
|
||||
</td>
|
||||
<td class="celda_normal totalReadingTP"
|
||||
data-id="footer totalReadingTP">
|
||||
</td>
|
||||
|
||||
<td class="celda_normal finalTP"
|
||||
data-id="footer finalTP">
|
||||
</td>
|
||||
<td class="celda_normal totalUnitsTP"
|
||||
data-id="footer totalUnitsTP">
|
||||
</td>
|
||||
|
||||
<td class="celda_normal totalReadingTP"
|
||||
data-id="footer totalReadingTP">
|
||||
</td>
|
||||
<td class="celda_normal averagePf"
|
||||
data-id="footer averagePf">
|
||||
</td>
|
||||
|
||||
<td class="celda_normal totalUnitsTP"
|
||||
data-id="footer totalUnitsTP">
|
||||
</td>
|
||||
<td class="celda_normal presentPf"
|
||||
data-id="footer presentPf">
|
||||
</td>
|
||||
|
||||
<td class="celda_normal averagePf"
|
||||
data-id="footer averagePf">
|
||||
</td>
|
||||
<td class="celda_normal mdTP"
|
||||
data-id="footer mdTP">
|
||||
</td>
|
||||
|
||||
<td class="celda_normal presentPf"
|
||||
data-id="footer presentPf">
|
||||
</td>
|
||||
<td class="celda_normal mfTP"
|
||||
data-id="footer mfTP">
|
||||
</td>
|
||||
|
||||
<td class="celda_normal mdTP"
|
||||
data-id="footer mdTP">
|
||||
</td>
|
||||
<?php foreach ($electricMachines as $each) {
|
||||
if (is_array($each)) {
|
||||
?>
|
||||
|
||||
<td class="celda_normal mfTP"
|
||||
data-id="footer mfTP">
|
||||
</td>
|
||||
<td class="celda_normal openingUnits"
|
||||
data-id="footer <?=$each['id']?>"></td>
|
||||
<td class="celda_normal closingUnits"
|
||||
data-id="footer <?=$each['id']?>"></td>
|
||||
<td class="celda_normal totalUnits"
|
||||
data-id="footer <?=$each['id']?>"></td>
|
||||
|
||||
<?php foreach ($electricMachines as $each) {
|
||||
if (is_array($each)) {
|
||||
?>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<td class="celda_normal openingUnits"
|
||||
data-id="footer <?=$each['id']?>"></td>
|
||||
<td class="celda_normal closingUnits"
|
||||
data-id="footer <?=$each['id']?>"></td>
|
||||
<td class="celda_normal totalUnits"
|
||||
data-id="footer <?=$each['id']?>"></td>
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</tbody>
|
||||
|
||||
@ -601,16 +601,15 @@ foreach ($period as $day) {
|
||||
|
||||
foreach ($groupedResinStockDetails as $groupedResinStockDetailsIndex => $resinStockDetails) {
|
||||
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $resinStockDetails[0]['date'])->format('d-m-Y');
|
||||
$currentDate = date('Y-m-d');
|
||||
|
||||
$backgroundColor = " ";
|
||||
|
||||
?>
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$resinStockDetails[0]['date'] > $currentDate ? "hidden-row" : "" ?>"
|
||||
|
||||
<?php
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
if ($resinStockDetails[0]['date'] === $currentDate) {
|
||||
$backgroundColor ="background: #cef0ad;";
|
||||
}
|
||||
?>
|
||||
@ -732,129 +731,127 @@ foreach ($period as $day) {
|
||||
|
||||
<!-- this else condition work if groupedBagStockDetails is empty and creating new records
|
||||
with initial values 0 for entire month -->
|
||||
<?php } else { ?>
|
||||
<?php } else { ?>
|
||||
|
||||
|
||||
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
|
||||
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
|
||||
|
||||
?>
|
||||
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
|
||||
|
||||
$currentDate = date('Y-m-d');
|
||||
?>
|
||||
|
||||
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
echo 'style="background: #cef0ad ;"';
|
||||
}
|
||||
?>
|
||||
>
|
||||
<?php
|
||||
// dd($resinMaterials);
|
||||
foreach ($resinMaterials as $resinMaterialIndex => $resinMaterial) { ?>
|
||||
<!-- this will loop till materials present -->
|
||||
|
||||
<?php if ($resinMaterialIndex == 0): ?>
|
||||
<?php
|
||||
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
|
||||
|
||||
|
||||
|
||||
if ($dateInMonth === $currentDate) {
|
||||
echo 'style="background: #cef0ad ;"';
|
||||
}
|
||||
?>
|
||||
<td class="celda_normal">
|
||||
<?= $startDate ?>
|
||||
>
|
||||
<?php
|
||||
// dd($resinMaterials);
|
||||
foreach ($resinMaterials as $resinMaterialIndex => $resinMaterial) { ?>
|
||||
<!-- this will loop till materials present -->
|
||||
|
||||
<?php if ($resinMaterialIndex == 0): ?>
|
||||
<?php
|
||||
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
|
||||
?>
|
||||
<td class="celda_normal">
|
||||
<?= $startDate ?>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<td class="celda_normal" style="display:none">
|
||||
<?= $dateInMonth ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal" style="display:none"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
|
||||
<?= $resinMaterial['MaterialCode'] ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal customer" style="display:none"
|
||||
data-materialCode="<?= $resinMaterial['MaterialCode'] ?>"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
|
||||
<?= $resinMaterial['customers'] ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal openingStock"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
||||
<?php if ($datesInMonthIndex == 0) { ?>
|
||||
|
||||
oninput="openingStockChange(this)"
|
||||
contenteditable="true"
|
||||
|
||||
<?php } ?>>
|
||||
|
||||
<?php
|
||||
foreach ($previousMonthResinStockDetails as $index => $previousMonthResinStockDetail) {
|
||||
if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) {
|
||||
echo $previousMonthResinStockDetail['balanceStock'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="celda_normal receiptStock"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
||||
oninput="receiptStockChange(this)"
|
||||
contenteditable="true"> <?= ' ' ?> </td>
|
||||
|
||||
<td class="celda_normal usedStock"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
||||
oninput="usedStockChange(this)"
|
||||
contenteditable="true"> <?= ' ' ?> </td>
|
||||
|
||||
<td class="celda_normal balanceStock"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
|
||||
|
||||
<?php
|
||||
foreach ($previousMonthResinStockDetails as $index => $previousMonthResinStockDetail) {
|
||||
if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) {
|
||||
echo $previousMonthResinStockDetail['balanceStock'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
|
||||
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
|
||||
<b> Total </b>
|
||||
</td>
|
||||
<?php endif; ?>
|
||||
|
||||
<td class="celda_normal" style="display:none">
|
||||
<?= $dateInMonth ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal" style="display:none"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
|
||||
<?= $resinMaterial['MaterialCode'] ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal customer" style="display:none"
|
||||
data-materialCode="<?= $resinMaterial['MaterialCode'] ?>"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
|
||||
<?= $resinMaterial['customers'] ?>
|
||||
</td>
|
||||
|
||||
<td class="celda_normal openingStock"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
||||
<?php if ($datesInMonthIndex == 0) { ?>
|
||||
|
||||
oninput="openingStockChange(this)"
|
||||
contenteditable="true"
|
||||
|
||||
<?php } ?>>
|
||||
|
||||
<?php
|
||||
foreach ($previousMonthResinStockDetails as $index => $previousMonthResinStockDetail) {
|
||||
if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) {
|
||||
echo $previousMonthResinStockDetail['balanceStock'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
|
||||
<td class="celda_normal receiptStock"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
||||
oninput="receiptStockChange(this)"
|
||||
contenteditable="true"> <?= ' ' ?> </td>
|
||||
|
||||
<td class="celda_normal usedStock"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>"
|
||||
oninput="usedStockChange(this)"
|
||||
contenteditable="true"> <?= ' ' ?> </td>
|
||||
|
||||
<td class="celda_normal balanceStock"
|
||||
data-id="<?= $dateInMonth ?> <?= $resinMaterial['MaterialCode'] ?>">
|
||||
|
||||
<?php
|
||||
foreach ($previousMonthResinStockDetails as $index => $previousMonthResinStockDetail) {
|
||||
if ($previousMonthResinStockDetail['materialCode'] == $resinMaterial['MaterialCode']) {
|
||||
echo $previousMonthResinStockDetail['balanceStock'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
|
||||
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
|
||||
<b> Total </b>
|
||||
</td>
|
||||
|
||||
<?php foreach ($resinMaterials as $each) { ?>
|
||||
<?php foreach ($resinMaterials as $each) { ?>
|
||||
|
||||
|
||||
<td class="celda_normal openingStock"
|
||||
data-id="footer <?=$each['MaterialCode']?>"></td>
|
||||
<td class="celda_normal receiptStock"
|
||||
data-id="footer <?=$each['MaterialCode']?>"></td>
|
||||
<td class="celda_normal usedStock"
|
||||
data-id="footer <?=$each['MaterialCode']?>"></td>
|
||||
<td class="celda_normal balanceStock"
|
||||
data-id="footer <?=$each['MaterialCode']?>"></td>
|
||||
<td class="celda_normal openingStock"
|
||||
data-id="footer <?=$each['MaterialCode']?>"></td>
|
||||
<td class="celda_normal receiptStock"
|
||||
data-id="footer <?=$each['MaterialCode']?>"></td>
|
||||
<td class="celda_normal usedStock"
|
||||
data-id="footer <?=$each['MaterialCode']?>"></td>
|
||||
<td class="celda_normal balanceStock"
|
||||
data-id="footer <?=$each['MaterialCode']?>"></td>
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
</tr>
|
||||
</tfoot>
|
||||
</tr>
|
||||
</tfoot>
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
</tbody>
|
||||
|
||||
@ -712,16 +712,16 @@ $timeOtions[] = "12:00 AM";
|
||||
?>
|
||||
|
||||
<?php foreach ($trpProductionDetails as $trpProductionDetailIndex => $trpProductionDetail) {
|
||||
$currentDate = date('d-m-Y');
|
||||
$currentDate = date('Y-m-d');
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $trpProductionDetail['date'])->format('d-m-Y');
|
||||
?>
|
||||
?>
|
||||
|
||||
<tr id="<?= $trpProductionDetail['date'] ?>" class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr id="<?= $trpProductionDetail['date'] ?>" class="<?=$trpProductionDetail['date'] > $currentDate ? "hidden-row" : "" ?>"
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
if ($trpProductionDetail['date'] === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>>
|
||||
@ -1152,6 +1152,7 @@ $timeOtions[] = "12:00 AM";
|
||||
'waterReceipt' => 0,
|
||||
'waterConsumption' => 0,
|
||||
'ebReading' => 0,
|
||||
'noOfEbReadingDays' => 0,
|
||||
'ebReadingPerUnitTon' => 0,
|
||||
'workingPersonEngineers' => 0,
|
||||
'workingPersonSupervisiors' => 0,
|
||||
@ -1214,6 +1215,8 @@ $timeOtions[] = "12:00 AM";
|
||||
$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;
|
||||
@ -1442,10 +1445,9 @@ $timeOtions[] = "12:00 AM";
|
||||
<!-- td:eq(38) -->
|
||||
<td class="celda_normal ebReadingPerUnitTon"
|
||||
data-id="footer ebReadingPerUnitTon">
|
||||
<?= $summary['ebReadingPerUnitTon'] ?>
|
||||
<?= number_format($summary['ebReadingPerUnitTon'] / ($summary['noOfEbReadingDays'] ?? 1 ),2) ?>
|
||||
</td>
|
||||
|
||||
|
||||
<!-- workingPersonEngineers -->
|
||||
<!-- td:eq(39) -->
|
||||
<td class="celda_normal workingPersonEngineers"
|
||||
@ -1703,7 +1705,7 @@ $timeOtions[] = "12:00 AM";
|
||||
[
|
||||
'absDate' => $trpAbstract["Power Consumption"]['date'],
|
||||
'absParticulars' => "Power Consumption",
|
||||
'absRunningHrs' => $summary['ebReadingPerUnitTon'] == 0 ? " " : $summary['ebReadingPerUnitTon'],
|
||||
'absRunningHrs' => $summary['ebReadingPerUnitTon'] / ($summary['noOfEbReadingDays'] ?? 1 ) == 0 ? " " : number_format($summary['ebReadingPerUnitTon'] / ($summary['noOfEbReadingDays'] ?? 1 ),2),
|
||||
'absPerHour' => "",
|
||||
'absOpeningStock' => (int)$trpAbstract["Power Consumption"]['opening_stock'] == 0 ? " " : (int)$trpAbstract["Power Consumption"]['opening_stock'],
|
||||
'absReceipt' => '',
|
||||
@ -1863,7 +1865,7 @@ $timeOtions[] = "12:00 AM";
|
||||
[
|
||||
|
||||
'absParticulars' => "Power Consumption",
|
||||
'absRunningHrs' => $summary['ebReadingPerUnitTon'] == 0 ? " " : $summary['ebReadingPerUnitTon'],
|
||||
'absRunningHrs' => $summary['ebReadingPerUnitTon'] / ($summary['noOfEbReadingDays'] ?? 1 ) == 0 ? " " : number_format($summary['ebReadingPerUnitTon'] / ($summary['noOfEbReadingDays'] ?? 1 ) , 2),
|
||||
'absPerHour' => "",
|
||||
'absOpeningStock' => '',
|
||||
'absReceipt' => '',
|
||||
|
||||
@ -514,12 +514,11 @@
|
||||
|
||||
foreach ($trpSandUseStockDetails as $trpSandUseStockDetailsIndex => $trpSandUseStockDetail) {
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $trpSandUseStockDetail['date'])->format('d-m-Y');
|
||||
?>
|
||||
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$trpSandUseStockDetail['date'] > $currentDate ? "hidden-row" : "" ?>"
|
||||
<?php
|
||||
if($dateInMonthDmYFormat === $currentDate) {
|
||||
if($trpSandUseStockDetail['date'] === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>
|
||||
@ -614,14 +613,13 @@
|
||||
}
|
||||
|
||||
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
|
||||
$currentDate = date('d-m-Y');
|
||||
$dateInMonthDmYFormat = date("d-m-Y", strtotime($dateInMonth));
|
||||
$currentDate = date('Y-m-d');
|
||||
?>
|
||||
|
||||
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
|
||||
<tr class="<?=$dateInMonth > $currentDate ? "hidden-row" : "" ?>"
|
||||
|
||||
<?php
|
||||
if ($dateInMonthDmYFormat === $currentDate) {
|
||||
if ($dateInMonth === $currentDate) {
|
||||
echo 'style="background: #cef0ad;"';
|
||||
}
|
||||
?>>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user