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;
}
</style>
<link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css">
<!-- 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;
}
<style>
th, td {
white-space: nowrap;
}
.dataTables_wrapper {
width: 100%;
overflow-x: auto;
}
</style>
</style>
<script>
$(function() {
var d = new Date();
@ -82,7 +52,8 @@
<thead style="background-color: #ddd;">
<tr>
<th style="display:none;"></th>
<th>Created Date</th>
<th>Create Date</th>
<th>Create time</th>
<th>IGR No</th>
<th>PO No</th>
<th>Supplier Name</th>
@ -98,15 +69,18 @@
if(!empty($IGR))
{ $index = 0;
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 ?>" >
<th style="display:none;"><?php echo $record->CreatedDate ?></th>
<td align="right"><?php
$createddate = new DateTime($record->CreatedDate);
echo $createddate->format('d-m-Y h:i A'); ?></td>
<td align="right"><?php echo $date; ?></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 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->DeliveryChellanOrInvoiceNo ?></td>
<td align="right"><?php
@ -1459,50 +1433,69 @@ function deleteBill(Billno,i){
}
</script>
<!-- Latest DataTables JS -->
<script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script>
<!-- Latest DataTables Buttons JS -->
<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.html5.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/jszip/3.10.1/jszip.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/pdfmake/0.2.7/vfs_fonts.js"></script>
<script src="https://cdn.datatables.net/plug-ins/1.13.6/sorting/datetime-moment.js"></script>
<script>
$(function () {
$.fn.dataTable.moment('DD-MM-YYYY');
$('#Inwardgateregistertable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"info": true,
"autoWidth": true,
"scrollCollapse": true,
"scrollX": true,
"pageLength": 25,
"order": [[0, "desc"]], // Assuming the "Created Date" is the first column and you want to order by it in descending order
"dom": '<"top"lBf>rt<"bottom"ip><"clear">', // Custom layout
"buttons": [
{
extend: 'excelHtml5',
text: 'Export to Excel',
title: 'Inward Gate Register',
exportOptions: {
columns: ':visible:not(:first-child):not(:last-child)' // Exclude first and last columns
}
},
{
extend: 'pdfHtml5',
text: 'Export to PDF',
title: 'Inward Gate Register',
exportOptions: {
columns: ':visible:not(:first-child):not(:last-child)' // Exclude first and last columns
}
}
]
});
});
</script>
<script src="https://cdn.datatables.net/plug-ins/1.10.16/sorting/datetime-moment.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.html5.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/jszip/3.10.1/jszip.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/pdfmake/0.2.7/vfs_fonts.js"></script>
<script>
$(document).ready(function() {
$.fn.dataTable.moment('DD-MM-YYYY HH:mm A');
$('#Inwardgateregistertable').DataTable({
"paging": true,
"lengthChange": true,
"searching": true,
"ordering": true,
"aaSorting": [[ 0, "desc" ]],
"order": [[0, "desc"]],
"pageLength": 10,
"lengthMenu": [5, 10, 20, 50, 100, 200, 500],
"info": true,
"autoWidth": true,
"dom": "<'row'<'col-sm-3'l><'col-sm-6 text-center'f><'col-sm-3 text-right'B>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-5'i><'col-sm-7'p>>",
"buttons": [
{
extend: 'excelHtml5',
text: 'Export to Excel',
title: 'Inward Gate Register',
exportOptions: {
columns: ':visible:not(:first-child):not(:last-child)' // Exclude first and last columns
}
},
{
extend: 'pdfHtml5',
text: 'Export to PDF',
title: 'Inward Gate Register',
customize: function (doc) {
doc.content[1].margin = [ 10, 0, 10, 0 ]; // left, top, right, bottom
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: {
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>