stock changes 18-04-2025

This commit is contained in:
vadivelJ96 2025-04-18 18:16:52 +05:30
parent 09c70db2be
commit 5973000586
12 changed files with 491 additions and 259 deletions

View File

@ -1011,7 +1011,7 @@ class StockController extends BaseController
->join(
'(SELECT date,
SUM(totalGasconsumption) AS coatingMachineGasconsumption,
SUM(totalCoatingSandInKg) / 1000 AS coatedSand
SUM(totalCoatingSandInKg) AS coatedSand
FROM t_coatingmachinedetails
WHERE is_active = 1
AND date >= ' . $this->db->escape($startDate) . '
@ -1369,27 +1369,49 @@ class StockController extends BaseController
//possible if no filter applied at all...!!!
if(empty($existingCustomMachineCodes)){
//no filter applied at all just present all active material codes
$existingCustomMachineCodes = $this ->factoryMachine_model
->getAllActiveDieselMachines() ;
//add this active products in monthwisemachine stock table
$inserts = [];
foreach($existingCustomMachineCodes as $index => $customisedMachineCode){
//no filter applied at all just present previous month material codes
$previousMonth = date('Y-m-01', strtotime('-1 month', strtotime("$month-01")));
$previousMonthCustomMachineCodes = $this->monthWiseMachineInStockModel
->select('machine_id')
->where('date',"$previousMonth")
->where('machine_category','diesel')
->get()
->getResultArray();
if(!empty($previousMonthCustomMachineCodes)){
$existingCustomMachineCodes = $this->factoryMachine_model
->getSelectedDieselMachines(array_column($previousMonthCustomMachineCodes, 'machine_id'));
}else{
// inserting all active if no previous month present
$existingCustomMachineCodes = $this ->factoryMachine_model
->getAllActiveDieselMachines();
//add this active products in monthwisemachine stock table
$inserts = [];
foreach($existingCustomMachineCodes as $index => $customisedMachineCode){
$inserts [] = [
'date' => "$month-01",
'machine_category' => "diesel",
'machine_id' => $customisedMachineCode['id']
];
}
if(!empty($inserts)){
//insert all the latest applied filter
$this->monthWiseMachineInStockModel->insertBatch($inserts);
}
$inserts [] = [
'date' => "$month-01",
'machine_category' => "diesel",
'machine_id' => $customisedMachineCode['id']
];
}
if(!empty($inserts)){
//insert all the latest applied filter
$this->monthWiseMachineInStockModel->insertBatch($inserts);
}
}else{
//if filter present,get that material codes
$existingCustomMachineCodes = $this->factoryMachine_model
@ -1816,7 +1838,24 @@ class StockController extends BaseController
//possible if no filter applied at all...!!!
if(empty($existingCustomMachineCodes) ){
//no filter applied at all just present all active material codes
//no filter applied at all just present previous month material codes
$previousMonth = date('Y-m-01', strtotime('-1 month', strtotime("$month-01")));
$previousMonthCustomMachineCodes = $this->monthWiseMachineInStockModel
->select('machine_id')
->where('date',"$previousMonth")
->where('machine_category','electric')
->get()
->getResultArray();
if(!empty($previousMonthCustomMachineCodes)){
$existingCustomMachineCodes = $this->factoryMachine_model
->getSelectedDieselMachines(array_column($previousMonthCustomMachineCodes, 'machine_id'));
}else{
// inserting all active if no previous month present
$existingCustomMachineCodes = $this->factoryMachine_model
->getAllActiveElectricMachines();
@ -1839,7 +1878,7 @@ class StockController extends BaseController
$this->monthWiseMachineInStockModel->insertBatch($inserts);
}
}
}else{
@ -2372,11 +2411,25 @@ class StockController extends BaseController
//possible if no filter applied at all...!!!
if(empty($existingCustomMaterialCodes)){
//no filter applied at all just present all active material codes
$existingCustomMaterialCodes = $this->rawmaterialdetails_model->getAllResinMaterialCode();
//no filter applied at all just present previous month material codes
$previousMonth = date('Y-m-01', strtotime('-1 month', strtotime("$month-01")));
$previousMonthCustomMachineCodes = $this->monthWiseMaterialInStockModel
->select('materialCode')
->where('date',"$previousMonth")
->where('stock_category','resin')
->get()
->getResultArray();
if(!empty($previousMonthCustomMachineCodes)){
$existingCustomMaterialCodes = $this->rawmaterialdetails_model
->getSelectedResinMaterialCode(array_column($previousMonthCustomMachineCodes, 'materialCode'));
}else{
// inserting all active if no previous month present
$existingCustomMaterialCodes = $this->rawmaterialdetails_model->getAllResinMaterialCode();
//if no filter already exists or removed current one , just add current filter for that month ....!!
$inserts = [];
foreach($existingCustomMaterialCodes as $index => $customisedMaterialCode){
@ -2394,6 +2447,7 @@ class StockController extends BaseController
$this->monthWiseMaterialInStockModel->insertBatch($inserts) ;
}
}
}else{
@ -2787,11 +2841,28 @@ class StockController extends BaseController
//possible if no filter applied at all...!!!
if(empty($existingCustomMaterialCodes)){
//no filter applied at all just present all active material codes
//no filter applied at all just present previous month material codes
$previousMonth = date('Y-m-01', strtotime('-1 month', strtotime("$month-01")));
$previousMonthCustomMachineCodes = $this->monthWiseMaterialInStockModel
->select('materialCode')
->where('date',"$previousMonth")
->where('stock_category','packing_material')
->get()
->getResultArray();
if(!empty($previousMonthCustomMachineCodes)){
$existingCustomMaterialCodes = $this->rawmaterialdetails_model
->getSelectedResinMaterialCode(array_column($previousMonthCustomMachineCodes, 'materialCode'));
}else{
// inserting all active if no previous month present
$existingCustomMaterialCodes = $this->rawmaterialdetails_model
->getAllBagMaterialCode();
//if no filter already exists or removed current one , just add current filter for that month ....!!
//if no filter already exists or removed current one , just add current filter for that month ....!!
$inserts = [];
foreach($existingCustomMaterialCodes as $index => $customisedMaterialCode){
@ -2809,6 +2880,8 @@ class StockController extends BaseController
$this->monthWiseMaterialInStockModel->insertBatch($inserts) ;
}
}
}else{
//if filter present,get that material codes
@ -2949,17 +3022,60 @@ class StockController extends BaseController
// getting customer for creating table headers
// checking already existing stock if yes then get customer from the existing stock
// if not set customer as '' empty string
// Collect all material codes to query in one go
$materialCodes = array_column($bagMaterials, 'MaterialCode');
// Get current month customers in bulk
$currentCustomers = $this->bagStockDetails_model
->select('materialCode, customer')
->where('date >=', $startDate)
->where('date <=', $endDate)
->whereIn('materialCode', $materialCodes)
->findAll();
// Map them as materialCode => customer
$currentCustomerMap = [];
foreach ($currentCustomers as $row) {
$currentCustomerMap[$row['materialCode']] = $row['customer'];
}
// Get previous month customers in bulk
$previousStartDate = date('Y-m-01', strtotime('-1 month', strtotime($startDate)));
$previousEndDate = date('Y-m-t', strtotime('-1 month', strtotime($startDate)));
$previousCustomers = $this->bagStockDetails_model
->select('materialCode, customer')
->where('date >=', $previousStartDate)
->where('date <=', $previousEndDate)
->whereIn('materialCode', $materialCodes)
->findAll();
// Map them as materialCode => customer
$previousCustomerMap = [];
foreach ($previousCustomers as $row) {
$previousCustomerMap[$row['materialCode']] = $row['customer'];
}
// Now merge this data efficiently
foreach ($bagMaterials as $key => $bagMaterial) {
$materialCode = $bagMaterial['MaterialCode'];
$bagMaterials[$key]['customers'] = $this->bagStockDetails_model
->select('customer')
->where('date >=', $startDate)
->where('date <=', $endDate)
->where('materialCode', $materialCode)
->first()['customer'] ?? '';
// First, check in current month
$customer = $currentCustomerMap[$materialCode] ?? '';
// If not found or empty/blank, check in previous month
if (trim($customer) === '') {
$customer = $previousCustomerMap[$materialCode] ?? '';
}
// Set final customer value
$bagMaterials[$key]['customers'] = $customer;
}
// Sort each date's materials based on the custom order to set table header th
if (!empty($customisedMaterialCodes)) {
@ -2984,6 +3100,8 @@ class StockController extends BaseController
}
// dd($bagMaterials);
$bagMaterialcount = count($bagMaterials);

View File

@ -335,7 +335,11 @@
</div>
</div>
<?php if (session()->getFlashdata('error')): ?>
<?php
use PhpOffice\PhpSpreadsheet\Reader\Xml\Style\NumberFormat;
if (session()->getFlashdata('error')): ?>
<div class="alert alert-danger">
<?= session()->getFlashdata('error'); ?>
</div>
@ -999,15 +1003,15 @@
<!-- td:eq(6) -->
<td class="celda_normal"><?php echo $record['grade'] ?? ' ' ?></td>
<!-- td:eq(7) -->
<td class="celda_normal"><?php echo $record['totalCoating'] ?></td>
<td class="celda_normal"><?php echo number_format((float)$record['totalCoating'],2) ?></td>
<!-- td:eq(8) -->
<td class="celda_normal"><?php echo $record['totalCoatingSandInKg'] ?></td>
<td class="celda_normal"><?php echo number_format((float)$record['totalCoatingSandInKg'],2) ?></td>
<!-- td:eq(9) -->
<td class="celda_normal"><?php echo $record['totalGasConsumption'] ?></td>
<td class="celda_normal"><?php echo number_format((float)$record['totalGasConsumption'],2) ?></td>
<!-- td:eq(10) -->
<td class="celda_normal"><?php echo round($record['perHourGasConsumption']) ?? '' ?></td>
<td class="celda_normal"><?php echo number_format($record['perHourGasConsumption'], 2) ?? '' ?></td>
<!-- td:eq(11) -->
<td class="celda_normal"><?php echo round($record['perHourCoatingSandQTY']) ?? '' ?></td>
<td class="celda_normal"><?php echo number_format($record['perHourCoatingSandQTY'] , 2) ?? '' ?></td>
<!-- td:eq(12) -->
<!-- edit and download option..!! -->
<td class="celda_normal">
@ -1077,11 +1081,11 @@
<td class="celda_normal "> <?= $summary['totalMachineRunningHrs'] ?></td>
<td class="celda_normal "> - </td>
<td class="celda_normal "> - </td>
<td class="celda_normal "><?= $summary['totalCoating'] ?></td>
<td class="celda_normal "><?= $summary['totalCoatingSandInKg'] ?></td>
<td class="celda_normal "><?= $summary['totalGasConsumption'] ?></td>
<td class="celda_normal "><?= round($summary['totalGasConsumption'] / $summary['totalMachineRunningHrs']) ?> (A)</td>
<td class="celda_normal "><?= round($summary['totalCoatingSandInKg'] / $summary['totalMachineRunningHrs']) ?> (A)</td>
<td class="celda_normal "><?= number_format($summary['totalCoating'],2) ?></td>
<td class="celda_normal "><?= number_format($summary['totalCoatingSandInKg'],2) ?></td>
<td class="celda_normal "><?= number_format($summary['totalGasConsumption'],2) ?></td>
<td class="celda_normal "><?= number_format($summary['totalGasConsumption'] / $summary['totalMachineRunningHrs'] , 2) ?> (A)</td>
<td class="celda_normal "><?= number_format($summary['totalCoatingSandInKg'] / $summary['totalMachineRunningHrs'], 2) ?> (A)</td>
</tr>
</tfoot>
@ -1715,8 +1719,10 @@
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom'
})
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
})

View File

@ -272,6 +272,11 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
@ -609,13 +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');
?>
<tr
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $bagStockDetails[0]['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
@ -730,124 +736,128 @@ 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) { ?>
<tr
<?php
<?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');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
<?php
foreach ($bagMaterials as $bagMaterialIndex => $bagMaterial) { ?>
<!-- this will loop till materials present -->
?>
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
<?php if ($bagMaterialIndex == 0): ?>
<?php
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
?>
<td class="celda_normal">
<?= $startDate ?>
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
<?php
foreach ($bagMaterials as $bagMaterialIndex => $bagMaterial) { ?>
<!-- this will loop till materials present -->
<?php if ($bagMaterialIndex == 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 ?> <?= $bagMaterial['MaterialCode'] ?>">
<?= $bagMaterial['MaterialCode'] ?>
</td>
<td class="celda_normal customer" style="display:none"
data-materialCode="<?= $bagMaterial['MaterialCode'] ?>"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>">
<?= $bagMaterial['customers'] ?>
</td>
<td class="celda_normal openingStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
<?php if ($datesInMonthIndex == 0) { ?>
oninput="openingStockChange(this)"
contenteditable="true"
<?php } ?>>
<?php
foreach ($previousMonthBagStockDetails as $index => $previousMonthBagStockDetail) {
if ($previousMonthBagStockDetail['materialCode'] == $bagMaterial['MaterialCode']) {
echo $previousMonthBagStockDetail['balanceStock'];
break;
}
}
?>
</td>
<td class="celda_normal receiptStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
oninput="receiptStockChange(this)"
contenteditable="true"> <?= " " ?> </td>
<td class="celda_normal usedStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
oninput="usedStockChange(this)" contenteditable="true"> <?= " " ?> </td>
<td class="celda_normal balanceStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>">
<?php
foreach ($previousMonthBagStockDetails as $index => $previousMonthBagStockDetail) {
if ($previousMonthBagStockDetail['materialCode'] == $bagMaterial['MaterialCode']) {
echo $previousMonthBagStockDetail['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 ?> <?= $bagMaterial['MaterialCode'] ?>">
<?= $bagMaterial['MaterialCode'] ?>
</td>
<td class="celda_normal customer" style="display:none"
data-materialCode="<?= $bagMaterial['MaterialCode'] ?>"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>">
<?= $bagMaterial['customers'] ?>
</td>
<td class="celda_normal openingStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
<?php if ($datesInMonthIndex == 0) { ?>
oninput="openingStockChange(this)"
contenteditable="true"
<?php } ?>>
<?php
foreach ($previousMonthBagStockDetails as $index => $previousMonthBagStockDetail) {
if ($previousMonthBagStockDetail['materialCode'] == $bagMaterial['MaterialCode']) {
echo $previousMonthBagStockDetail['balanceStock'];
break;
}
}
<?php foreach ($bagMaterials as $each) {
?>
</td>
<td class="celda_normal receiptStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
oninput="receiptStockChange(this)"
contenteditable="true"> <?= " " ?> </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>
<td class="celda_normal usedStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>"
oninput="usedStockChange(this)" contenteditable="true"> <?= " " ?> </td>
<?php } ?>
<td class="celda_normal balanceStock"
data-id="<?= $dateInMonth ?> <?= $bagMaterial['MaterialCode'] ?>">
<?php
foreach ($previousMonthBagStockDetails as $index => $previousMonthBagStockDetail) {
if ($previousMonthBagStockDetail['materialCode'] == $bagMaterial['MaterialCode']) {
echo $previousMonthBagStockDetail['balanceStock'];
break;
}
}
?>
</td>
<?php } ?>
</tr>
<?php } ?>
<tfoot>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<?php foreach ($bagMaterials as $each) {
?>
</tr>
</tfoot>
<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 } ?>
</tr>
</tfoot>
<?php } ?>
<?php } ?>
</tbody>
@ -1435,11 +1445,14 @@ foreach ($period as $day) {
})
$('#month').datepicker({
format: "M-yyyy", // Format as "Jan-2025"
minViewMode: 1, // Month-Year Picker
autoclose: true,
todayHighlight: true
}).on('focus', function() {
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
}).on('focus', function() {
$(this).datepicker('show'); // Ensure it opens on focus
});
});

View File

@ -260,6 +260,13 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
@ -594,17 +601,18 @@ 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');
?>
<tr
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dieselStockDetails[0]['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>
>
<?php
@ -847,13 +855,16 @@ foreach ($period as $day) {
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?>
<tr
<?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
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
@ -1921,8 +1932,12 @@ foreach ($period as $day) {
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom'
})
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script>
<script>

View File

@ -968,8 +968,9 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
$summary['input_sand_qty'] += $a['input_sand_qty'] == "-" ? 0 : (float) $a['input_sand_qty'];
$summary['moisture_loss_qty'] += $a['moisture_loss_qty'] == "-" ? 0 : (float) $a['moisture_loss_qty'];
$summary['sand_dried_qty'] += $a['sand_dried_qty'] == "-" ? 0 : (float) $a['sand_dried_qty'];
$summary['gas_per_ton'] = round(($summary['total_gas_consumption'] / $summary['sand_dried_qty']));
$summary['qty_per_hrs'] = round( ($summary['sand_dried_qty'] / $summary['drier_running_hours']) );
$summary['gas_per_ton'] = number_format(($summary['total_gas_consumption'] / $summary['sand_dried_qty']), 2);
$summary['qty_per_hrs'] = number_format(($summary['sand_dried_qty'] / $summary['drier_running_hours']), 2);
$summary['dust_qty'] += $a['dust_qty'] == "-" ? 0 : (float) $a['dust_qty'];
} ?>

View File

@ -297,6 +297,12 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
@ -523,11 +529,12 @@
$summary = [];
foreach ($dustAndRoughStockDetails as $dustAndRoughStockDetailsIndex => $dustAndRoughStockDetail) {
?>
<tr
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dustAndRoughStockDetail['date'])->format('d-m-Y');
?>
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dustAndRoughStockDetail['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
@ -602,11 +609,12 @@
}
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
?>
<tr
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = date("d-m-Y", strtotime($dateInMonth));
?>
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
<?php
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
@ -994,12 +1002,14 @@
$(document).ready(function() {
$('#month').datepicker({
format: "M-yyyy", // Format as "Jan-2025"
minViewMode: 1, // Month-Year Picker
autoclose: true,
todayHighlight: true,
orientation: "auto" // Adjusts automatically, or use "top" / "bottom"
}).on('focus', function() {
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
}).on('focus', function() {
$(this).datepicker('show'); // Ensure it opens on focus
});
});

View File

@ -280,6 +280,12 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
<div class="content-page">
<div class="content">
@ -337,9 +343,7 @@
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control "
data-provide="datepicker"
data-date-format="M-yyyy"
data-date-min-view-mode="1" readonly>
readonly>
</div>
@ -486,9 +490,9 @@
<!-- gas stock details stored -->
<th class="celda_encabezado_general">Consumption </th>
<th class="celda_encabezado_general">Sand Dried Qty </th>
<th class="celda_encabezado_general">Sand Dried Qty(MT) </th>
<th class="celda_encabezado_general">Consumption</th>
<th class="celda_encabezado_general">Sand Coated Qty </th>
<th class="celda_encabezado_general">Sand Coated Qty(Kg) </th>
<th class="celda_encabezado_general">Panel Consumption</th>
<th class="celda_encabezado_general">Physical Consumption</th>
<th class="celda_encabezado_general">Ton </th>
@ -500,21 +504,22 @@
</thead>
<tbody style="background-color: #fff;">
<?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')
?>
<!-- implementing date highlighter -->
<tr
<tr class="<?=$date > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
if ($date === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
if ($date === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>
>
<!-- td:eq(0) -->
<td class="celda_normal"><?= $date ?? '-' ?></td>
@ -726,17 +731,17 @@
}
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = Datetime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
?>
<!-- implementing date highlighter -->
<tr
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
@ -1414,6 +1419,15 @@
$('#month').change(function() {
$('#changeMonthForm').submit();
})
$('#month').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
})
</script>

