master module changes-3 vadivel J 19-12-2024

This commit is contained in:
vadivelJ96 2024-12-19 18:17:04 +05:30
parent 4df1ff8885
commit 37ed0276bf
3 changed files with 53 additions and 10 deletions

View File

@ -670,7 +670,7 @@
for (let i = 1; i < rowCells.length; i += 7) {
const rowData = {
date: rowCells.eq(i).text().trim(),
materialCode: rowCells.eq(i+1).text().trim(),
materialCode: rowCells.eq(i+1).text().trim(),
customer: rowCells.eq(i+2).text().trim(),
opening: rowCells.eq(i+3).text().trim(),
receipt: rowCells.eq(i+4).text().trim(),

View File

@ -433,11 +433,11 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
<div class="modal-body">
<div class="row">
<!-- Date Dropdown -->
<!-- Date Filter -->
<div class="col-md-6">
<div class="form-group">
<label for="dateDropdown">Select Date</label>
<select id="dateDropdown" class="form-control">
<label for="fromDateFilter">Select Date</label>
<select id="fromDateFilter" name="fromDateFilter" class="form-control">
<?php foreach ($drierDetails as $a) :
$selectDate = DateTime::createFromFormat('Y-m-d', $a['date'])->format('d-m-Y'); ?>
<option value="<?= $selectDate ?>"><?= $selectDate ?></option>
@ -447,11 +447,11 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
</div>
</div>
<!-- Date Dropdown -->
<!-- Date Filter -->
<div class="col-md-6">
<div class="form-group">
<label for="dateDropdown">Select Date</label>
<select id="dateDropdown" class="form-control">
<label for="toDateFilter">Select Date</label>
<select id="toDateFilter" name="toDateFilter" class="form-control">
<?php foreach ($drierDetails as $a) :
$selectDate = DateTime::createFromFormat('Y-m-d', $a['date'])->format('d-m-Y'); ?>
<option value="<?= $selectDate ?>"><?= $selectDate ?></option>
@ -460,7 +460,7 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
</div>
</div>
</div>
<button class="btn btn-primary float-right" onclick="navigateToMachine()">Filter</button>
<button class="btn btn-primary float-right" onclick="filterDate()">Filter</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
@ -895,4 +895,47 @@ $datefordropdown = format_date($datefordropdown, 0, 'M-Y');
}
}
</script>
<script>
function filterDate(){
let fromDate = $('#fromDateFilter').val(); //01-12-2024
let toDate = $('#toDateFilter').val(); //05-12-2024
$('#drierTable').find('tbody tr').each(function() {
const rowCells = $(this).find('td');
let tableDate = rowCells.eq(0).text(); // prints every date in the month from 1 to 30 .
let result = checkDateRange(fromDate,toDate,tableDate);
if (result) {
$(this).show(); // Show the row if the date is within range
} else {
$(this).hide(); // Hide the row if the date is out of range
}
});
$('#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

@ -260,8 +260,8 @@
<td align="right"><?php echo (int)$record->ReceivedQuantity ?></td>
<!-- below one is currently shown as received qty -->
<td align="right"><?php echo $record->NetWeight ?></td>
<td align="right"><?php echo (int)$record->NetWeight ?></td>
<td><?php echo $record->VehicleNo ?></td>
<td><?php echo $record->DriverName ?></td>
<td><?php echo $record->TransporterName ?></td>