CHANGE_ALL_TABLE_FROM_TO_SEARCH_DATE

This commit is contained in:
aadhavan valli 2024-09-18 16:18:53 +05:30
parent bb07cb8dbb
commit 3a60759b94
19 changed files with 667 additions and 569 deletions

View File

@ -68,9 +68,9 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
<div class="error" id="error"></div> <div class="error" id="error"></div>
@ -237,17 +237,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -255,11 +257,17 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );
// Handle form submission for the date range filter // Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) { $("#DateRangeFilter").submit(function(e) {
e.preventDefault(); e.preventDefault();

View File

@ -100,10 +100,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -282,17 +282,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -300,8 +302,13 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -58,10 +58,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -180,17 +180,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -198,8 +200,13 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -98,10 +98,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -217,17 +217,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -235,8 +237,13 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -56,10 +56,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -238,17 +238,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -256,8 +258,13 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -273,10 +273,10 @@
<span class="Date-filter-form" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <span class="Date-filter-form" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="button" class="range_search_button" id="DateRangeFilter"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="button" class="range_search_button" id="DateRangeFilter"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -307,21 +307,21 @@
foreach ($ReqList as $record) { foreach ($ReqList as $record) {
?> ?>
<tr id="<?php echo $index; ?>"> <tr id="<?php echo $index; ?>">
<td align="center"><input type="checkbox" name="chk<?php echo $index; ?>" id="chk<?php echo $index; ?>" onclick="selectReqNo(<?php echo $index; ?>)" />&nbsp;</td> <td align="left"><input type="checkbox" name="chk<?php echo $index; ?>" id="chk<?php echo $index; ?>" onclick="selectReqNo(<?php echo $index; ?>)" />&nbsp;</td>
<td align="center"> <td align="left">
<?php <?php
$dt = new DateTime($record->ReqDate); $dt = new DateTime($record->ReqDate);
$RequestedDate = $dt->format('d-m-Y'); $RequestedDate = $dt->format('d-m-Y');
echo $RequestedDate; echo $RequestedDate;
?> ?>
</td> </td>
<td align="center"><a data-toggle="modal" data-target="#RequisitionDtlsModal" data-id="<%=index%>" data-userid="<?php echo $record->ReqNo ?>"><u><?php echo $record->ReqNo; ?> </u></a></td> <td align="left"><a data-toggle="modal" data-target="#RequisitionDtlsModal" data-id="<%=index%>" data-userid="<?php echo $record->ReqNo ?>"><u><?php echo $record->ReqNo; ?> </u></a></td>
<td align="center"><?php echo $record->ReqType; ?></td> <td align="left"><?php echo $record->ReqType; ?></td>
<td><?php echo $record->FirstName; ?></td> <td><?php echo $record->FirstName; ?></td>
<td align="center"><?php echo $record->TotalNoofLineItems; ?></td> <td align="left"><?php echo $record->TotalNoofLineItems; ?></td>
<td align="center"><?php echo $record->PolineItems; ?></td> <td align="left"><?php echo $record->PolineItems; ?></td>
<td align="center"><?php echo $record->PartilallyLineItems; ?></td> <td align="left"><?php echo $record->PartilallyLineItems; ?></td>
<td align="center"><?php echo $record->newLineItem; ?></td> <td align="left"><?php echo $record->newLineItem; ?></td>
<td><?php echo $record->StatusName; ?></td> <td><?php echo $record->StatusName; ?></td>
<td><?php echo $record->DepartmentName; ?></td> <td><?php echo $record->DepartmentName; ?></td>
<td><?php echo $record->Designation; ?></td> <td><?php echo $record->Designation; ?></td>
@ -408,17 +408,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[1]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -426,8 +428,13 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -83,10 +83,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -178,17 +178,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -196,8 +198,13 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -190,52 +190,6 @@
} }
}); });
// Initialize the datepickers
$("#fromDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var minDate = $(this).datepicker("getDate");
$("#toDate").datepicker("option", "minDate", minDate);
}
});
$("#toDate").datepicker({
dateFormat: 'dd-mm-yy',
onSelect: function(selectedDate) {
var maxDate = $(this).datepicker("getDate");
$("#fromDate").datepicker("option", "maxDate", maxDate);
}
});
// Reset button functionality
$("#resetButton").click(function() {
$("#fromDate").datepicker("setDate", null);
$("#toDate").datepicker("setDate", null);
$("#toDate").datepicker("option", "minDate", null);
$("#fromDate").datepicker("option", "maxDate", null);
table.draw();
});
// Date range filter
$.fn.dataTable.ext.search.push(
function(settings, data, dataIndex) {
var fromDate = $("#fromDate").datepicker("getDate");
var toDate = $("#toDate").datepicker("getDate");
var dateStr = data[0]; // Assuming the date is in the first column
// Convert dateStr to Date object
var dateParts = dateStr.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object
if (!fromDate || !toDate) {
return true; // No filter if dates are not selected
}
return date >= fromDate && date <= toDate;
}
);
// Handle form submission // Handle form submission
$("#DateRangeFilter").submit(function(e) { $("#DateRangeFilter").submit(function(e) {

View File

@ -76,10 +76,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -89,16 +89,16 @@
<table class="table table-bordered table-hover" id="expense_list_table" style="background-color:#fff;"> <table class="table table-bordered table-hover" id="expense_list_table" style="background-color:#fff;">
<thead> <thead>
<tr> <tr>
<th align="right" style="width: 10%;">Created Date</th> <th align="left" style="width: 10%;">Created Date</th>
<!-- <th align="right">Expense Id</th> --> <!-- <th align="right">Expense Id</th> -->
<th align="right" style="width: 20%;">Supplier Name</th> <th align="left" style="width: 20%;">Supplier Name</th>
<th align="right" style="width: 25%;">Item Description</th> <th align="left" style="width: 25%;">Item Description</th>
<th align="right" style="width: 7%;">Cost</th> <th align="left" style="width: 7%;">Cost</th>
<th align="right" style="width: 5%;">CGST</th> <th align="left" style="width: 5%;">CGST</th>
<th align="right" style="width: 5%;">SGST</th> <th align="left" style="width: 5%;">SGST</th>
<th align="right" style="width: 5%;">IGST</th> <th align="left" style="width: 5%;">IGST</th>
<th align="right" style="width: 7%;">Total</th> <th align="left" style="width: 7%;">Total</th>
<th align="right" style="width: 8%;">Action</th> <th align="left" style="width: 8%;">Action</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
@ -467,22 +467,33 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
// Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
return date >= startDate && date <= endDate; // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -59,6 +59,27 @@
<script src="<?php echo base_url(); ?>public/new_assets/js/pages/form-wizard.init.js"></script> <script src="<?php echo base_url(); ?>public/new_assets/js/pages/form-wizard.init.js"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
form = $(".form-date-search")
.datepicker({
autoclose: true,
orientation: 'bottom',
format: 'dd-mm-yyyy',
todayHighlight: true,
endDate: '+0d'
})
.on("change", function() {
to.datepicker("option", "minDate", getDate(this));
}),
to = $(".to-date-search").datepicker({
autoclose: true,
orientation: 'bottom',
format: 'dd-mm-yyyy',
todayHighlight: true,
endDate: '+0d'
})
.on("change", function() {
from.datepicker("option", "maxDate", getDate(this));
});
var table = $('.ria_data_table').DataTable({ var table = $('.ria_data_table').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
buttons: [ buttons: [

View File

@ -140,10 +140,10 @@ if (empty($Status)) {
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -572,17 +572,19 @@ if (empty($Status)) {
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -590,8 +592,13 @@ if (empty($Status)) {
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -233,9 +233,11 @@ if (!empty($INRSYMBOL)) {
}); });
if (PaymentID != 'PT08') { if (PaymentID != 'PT08') {
$('#otheroptiondiv').hide(); $('#otheroptiondiv').hide();
$('#Otherpayment').prop('required', false);
$('#Otherpayment').val(''); $('#Otherpayment').val('');
} else if (PaymentID == 'PT08') { } else if (PaymentID == 'PT08') {
$('#otheroptiondiv').show(); $('#otheroptiondiv').show();
$('#Otherpayment').prop('required', true);
} }
$.each(Payment, function(pay, payobj) { $.each(Payment, function(pay, payobj) {
if (payobj.PaymentID == PaymentID) { if (payobj.PaymentID == PaymentID) {
@ -2018,7 +2020,7 @@ if (!empty($INRSYMBOL)) {
<label>Description of Payable Terms<span class="badge mandatory">*</span></label> <label>Description of Payable Terms<span class="badge mandatory">*</span></label>
<div> <div>
<?php <?php
$data = array('name' => 'Otherpayment', 'Otherpayment' => set_value('Otherpayment'), 'id' => 'Otherpayment', 'class' => 'form-control', 'required' => 'true'); $data = array('name' => 'Otherpayment', 'Otherpayment' => set_value('Otherpayment'), 'id' => 'Otherpayment', 'class' => 'form-control');
echo form_input($data); echo form_input($data);
?> ?>
</div> </div>
@ -4048,8 +4050,10 @@ if (!empty($INRSYMBOL)) {
$("#PaymentTerms").change(function() { $("#PaymentTerms").change(function() {
if ($('#PaymentTerms').val().trim() == 'PT08') { if ($('#PaymentTerms').val().trim() == 'PT08') {
$('#otheroptiondiv').show(); $('#otheroptiondiv').show();
$('#Otherpayment').prop('required', true);
} else { } else {
$('#otheroptiondiv').hide(); $('#otheroptiondiv').hide();
$('#Otherpayment').prop('required', false);
$('#Otherpayment').val(''); $('#Otherpayment').val('');
} }
}); });

View File

@ -70,10 +70,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -184,17 +184,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -202,8 +204,13 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -1,69 +1,73 @@
<?php <?php
$DraftCount = ''; $DraftCount = '';
$ReqNo = ''; $ReqNo = '';
if(!empty($Status)) if (!empty($Status)) {
{ foreach ($Status as $St) {
foreach ($Status as $St)
{
$DraftCount = $St->cnt; $DraftCount = $St->cnt;
$ReqNo = $St->ReqNo; $ReqNo = $St->ReqNo;
} }
//echo $ReqNo; //echo $ReqNo;
}?> } ?>
<style> <style>
#Requisition_filter { #Requisition_filter {
float: inline-end; float: inline-end;
} }
#Requisition_wrapper .row .col-sm-4 { #Requisition_wrapper .row .col-sm-4 {
flex-basis: 50%; flex-basis: 50%;
float: inline-end; float: inline-end;
} }
#Requisition_paginate .pagination { #Requisition_paginate .pagination {
flex-basis: 50%; flex-basis: 50%;
float: inline-end; float: inline-end;
margin: 0 0 15px; margin: 0 0 15px;
} }
#Requisition_wrapper .row:nth-child(3), #Requisition_wrapper .row:nth-child(3),
#Requisition_wrapper .row:nth-child(1) { #Requisition_wrapper .row:nth-child(1) {
padding: 0 15px; padding: 0 15px;
} }
#Requisition_info { #Requisition_info {
margin-top: 5px; margin-top: 5px;
} }
.dataTables_wrapper { .dataTables_wrapper {
padding-bottom: 0; padding-bottom: 0;
} }
span.highlight { span.highlight {
background-color: yellow; background-color: yellow;
} }
</style> </style>
<style> <style>
.Date-filter-form { .Date-filter-form {
display: flex; display: flex;
align-items: center; align-items: center;
gap: 10px; /* Adjust the gap as needed */ gap: 10px;
/* Adjust the gap as needed */
} }
.Date-filter-form input, .Date-filter-form button {
.Date-filter-form input,
.Date-filter-form button {
padding: 5px; padding: 5px;
font-size: 14px; font-size: 14px;
} }
.Date-filter-form button { .Date-filter-form button {
background-color: #007bff; background-color: #007bff;
color: white; color: white;
border: none; border: none;
cursor: pointer; cursor: pointer;
} }
.Date-filter-form button:hover { .Date-filter-form button:hover {
background-color: #0056b3; background-color: #0056b3;
} }
.icon-button { .icon-button {
background: none; background: none;
border: none; border: none;
@ -71,10 +75,11 @@ span.highlight {
color: #007bff; color: #007bff;
font-size: 18px; font-size: 18px;
} }
.icon-button:hover { .icon-button:hover {
color: #0056b3; color: #0056b3;
} }
</style> </style>
<div class="content-page"> <div class="content-page">
<div class="content"> <div class="content">
@ -87,11 +92,11 @@ span.highlight {
<div class="col-12"> <div class="col-12">
<div class="page-title-box page-title-box-alt"> <div class="page-title-box page-title-box-alt">
<h4 class="page-title">Requisition List</h4> <h4 class="page-title">Requisition List</h4>
<?php if($DraftCount == 0) { ?> <?php if ($DraftCount == 0) { ?>
<a class="btn btn-success" href="<?php echo base_url(); ?>RequisitionForm">Raise New Requisition</a> <a class="btn btn-success" href="<?php echo base_url(); ?>RequisitionForm">Raise New Requisition</a>
<?php } ?> <?php } ?>
<?php if($DraftCount > 0 ) {?> <?php if ($DraftCount > 0) { ?>
<p><span class="highlight">The Requisition No <b><?php echo $ReqNo;?></b> is in Draft <p><span class="highlight">The Requisition No <b><?php echo $ReqNo; ?></b> is in Draft
status.</span> Please act on the requisition.<span class="highlight">Then only you can raise status.</span> Please act on the requisition.<span class="highlight">Then only you can raise
New Requisition. </span></p> New Requisition. </span></p>
<?php } ?> <?php } ?>
@ -105,10 +110,10 @@ span.highlight {
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -131,13 +136,11 @@ span.highlight {
</thead> </thead>
<tbody> <tbody>
<?php <?php
if(!empty($TotNoOfLine)) if (!empty($TotNoOfLine)) {
{ foreach ($TotNoOfLine as $record) { //print_r($record);
foreach($TotNoOfLine as $record)
{ //print_r($record);
?> ?>
<tr> <tr>
<td> <?php $Pdt = new DateTime($record->CreatedDate ); <td> <?php $Pdt = new DateTime($record->CreatedDate);
$PODate = $Pdt->format('d-m-Y'); $PODate = $Pdt->format('d-m-Y');
echo $PODate ?> echo $PODate ?>
</td> </td>
@ -152,7 +155,7 @@ span.highlight {
<td><?php echo $record->StatusName ?></td> <td><?php echo $record->StatusName ?></td>
<td> <a data-toggle="tooltip" <td> <a data-toggle="tooltip"
href="<?php echo base_url().'EditRequisitionForm?ReqNo='.$record->ReqNo.'&ReqType='.$record->ReqType; ?>"><i href="<?php echo base_url() . 'EditRequisitionForm?ReqNo=' . $record->ReqNo . '&ReqType=' . $record->ReqType; ?>"><i
class="fas fa-pencil-alt" data-toggle="tooltip" class="fas fa-pencil-alt" data-toggle="tooltip"
title="<?php echo $record->ReqNo; ?> - Click here to view Requisition details"></i>&nbsp;&nbsp;&nbsp;</a> title="<?php echo $record->ReqNo; ?> - Click here to view Requisition details"></i>&nbsp;&nbsp;&nbsp;</a>
<a data-toggle="tooltip" onclick="DeleteRow('<?php echo $record->ReqNo; ?>' )"><span <a data-toggle="tooltip" onclick="DeleteRow('<?php echo $record->ReqNo; ?>' )"><span
@ -179,7 +182,7 @@ span.highlight {
<script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script> <script src="https://cdn.datatables.net/plug-ins/1.10.11/sorting/date-eu.js"></script>
<script> <script>
function DeleteRow(rowid) { function DeleteRow(rowid) {
id = rowid; id = rowid;
@ -206,9 +209,9 @@ function DeleteRow(rowid) {
} }
}); });
} }
} }
$(document).ready(function() { $(document).ready(function() {
// Initialize the DataTable // Initialize the DataTable
var table = $('#requisition_listing').DataTable({ var table = $('#requisition_listing').DataTable({
dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination dom: 'Blfrtip', // Buttons, length menu, filter, table, information, pagination
@ -216,7 +219,10 @@ $(document).ready(function() {
'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons 'copy', 'csv', 'excel', 'pdf', 'print' // Export buttons
], ],
pageLength: 10, // Default rows per page pageLength: 10, // Default rows per page
lengthMenu: [ [10, 20, 30, 50, -1], [10, 20, 30, 50, "All"] ], // Rows per page options lengthMenu: [
[10, 20, 30, 50, -1],
[10, 20, 30, 50, "All"]
], // Rows per page options
responsive: true, // Responsive table responsive: true, // Responsive table
order: [], // Default ordering (column index 0, descending) order: [], // Default ordering (column index 0, descending)
language: { language: {
@ -232,17 +238,19 @@ $(document).ready(function() {
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -250,8 +258,13 @@ $(document).ready(function() {
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );
@ -281,10 +294,5 @@ $(document).ready(function() {
toDateInput.value = fromDate; toDateInput.value = fromDate;
} }
}); });
}); });
</script> </script>

View File

@ -127,10 +127,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button" title="Search"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button" title="Search"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -295,17 +295,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -313,8 +315,13 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -71,10 +71,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -215,17 +215,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -233,11 +235,17 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );
// Handle form submission for the date range filter // Handle form submission for the date range filter
$("#DateRangeFilter").submit(function(e) { $("#DateRangeFilter").submit(function(e) {
e.preventDefault(); e.preventDefault();

View File

@ -94,10 +94,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -270,17 +270,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -288,8 +290,13 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -69,10 +69,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -210,17 +210,19 @@
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -228,8 +230,13 @@
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );

View File

@ -163,10 +163,10 @@
<form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;"> <form class="Date-filter-form" id="DateRangeFilter" style="margin-top: 14px;margin-bottom: -11px;margin-left: 33px;">
<input type="hidden" name="table" value="requisition"> <input type="hidden" name="table" value="requisition">
<label for="fromDate">From:</label> <label for="fromDate">From:</label>
<input class="form-control date_range" type="date" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required> <input class="form-control date_range form-date-search" id="fromDate" name="fromDate" placeholder="Select From Date" autocomplete="off" required>
<label for="toDate">To:</label> <label for="toDate">To:</label>
<input class="form-control date_range" type="date" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required> <input class="form-control date_range to-date-search" id="toDate" name="toDate" placeholder="Select To Date" autocomplete="off" required>
<button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button> <button type="submit" class="range_search_button"><i class="fe-search" aria-hidden="true" class="icon-button" title="Search"></i></button>
<i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i> <i class="fe-rotate-cw range_reset_button" aria-hidden="true" class="icon-button" id="resetButton" title="Reset"></i>
@ -204,11 +204,11 @@
$date = $createddate->format('d-m-Y'); $date = $createddate->format('d-m-Y');
$time = $createddate->format('h:i A'); $time = $createddate->format('h:i A');
?> ?>
<tr id="<?php echo $index ?>" > <tr id="<?php echo $index ?>">
<td align="right"><?php echo $date; ?></td> <td align="right"><?php echo $date; ?></td>
<td align="right"><?php echo $time; ?></td> <td align="right"><?php echo $time; ?></td>
<td><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $index;?>" data-inx="<?php echo $index;?>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>"> <u><?php echo $record->IGRNO ?></u></a></td> <td><a data-toggle="modal" data-target="#Igrshow" data-id="<?php echo $index; ?>" data-inx="<?php echo $index; ?>" data-userid="<?php echo $record->IGRNO ?>" data-igrstatus="<?php echo $record->IGRStatus ?>"> <u><?php echo $record->IGRNO ?></u></a></td>
<td><a data-toggle="modal" data-target="#CostCentershow" data-id="<?php echo $index;?>" data-igno="<?php echo $record->IGRNO;?>" data-pono="<?php echo $record->PONO ?>" target="_blank"> <u><?php echo $record->PONO ?></u></a></td> <td><a data-toggle="modal" data-target="#CostCentershow" data-id="<?php echo $index; ?>" data-igno="<?php echo $record->IGRNO; ?>" data-pono="<?php echo $record->PONO ?>" target="_blank"> <u><?php echo $record->PONO ?></u></a></td>
<td><?php echo $record->SupplierName ?></td> <td><?php echo $record->SupplierName ?></td>
<td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td> <td><?php echo $record->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php <td align="right"><?php
@ -240,7 +240,7 @@
&nbsp; &nbsp;
<!-- <a class="a_tag_for_mrir" href="<?php echo base_url().'MRIRcontroller/igrdatavalues?IGRNO='.$record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a> --> <!-- <a class="a_tag_for_mrir" href="<?php echo base_url() . 'MRIRcontroller/igrdatavalues?IGRNO=' . $record->IGRNO; ?>" target="_blank" data-id="<%=index%>" title="Generate MRIR"><i class="fa fa-external-link" style="text-align: center;"></i></a> -->
</td> </td>
</tr> </tr>
<?php <?php
@ -839,7 +839,7 @@
}); });
}); });
}); });
</script> </script>
<script> <script>
$('#update').click(function() { $('#update').click(function() {
@ -1502,14 +1502,14 @@
<script src="https://cdn.datatables.net/plug-ins/1.13.6/sorting/datetime-moment.js"></script> <script src="https://cdn.datatables.net/plug-ins/1.13.6/sorting/datetime-moment.js"></script>
<script> <script>
$(document).ready(function() { $(document).ready(function() {
$.fn.dataTable.ext.type.order['date-eu-pre'] = function (date) { $.fn.dataTable.ext.type.order['date-eu-pre'] = function(date) {
var dateSplit = date.split('-'); var dateSplit = date.split('-');
return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1; return (dateSplit[2] + dateSplit[1] + dateSplit[0]) * 1;
}; };
}); });
function appendExistingFilesFileds(data){ function appendExistingFilesFileds(data) {
const base_url = '<?php echo base_url(); ?>'; const base_url = '<?php echo base_url(); ?>';
var filePath = data != null && data != '' ? data.FilePath : ''; var filePath = data != null && data != '' ? data.FilePath : '';
var fileName = data != null && data != '' ? data.Remarks : ''; var fileName = data != null && data != '' ? data.Remarks : '';
@ -1631,17 +1631,19 @@ function appendExistingFilesFileds(data){
function(settings, data, dataIndex) { function(settings, data, dataIndex) {
var fromDate = $('#fromDate').val(); var fromDate = $('#fromDate').val();
var toDate = $('#toDate').val(); var toDate = $('#toDate').val();
console.log(fromDate); // e.g., 01-09-2024
console.log(toDate); // e.g., 08-09-2024
if (!fromDate || !toDate) { if (!fromDate || !toDate) {
return true; // If no dates selected, don't filter return true; // If no dates selected, don't filter
} }
var dateStr = data[0]; // Assuming the date is in the first column // Convert the fromDate and toDate from dd-mm-yyyy to Date objects
var dateParts = dateStr.split("-"); var fromParts = fromDate.split("-");
var date = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]); // Convert dd-mm-yyyy to Date object var toParts = toDate.split("-");
var startDate = new Date(fromDate); var startDate = new Date(fromParts[2], fromParts[1] - 1, fromParts[0]); // Year, month (0-based), day
var endDate = new Date(toDate); var endDate = new Date(toParts[2], toParts[1] - 1, toParts[0]);
// Adjust startDate to include the day before the selected fromDate // Adjust startDate to include the day before the selected fromDate
startDate.setDate(startDate.getDate() - 1); startDate.setDate(startDate.getDate() - 1);
@ -1649,8 +1651,13 @@ function appendExistingFilesFileds(data){
// Ensure endDate includes the entire end date by setting time to the end of the day // Ensure endDate includes the entire end date by setting time to the end of the day
endDate.setHours(23, 59, 59, 999); endDate.setHours(23, 59, 59, 999);
// Return true if the date is within the range // Get the date from the DataTable row (assuming it's in the first column in dd-mm-yyyy format)
return date >= startDate && date <= endDate; var dateStr = data[0];
var dateParts = dateStr.split("-");
var rowDate = new Date(dateParts[2], dateParts[1] - 1, dateParts[0]);
// Return true if the row date is within the range
return rowDate >= startDate && rowDate <= endDate;
} }
); );