View File

@ -325,9 +325,6 @@
<input type="text" name="month" id="month" value="<?php echo "$month" ?>"
class="form-control "
data-provide="datepicker"
data-date-format="M-yyyy"
data-date-min-view-mode="1"
readonly>
<input type="hidden" name="remark" id="remark" value="<?php echo $remark ?>">
@ -1979,6 +1976,15 @@
$('#month').change(function() {
$('#changeMonthForm').submit();
})
$('#month').datepicker({
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
})
</script>

View File

@ -266,6 +266,11 @@
/* Replace with your table's actual ID or selector */
border-collapse: collapse;
}
.hidden-row {
display: none;
}
</style>
@ -605,15 +610,14 @@ 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');
?>
<tr
?>
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $powerStockDetails[0]['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
@ -869,17 +873,20 @@ foreach ($period as $day) {
<?php } else { ?>
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?>
<tr
<?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
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
?>
>
<?php
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
@ -1799,8 +1806,10 @@ foreach ($period as $day) {
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom'
})
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script>

View File

@ -265,6 +265,13 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
@ -590,21 +597,28 @@ foreach ($period as $day) {
<?php if (!empty($groupedResinStockDetails)) {
$summary = [];
foreach ($groupedResinStockDetails as $groupedResinStockDetailsIndex => $resinStockDetails) {
?>
<tr
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $resinStockDetails[0]['date'])->format('d-m-Y');
$backgroundColor = " ";
?>
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
<?php
if ($dateInMonthDmYFormat === $currentDate) {
$backgroundColor ="background: #cef0ad;";
}
?>
style="<?= $backgroundColor;?> ">
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $resinStockDetails[0]['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
<!-- td -->
<?php foreach ($resinStockDetails as $resinStockIndex => $resinStock) {
?>
@ -721,17 +735,25 @@ foreach ($period as $day) {
<?php } else { ?>
<?php foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) { ?>
<tr
<?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
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad ;"';
}
?>>
?>
>
<?php
// dd($resinMaterials);
foreach ($resinMaterials as $resinMaterialIndex => $resinMaterial) { ?>
@ -1145,7 +1167,7 @@ foreach ($period as $day) {
// Validate against the regex
const isValid = /^-?\d*\.?\d*$/.test(input);
if (!isValid) {
alert('Invalid input! Please enter a valid number.');
return 0;
}
@ -1409,8 +1431,10 @@ foreach ($period as $day) {
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom'
})
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script>
<script>

View File

@ -310,6 +310,11 @@
/* Replace with your table's actual ID or selector */
border-collapse: collapse;
}
.hidden-row {
display: none;
}
</style>
@ -707,15 +712,15 @@ $timeOtions[] = "12:00 AM";
?>
<?php foreach ($trpProductionDetails as $trpProductionDetailIndex => $trpProductionDetail) {
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $trpProductionDetail['date'])->format('d-m-Y');
?>
<tr id="<?= $trpProductionDetail['date'] ?>"
<tr id="<?= $trpProductionDetail['date'] ?>" class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $trpProductionDetail['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
@ -2681,8 +2686,10 @@ $timeOtions[] = "12:00 AM";
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom'
})
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
});
</script>

View File

@ -283,6 +283,11 @@
.card {
margin-bottom: 5px;
}
.hidden-row {
display: none;
}
</style>
@ -508,17 +513,17 @@
$summary = [];
foreach ($trpSandUseStockDetails as $trpSandUseStockDetailsIndex => $trpSandUseStockDetail) {
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $trpSandUseStockDetail['date'])->format('d-m-Y');
?>
<tr
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = DateTime::createFromFormat('Y-m-d', $trpSandUseStockDetail['date'])->format('d-m-Y');
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
if($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>
>
<td class="celda_normal">
<?php
@ -609,11 +614,13 @@
}
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
?>
<tr
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = date("d-m-Y", strtotime($dateInMonth));
$dateInMonthDmYFormat = date("d-m-Y", strtotime($dateInMonth));
?>
<tr class="<?=$dateInMonthDmYFormat > $currentDate ? "hidden-row" : "" ?>"
<?php
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
@ -1037,12 +1044,14 @@
$(document).ready(function() {
$('#month').datepicker({
format: "M-yyyy", // Format as "Jan-2025"
minViewMode: 1, // Month-Year Picker
autoclose: true,
todayHighlight: true,
orientation: "auto" // Adjusts automatically, or use "top" / "bottom"
}).on('focus', function() {
format: 'M-yyyy',
viewMode: 'months',
minViewMode: 'months',
autoclose: true,
orientation: 'bottom',
startDate: new Date(2025, 0), // Jan is month 0
endDate: new Date() // current date as max
}).on('focus', function() {
$(this).datepicker('show'); // Ensure it opens on focus
});
});