164 lines
5.3 KiB
Plaintext
164 lines
5.3 KiB
Plaintext
<div class="tab-content-wrapper">
|
|
<table id="RemovedPRTable" class="row-border" cellspacing="0" width="100%">
|
|
<thead>
|
|
<tr>
|
|
<th>PRNo</th>
|
|
<th>ItemNo</th>
|
|
<th>ItemName</th>
|
|
<th>Qty</th>
|
|
<th>PR By</th>
|
|
<th>PR Date</th>
|
|
<th>Attested By</th>
|
|
<th>Attested Date</th>
|
|
<th>Approved By</th>
|
|
<th>Approved Date</th>
|
|
<th>Charge To</th>
|
|
<th>Remarks</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
|
|
const reportTitle = `Deleted Purchase Request - as of ${getFormattedDateTime()}`;
|
|
var removedPRTable = $('#RemovedPRTable').DataTable({
|
|
ajax: {
|
|
url: '/PRMgmt/GetApprovedPR',
|
|
type: 'GET',
|
|
beforeSend: function () {
|
|
loader.show();
|
|
},
|
|
complete: function () {
|
|
loader.hide();
|
|
},
|
|
error: function (xhr, error, thrown) {
|
|
loader.hide();
|
|
console.error('Error loading data:', error);
|
|
if (typeof toastr !== 'undefined') {
|
|
toastr.error('Failed to load data. Please try again.');
|
|
}
|
|
}
|
|
},
|
|
dom: 'lBfrtip',
|
|
buttons: [
|
|
{
|
|
extend: 'csv',
|
|
title: reportTitle
|
|
},
|
|
{
|
|
extend: 'excel',
|
|
title: reportTitle
|
|
},
|
|
{
|
|
extend: 'pdf',
|
|
title: reportTitle
|
|
}
|
|
],
|
|
initComplete: function () {
|
|
initializeColumnSearch({
|
|
tableId: '#RemovedPRTable',
|
|
dataTable: removedPRTable,
|
|
searchableColumns: [
|
|
{
|
|
columnIndex: 0,
|
|
columnName: 'PR No',
|
|
placeholder: 'Enter PR Number...',
|
|
searchType: 'text',
|
|
searchMode: 'exact',
|
|
width: '150px'
|
|
},
|
|
{
|
|
columnIndex: 1,
|
|
columnName: 'Item No',
|
|
placeholder: 'Enter Item Number...',
|
|
searchType: 'text',
|
|
searchMode: 'exact',
|
|
width: '150px'
|
|
},
|
|
{
|
|
columnIndex: 2,
|
|
columnName: 'Item Name',
|
|
placeholder: 'Enter Item Name...',
|
|
searchType: 'text',
|
|
searchMode: 'contains',
|
|
width: '200px'
|
|
},
|
|
{
|
|
columnIndex: 10,
|
|
columnName: 'Department',
|
|
placeholder: 'Select Department...',
|
|
searchType: 'select',
|
|
searchMode: 'exact',
|
|
width: '150px'
|
|
}
|
|
]
|
|
});
|
|
|
|
const uniqueSearchClass = 'column-search-input-RemovedPRTable';
|
|
|
|
populateSelectOptions(removedPRTable, 10, '.' + uniqueSearchClass + '[data-column="10"]');
|
|
|
|
restoreSearchFromURL(uniqueSearchClass, '#RemovedPRTable');
|
|
},
|
|
columns: [
|
|
{ data: 'prNo' },
|
|
{ data: 'itemNo' },
|
|
{ data: 'itemName' },
|
|
{
|
|
searchable: false,
|
|
data: 'qty',
|
|
render: function (data) {
|
|
return numberWithCommas(data);
|
|
}
|
|
},
|
|
{ data: 'createdBy' },
|
|
{
|
|
searchable: false,
|
|
data: 'createdDate',
|
|
render: function (data) {
|
|
return formatDateTime(data);
|
|
}
|
|
},
|
|
{ data: 'attestedBy' },
|
|
{
|
|
searchable: false,
|
|
data: 'attestedDate',
|
|
render: function (data) {
|
|
return formatStrDateTime(data);
|
|
}
|
|
},
|
|
{ data: 'approvedBy' },
|
|
{
|
|
searchable: false,
|
|
data: 'approvedDate',
|
|
render: function (data) {
|
|
return formatStrDateTime(data);
|
|
}
|
|
},
|
|
{ data: 'department' },
|
|
{ data: 'remarks' }
|
|
],
|
|
order: [[9, 'asc']],
|
|
responsive: true,
|
|
language: {
|
|
emptyTable: "No approved records available"
|
|
}
|
|
});
|
|
});
|
|
function formatStrDateTime(dateString) {
|
|
if (!dateString || dateString === "None") return "None";
|
|
|
|
let date = new Date(dateString);
|
|
let month = ('0' + (date.getMonth() + 1)).slice(-2);
|
|
let day = ('0' + date.getDate()).slice(-2);
|
|
let year = date.getFullYear();
|
|
let hours = ('0' + date.getHours()).slice(-2);
|
|
let minutes = ('0' + date.getMinutes()).slice(-2);
|
|
let seconds = ('0' + date.getSeconds()).slice(-2);
|
|
return `${month}/${day}/${year} ${hours}:${minutes}:${seconds}`;
|
|
}
|
|
</script> |