FIX_igr Datatable

This commit is contained in:
VE10-Sanjeev 2024-08-08 07:31:32 +00:00
parent e87e407c9c
commit a2ea33299a

View File

@ -14,42 +14,12 @@
white-space: nowrap; white-space: nowrap;
} }
</style> </style>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css"> <style>
<!-- Latest DataTables Buttons CSS -->
<link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.3.4/css/buttons.dataTables.min.css">
<style>
.dataTables_wrapper .dataTables_length select {
background-color:white !important;
}
.dataTables_wrapper .dataTables_filter input {
background-color: white !important;
}
button.dt-button, div.dt-button, a.dt-button, input.dt-button {
background-color: white !important;
}
.dataTables_length, label{
display: flex !important;
}
.dataTables_wrapper .dataTables_filter {
text-align: center;
}
.dataTables_wrapper .dataTables_length {
float: left;
}
.dataTables_wrapper .dt-buttons {
float: right;
}
.dataTables_wrapper .clear {
clear: both;
}
th, td { th, td {
white-space: nowrap; white-space: nowrap;
} }
.dataTables_wrapper { </style>
width: 100%;
overflow-x: auto;
}
</style>
<script> <script>
$(function() { $(function() {
var d = new Date(); var d = new Date();
@ -82,7 +52,8 @@
<thead style="background-color: #ddd;"> <thead style="background-color: #ddd;">
<tr> <tr>
<th style="display:none;"></th> <th style="display:none;"></th>
<th>Created Date</th> <th>Create Date</th>
<th>Create time</th>
<th>IGR No</th> <th>IGR No</th>
<th>PO No</th> <th>PO No</th>
<th>Supplier Name</th> <th>Supplier Name</th>
@ -98,15 +69,18 @@
if(!empty($IGR)) if(!empty($IGR))
{ $index = 0; { $index = 0;
foreach($IGR as $record) foreach($IGR as $record)
{ $index = $index +1; { $index = $index +1;
$createddate = new DateTime($record->CreatedDate);
$datewithtime = $createddate->format('d-m-Y h:i A');
$date = $createddate->format('d-m-Y');
$time = $createddate->format('h:i A');
?> ?>
<tr id="<?php echo $index ?>" > <tr id="<?php echo $index ?>" >
<th style="display:none;"><?php echo $record->CreatedDate ?></th> <th style="display:none;"><?php echo $record->CreatedDate ?></th>
<td align="right"><?php <td align="right"><?php echo $date; ?></td>
$createddate = new DateTime($record->CreatedDate); <td align="right"><?php echo $time; ?></td>
echo $createddate->format('d-m-Y h:i 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="#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 target="_blank" data-toggle="modal" data-target="#CostCentershow" data-id="<%=index%>" title="Cost Center" data-igrno="<?php echo $record->IGRNO ?>" data-pono="<?php echo $record->PONO ?>"><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
@ -1459,50 +1433,69 @@ function deleteBill(Billno,i){
} }
</script> </script>
<!-- Latest DataTables JS --> <script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.js"></script>
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.3.4/js/dataTables.buttons.min.js"></script>
<!-- Latest DataTables Buttons JS --> <script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.4/js/dataTables.buttons.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.print.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.html5.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.3.4/js/buttons.print.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/pdfmake.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.2.7/vfs_fonts.js"></script> <script>
<script src="https://cdn.datatables.net/plug-ins/1.13.6/sorting/datetime-moment.js"></script> $(document).ready(function() {
$.fn.dataTable.moment('DD-MM-YYYY HH:mm A');
<script> $('#Inwardgateregistertable').DataTable({
$(function () { "paging": true,
$.fn.dataTable.moment('DD-MM-YYYY'); "lengthChange": true,
$('#Inwardgateregistertable').DataTable({ "searching": true,
"paging": true, "ordering": true,
"lengthChange": true, "aaSorting": [[ 0, "desc" ]],
"searching": true, "order": [[0, "desc"]],
"ordering": true, "pageLength": 10,
"info": true, "lengthMenu": [5, 10, 20, 50, 100, 200, 500],
"autoWidth": true, "info": true,
"scrollCollapse": true, "autoWidth": true,
"scrollX": true, "dom": "<'row'<'col-sm-3'l><'col-sm-6 text-center'f><'col-sm-3 text-right'B>>" +
"pageLength": 25, "<'row'<'col-sm-12'tr>>" +
"order": [[0, "desc"]], // Assuming the "Created Date" is the first column and you want to order by it in descending order "<'row'<'col-sm-5'i><'col-sm-7'p>>",
"dom": '<"top"lBf>rt<"bottom"ip><"clear">', // Custom layout "buttons": [
"buttons": [ {
{ extend: 'excelHtml5',
extend: 'excelHtml5', text: 'Export to Excel',
text: 'Export to Excel', title: 'Inward Gate Register',
title: 'Inward Gate Register', exportOptions: {
exportOptions: { columns: ':visible:not(:first-child):not(:last-child)' // Exclude first and last columns
columns: ':visible:not(:first-child):not(:last-child)' // Exclude first and last columns }
} },
}, {
{ extend: 'pdfHtml5',
extend: 'pdfHtml5', text: 'Export to PDF',
text: 'Export to PDF', title: 'Inward Gate Register',
title: 'Inward Gate Register', customize: function (doc) {
exportOptions: { doc.content[1].margin = [ 10, 0, 10, 0 ]; // left, top, right, bottom
columns: ':visible:not(:first-child):not(:last-child)' // Exclude first and last columns doc.pageSize = 'A4'; // Ensure it's A4
} doc.pageOrientation = 'landscape'; // Set landscape orientation
} doc.defaultStyle.fontSize = 10; // Set default font size
] doc.styles.tableHeader.fontSize = 12; // Set font size for header
}); },
}); exportOptions: {
</script> columns: ':visible:not(:first-child):not(:last-child)' // Exclude first and last columns
}
}
]
});
});
</script>
<style>
.dataTables_wrapper .col-sm-3 .dataTables_length {
float: left;
}
.dataTables_wrapper .col-sm-6 .dataTables_filter {
float: none;
text-align: center;
}
.dataTables_wrapper .col-sm-3 .dt-buttons {
float: right;
}
</style>