stock module - 28-03-2025

This commit is contained in:
vadivelJ96 2025-03-28 17:38:58 +05:30
parent a5fa744513
commit 3e7a903cc0
11 changed files with 6557 additions and 6007 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,11 +5,13 @@
.grab { .grab {
cursor: grab; /* Default open-hand cursor */ cursor: grab;
/* Default open-hand cursor */
} }
.grab:active { .grab:active {
cursor: grabbing; /* Closed-hand cursor when dragging */ cursor: grabbing;
/* Closed-hand cursor when dragging */
} }
.fht-table, .fht-table,
@ -28,14 +30,16 @@
.fht-table td:hover { .fht-table td:hover {
background-color: rgb(170, 222, 167); background-color: rgb(170, 222, 167);
color:rgb(2, 2, 2); color: rgb(2, 2, 2);
transform: scale(1.25); /* Increases size by 25% */ transform: scale(1.25);
transition: transform 0.5s ease-in-out; /* Smooth scaling effect */ /* Increases size by 25% */
transition: transform 0.5s ease-in-out;
/* Smooth scaling effect */
} }
.fht-table tr:hover { .fht-table tr:hover {
background-color: rgb(170, 222, 167); background-color: rgb(170, 222, 167);
color:rgb(2, 2, 2); color: rgb(2, 2, 2);
} }
.fht-table { .fht-table {
@ -167,7 +171,7 @@
} }
.celda_encabezado_total { .celda_encabezado_total {
background-color:#ffffff !important; background-color: #ffffff !important;
border: 1px solid #ffffff; border: 1px solid #ffffff;
color: #ffffff !important; color: #ffffff !important;
font-weight: bold; font-weight: bold;
@ -188,12 +192,14 @@
.fht-table thead { .fht-table thead {
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 20; /* Ensure the entire header stays above table rows */ z-index: 20;
background-color: #50bbd9; /* Header background color */ /* Ensure the entire header stays above table rows */
background-color: #50bbd9;
/* Header background color */
} }
.dropdown-menu { .dropdown-menu {
z-index :25 ; z-index: 25;
} }
@ -202,8 +208,10 @@
.fht-table thead th { .fht-table thead th {
position: sticky; position: sticky;
top: 0; top: 0;
z-index: 11; /* Higher than table rows but lower than first column */ z-index: 11;
background-color: #50bbd9; /* Green background */ /* Higher than table rows but lower than first column */
background-color: #50bbd9;
/* Green background */
color: #ffffff; color: #ffffff;
border: 1px solid #ddd; border: 1px solid #ddd;
padding: 10px; padding: 10px;
@ -215,7 +223,8 @@
position: sticky; position: sticky;
left: 0; left: 0;
background-color: #50bbd9; background-color: #50bbd9;
z-index: 15; /* Ensures it stays above other cells */ z-index: 15;
/* Ensures it stays above other cells */
border-right: 2px solid #ddd; border-right: 2px solid #ddd;
color: #ffffff; color: #ffffff;
} }
@ -230,28 +239,27 @@
} }
td{ td {
min-width: 100px; min-width: 100px;
max-width: 100px; max-width: 100px;
} }
tfoot tr{ tfoot tr {
background-color:rgb(235, 236, 203); background-color: rgb(235, 236, 203);
} }
body[data-layout-mode = horizontal] .container-fluid{ body[data-layout-mode=horizontal] .container-fluid {
max-width: 100%; max-width: 100%;
} }
.card-body{
padding-top : 0; .card-body {
padding-top: 0;
padding-bottom: 0; padding-bottom: 0;
} }
.card{ margin-bottom: 5px;}
.card {
margin-bottom: 5px;
}
</style> </style>
@ -325,7 +333,7 @@ foreach ($period as $day) {
<div class="col-10 text-right d-flex" style="justify-content: end;" > <div class="col-10 text-right d-flex" style="justify-content: end;">
<input type="text" id="searchInput" placeholder="Search..." <input type="text" id="searchInput" placeholder="Search..."
class="mt-2" class="mt-2"
@ -335,11 +343,11 @@ foreach ($period as $day) {
<?php <?php
if($month == date('M-Y') ){ if ($month == date('M-Y')) {
?> ?>
<i class="fa fa-cog btn-lg mt-2" <i class="fa fa-cog btn-lg mt-2"
style="font-size: x-large; cursor:pointer;" style="font-size: x-large; cursor:pointer;"
title = "Customize" title="Customize"
data-target="#customizeModalId" data-target="#customizeModalId"
data-toggle="modal"> data-toggle="modal">
@ -365,14 +373,14 @@ foreach ($period as $day) {
<i class="fe-maximize noti-icon btn-lg mt-2" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" title="Full Screen"
style="font-size: x-large; cursor:pointer;" style="font-size: x-large; cursor:pointer;"
onclick="toggleDivFullscreen()" > onclick="toggleDivFullscreen()">
</i> </i>
<i class="fas fa-save btn-lg mt-2" <i class="fas fa-save btn-lg mt-2"
title="Save" title="Save"
style="font-size: x-large; cursor:pointer;" style="font-size: x-large; cursor:pointer;"
id="saveId" > id="saveId">
</i> </i>
</div> </div>
@ -408,10 +416,10 @@ foreach ($period as $day) {
<select id="customizeHeader" class="form-control select2" onchange="addBackToList()"> <select id="customizeHeader" class="form-control select2" onchange="addBackToList()">
<option value="">Select</option> <option value="">Select</option>
<?php <?php
foreach($activeDieselMachines as $index => $activeDieselMachine){ ?> foreach ($activeDieselMachines as $index => $activeDieselMachine) { ?>
<option value="<?=$activeDieselMachine['id']?>"> <option value="<?= $activeDieselMachine['id'] ?>">
<?=$activeDieselMachine['id']?> - <?=$activeDieselMachine['machine_name']?> <?= $activeDieselMachine['id'] ?> - <?= $activeDieselMachine['machine_name'] ?>
</option> </option>
<?php <?php
@ -435,11 +443,11 @@ foreach ($period as $day) {
<?php foreach ($dieselMachines as $dieselMachine): ?> <?php foreach ($dieselMachines as $dieselMachine): ?>
<div class="sortable-item" draggable="true" id="<?= $dieselMachine['id'] ?>_container"> <div class="sortable-item" draggable="true" id="<?= $dieselMachine['id'] ?>_container">
<input type = "checkbox" <input type="checkbox"
id = "<?= $dieselMachine['id'] ?>_checkboxId" id="<?= $dieselMachine['id'] ?>_checkboxId"
name = "customisedMachineCodes[]" name="customisedMachineCodes[]"
value = "<?= $dieselMachine['id'] ?>" value="<?= $dieselMachine['id'] ?>"
onclick = "removeSelectedMaterial(this)" onclick="removeSelectedMaterial(this)"
checked> checked>
<label class="grab" for="<?= $dieselMachine['id'] ?>_checkboxId"> <label class="grab" for="<?= $dieselMachine['id'] ?>_checkboxId">
<?= $dieselMachine['id'] ?> - <?= $dieselMachine['machine_name']; ?> <?= $dieselMachine['id'] ?> - <?= $dieselMachine['machine_name']; ?>
@ -462,10 +470,58 @@ foreach ($period as $day) {
<!-- hidden fields --> <!-- hidden fields -->
<input type="hidden" name="month" value="<?php echo "$month" ?>" <input type="hidden" name="month" value="<?php echo "$month" ?>"
class="form-control mt-2" > class="form-control mt-2">
</form> </form>
<div>
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Navigation Options</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- bag Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="dieselDropdown">Select Machine</label>
<select id="dieselDropdown" class="form-control select2">
<option value="">Select Diesel</option>
<?php foreach ($dieselMachines as $dieselMachine): ?>
<option value=" <?= $dieselMachine['machine_name'] ?>">
<?= $dieselMachine['machine_name'] ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
<!-- Date Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="dateDropdown">Select Date</label>
<select id="dateDropdown" class="form-control select2">
<?php foreach ($datesInMonth as $selectDate): ?>
<?php $selectDate = DateTime::createFromFormat('Y-m-d', $selectDate)->format('d-m-Y'); ?>
<option value="<?= $selectDate ?>"><?= $selectDate ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<button class="btn btn-primary float-right" onclick="navigateToDiesel()">Navigate</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<div class="table-responsive" id="table-responsive"> <div class="table-responsive" id="table-responsive">
@ -547,20 +603,18 @@ foreach ($period as $day) {
<td class="celda_normal openingTD" <td class="celda_normal openingTD"
data-id="<?=$totalDiesel[$groupedDieselMachineStockDetailsIndex]['date']?>" data-id="<?= $totalDiesel[$groupedDieselMachineStockDetailsIndex]['date'] ?>"
<?php if ($groupedDieselMachineStockDetailsIndex == 0): ?> <?php if ($groupedDieselMachineStockDetailsIndex == 0): ?>
oninput="openingTDStockChange(this)" oninput="openingTDStockChange(this)"
contenteditable="true" contenteditable="true"
<?php endif; ?> <?php endif; ?>><?= $totalDiesel[$groupedDieselMachineStockDetailsIndex]['opening_stock'] ?? ' ' ?></td>
><?= $totalDiesel[$groupedDieselMachineStockDetailsIndex]['opening_stock'] ?? ' ' ?></td>
<td class="celda_normal purchaseTD" <td class="celda_normal purchaseTD"
data-id="<?=$totalDiesel[$groupedDieselMachineStockDetailsIndex]['date']?>" data-id="<?= $totalDiesel[$groupedDieselMachineStockDetailsIndex]['date'] ?>"
oninput="purchaseTDStockChange(this)" oninput="purchaseTDStockChange(this)"
contenteditable="true"> contenteditable="true">
@ -570,15 +624,14 @@ foreach ($period as $day) {
</td> </td>
<td class="celda_normal fillingTD" <td class="celda_normal fillingTD"
data-id="<?=$totalDiesel[$groupedDieselMachineStockDetailsIndex]['date']?>" > data-id="<?= $totalDiesel[$groupedDieselMachineStockDetailsIndex]['date'] ?>">
<?= $totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel'] ?? ' ' ?> <?= $totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel'] ?? ' ' ?>
</td> </td>
<td class="celda_normal balanceTD" <td class="celda_normal balanceTD"
data-id="<?=$totalDiesel[$groupedDieselMachineStockDetailsIndex]['date']?>" data-id="<?= $totalDiesel[$groupedDieselMachineStockDetailsIndex]['date'] ?>">
>
<?= $totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock'] ?? ' ' ?> <?= $totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock'] ?? ' ' ?>
@ -590,15 +643,15 @@ foreach ($period as $day) {
//before closing outer loop //before closing outer loop
if (!isset($summary['totalPurchaseDiesel'])) { if (!isset($summary['totalPurchaseDiesel'])) {
$summary['opening_diesel'] = '-' ; $summary['opening_diesel'] = '-';
$summary['totalPurchaseDiesel'] = 0 ; $summary['totalPurchaseDiesel'] = 0;
$summary['totalFillingDiesel'] = 0 ; $summary['totalFillingDiesel'] = 0;
$summary['balanceStock'] = 0 ; $summary['balanceStock'] = 0;
} }
$summary['totalPurchaseDiesel'] += is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel'] ) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel'] : 0 ; $summary['totalPurchaseDiesel'] += is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel']) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['purchase_diesel'] : 0;
$summary['totalFillingDiesel'] += is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel']) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel'] : 0 ; $summary['totalFillingDiesel'] += is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel']) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['total_filling_diesel'] : 0;
$summary['balanceStock'] = is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock']) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock'] : 0 ; $summary['balanceStock'] = is_numeric($totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock']) ? $totalDiesel[$groupedDieselMachineStockDetailsIndex]['balance_stock'] : 0;
?> ?>
@ -661,8 +714,7 @@ foreach ($period as $day) {
</td> </td>
<td class="celda_normal runningHours" <td class="celda_normal runningHours"
data-id="<?= $dieselStock['date'] ?> <?= $dieselStock['machine_id'] ?>" data-id="<?= $dieselStock['date'] ?> <?= $dieselStock['machine_id'] ?>">
>
<?= $dieselStock['running_hours'] ?? " " ?> <?= $dieselStock['running_hours'] ?? " " ?>
@ -685,41 +737,34 @@ foreach ($period as $day) {
// Initialize the material entry if it doesn't exist // Initialize the material entry if it doesn't exist
if (!isset($summary["machineId_$machineId"])) { if (!isset($summary["machineId_$machineId"])) {
$summary["machineId_$machineId"] = [ $summary["machineId_$machineId"] = [
'opening_reading' => "-" , 'opening_reading' => "-",
'closing_reading' => 0 , 'closing_reading' => 0,
'filling_diesel' => 0 , 'filling_diesel' => 0,
'consumption' => 0 , 'consumption' => 0,
'running_hours' => 0 , 'running_hours' => 0,
'mileage' => 0 , 'mileage' => 0,
]; ];
} }
// Sum values for the material // Sum values for the material
$summary["machineId_$machineId"]['opening_reading'] = 0 ; $summary["machineId_$machineId"]['opening_reading'] = 0;
$summary["machineId_$machineId"]['closing_reading'] = is_numeric($dieselStock['closing_reading']) ? $dieselStock['closing_reading'] : 0 ; $summary["machineId_$machineId"]['closing_reading'] = is_numeric($dieselStock['closing_reading']) ? $dieselStock['closing_reading'] : 0;
$summary["machineId_$machineId"]['filling_diesel'] += is_numeric($dieselStock['filling_diesel']) ? $dieselStock['filling_diesel'] : 0 ; $summary["machineId_$machineId"]['filling_diesel'] += is_numeric($dieselStock['filling_diesel']) ? $dieselStock['filling_diesel'] : 0;
$summary["machineId_$machineId"]['consumption'] += is_numeric($dieselStock['consumption']) ? $dieselStock['consumption'] : 0 ; $summary["machineId_$machineId"]['consumption'] += is_numeric($dieselStock['consumption']) ? $dieselStock['consumption'] : 0;
$summary["machineId_$machineId"]['running_hours'] += is_numeric($dieselStock['running_hours']) ? $dieselStock['running_hours'] : 0 ; $summary["machineId_$machineId"]['running_hours'] += is_numeric($dieselStock['running_hours']) ? $dieselStock['running_hours'] : 0;
if($summary["machineId_$machineId"]['running_hours'] > 0){ if ($summary["machineId_$machineId"]['running_hours'] > 0) {
$dieselMileage = round( $dieselMileage = round(
$summary["machineId_$machineId"]['consumption'] / $summary["machineId_$machineId"]['running_hours'], $summary["machineId_$machineId"]['consumption'] / $summary["machineId_$machineId"]['running_hours'],
2 2
); );
} else {
}else{ $dieselMileage = 0;
$dieselMileage = 0 ;
} }
$summary["machineId_$machineId"]['mileage'] = is_numeric( $dieselMileage) ? $dieselMileage : 0 ; $summary["machineId_$machineId"]['mileage'] = is_numeric($dieselMileage) ? $dieselMileage : 0;
} ?> } ?>
</tr> </tr>
@ -741,16 +786,16 @@ foreach ($period as $day) {
<td class="celda_normal "><?= $summary['totalFillingDiesel'] ?></td> <td class="celda_normal "><?= $summary['totalFillingDiesel'] ?></td>
<td class="celda_normal "><?= $summary['balanceStock'] ?></td> <td class="celda_normal "><?= $summary['balanceStock'] ?></td>
<?php foreach($summary as $each){ <?php foreach ($summary as $each) {
if(is_array($each)){ if (is_array($each)) {
?> ?>
<td class="celda_normal "><?=$each['opening_reading']?> </td> <td class="celda_normal "><?= $each['opening_reading'] ?> </td>
<td class="celda_normal "><?=$each['closing_reading']?></td> <td class="celda_normal "><?= $each['closing_reading'] ?></td>
<td class="celda_normal "><?=$each['filling_diesel']?></td> <td class="celda_normal "><?= $each['filling_diesel'] ?></td>
<td class="celda_normal "><?=$each['consumption']?></td> <td class="celda_normal "><?= $each['consumption'] ?></td>
<td class="celda_normal "><?=$each['running_hours']?></td> <td class="celda_normal "><?= $each['running_hours'] ?></td>
<td class="celda_normal "><?=$each['mileage']?></td> <td class="celda_normal "><?= $each['mileage'] ?></td>
<?php <?php
} }
@ -779,7 +824,7 @@ foreach ($period as $day) {
if ($dateInMonthDmYFormat === $currentDate) { if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"'; echo 'style="background: #cef0ad;"';
} }
?> > ?>>
<?php <?php
$startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y'); $startDate = DateTime::createFromFormat('Y-m-d', $dateInMonth)->format('d-m-Y');
@ -792,18 +837,16 @@ foreach ($period as $day) {
<td class="celda_normal openingTD" <td class="celda_normal openingTD"
data-id="<?= $dateInMonth?>" data-id="<?= $dateInMonth ?>"
<?php if ($datesInMonthIndex == 0) { ?> <?php if ($datesInMonthIndex == 0) { ?>
oninput="openingTDStockChange(this)" oninput="openingTDStockChange(this)"
contenteditable="true" contenteditable="true"
<?php } ?> <?php } ?>><?= !empty($previousMonthTotalDieselMachineStockDetails)
><?= !empty($previousMonthTotalDieselMachineStockDetails)
? $previousMonthTotalDieselMachineStockDetails[0]['balance_stock'] ? $previousMonthTotalDieselMachineStockDetails[0]['balance_stock']
:" " ; : " ";
?></td> ?></td>
@ -818,11 +861,9 @@ foreach ($period as $day) {
data-id="<?= $dateInMonth ?>"> </td> data-id="<?= $dateInMonth ?>"> </td>
<td class="celda_normal balanceTD" <td class="celda_normal balanceTD"
data-id="<?= $dateInMonth ?>" data-id="<?= $dateInMonth ?>"><?= !empty($previousMonthTotalDieselMachineStockDetails)
><?= !empty($previousMonthTotalDieselMachineStockDetails)
? $previousMonthTotalDieselMachineStockDetails[0]['balance_stock'] ? $previousMonthTotalDieselMachineStockDetails[0]['balance_stock']
:" " ; : " ";
?> ?>
</td> </td>
@ -853,20 +894,14 @@ foreach ($period as $day) {
oninput="openingReadingChange(this)" oninput="openingReadingChange(this)"
contenteditable="true" contenteditable="true"
<?php } ?> <?php } ?>>
>
<?php <?php
foreach($previousMonthDieselMachineStockDetails as $index => $previousMonthDieselMachineStockDetail) foreach ($previousMonthDieselMachineStockDetails as $index => $previousMonthDieselMachineStockDetail) {
{ if ($previousMonthDieselMachineStockDetail['machine_id'] == $dieselMachine['id']) {
if($previousMonthDieselMachineStockDetail['machine_id'] == $dieselMachine['id']){ echo $previousMonthDieselMachineStockDetail['closing_reading'];
echo $previousMonthDieselMachineStockDetail['closing_reading'] ;
break; break;
} }
} }
?> ?>
</td> </td>
@ -879,13 +914,11 @@ foreach ($period as $day) {
<?php <?php
foreach($previousMonthDieselMachineStockDetails as $index => $previousMonthDieselMachineStockDetail) foreach ($previousMonthDieselMachineStockDetails as $index => $previousMonthDieselMachineStockDetail) {
{ if ($previousMonthDieselMachineStockDetail['machine_id'] == $dieselMachine['id']) {
if($previousMonthDieselMachineStockDetail['machine_id'] == $dieselMachine['id']){ echo $previousMonthDieselMachineStockDetail['closing_reading'];
echo $previousMonthDieselMachineStockDetail['closing_reading'] ;
break; break;
} }
} }
?> ?>
@ -928,56 +961,10 @@ foreach ($period as $day) {
</div> </div>
<div>
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Navigation Options</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- bag Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="dieselDropdown">Select Machine</label>
<select id="dieselDropdown" class="form-control select2">
<option value="">Select Diesel</option>
<?php foreach ($dieselMachines as $dieselMachine): ?>
<option value=" <?= $dieselMachine['machine_name'] ?>">
<?= $dieselMachine['machine_name'] ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
<!-- Date Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="dateDropdown">Select Date</label>
<select id="dateDropdown" class="form-control select2">
<?php foreach ($datesInMonth as $selectDate): ?>
<?php $selectDate = DateTime::createFromFormat('Y-m-d', $selectDate)->format('d-m-Y'); ?>
<option value="<?= $selectDate ?>"><?= $selectDate ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<button class="btn btn-primary float-right" onclick="navigateToDiesel()">Navigate</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<script> <script>
function navigateToDiesel() { function navigateToDiesel() {
@ -1101,9 +1088,9 @@ foreach ($period as $day) {
<script> <script>
function tableToJson() { function tableToJson() {
const table = $('#dieselStockDetailsTableId'); const table = $('#dieselStockDetailsTableId');
const summaryRowPart = [] ; const summaryRowPart = [];
const readingsRowPart = []; const readingsRowPart = [];
const allRow = [] ; const allRow = [];
//this table to json is customized for dieselStock not for all //this table to json is customized for dieselStock not for all
@ -1130,7 +1117,7 @@ foreach ($period as $day) {
/** we get eight entries against a machines so we loop from 1 to 8 and so on /** we get eight entries against a machines so we loop from 1 to 8 and so on
in a single row **/ in a single row **/
for (let i = 5 ; i < rowCells.length; i += 8) { for (let i = 5; i < rowCells.length; i += 8) {
const readingsRowData = { const readingsRowData = {
date: rowCells.eq(i).text().trim(), date: rowCells.eq(i).text().trim(),
machine_id: rowCells.eq(i + 1).text().trim(), machine_id: rowCells.eq(i + 1).text().trim(),
@ -1151,16 +1138,13 @@ foreach ($period as $day) {
}); });
allRow.push(summaryRowPart ,readingsRowPart ) allRow.push(summaryRowPart, readingsRowPart)
return JSON.stringify(allRow, null, 2); return JSON.stringify(allRow, null, 2);
} }
</script> </script>
<script> <script>
function openingReadingChange(tdElement) { function openingReadingChange(tdElement) {
try { try {
@ -1170,13 +1154,13 @@ foreach ($period as $day) {
let closingReading = validateInput(document.querySelector(`td.closingReading[data-id="${dataId}"]`).innerText); let closingReading = validateInput(document.querySelector(`td.closingReading[data-id="${dataId}"]`).innerText);
let consumption = validateInput(document.querySelector(`td.consumption[data-id="${dataId}"]`).innerText); let consumption = validateInput(document.querySelector(`td.consumption[data-id="${dataId}"]`).innerText);
let runningHours = Math.abs(Number(closingReading) - Number(openingReading)); let runningHours = Math.abs(Number(closingReading) - Number(openingReading));
let mileage = consumption == 0 || runningHours == 0 ? 0 : (Number(consumption) / Number(runningHours)) ; let mileage = consumption == 0 || runningHours == 0 ? 0 : (Number(consumption) / Number(runningHours));
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = parseFloat(runningHours).toFixed(2); document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = parseFloat(runningHours).toFixed(2);
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = parseFloat(mileage).toFixed(2); document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = parseFloat(mileage).toFixed(2);
updateStockValue(date,machine_id,closingReading) updateStockValue(date, machine_id, closingReading)
} catch (error) { } catch (error) {
@ -1195,7 +1179,7 @@ foreach ($period as $day) {
let openingReading = validateInput(document.querySelector(`td.openingReading[data-id="${dataId}"]`).innerText); let openingReading = validateInput(document.querySelector(`td.openingReading[data-id="${dataId}"]`).innerText);
let consumption = validateInput(document.querySelector(`td.consumption[data-id="${dataId}"]`).innerText); let consumption = validateInput(document.querySelector(`td.consumption[data-id="${dataId}"]`).innerText);
let runningHours = Math.abs(Number(closingReading) - Number(openingReading)); let runningHours = Math.abs(Number(closingReading) - Number(openingReading));
let mileage = consumption == 0 || runningHours == 0 ? 0 : Number(consumption) / Number(runningHours) ; let mileage = consumption == 0 || runningHours == 0 ? 0 : Number(consumption) / Number(runningHours);
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = parseFloat(runningHours).toFixed(2); document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = parseFloat(runningHours).toFixed(2);
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = parseFloat(mileage).toFixed(2); document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = parseFloat(mileage).toFixed(2);
@ -1220,7 +1204,7 @@ foreach ($period as $day) {
let openingReading = validateInput(document.querySelector(`td.openingReading[data-id="${dataId}"]`).innerText); let openingReading = validateInput(document.querySelector(`td.openingReading[data-id="${dataId}"]`).innerText);
let consumption = validateInput(tdElement.innerText); let consumption = validateInput(tdElement.innerText);
let runningHours = Math.abs(Number(closingReading) - Number(openingReading)); let runningHours = Math.abs(Number(closingReading) - Number(openingReading));
let mileage = consumption == 0 || runningHours == 0 ? 0 : (Number(consumption) / Number(runningHours)) ; let mileage = consumption == 0 || runningHours == 0 ? 0 : (Number(consumption) / Number(runningHours));
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = parseFloat(runningHours).toFixed(2); document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = parseFloat(runningHours).toFixed(2);
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = parseFloat(mileage).toFixed(2); document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = parseFloat(mileage).toFixed(2);
@ -1231,8 +1215,8 @@ foreach ($period as $day) {
console.error("There is an error updating stock ..!!" + error); console.error("There is an error updating stock ..!!" + error);
} }
} }
function fillingReadingChange(tdElement) { function fillingReadingChange(tdElement) {
@ -1240,33 +1224,33 @@ foreach ($period as $day) {
try { try {
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
let [date,machine_id] = tdElement.getAttribute('data-id').split(" "); let [date, machine_id] = tdElement.getAttribute('data-id').split(" ");
let fillingDiesel = tdElement.innerText; let fillingDiesel = tdElement.innerText;
let totalFillingDiesel = 0 ; let totalFillingDiesel = 0;
let machines = <?= json_encode($dieselMachines) ?> ; let machines = <?= json_encode($dieselMachines) ?>;
machines.forEach((each)=>{ machines.forEach((each) => {
totalFillingDiesel += Number(document.querySelector(`td.fillingDiesel[data-id="${date} ${each.id}"]`).innerText totalFillingDiesel += Number(document.querySelector(`td.fillingDiesel[data-id="${date} ${each.id}"]`).innerText)
)}); });
document.querySelector(`td.fillingTD[data-id="${date}"]`).innerText = parseFloat(totalFillingDiesel).toFixed(2) ; document.querySelector(`td.fillingTD[data-id="${date}"]`).innerText = parseFloat(totalFillingDiesel).toFixed(2);
let openingTD = validateInput(document.querySelector(`td.openingTD[data-id="${date}"]`).innerText); let openingTD = validateInput(document.querySelector(`td.openingTD[data-id="${date}"]`).innerText);
let purchaseTD = validateInput(document.querySelector(`td.purchaseTD[data-id="${date}"]`).innerText); let purchaseTD = validateInput(document.querySelector(`td.purchaseTD[data-id="${date}"]`).innerText);
let balanceTD = (Number(openingTD) + Number(purchaseTD)) - Number(totalFillingDiesel) ; let balanceTD = (Number(openingTD) + Number(purchaseTD)) - Number(totalFillingDiesel);
document.querySelector(`td.balanceTD[data-id="${date}"]`).innerText = parseFloat(balanceTD).toFixed(2) ; document.querySelector(`td.balanceTD[data-id="${date}"]`).innerText = parseFloat(balanceTD).toFixed(2);
updateTotalStockValue(date, balanceTD) ; updateTotalStockValue(date, balanceTD);
@ -1281,7 +1265,7 @@ foreach ($period as $day) {
function openingTDStockChange(tdElement){ function openingTDStockChange(tdElement) {
try { try {
@ -1292,11 +1276,11 @@ foreach ($period as $day) {
let fillingTD = validateInput(document.querySelector(`td.fillingTD[data-id="${dataId}"]`).innerText); let fillingTD = validateInput(document.querySelector(`td.fillingTD[data-id="${dataId}"]`).innerText);
let balanceTD = (Number(openingTD) + Number(purchaseTD)) - Number(fillingTD) ; let balanceTD = (Number(openingTD) + Number(purchaseTD)) - Number(fillingTD);
document.querySelector(`td.balanceTD[data-id="${dataId}"]`).innerText = parseFloat(balanceTD).toFixed(2) ; document.querySelector(`td.balanceTD[data-id="${dataId}"]`).innerText = parseFloat(balanceTD).toFixed(2);
updateTotalStockValue(dataId , balanceTD) updateTotalStockValue(dataId, balanceTD)
} catch (error) { } catch (error) {
@ -1307,7 +1291,7 @@ foreach ($period as $day) {
} }
function purchaseTDStockChange(tdElement){ function purchaseTDStockChange(tdElement) {
try { try {
let dataId = tdElement.getAttribute('data-id'); let dataId = tdElement.getAttribute('data-id');
@ -1316,11 +1300,11 @@ foreach ($period as $day) {
let fillingTD = validateInput(document.querySelector(`td.fillingTD[data-id="${dataId}"]`).innerText); let fillingTD = validateInput(document.querySelector(`td.fillingTD[data-id="${dataId}"]`).innerText);
let balanceTD = validateInput(document.querySelector(`td.balanceTD[data-id="${dataId}"]`).innerText); let balanceTD = validateInput(document.querySelector(`td.balanceTD[data-id="${dataId}"]`).innerText);
balanceTD = (Number(openingTD) + Number(purchaseTD)) - Number(fillingTD) ; balanceTD = (Number(openingTD) + Number(purchaseTD)) - Number(fillingTD);
document.querySelector(`td.balanceTD[data-id="${dataId}"]`).innerText = parseFloat(balanceTD).toFixed(2) ; document.querySelector(`td.balanceTD[data-id="${dataId}"]`).innerText = parseFloat(balanceTD).toFixed(2);
updateTotalStockValue(dataId, balanceTD) ; updateTotalStockValue(dataId, balanceTD);
} catch (error) { } catch (error) {
@ -1352,16 +1336,9 @@ foreach ($period as $day) {
return input; return input;
} }
</script> </script>
<script> <script>
function updateStockValue(date, machine_id, closingReading) { function updateStockValue(date, machine_id, closingReading) {
const table = $('#dieselStockDetailsTableId'); const table = $('#dieselStockDetailsTableId');
@ -1384,7 +1361,7 @@ foreach ($period as $day) {
let dataId = `${otherDate} ${machine_id}`; let dataId = `${otherDate} ${machine_id}`;
document.querySelector(`td.openingReading[data-id="${dataId}"]`).innerText = closingReading == 0 ? " " : parseFloat(closingReading).toFixed(2) ; document.querySelector(`td.openingReading[data-id="${dataId}"]`).innerText = closingReading == 0 ? " " : parseFloat(closingReading).toFixed(2);
let openingReading = validateInput(document.querySelector(`td.openingReading[data-id="${dataId}"]`).innerText); let openingReading = validateInput(document.querySelector(`td.openingReading[data-id="${dataId}"]`).innerText);
@ -1396,13 +1373,13 @@ foreach ($period as $day) {
runningHours = Math.abs(Number(closingReading) - Number(openingReading)); runningHours = Math.abs(Number(closingReading) - Number(openingReading));
let mileage = consumption == 0 || runningHours == 0 ? 0 : (Number(consumption) / Number(runningHours)).toFixed(2) ; let mileage = consumption == 0 || runningHours == 0 ? 0 : (Number(consumption) / Number(runningHours)).toFixed(2);
document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = runningHours == 0 ? " " : (runningHours).toFixed(2) ; document.querySelector(`td.runningHours[data-id="${dataId}"]`).innerText = runningHours == 0 ? " " : (runningHours).toFixed(2);
document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = mileage == 0 ? " " : parseFloat(mileage).toFixed(2) ; document.querySelector(`td.mileage[data-id="${dataId}"]`).innerText = mileage == 0 ? " " : parseFloat(mileage).toFixed(2);
document.querySelector(`td.closingReading[data-id="${dataId}"]`).innerText = closingReading == 0 ? " " : parseFloat(closingReading).toFixed(2) ; document.querySelector(`td.closingReading[data-id="${dataId}"]`).innerText = closingReading == 0 ? " " : parseFloat(closingReading).toFixed(2);
} }
@ -1412,7 +1389,7 @@ foreach ($period as $day) {
function updateTotalStockValue(date, balanceTD){ function updateTotalStockValue(date, balanceTD) {
const table = $('#dieselStockDetailsTableId'); const table = $('#dieselStockDetailsTableId');
const rows = []; const rows = [];
@ -1434,33 +1411,31 @@ foreach ($period as $day) {
let dataId = `${otherDate}`; let dataId = `${otherDate}`;
document.querySelector(`td.openingTD[data-id="${dataId}"]`).innerText = parseFloat(balanceTD).toFixed(2) ; document.querySelector(`td.openingTD[data-id="${dataId}"]`).innerText = parseFloat(balanceTD).toFixed(2);
let openingTD = document.querySelector(`td.openingTD[data-id="${dataId}"]`).innerText; let openingTD = document.querySelector(`td.openingTD[data-id="${dataId}"]`).innerText;
let purchaseTD = document.querySelector(`td.purchaseTD[data-id="${dataId}"]`).innerText ; let purchaseTD = document.querySelector(`td.purchaseTD[data-id="${dataId}"]`).innerText;
let fillingTD = document.querySelector(`td.fillingTD[data-id="${dataId}"]`).innerText ; let fillingTD = document.querySelector(`td.fillingTD[data-id="${dataId}"]`).innerText;
balanceTD = (Number(openingTD) + Number(purchaseTD)) - Number(fillingTD) ; balanceTD = (Number(openingTD) + Number(purchaseTD)) - Number(fillingTD);
document.querySelector(`td.balanceTD[data-id="${dataId}"]`).innerText = parseFloat(balanceTD).toFixed(2) ; document.querySelector(`td.balanceTD[data-id="${dataId}"]`).innerText = parseFloat(balanceTD).toFixed(2);
} }
}) })
} }
</script> </script>
<script> <script>
$(document).ready(function() {
$(document).ready(function(){
function exportTableToExcel(tableID, filename = '') { function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID); let table = document.getElementById(tableID);
@ -1468,12 +1443,12 @@ foreach ($period as $day) {
let cloneTable = table.cloneNode(true); // Clone the table to modify let cloneTable = table.cloneNode(true); // Clone the table to modify
// Remove hidden rows // Remove hidden rows
$(cloneTable).find('tr').filter(function () { $(cloneTable).find('tr').filter(function() {
return $(this).css('display') === 'none'; return $(this).css('display') === 'none';
}).remove(); }).remove();
// Remove hidden columns // Remove hidden columns
$(cloneTable).find('th, td').each(function () { $(cloneTable).find('th, td').each(function() {
if ($(this).css('display') === 'none') { if ($(this).css('display') === 'none') {
$(this).remove(); $(this).remove();
} }
@ -1504,21 +1479,18 @@ foreach ($period as $day) {
let tableId = 'dieselStockDetailsTableId'; let tableId = 'dieselStockDetailsTableId';
document.getElementById('dieselMachineStockDetailsExport').addEventListener('click',function(){ document.getElementById('dieselMachineStockDetailsExport').addEventListener('click', function() {
exportTableToExcel(tableId,'Diesel_Machine_Stock_<?=$month?>.xlsx'); exportTableToExcel(tableId, 'Diesel_Machine_Stock_<?= $month ?>.xlsx');
}) })
}) })
</script> </script>
<script> <script>
document.addEventListener("keydown", function (event) { document.addEventListener("keydown", function(event) {
if (event.key === "Enter") { if (event.key === "Enter") {
@ -1551,13 +1523,12 @@ foreach ($period as $day) {
} }
} }
} }
}); });
</script> </script>
<script> <script>
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function() {
const list = document.getElementById("sortableList"); const list = document.getElementById("sortableList");
@ -1595,16 +1566,21 @@ foreach ($period as $day) {
const box = child.getBoundingClientRect(); const box = child.getBoundingClientRect();
const offset = y - box.top - box.height / 2; const offset = y - box.top - box.height / 2;
return offset < 0 && offset > closest.offset return offset < 0 && offset > closest.offset ?
? { offset, element: child } {
: closest; offset,
}, { offset: Number.NEGATIVE_INFINITY }).element; element: child
} :
closest;
}, {
offset: Number.NEGATIVE_INFINITY
}).element;
} }
// Attach drag events to existing items // Attach drag events to existing items
document.querySelectorAll(".sortable-item").forEach(attachDragEvents); document.querySelectorAll(".sortable-item").forEach(attachDragEvents);
window.removeSelectedMaterial = function (checkbox) { window.removeSelectedMaterial = function(checkbox) {
let container = checkbox.closest(".sortable-item"); let container = checkbox.closest(".sortable-item");
let materialCode = checkbox.value; let materialCode = checkbox.value;
let materialName = container.querySelector("label").innerText; let materialName = container.querySelector("label").innerText;
@ -1612,7 +1588,7 @@ foreach ($period as $day) {
container.remove(); container.remove();
}; };
window.addBackToList = function () { window.addBackToList = function() {
let dropdown = document.getElementById("customizeHeader"); let dropdown = document.getElementById("customizeHeader");
let selectedOption = dropdown.options[dropdown.selectedIndex]; let selectedOption = dropdown.options[dropdown.selectedIndex];
@ -1636,20 +1612,18 @@ foreach ($period as $day) {
document.getElementById("sortableList").appendChild(container); document.getElementById("sortableList").appendChild(container);
} }
}; };
}); });
</script> </script>
<script> <script>
$(document).ready(function(){ $(document).ready(function() {
$('#customizeHeader').select2(); $('#customizeHeader').select2();
$('.select2').select2(); $('.select2').select2();
}) })
</script> </script>
<script> <script>
$('#month').change(function(){ $('#month').change(function() {
$('#changeMonthForm').submit(); $('#changeMonthForm').submit();
}) })
@ -1691,15 +1665,62 @@ foreach ($period as $day) {
} }
}).catch(err => console.log("Error exiting fullscreen:", err)); }).catch(err => console.log("Error exiting fullscreen:", err));
} }
} }
$("#searchInput").on("keyup", function () { $("#searchInput").on("keyup", function() {
let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search
$(".table-responsive tbody tr").filter(function () { $(".table-responsive tbody tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1); $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
}); });
}); });
</script>
<script>
$(document).ready(function() {
$('.select2').select2({
dropdownParent: $('#fullscreenDiv')
});
// Initialize Select2 when the modal is shown inside full screen
$('#bs-example-modal-lg').on('shown.bs.modal', function() {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
$('#customizeModalId').on('shown.bs.modal', function() {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
});
</script>
<script>
//getting modal backdrop inside full screen
$(document).ready(function() {
function moveModalBackdropToFullscreen() {
setTimeout(() => {
$('.modal-backdrop').appendTo('#fullscreenDiv'); // Move backdrop inside fullscreen
}, 10); // Small delay ensures backdrop is created first
}
// Move the modal backdrop when a modal opens
$('#bs-example-modal-lg, #customizeModalId').on('show.bs.modal', function() {
moveModalBackdropToFullscreen();
});
// Ensure modals work properly in fullscreen mode
document.addEventListener("fullscreenchange", function() {
setTimeout(() => {
$('.modal-backdrop').remove(); // Remove any existing backdrops
moveModalBackdropToFullscreen();
}, 200);
});
});
</script> </script>

File diff suppressed because it is too large Load Diff

View File

@ -18,11 +18,13 @@
} }
.grab { .grab {
cursor: grab; /* Default open-hand cursor */ cursor: grab;
/* Default open-hand cursor */
} }
.grab:active { .grab:active {
cursor: grabbing; /* Closed-hand cursor when dragging */ cursor: grabbing;
/* Closed-hand cursor when dragging */
} }
/* .fht-table td[contenteditable="true"] { /* .fht-table td[contenteditable="true"] {
@ -32,14 +34,16 @@
.fht-table td:hover { .fht-table td:hover {
background-color: rgb(170, 222, 167); background-color: rgb(170, 222, 167);
color:rgb(2, 2, 2); color: rgb(2, 2, 2);
transform: scale(1.25); /* Increases size by 25% */ transform: scale(1.25);
transition: transform 0.5s ease-in-out; /* Smooth scaling effect */ /* Increases size by 25% */
transition: transform 0.5s ease-in-out;
/* Smooth scaling effect */
} }
.fht-table tr:hover { .fht-table tr:hover {
background-color: rgb(170, 222, 167); background-color: rgb(170, 222, 167);
color:rgb(2, 2, 2); color: rgb(2, 2, 2);
} }
.fht-table { .fht-table {
@ -239,20 +243,36 @@
} }
/* Adjust heights based on screen zoom */ /* Adjust heights based on screen zoom */
@media only screen and (min-height: 1400px) { /* Approximate Zoom < 100% */ @media only screen and (min-height: 1400px) {
.table-responsive { max-height: 425px; }
/* Approximate Zoom < 100% */
.table-responsive {
max-height: 425px;
}
} }
@media only screen and (min-height: 1200px) { /* Approximate Zoom ~ 90% */ @media only screen and (min-height: 1200px) {
.table-responsive { max-height: 500px; }
/* Approximate Zoom ~ 90% */
.table-responsive {
max-height: 500px;
}
} }
@media only screen and (min-height: 1000px) { /* Approximate Zoom ~ 80% */ @media only screen and (min-height: 1000px) {
.table-responsive { max-height: 600px; }
/* Approximate Zoom ~ 80% */
.table-responsive {
max-height: 600px;
}
} }
@media only screen and (min-height: 800px) { /* Approximate Zoom ~ 75% */ @media only screen and (min-height: 800px) {
.table-responsive { max-height: 650px; }
/* Approximate Zoom ~ 75% */
.table-responsive {
max-height: 650px;
}
} }
td { td {
@ -261,23 +281,22 @@
} }
tfoot tr { tfoot tr {
background-color:rgb(235, 236, 203); background-color: rgb(235, 236, 203);
} }
body[data-layout-mode = horizontal] .container-fluid{ body[data-layout-mode=horizontal] .container-fluid {
max-width: 100%; max-width: 100%;
} }
.card-body{ .card-body {
padding-top : 0; padding-top: 0;
padding-bottom : 0; padding-bottom: 0;
} }
.card{ margin-bottom: 5px;} .card {
margin-bottom: 5px;
}
</style> </style>
@ -308,13 +327,13 @@
<div class="row" align="center"> <div class="row" >
<div class="col-12"> <div class="col-12">
<div class="card" id="fullscreenDiv"> <div class="card" id="fullscreenDiv">
<div class="card-body" > <div class="card-body">
<form id="changeMonthForm" action="<?= base_url('dustAndRoughStockDetails'); ?>" method="post"> <form align="center" id="changeMonthForm" action="<?= base_url('dustAndRoughStockDetails'); ?>" method="post">
<div class="row"> <div class="row">
@ -336,7 +355,7 @@
<div class="col-3 text-right d-flex" style="justify-content: end;" > <div class="col-3 text-right d-flex" style="justify-content: end;">
<input type="text" id="searchInput" placeholder="Search..." <input type="text" id="searchInput" placeholder="Search..."
class="mt-2" class="mt-2"
@ -361,15 +380,14 @@
<i class="fe-maximize noti-icon btn-lg mt-2" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" title="Full Screen"
style="font-size: x-large; cursor:pointer;" style="font-size: x-large; cursor:pointer;"
onclick="toggleDivFullscreen()" > onclick="toggleDivFullscreen()">
</i> </i>
<i class="fa fa-save btn-lg mt-2" <i class="fa fa-save btn-lg mt-2"
title="Save" title="Save"
style="font-size: x-large; cursor:pointer;" style="font-size: x-large; cursor:pointer;"
id="saveId" id="saveId">
>
</i> </i>
@ -382,179 +400,8 @@
</div> </div>
</form> </form>
<!-- filter modal -->
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
<div class="table-responsive" id="table-responsive">
<table style="width: 700px;" id="dustAndRoughStockDetailsTableId" class="fht-table ">
<thead class="celda_encabezado_general" style="padding: 10px;">
<tr>
<th
style="width: 100px;"
class="celda_encabezado_general" rowspan="2" colspan="1">Date </th>
<th class="celda_encabezado_general" colspan="1">Final Rough </th>
<th class="celda_encabezado_general" colspan="1">Dust </th>
<th class="celda_encabezado_general" rowspan="2" colspan="1">Total </th>
</tr>
<tr>
<th class="celda_encabezado_general" colspan="1">+16 Mesh </th>
<th class="celda_encabezado_general" colspan="1">10 Ton Dryer </th>
</tr>
</thead>
<tbody style="background-color: #fff;" >
<?php
if(!empty($dustAndRoughStockDetails)){
$summary = [] ;
foreach($dustAndRoughStockDetails as $dustAndRoughStockDetailsIndex => $dustAndRoughStockDetail){
?>
<tr
<?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;"';}
?>
>
<td class="celda_normal">
<?php
echo date("d-m-Y", strtotime($dustAndRoughStockDetail['date']));
?>
</td>
<td class="celda_normal finalRough"
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
oninput="finalRoughStockChange(this)"
contenteditable="true"
><?= $dustAndRoughStockDetail['finalRough'] ?? ' ' ?></td>
<td class="celda_normal dust"
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
oninput="dustStockChange(this)"
contenteditable="true"
><?= $dustAndRoughStockDetail['dust'] ?? ' ' ?></td>
<td class="celda_normal total"
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
><?= $dustAndRoughStockDetail['total'] ?? ' ' ?></td>
</tr>
<?php
//before closing inner loop
if (!isset($summary['finalRough'])) {
$summary['finalRough'] = 0 ;
$summary['dust'] = 0 ;
$summary['total'] = 0 ;
}
$summary['finalRough'] += $dustAndRoughStockDetail['finalRough'] == "-" ? 0 : (float) $dustAndRoughStockDetail['finalRough'] ;
$summary['dust'] += $dustAndRoughStockDetail['dust'] == "-" ? 0 : (float) $dustAndRoughStockDetail['dust'] ;
$summary['total'] += $dustAndRoughStockDetail['total'] == "-" ? 0 : (float) $dustAndRoughStockDetail['total'] ;
} ?>
<tfoot>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;"> Total </td>
<td class="celda_normal "> <b> <?=$summary['finalRough']?> </b> </td>
<td class="celda_normal "> <b> <?=$summary['dust']?> </b> </td>
<td class="celda_normal "> <b> <?=$summary['total']?> </b> </td>
</tr>
</tfoot>
<?php }else{
$date = DateTime::createFromFormat('M-Y', $month);
$startDate = $date->modify('first day of this month')->format('Y-m-d');
$endDate = $date->modify('last day of this month')->format('Y-m-d');
$datesInMonth = [];
$period = new DatePeriod(
new DateTime($startDate),
new DateInterval('P1D'),
(new DateTime($endDate))->modify('+1 day')
);
foreach ($period as $day) {
$datesInMonth[] = $day->format('Y-m-d');
}
foreach($datesInMonth as $datesInMonthIndex => $dateInMonth){
?>
<tr
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat=date("d-m-Y", strtotime($dateInMonth));
if ($dateInMonthDmYFormat === $currentDate) { echo 'style="background: #cef0ad;"';}
?>
>
<td class="celda_normal">
<?php
echo date("d-m-Y", strtotime($dateInMonth));
?>
</td>
<td class="celda_normal finalRough"
data-id="<?= $dateInMonth ?>"
oninput="finalRoughStockChange(this)"
contenteditable="true"
><?= ' ' ?></td>
<td class="celda_normal dust"
data-id="<?= $dateInMonth ?>"
oninput="dustStockChange(this)"
contenteditable="true"
><?= ' ' ?></td>
<td class="celda_normal total"
data-id="<?= $dateInMonth ?>"
><?= ' ' ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div> <!-- End card-body -->
</div> <!-- End card -->
</div> <!-- End col -->
</div> <!-- End row -->
</div>
</div> <!-- End container-fluid -->
</div>
</div>
<!-- modal section -->
<!-- filter modal -->
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
<div class="modal-dialog modal-md"> <div class="modal-dialog modal-md">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -596,7 +443,7 @@
<select id="fromDateFilter" name="fromDateFilter" class="form-control select2"> <select id="fromDateFilter" name="fromDateFilter" class="form-control select2">
<?php if (!empty($dateArray)) : ?> <?php if (!empty($dateArray)) : ?>
<?php foreach ($dateArray as $index => $date) : ?> <?php foreach ($dateArray as $index => $date) : ?>
<option value="<?= $date ?>" ><?= $date ?></option> <option value="<?= $date ?>"><?= $date ?></option>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
</select> </select>
@ -612,7 +459,7 @@
<?php if (!empty($dateArray)) : ?> <?php if (!empty($dateArray)) : ?>
<?php foreach ($dateArray as $date) : ?> <?php foreach ($dateArray as $date) : ?>
<option value="<?= $date ?>" <?= ($date == $currentDateInDmY) || ($date == $dateArray[9]) ?"selected" :" " ?> ><?= $date ?></option> <option value="<?= $date ?>" <?= ($date == $currentDateInDmY) || ($date == $dateArray[9]) ? "selected" : " " ?>><?= $date ?></option>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
@ -624,14 +471,182 @@
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div>
<!-- end modal section -->
<div class="table-responsive" id="table-responsive" align="center">
<table style="width: 700px;" id="dustAndRoughStockDetailsTableId" class="fht-table ">
<thead class="celda_encabezado_general" style="padding: 10px;">
<tr>
<th
style="width: 100px;"
class="celda_encabezado_general" rowspan="2" colspan="1">Date </th>
<th class="celda_encabezado_general" colspan="1">Final Rough </th>
<th class="celda_encabezado_general" colspan="1">Dust </th>
<th class="celda_encabezado_general" rowspan="2" colspan="1">Total </th>
</tr>
<tr>
<th class="celda_encabezado_general" colspan="1">+16 Mesh </th>
<th class="celda_encabezado_general" colspan="1">10 Ton Dryer </th>
</tr>
</thead>
<tbody style="background-color: #fff;">
<?php
if (!empty($dustAndRoughStockDetails)) {
$summary = [];
foreach ($dustAndRoughStockDetails as $dustAndRoughStockDetailsIndex => $dustAndRoughStockDetail) {
?>
<tr
<?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;"';
}
?>>
<td class="celda_normal">
<?php
echo date("d-m-Y", strtotime($dustAndRoughStockDetail['date']));
?>
</td>
<td class="celda_normal finalRough"
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
oninput="finalRoughStockChange(this)"
contenteditable="true"><?= $dustAndRoughStockDetail['finalRough'] ?? ' ' ?></td>
<td class="celda_normal dust"
data-id="<?= $dustAndRoughStockDetail['date'] ?>"
oninput="dustStockChange(this)"
contenteditable="true"><?= $dustAndRoughStockDetail['dust'] ?? ' ' ?></td>
<td class="celda_normal total"
data-id="<?= $dustAndRoughStockDetail['date'] ?>"><?= $dustAndRoughStockDetail['total'] ?? ' ' ?></td>
</tr>
<?php
//before closing inner loop
if (!isset($summary['finalRough'])) {
$summary['finalRough'] = 0;
$summary['dust'] = 0;
$summary['total'] = 0;
}
$summary['finalRough'] += $dustAndRoughStockDetail['finalRough'] == "-" ? 0 : (float) $dustAndRoughStockDetail['finalRough'];
$summary['dust'] += $dustAndRoughStockDetail['dust'] == "-" ? 0 : (float) $dustAndRoughStockDetail['dust'];
$summary['total'] += $dustAndRoughStockDetail['total'] == "-" ? 0 : (float) $dustAndRoughStockDetail['total'];
} ?>
<tfoot>
<tr>
<td style="background-color:rgb(189, 9, 6); color:#ffff;"> Total </td>
<td class="celda_normal "> <b> <?= $summary['finalRough'] ?> </b> </td>
<td class="celda_normal "> <b> <?= $summary['dust'] ?> </b> </td>
<td class="celda_normal "> <b> <?= $summary['total'] ?> </b> </td>
</tr>
</tfoot>
<?php } else {
$date = DateTime::createFromFormat('M-Y', $month);
$startDate = $date->modify('first day of this month')->format('Y-m-d');
$endDate = $date->modify('last day of this month')->format('Y-m-d');
$datesInMonth = [];
$period = new DatePeriod(
new DateTime($startDate),
new DateInterval('P1D'),
(new DateTime($endDate))->modify('+1 day')
);
foreach ($period as $day) {
$datesInMonth[] = $day->format('Y-m-d');
}
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
?>
<tr
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = date("d-m-Y", strtotime($dateInMonth));
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
<td class="celda_normal">
<?php
echo date("d-m-Y", strtotime($dateInMonth));
?>
</td>
<td class="celda_normal finalRough"
data-id="<?= $dateInMonth ?>"
oninput="finalRoughStockChange(this)"
contenteditable="true"><?= ' ' ?></td>
<td class="celda_normal dust"
data-id="<?= $dateInMonth ?>"
oninput="dustStockChange(this)"
contenteditable="true"><?= ' ' ?></td>
<td class="celda_normal total"
data-id="<?= $dateInMonth ?>"><?= ' ' ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div> <!-- End card-body -->
</div> <!-- End card -->
</div> <!-- End col -->
</div> <!-- End row -->
</div>
</div> <!-- End container-fluid -->
</div>
</div> </div>
<!-- end modal section --> <!-- modal section -->
<script> <script>
function customFilterDate(){ function customFilterDate() {
let fromDate = $('#fromDateFilter').val(); //01-12-2024 let fromDate = $('#fromDateFilter').val(); //01-12-2024
let toDate = $('#toDateFilter').val(); //05-12-2024 let toDate = $('#toDateFilter').val(); //05-12-2024
@ -639,7 +654,7 @@
$('#dustAndRoughStockDetailsTableId').find('tbody tr').each(function() { $('#dustAndRoughStockDetailsTableId').find('tbody tr').each(function() {
const rowCells = $(this).find('td'); const rowCells = $(this).find('td');
let tableDate = rowCells.eq(0).text(); let tableDate = rowCells.eq(0).text();
let result = checkDateRange(fromDate,toDate,tableDate); let result = checkDateRange(fromDate, toDate, tableDate);
if (result) { if (result) {
$(this).show(); $(this).show();
} else { } else {
@ -670,22 +685,19 @@
let parts = dateString.split('-'); let parts = dateString.split('-');
return new Date(parts[2], parts[1] - 1, parts[0]); // Year, Month (0-based), Day return new Date(parts[2], parts[1] - 1, parts[0]); // Year, Month (0-based), Day
} }
</script> </script>
<script> <script>
$(document).ready(function(){ $(document).ready(function() {
$('.select2').select2(); $('.select2').select2();
}) })
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() {
$('#saveId').click(function() {
$(document).ready(function () {
$('#saveId').click(function () {
//table to json function //table to json function
@ -701,7 +713,7 @@
type: "POST", type: "POST",
url: "<?php echo base_url() ?>updateDustAndRoughStockDetails", url: "<?php echo base_url() ?>updateDustAndRoughStockDetails",
success: function (data) { success: function(data) {
if (data) { if (data) {
$('#loader').hide(); $('#loader').hide();
console.log(data); console.log(data);
@ -726,7 +738,6 @@
}); });
}); });
</script> </script>
<script> <script>
@ -757,35 +768,33 @@
return JSON.stringify(rows, null, 2); return JSON.stringify(rows, null, 2);
} }
</script> </script>
<script> <script>
function finalRoughStockChange(tdElement) { function finalRoughStockChange(tdElement) {
try { try {
let dataId = tdElement.getAttribute('data-id') let dataId = tdElement.getAttribute('data-id')
let finalRoughStock = validateInput(tdElement.innerText); let finalRoughStock = validateInput(tdElement.innerText);
let dustStock = validateInput(document.querySelector(`td.dust[data-id="${dataId}"]`).innerText); let dustStock = validateInput(document.querySelector(`td.dust[data-id="${dataId}"]`).innerText);
let total = (Number(finalRoughStock) + Number(dustStock)) ; let total = (Number(finalRoughStock) + Number(dustStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText=total; document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total;
} catch(error){ } catch (error) {
console.error("There is an error updating stock ..!!" + error); console.error("There is an error updating stock ..!!" + error);
} }
} }
function dustStockChange(tdElement) { function dustStockChange(tdElement) {
try{ try {
let dataId = tdElement.getAttribute('data-id') let dataId = tdElement.getAttribute('data-id')
let finalRoughStock = validateInput(document.querySelector(`td.finalRough[data-id="${dataId}"]`).innerText); let finalRoughStock = validateInput(document.querySelector(`td.finalRough[data-id="${dataId}"]`).innerText);
let dustStock = validateInput(tdElement.innerText); let dustStock = validateInput(tdElement.innerText);
let total = (Number(finalRoughStock) + Number(dustStock)) ; let total = (Number(finalRoughStock) + Number(dustStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total; document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total;
} catch(error){ } catch (error) {
console.error("There is an error updating stock ..!!" + error); console.error("There is an error updating stock ..!!" + error);
@ -815,16 +824,11 @@
return input; return input;
} }
</script> </script>
<script> <script>
$(document).ready(function() {
$(document).ready(function(){
function exportTableToExcel(tableID, filename = '') { function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID); let table = document.getElementById(tableID);
@ -832,12 +836,12 @@
let cloneTable = table.cloneNode(true); // Clone the table to modify let cloneTable = table.cloneNode(true); // Clone the table to modify
// Remove hidden rows // Remove hidden rows
$(cloneTable).find('tr').filter(function () { $(cloneTable).find('tr').filter(function() {
return $(this).css('display') === 'none'; return $(this).css('display') === 'none';
}).remove(); }).remove();
// Remove hidden columns // Remove hidden columns
$(cloneTable).find('th, td').each(function () { $(cloneTable).find('th, td').each(function() {
if ($(this).css('display') === 'none') { if ($(this).css('display') === 'none') {
$(this).remove(); $(this).remove();
} }
@ -872,21 +876,18 @@
let tableId = 'dustAndRoughStockDetailsTableId'; let tableId = 'dustAndRoughStockDetailsTableId';
document.getElementById('dustAndRoughStockExport').addEventListener('click',function(){ document.getElementById('dustAndRoughStockExport').addEventListener('click', function() {
exportTableToExcel(tableId ,'dustAndRoughStockDetails.xlsx'); exportTableToExcel(tableId, 'dustAndRoughStockDetails.xlsx');
}) })
}) })
</script> </script>
<script> <script>
document.addEventListener("keydown", function (event) { document.addEventListener("keydown", function(event) {
if (event.key === "Enter") { if (event.key === "Enter") {
@ -919,18 +920,16 @@
} }
} }
} }
}); });
</script> </script>
<script> <script>
$('#month').change(function() {
$('#month').change(function(){
$('#changeMonthForm').submit(); $('#changeMonthForm').submit();
}) })
$(document).ready(function () { $(document).ready(function() {
$('#month').datepicker({ $('#month').datepicker({
format: "M-yyyy", // Format as "Jan-2025" format: "M-yyyy", // Format as "Jan-2025"
@ -973,15 +972,54 @@
} }
}).catch(err => console.log("Error exiting fullscreen:", err)); }).catch(err => console.log("Error exiting fullscreen:", err));
} }
} }
$("#searchInput").on("keyup", function () { $("#searchInput").on("keyup", function() {
let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search
$(".table-responsive tbody tr").filter(function () { $(".table-responsive tbody tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1); $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
}); });
}); });
</script>
<script>
$(document).ready(function() {
$('.select2').select2({
dropdownParent: $('#fullscreenDiv')
});
// Initialize Select2 when the modal is shown inside full screen
$('#filterModalId,').on('shown.bs.modal', function() {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
});
</script>
<script>
//getting modal backdrop inside full screen
$(document).ready(function() {
function moveModalBackdropToFullscreen() {
setTimeout(() => {
$('.modal-backdrop').appendTo('#fullscreenDiv'); // Move backdrop inside fullscreen
}, 10); // Small delay ensures backdrop is created first
}
// Move the modal backdrop when a modal opens
$('#filterModalId').on('show.bs.modal', function() {
moveModalBackdropToFullscreen();
});
// Ensure modals work properly in fullscreen mode
document.addEventListener("fullscreenchange", function() {
setTimeout(() => {
$('.modal-backdrop').remove(); // Remove any existing backdrops
moveModalBackdropToFullscreen();
}, 200);
});
});
</script> </script>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -474,6 +474,54 @@ foreach ($period as $day) {
</form> </form>
<div>
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Navigation Options</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- bag Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="powerDropdown">Select Machine</label>
<select id="powerDropdown" class="form-control select2">
<option value="">Select Electric Machines</option>
<?php foreach ($electricMachines as $powerMachine): ?>
<option value=" <?= $powerMachine['machine_name'] ?>">
<?= $powerMachine['machine_name'] ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
<!-- Date Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="dateDropdown">Select Date</label>
<select id="dateDropdown" class="form-control select2">
<?php foreach ($datesInMonth as $selectDate): ?>
<?php $selectDate = DateTime::createFromFormat('Y-m-d', $selectDate)->format('d-m-Y'); ?>
<option value="<?= $selectDate ?>"><?= $selectDate ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<button class="btn btn-primary float-right" onclick="navigateToPower()">Navigate</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<div class="table-responsive" id="table-responsive"> <div class="table-responsive" id="table-responsive">
@ -934,55 +982,9 @@ foreach ($period as $day) {
</div> </div>
<div>
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Navigation Options</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- bag Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="powerDropdown">Select Machine</label>
<select id="powerDropdown" class="form-control select2">
<option value="">Select Electric Machines</option>
<?php foreach ($electricMachines as $powerMachine): ?>
<option value=" <?= $powerMachine['machine_name'] ?>">
<?= $powerMachine['machine_name'] ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
<!-- Date Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="dateDropdown">Select Date</label>
<select id="dateDropdown" class="form-control select2">
<?php foreach ($datesInMonth as $selectDate): ?>
<?php $selectDate = DateTime::createFromFormat('Y-m-d', $selectDate)->format('d-m-Y'); ?>
<option value="<?= $selectDate ?>"><?= $selectDate ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<button class="btn btn-primary float-right" onclick="navigateToPower()">Navigate</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('.select2').select2(); $('.select2').select2();
@ -1527,8 +1529,7 @@ foreach ($period as $day) {
const box = child.getBoundingClientRect(); const box = child.getBoundingClientRect();
const offset = y - box.top - box.height / 2; const offset = y - box.top - box.height / 2;
return offset < 0 && offset > closest.offset ? return offset < 0 && offset > closest.offset ? {
{
offset, offset,
element: child element: child
} : } :
@ -1626,15 +1627,67 @@ foreach ($period as $day) {
} }
}).catch(err => console.log("Error exiting fullscreen:", err)); }).catch(err => console.log("Error exiting fullscreen:", err));
} }
} }
$("#searchInput").on("keyup", function () { $("#searchInput").on("keyup", function() {
let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search
$(".table-responsive tbody tr").filter(function () { $(".table-responsive tbody tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1); $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
}); });
});
</script>
<script>
$(document).ready(function() {
$('.select2').select2({
dropdownParent: $('#fullscreenDiv')
});
// Initialize Select2 when the modal is shown inside full screen
$('#bs-example-modal-lg').on('shown.bs.modal', function () {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
$('#customizeModalId').on('shown.bs.modal', function () {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
});
</script>
<script>
//getting modal backdrop inside full screen
$(document).ready(function() {
function moveModalBackdropToFullscreen() {
setTimeout(() => {
$('.modal-backdrop').appendTo('#fullscreenDiv'); // Move backdrop inside fullscreen
}, 10); // Small delay ensures backdrop is created first
}
// Move the modal backdrop when a modal opens
$('#bs-example-modal-lg, #customizeModalId').on('show.bs.modal', function () {
moveModalBackdropToFullscreen();
});
// Ensure modals work properly in fullscreen mode
document.addEventListener("fullscreenchange", function() {
setTimeout(() => {
$('.modal-backdrop').remove(); // Remove any existing backdrops
moveModalBackdropToFullscreen();
}, 200);
});
}); });
</script> </script>

View File

@ -416,7 +416,7 @@ foreach ($period as $day) {
<div class="col"> <div class="col">
<div class="form-group"> <div class="form-group">
<label for="customizeHeader"> Add For This Month </label> <label for="customizeHeader"> Add For This Month </label>
<select id="customizeHeader" class="form-control" onchange="addBackToList()"> <select id="customizeHeader" class="form-control select2" onchange="addBackToList()">
<option value="">Select</option> <option value="">Select</option>
<?php <?php
foreach($activeResinMaterials as $index => $activeResinMaterial){ ?> foreach($activeResinMaterials as $index => $activeResinMaterial){ ?>
@ -472,12 +472,60 @@ foreach ($period as $day) {
</div> </div>
<!-- hidden fields --> <!-- hidden fields -->
<input type="hidden" name="month" id="month" value="<?php echo "$month" ?>" <input type="hidden" name="month" value="<?php echo "$month" ?>"
class="form-control mt-2" data-provide="datepicker" class="form-control mt-2" data-provide="datepicker"
data-date-format="M-yyyy" data-date-min-view-mode="1"> data-date-format="M-yyyy" data-date-min-view-mode="1">
</form> </form>
<div>
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Navigation Options</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- bag Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="resinDropdown">Select Machine</label>
<select id="resinDropdown" class="form-control select2">
<option value="">Select Resin</option>
<?php foreach ($resinMaterials as $resinMaterial): ?>
<option value=" <?= $resinMaterial['MaterialName'] ?>">
<?= $resinMaterial['MaterialName'] ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
<!-- Date Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="dateDropdown">Select Date</label>
<select id="dateDropdown" class="form-control select2">
<?php foreach ($datesInMonth as $selectDate): ?>
<?php $selectDate = DateTime::createFromFormat('Y-m-d', $selectDate)->format('d-m-Y'); ?>
<option value="<?= $selectDate ?>"><?= $selectDate ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<button class="btn btn-primary float-right" onclick="navigateToResin()">Navigate</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<div class="table-responsive" id="table-responsive"> <div class="table-responsive" id="table-responsive">
@ -758,72 +806,10 @@ foreach ($period as $day) {
</div> </div>
<div>
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="myLargeModalLabel">Navigation Options</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<!-- bag Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="resinDropdown">Select Machine</label>
<select id="resinDropdown" class="form-control select2">
<option value="">Select Resin</option>
<?php foreach ($resinMaterials as $resinMaterial): ?>
<option value=" <?= $resinMaterial['MaterialName'] ?>">
<?= $resinMaterial['MaterialName'] ?>
</option>
<?php endforeach; ?>
</select>
</div>
</div>
<!-- Date Dropdown -->
<div class="col-md-6">
<div class="form-group">
<label for="dateDropdown">Select Date</label>
<select id="dateDropdown" class="form-control select2">
<?php foreach ($datesInMonth as $selectDate): ?>
<?php $selectDate = DateTime::createFromFormat('Y-m-d', $selectDate)->format('d-m-Y'); ?>
<option value="<?= $selectDate ?>"><?= $selectDate ?></option>
<?php endforeach; ?>
</select>
</div>
</div>
</div>
<button class="btn btn-primary float-right" onclick="navigateToResin()">Navigate</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
</div>
<!-- modal section ends -->
<script> <script>
$(document).ready(function(){ $(document).ready(function(){
@ -1347,3 +1333,58 @@ $("#searchInput").on("keyup", function () {
</script> </script>
<script>
$(document).ready(function() {
$('.select2').select2({
dropdownParent: $('#fullscreenDiv')
});
// Initialize Select2 when the modal is shown inside full screen
$('#bs-example-modal-lg').on('shown.bs.modal', function () {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
$('#customizeModalId').on('shown.bs.modal', function () {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
});
</script>
<script>
//getting modal backdrop inside full screen
$(document).ready(function() {
function moveModalBackdropToFullscreen() {
setTimeout(() => {
$('.modal-backdrop').appendTo('#fullscreenDiv'); // Move backdrop inside fullscreen
}, 10); // Small delay ensures backdrop is created first
}
// Move the modal backdrop when a modal opens
$('#bs-example-modal-lg, #customizeModalId').on('show.bs.modal', function () {
moveModalBackdropToFullscreen();
});
// Ensure modals work properly in fullscreen mode
document.addEventListener("fullscreenchange", function() {
setTimeout(() => {
$('.modal-backdrop').remove(); // Remove any existing backdrops
moveModalBackdropToFullscreen();
}, 200);
});
});
</script>

View File

@ -455,6 +455,82 @@ $timeOtions[] = "12:00 AM";
</form> </form>
<!-- filter modal -->
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
<div class="modal-dialog modal-md">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="filterModalLabelId">Filter Options</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div class="modal-body">
<div class="row">
<?php
$currentDateInDmY = date('d-m-Y');
?>
<?php
$startDate = DateTime::createFromFormat('M-Y', $month);
if ($startDate) {
$startDate->modify('first day of this month');
$daysInMonth = $startDate->format('t');
$dateArray = [];
for ($i = 0; $i < $daysInMonth; $i++) {
$dateArray[] = $startDate->format('d-m-Y');
$startDate->modify('+1 day');
}
} else {
echo "Invalid date format.";
}
?>
<!-- From Date Filter -->
<div class="col-md-6">
<div class="form-group">
<label for="fromDateFilter">Select From Date</label>
<select id="fromDateFilter" name="fromDateFilter" class="form-control select2">
<?php if (!empty($dateArray)) : ?>
<?php foreach ($dateArray as $index => $date) : ?>
<option value="<?= $date ?>"><?= $date ?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
</div>
<!-- To Date Filter -->
<div class="col-md-6">
<div class="form-group">
<label for="toDateFilter">Select Date</label>
<select id="toDateFilter" name="toDateFilter" class="form-control select2">
<?php if (!empty($dateArray)) : ?>
<?php foreach ($dateArray as $date) : ?>
<option value="<?= $date ?>" <?= ($date == $currentDateInDmY) || ($date == $dateArray[9]) ? "selected" : " " ?>><?= $date ?></option>
<?php endforeach; ?>
<?php endif; ?>
</select>
</div>
</div>
</div>
<button class="btn btn-primary float-right" onclick="customFilterDate()">Filter</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div>
<!-- end modal section -->
<div class="table-responsive" id="table-responsive"> <div class="table-responsive" id="table-responsive">
@ -643,7 +719,7 @@ $timeOtions[] = "12:00 AM";
<td class="celda_normal trpProductionStock openingTime" <td class="celda_normal trpProductionStock openingTime"
data-id="<?= $trpProductionDetail['date'] ?> openingTime"> data-id="<?= $trpProductionDetail['date'] ?> openingTime">
<select class="timeDropdown trp_on_time" style="width: 150px;"> <select class="timeDropdown trp_on_time select2" style="width: 150px;">
<?php <?php
foreach ($timeOptions as $timeOption) { foreach ($timeOptions as $timeOption) {
?> ?>
@ -663,7 +739,7 @@ $timeOtions[] = "12:00 AM";
<td class="celda_normal trpProductionStock closingTime" <td class="celda_normal trpProductionStock closingTime"
data-id="<?= $trpProductionDetail['date'] ?> closingTime"> data-id="<?= $trpProductionDetail['date'] ?> closingTime">
<select class="timeDropdown trp_off_time" style="width: 150px;"> <select class="timeDropdown trp_off_time select2" style="width: 150px;">
<?php <?php
foreach ($timeOptions as $timeOption) { foreach ($timeOptions as $timeOption) {
?> ?>
@ -1790,6 +1866,8 @@ $timeOtions[] = "12:00 AM";
</div> </div>
<!-- navigation to trp production is in hold -->
<div> <div>
<div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> <div class="modal fade" id="bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true">
<div class="modal-dialog modal-md"> <div class="modal-dialog modal-md">
@ -1805,7 +1883,7 @@ $timeOtions[] = "12:00 AM";
<div class="col-md-6"> <div class="col-md-6">
<div class="form-group"> <div class="form-group">
<label for="dateDropdown">Select Date</label> <label for="dateDropdown">Select Date</label>
<select id="dateDropdown" class="form-control"> <select id="dateDropdown select2" class="form-control">
<?php foreach ($datesInMonth as $selectDate): ?> <?php foreach ($datesInMonth as $selectDate): ?>
<?php $selectDate = DateTime::createFromFormat('Y-m-d', $selectDate)->format('d-m-Y'); ?> <?php $selectDate = DateTime::createFromFormat('Y-m-d', $selectDate)->format('d-m-Y'); ?>
<option value="<?= $selectDate ?>"><?= $selectDate ?></option> <option value="<?= $selectDate ?>"><?= $selectDate ?></option>
@ -2130,7 +2208,7 @@ $timeOtions[] = "12:00 AM";
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$('.timeDropdown').select2({ $('.select2').select2({
placeholder: "Select", placeholder: "Select",
}); });
@ -2507,3 +2585,88 @@ $timeOtions[] = "12:00 AM";
}); });
}); });
</script> </script>
<script>
$(document).ready(function() {
$('.select2').select2({
dropdownParent: $('#fullscreenDiv')
});
// Initialize Select2 when the modal is shown inside full screen
$('#filterModalId,').on('shown.bs.modal', function() {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
});
</script>
<script>
//getting modal backdrop inside full screen
$(document).ready(function() {
function moveModalBackdropToFullscreen() {
setTimeout(() => {
$('.modal-backdrop').appendTo('#fullscreenDiv'); // Move backdrop inside fullscreen
}, 10); // Small delay ensures backdrop is created first
}
// Move the modal backdrop when a modal opens
$('#filterModalId').on('show.bs.modal', function() {
moveModalBackdropToFullscreen();
});
// Ensure modals work properly in fullscreen mode
document.addEventListener("fullscreenchange", function() {
setTimeout(() => {
$('.modal-backdrop').remove(); // Remove any existing backdrops
moveModalBackdropToFullscreen();
}, 200);
});
});
</script>
<script>
function customFilterDate() {
let fromDate = $('#fromDateFilter').val(); //01-12-2024
let toDate = $('#toDateFilter').val(); //05-12-2024
$('#trpProductionStockDetailsTableId').find('tbody tr').each(function() {
const rowCells = $(this).find('td');
let tableDate = rowCells.eq(0).text();
let result = checkDateRange(fromDate, toDate, tableDate);
if (result) {
$(this).show();
} else {
$(this).hide();
}
});
$('#filterModalId').modal('hide');
}
function checkDateRange(fromDate, toDate, tableDate) {
// Convert the dates to a comparable format (YYYY-MM-DD)
let from = convertToDate(fromDate);
let to = convertToDate(toDate);
let table = convertToDate(tableDate);
// Return true if the table date is within the range
return table >= from && table <= to;
}
function convertToDate(dateString) {
// Convert from DD-MM-YYYY to YYYY-MM-DD for comparison
let parts = dateString.split('-');
return new Date(parts[2], parts[1] - 1, parts[0]); // Year, Month (0-based), Day
}
</script>

View File

@ -19,14 +19,16 @@
.fht-table td:hover { .fht-table td:hover {
background-color: rgb(170, 222, 167); background-color: rgb(170, 222, 167);
color:rgb(2, 2, 2); color: rgb(2, 2, 2);
transform: scale(1.25); /* Increases size by 25% */ transform: scale(1.25);
transition: transform 0.5s ease-in-out; /* Smooth scaling effect */ /* Increases size by 25% */
transition: transform 0.5s ease-in-out;
/* Smooth scaling effect */
} }
.fht-table tr:hover { .fht-table tr:hover {
background-color: rgb(170, 222, 167); background-color: rgb(170, 222, 167);
color:rgb(2, 2, 2); color: rgb(2, 2, 2);
} }
.fht-table { .fht-table {
@ -158,7 +160,7 @@
} }
.celda_encabezado_total { .celda_encabezado_total {
background-color:#ffffff !important; background-color: #ffffff !important;
border: 1px solid #ffffff; border: 1px solid #ffffff;
color: #ffffff !important; color: #ffffff !important;
font-weight: bold; font-weight: bold;
@ -226,20 +228,36 @@
} }
/* Adjust heights based on screen zoom */ /* Adjust heights based on screen zoom */
@media only screen and (min-height: 1400px) { /* Approximate Zoom < 100% */ @media only screen and (min-height: 1400px) {
.table-responsive { max-height: 425px; }
/* Approximate Zoom < 100% */
.table-responsive {
max-height: 425px;
}
} }
@media only screen and (min-height: 1200px) { /* Approximate Zoom ~ 90% */ @media only screen and (min-height: 1200px) {
.table-responsive { max-height: 500px; }
/* Approximate Zoom ~ 90% */
.table-responsive {
max-height: 500px;
}
} }
@media only screen and (min-height: 1000px) { /* Approximate Zoom ~ 80% */ @media only screen and (min-height: 1000px) {
.table-responsive { max-height: 600px; }
/* Approximate Zoom ~ 80% */
.table-responsive {
max-height: 600px;
}
} }
@media only screen and (min-height: 800px) { /* Approximate Zoom ~ 75% */ @media only screen and (min-height: 800px) {
.table-responsive { max-height: 650px; }
/* Approximate Zoom ~ 75% */
.table-responsive {
max-height: 650px;
}
} }
td { td {
@ -248,24 +266,23 @@
} }
tfoot tr { tfoot tr {
background-color:rgb(235, 236, 203); background-color: rgb(235, 236, 203);
} }
body[data-layout-mode = horizontal] .container-fluid{ body[data-layout-mode=horizontal] .container-fluid {
max-width: 100%; max-width: 100%;
} }
.card-body{ .card-body {
padding-top : 0; padding-top: 0;
padding-bottom : 0; padding-bottom: 0;
} }
.card{ margin-bottom: 5px;} .card {
margin-bottom: 5px;
}
</style> </style>
@ -297,13 +314,13 @@
<div class="row" align="center"> <div class="row" >
<div class="col-12"> <div class="col-12">
<div class="card" id="fullscreenDiv"> <div class="card" id="fullscreenDiv">
<div class="card-body" > <div class="card-body">
<form id="changeMonthForm" action="<?= base_url('trpSandUseStockDetails'); ?>" method="post"> <form align="center" id="changeMonthForm" action="<?= base_url('trpSandUseStockDetails'); ?>" method="post">
<div class="row"> <div class="row">
@ -324,7 +341,7 @@
<div class="col-3 text-right d-flex" style="justify-content: end;" > <div class="col-3 text-right d-flex" style="justify-content: end;">
<input type="text" id="searchInput" placeholder="Search..." <input type="text" id="searchInput" placeholder="Search..."
class="mt-2" class="mt-2"
@ -349,15 +366,14 @@
<i class="fe-maximize noti-icon btn-lg mt-2" <i class="fe-maximize noti-icon btn-lg mt-2"
title="Full Screen" title="Full Screen"
style="font-size: x-large; cursor:pointer;" style="font-size: x-large; cursor:pointer;"
onclick="toggleDivFullscreen()" > onclick="toggleDivFullscreen()">
</i> </i>
<i class="fa fa-save btn-lg mt-2" <i class="fa fa-save btn-lg mt-2"
title="Save" title="Save"
style="font-size: x-large; cursor:pointer;" style="font-size: x-large; cursor:pointer;"
id="saveId" id="saveId">
>
</i> </i>
@ -372,218 +388,8 @@
</form> </form>
<!-- filter modal -->
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
<div class="table-responsive" id="table-responsive">
<table style="width: 700px;" id="trpSandUseStockDetailsTableId" class="fht-table ">
<thead class="celda_encabezado_general" >
<tr>
<th class="celda_encabezado_general" colspan="5" >Trp Sand To Use Coating Sand </th>
</tr>
<tr>
<th
style="width: 100px;"
class="celda_encabezado_general" >Date </th>
<th class="celda_encabezado_general" >Rough Kgs </th>
<th class="celda_encabezado_general" >Fine Kgs </th>
<th class="celda_encabezado_general" >Total Kgs </th>
<th class="celda_encabezado_general" >Customer Name</th>
</tr>
</thead>
<tbody style="background-color: #fff;" >
<?php
if(!empty($trpSandUseStockDetails)){
$summary = [] ;
foreach($trpSandUseStockDetails as $trpSandUseStockDetailsIndex => $trpSandUseStockDetail){
?>
<tr
<?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;"';}
?>
>
<td class="celda_normal">
<?php
echo date("d-m-Y", strtotime($trpSandUseStockDetail['date']));
?>
</td>
<td class="celda_normal rough"
data-id="<?= $trpSandUseStockDetail['date'] ?>"
oninput="roughStockChange(this)"
contenteditable="true"
><?= $trpSandUseStockDetail['rough_kgs'] ?? " " ?></td>
<td class="celda_normal fine"
data-id="<?= $trpSandUseStockDetail['date'] ?>"
oninput="fineStockChange(this)"
contenteditable="true"
><?= $trpSandUseStockDetail['fine_kgs'] ?? " " ?></td>
<td class="celda_normal total"
data-id="<?= $trpSandUseStockDetail['date'] ?>"
><?= $trpSandUseStockDetail['total_kgs'] ?? " " ?></td>
<td class="celda_normal customerName"
data-id="<?= $trpSandUseStockDetail['date'] ?>"
contenteditable="true"
><?= $trpSandUseStockDetail['customer_name'] ?? " " ?></td>
<td style="display:none"
data-id="<?= $trpSandUseStockDetail['date'] ?>"
><?= $trpSandUseStockDetail['id'] ?? " " ?></td>
</tr>
<?php
//before closing inner loop
if (!isset($summary['rough_kgs'])) {
$summary['rough_kgs'] = 0 ;
$summary['fine_kgs'] = 0 ;
$summary['total_kgs'] = 0 ;
}
$summary['rough_kgs'] += $trpSandUseStockDetail['rough_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['rough_kgs'] ;
$summary['fine_kgs'] += $trpSandUseStockDetail['fine_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['fine_kgs'] ;
$summary['total_kgs'] += $trpSandUseStockDetail['total_kgs'] == "-" ? 0 :(float) $trpSandUseStockDetail['total_kgs'] ;
} ?>
<tfoot>
<tr class="total_row">
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<td class="celda_normal "><b><?=$summary['rough_kgs']?></b></td>
<td class="celda_normal "><b><?=$summary['fine_kgs']?></b></td>
<td class="celda_normal "><b><?=$summary['total_kgs']?></b></td>
<td class="celda_normal "> </td>
</tr>
</tfoot>
</div>
<?php }else{
$date = DateTime::createFromFormat('M-Y', $month);
$startDate = $date->modify('first day of this month')->format('Y-m-d');
$endDate = $date->modify('last day of this month')->format('Y-m-d');
$datesInMonth = [];
$period = new DatePeriod(
new DateTime($startDate),
new DateInterval('P1D'),
(new DateTime($endDate))->modify('+1 day')
);
foreach ($period as $day) {
$datesInMonth[] = $day->format('Y-m-d');
}
foreach($datesInMonth as $datesInMonthIndex => $dateInMonth){
?>
<tr
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat=date("d-m-Y", strtotime($dateInMonth));
if ($dateInMonthDmYFormat === $currentDate) { echo 'style="background: #cef0ad;"';}
?>
>
<!-- td:eq(0) -->
<td class="celda_normal">
<?php
echo date("d-m-Y", strtotime($dateInMonth));
?>
</td>
<!-- td:eq(1) -->
<td class="celda_normal rough"
data-id="<?= $dateInMonth ?>"
oninput="roughStockChange(this)"
contenteditable="true"
><?= " " ?></td>
<!-- td:eq(2) -->
<td class="celda_normal fine"
data-id="<?= $dateInMonth ?>"
oninput="fineStockChange(this)"
contenteditable="true"
><?= " " ?></td>
<!-- td:eq(3) -->
<td class="celda_normal total"
data-id="<?= $dateInMonth ?>"
><?= " " ?></td>
<!-- td:eq(4) -->
<td class="celda_normal customer"
data-id="<?= $dateInMonth ?>"
contenteditable="true"
><?= " " ?></td>
<!-- td:eq(5) -->
<td style="display:none"
data-id="<?= $dateInMonth ?>"
contenteditable="true"
><?= " " ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div> <!-- End card-body -->
</div> <!-- End card -->
</div> <!-- End col -->
</div> <!-- End row -->
</div>
</div> <!-- End container-fluid -->
</div>
</div>
<!-- modal section -->
<!-- filter modal -->
<div class="modal fade" id="filterModalId" tabindex="-1" role="dialog" aria-labelledby="filterModalLabelId" aria-hidden="true">
<div class="modal-dialog modal-md"> <div class="modal-dialog modal-md">
<div class="modal-content"> <div class="modal-content">
<div class="modal-header"> <div class="modal-header">
@ -625,7 +431,7 @@
<select id="fromDateFilter" name="fromDateFilter" class="form-control select2"> <select id="fromDateFilter" name="fromDateFilter" class="form-control select2">
<?php if (!empty($dateArray)) : ?> <?php if (!empty($dateArray)) : ?>
<?php foreach ($dateArray as $index => $date) : ?> <?php foreach ($dateArray as $index => $date) : ?>
<option value="<?= $date ?>" ><?= $date ?></option> <option value="<?= $date ?>"><?= $date ?></option>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
</select> </select>
@ -641,7 +447,7 @@
<?php if (!empty($dateArray)) : ?> <?php if (!empty($dateArray)) : ?>
<?php foreach ($dateArray as $date) : ?> <?php foreach ($dateArray as $date) : ?>
<option value="<?= $date ?>" <?= ($date == $currentDateInDmY) || ($date == $dateArray[9]) ?"selected" :" " ?> ><?= $date ?></option> <option value="<?= $date ?>" <?= ($date == $currentDateInDmY) || ($date == $dateArray[9]) ? "selected" : " " ?>><?= $date ?></option>
<?php endforeach; ?> <?php endforeach; ?>
<?php endif; ?> <?php endif; ?>
@ -653,14 +459,217 @@
</div> </div>
</div><!-- /.modal-content --> </div><!-- /.modal-content -->
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div>
<!-- end modal section -->
<div class="table-responsive" id="table-responsive" align="center">
<table style="width: 700px;" id="trpSandUseStockDetailsTableId" class="fht-table ">
<thead class="celda_encabezado_general">
<tr>
<th class="celda_encabezado_general" colspan="5">Trp Sand To Use Coating Sand </th>
</tr>
<tr>
<th
style="width: 100px;"
class="celda_encabezado_general">Date </th>
<th class="celda_encabezado_general">Rough Kgs </th>
<th class="celda_encabezado_general">Fine Kgs </th>
<th class="celda_encabezado_general">Total Kgs </th>
<th class="celda_encabezado_general">Customer Name</th>
</tr>
</thead>
<tbody style="background-color: #fff;">
<?php
if (!empty($trpSandUseStockDetails)) {
$summary = [];
foreach ($trpSandUseStockDetails as $trpSandUseStockDetailsIndex => $trpSandUseStockDetail) {
?>
<tr
<?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;"';
}
?>>
<td class="celda_normal">
<?php
echo date("d-m-Y", strtotime($trpSandUseStockDetail['date']));
?>
</td>
<td class="celda_normal rough"
data-id="<?= $trpSandUseStockDetail['date'] ?>"
oninput="roughStockChange(this)"
contenteditable="true"><?= $trpSandUseStockDetail['rough_kgs'] ?? " " ?></td>
<td class="celda_normal fine"
data-id="<?= $trpSandUseStockDetail['date'] ?>"
oninput="fineStockChange(this)"
contenteditable="true"><?= $trpSandUseStockDetail['fine_kgs'] ?? " " ?></td>
<td class="celda_normal total"
data-id="<?= $trpSandUseStockDetail['date'] ?>"><?= $trpSandUseStockDetail['total_kgs'] ?? " " ?></td>
<td class="celda_normal customerName"
data-id="<?= $trpSandUseStockDetail['date'] ?>"
contenteditable="true"><?= $trpSandUseStockDetail['customer_name'] ?? " " ?></td>
<td style="display:none"
data-id="<?= $trpSandUseStockDetail['date'] ?>"><?= $trpSandUseStockDetail['id'] ?? " " ?></td>
</tr>
<?php
//before closing inner loop
if (!isset($summary['rough_kgs'])) {
$summary['rough_kgs'] = 0;
$summary['fine_kgs'] = 0;
$summary['total_kgs'] = 0;
}
$summary['rough_kgs'] += $trpSandUseStockDetail['rough_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['rough_kgs'];
$summary['fine_kgs'] += $trpSandUseStockDetail['fine_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['fine_kgs'];
$summary['total_kgs'] += $trpSandUseStockDetail['total_kgs'] == "-" ? 0 : (float) $trpSandUseStockDetail['total_kgs'];
} ?>
<tfoot>
<tr class="total_row">
<td style="background-color:rgb(189, 9, 6); color:#ffff;">
<b> Total </b>
</td>
<td class="celda_normal "><b><?= $summary['rough_kgs'] ?></b></td>
<td class="celda_normal "><b><?= $summary['fine_kgs'] ?></b></td>
<td class="celda_normal "><b><?= $summary['total_kgs'] ?></b></td>
<td class="celda_normal "> </td>
</tr>
</tfoot>
</div>
<?php } else {
$date = DateTime::createFromFormat('M-Y', $month);
$startDate = $date->modify('first day of this month')->format('Y-m-d');
$endDate = $date->modify('last day of this month')->format('Y-m-d');
$datesInMonth = [];
$period = new DatePeriod(
new DateTime($startDate),
new DateInterval('P1D'),
(new DateTime($endDate))->modify('+1 day')
);
foreach ($period as $day) {
$datesInMonth[] = $day->format('Y-m-d');
}
foreach ($datesInMonth as $datesInMonthIndex => $dateInMonth) {
?>
<tr
<?php
$currentDate = date('d-m-Y');
$dateInMonthDmYFormat = date("d-m-Y", strtotime($dateInMonth));
if ($dateInMonthDmYFormat === $currentDate) {
echo 'style="background: #cef0ad;"';
}
?>>
<!-- td:eq(0) -->
<td class="celda_normal">
<?php
echo date("d-m-Y", strtotime($dateInMonth));
?>
</td>
<!-- td:eq(1) -->
<td class="celda_normal rough"
data-id="<?= $dateInMonth ?>"
oninput="roughStockChange(this)"
contenteditable="true"><?= " " ?></td>
<!-- td:eq(2) -->
<td class="celda_normal fine"
data-id="<?= $dateInMonth ?>"
oninput="fineStockChange(this)"
contenteditable="true"><?= " " ?></td>
<!-- td:eq(3) -->
<td class="celda_normal total"
data-id="<?= $dateInMonth ?>"><?= " " ?></td>
<!-- td:eq(4) -->
<td class="celda_normal customer"
data-id="<?= $dateInMonth ?>"
contenteditable="true"><?= " " ?></td>
<!-- td:eq(5) -->
<td style="display:none"
data-id="<?= $dateInMonth ?>"
contenteditable="true"><?= " " ?></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</div>
</div>
</div> <!-- End card-body -->
</div> <!-- End card -->
</div> <!-- End col -->
</div> <!-- End row -->
</div>
</div> <!-- End container-fluid -->
</div>
</div> </div>
<!-- end modal section -->
<!-- modal section -->
<script> <script>
function customFilterDate(){ function customFilterDate() {
let fromDate = $('#fromDateFilter').val(); //01-12-2024 let fromDate = $('#fromDateFilter').val(); //01-12-2024
let toDate = $('#toDateFilter').val(); //05-12-2024 let toDate = $('#toDateFilter').val(); //05-12-2024
@ -668,7 +677,7 @@
$('#trpSandUseStockDetailsTableId').find('tbody tr').each(function() { $('#trpSandUseStockDetailsTableId').find('tbody tr').each(function() {
const rowCells = $(this).find('td'); const rowCells = $(this).find('td');
let tableDate = rowCells.eq(0).text(); let tableDate = rowCells.eq(0).text();
let result = checkDateRange(fromDate,toDate,tableDate); let result = checkDateRange(fromDate, toDate, tableDate);
if (result) { if (result) {
$(this).show(); $(this).show();
} else { } else {
@ -699,11 +708,10 @@
let parts = dateString.split('-'); let parts = dateString.split('-');
return new Date(parts[2], parts[1] - 1, parts[0]); // Year, Month (0-based), Day return new Date(parts[2], parts[1] - 1, parts[0]); // Year, Month (0-based), Day
} }
</script> </script>
<script> <script>
$(document).ready(function(){ $(document).ready(function() {
$('.select2').select2(); $('.select2').select2();
}) })
</script> </script>
@ -712,11 +720,9 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() {
$('#saveId').click(function() {
$(document).ready(function () {
$('#saveId').click(function () {
//table to json function //table to json function
@ -732,7 +738,7 @@
type: "POST", type: "POST",
url: "<?php echo base_url() ?>updateTrpSandUseStockDetails", url: "<?php echo base_url() ?>updateTrpSandUseStockDetails",
success: function (data) { success: function(data) {
if (data) { if (data) {
$('#loader').hide(); $('#loader').hide();
console.log(data); console.log(data);
@ -756,7 +762,6 @@
}); });
}); });
</script> </script>
<script> <script>
@ -784,40 +789,38 @@
return JSON.stringify(rows, null, 2); return JSON.stringify(rows, null, 2);
} }
</script> </script>
<script> <script>
function roughStockChange(tdElement) { function roughStockChange(tdElement) {
try{ try {
console.log("just an alert from RoughStockChange..!!") console.log("just an alert from RoughStockChange..!!")
console.log(tdElement.innerText) console.log(tdElement.innerText)
let dataId = tdElement.getAttribute('data-id') let dataId = tdElement.getAttribute('data-id')
let roughStock = validateInput(tdElement.innerText); let roughStock = validateInput(tdElement.innerText);
let fineStock = validateInput(document.querySelector(`td.fine[data-id="${dataId}"]`).innerText); let fineStock = validateInput(document.querySelector(`td.fine[data-id="${dataId}"]`).innerText);
let total = (Number(roughStock) + Number(fineStock)) ; let total = (Number(roughStock) + Number(fineStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total; document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total;
} catch(error){ } catch (error) {
console.error("There is an error updating stock ..!!" + error); console.error("There is an error updating stock ..!!" + error);
} }
} }
function fineStockChange(tdElement) { function fineStockChange(tdElement) {
try{ try {
console.log("just an alert from fineStockChange..!!") console.log("just an alert from fineStockChange..!!")
console.log(tdElement.innerText) console.log(tdElement.innerText)
let dataId = tdElement.getAttribute('data-id') let dataId = tdElement.getAttribute('data-id')
let roughStock = validateInput(document.querySelector(`td.rough[data-id="${dataId}"]`).innerText); let roughStock = validateInput(document.querySelector(`td.rough[data-id="${dataId}"]`).innerText);
let fineStock = validateInput(tdElement.innerText) ; let fineStock = validateInput(tdElement.innerText);
let total = (Number(roughStock) + Number(fineStock)) ; let total = (Number(roughStock) + Number(fineStock));
document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total ; document.querySelector(`td.total[data-id="${dataId}"]`).innerText = total == 0 ? " " : total;
} catch(error){ } catch (error) {
console.error("There is an error updating stock ..!!" + error); console.error("There is an error updating stock ..!!" + error);
@ -848,10 +851,6 @@
return input; return input;
} }
</script> </script>
@ -859,8 +858,7 @@
<script> <script>
$(document).ready(function() {
$(document).ready(function(){
function exportTableToExcel(tableID, filename = '') { function exportTableToExcel(tableID, filename = '') {
let table = document.getElementById(tableID); let table = document.getElementById(tableID);
@ -868,12 +866,12 @@
let cloneTable = table.cloneNode(true); // Clone the table to modify let cloneTable = table.cloneNode(true); // Clone the table to modify
// Remove hidden rows // Remove hidden rows
$(cloneTable).find('tr').filter(function () { $(cloneTable).find('tr').filter(function() {
return $(this).css('display') === 'none'; return $(this).css('display') === 'none';
}).remove(); }).remove();
// Remove hidden columns // Remove hidden columns
$(cloneTable).find('th, td').each(function () { $(cloneTable).find('th, td').each(function() {
if ($(this).css('display') === 'none') { if ($(this).css('display') === 'none') {
$(this).remove(); $(this).remove();
} }
@ -906,23 +904,20 @@
let tableId = 'trpSandUseStockDetailsTableId'; let tableId = 'trpSandUseStockDetailsTableId';
document.getElementById('trpSandUseStockExport').addEventListener('click',function(){ document.getElementById('trpSandUseStockExport').addEventListener('click', function() {
exportTableToExcel(tableId,'Trp_Sand_Use_Stock_Details_<?=$month?>.xlsx'); exportTableToExcel(tableId, 'Trp_Sand_Use_Stock_Details_<?= $month ?>.xlsx');
}) })
}) })
</script> </script>
<script> <script>
document.addEventListener("keydown", function (event) { document.addEventListener("keydown", function(event) {
if (event.key === "Enter") { if (event.key === "Enter") {
@ -955,17 +950,15 @@
} }
} }
} }
}); });
</script> </script>
<script> <script>
$('#month').change(function() {
$('#month').change(function(){
$('#changeMonthForm').submit(); $('#changeMonthForm').submit();
}) })
$(document).ready(function () { $(document).ready(function() {
$('#month').datepicker({ $('#month').datepicker({
format: "M-yyyy", // Format as "Jan-2025" format: "M-yyyy", // Format as "Jan-2025"
@ -1010,15 +1003,56 @@
} }
}).catch(err => console.log("Error exiting fullscreen:", err)); }).catch(err => console.log("Error exiting fullscreen:", err));
} }
} }
$("#searchInput").on("keyup", function () { $("#searchInput").on("keyup", function() {
let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search let value = $(this).val().toLowerCase(); // Convert input to lowercase for case-insensitive search
$(".table-responsive tbody tr").filter(function () { $(".table-responsive tbody tr").filter(function() {
$(this).toggle($(this).text().toLowerCase().indexOf(value) > -1); $(this).toggle($(this).text().toLowerCase().indexOf(value) > -1);
}); });
}); });
</script> </script>
<script>
$(document).ready(function() {
$('.select2').select2({
dropdownParent: $('#fullscreenDiv')
});
// Initialize Select2 when the modal is shown inside full screen
$('#filterModalId,').on('shown.bs.modal', function() {
$('.select2').select2({
dropdownParent: $(this) // This ensures Select2 works in the modal
});
});
});
</script>
<script>
//getting modal backdrop inside full screen
$(document).ready(function() {
function moveModalBackdropToFullscreen() {
setTimeout(() => {
$('.modal-backdrop').appendTo('#fullscreenDiv'); // Move backdrop inside fullscreen
}, 10); // Small delay ensures backdrop is created first
}
// Move the modal backdrop when a modal opens
$('#filterModalId').on('show.bs.modal', function() {
moveModalBackdropToFullscreen();
});
// Ensure modals work properly in fullscreen mode
document.addEventListener("fullscreenchange", function() {
setTimeout(() => {
$('.modal-backdrop').remove(); // Remove any existing backdrops
moveModalBackdropToFullscreen();
}, 200);
});
});
</script>