224 lines
10 KiB
PHP
224 lines
10 KiB
PHP
<style>
|
|
.table th,
|
|
.table td {
|
|
padding: 8px;
|
|
}
|
|
|
|
table.dataTable tbody td {
|
|
padding: 4px 4px !important;
|
|
}
|
|
|
|
.col-12 {
|
|
|
|
max-width: 98% !important;
|
|
}
|
|
|
|
.dataTables_filter {
|
|
position: absolute;
|
|
}
|
|
|
|
.right-align-input {
|
|
text-align: right;
|
|
}
|
|
.dataTables_length label {height: 21px !important;}
|
|
</style>
|
|
|
|
<div class="col-12" id="second_page">
|
|
<div class="card">
|
|
<div class="card-body">
|
|
<div class="row" style="padding-bottom: 10px;">
|
|
<div class="col-6" style="align-self: center;">
|
|
<h4 style="position: relative;">Client Report </h4>
|
|
</div>
|
|
|
|
</div>
|
|
<div class="table-responsive">
|
|
<table data-custom-table-css="table" id="scroll-horizontal-datatable" class="table w-100 nowrap">
|
|
<thead class="bg-light">
|
|
<tr>
|
|
<th>S. No</th>
|
|
<th>Insured</th>
|
|
<th>Policies</th>
|
|
<th>Premium</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php if (isset($data) && !empty($data)) { ?>
|
|
|
|
<?php foreach($data as $index => $row){ ?>
|
|
<tr>
|
|
<td ><?= $index + 1 ?></td>
|
|
<td><?php echo $row['client_name']; ?></td>
|
|
<td ><?php echo $row['policy_count']; ?> </td>
|
|
<td ><?php echo $row['premium']; ?></td>
|
|
</tr>
|
|
<?php } ?>
|
|
|
|
<?php } ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<div>
|
|
</div>
|
|
</div>
|
|
</div><!-- end col -->
|
|
</div>
|
|
</div>
|
|
|
|
<!-------------------------------------------------------------------------------------------------->
|
|
|
|
<script>
|
|
// Datatable document ready
|
|
$(document).ready(function() {
|
|
|
|
var ticketsTable = $('#scroll-horizontal-datatable');
|
|
|
|
if (ticketsTable.length) {
|
|
ticketsTable.DataTable({
|
|
scrollX: true,
|
|
// dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
|
// "<'row'<'col-sm-12'tr>>" +
|
|
// "<'row'<'col-sm-5'i><'col-sm-7'p>>", // Pagination at the bottom, without page length selector
|
|
// buttons: [{
|
|
// extend: 'csv',
|
|
// text: 'CSV',
|
|
// title: 'IRDA-BAP-CLIENT-List',
|
|
// },
|
|
// {
|
|
// extend: 'excel',
|
|
// text: 'Excel',
|
|
// title: 'IRDA-BAP-CLIENT-List',
|
|
// customize: function(xlsx) {
|
|
// var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
|
// var total = 0;
|
|
|
|
// // Find cells in column AB (28th column in Excel)
|
|
// $('row c[r^="AB"]', sheet).each(function() {
|
|
// var value = parseFloat($('v', this)
|
|
// .text()); // Get the value inside the cell
|
|
// if (!isNaN(value)) {
|
|
// total += value;
|
|
// }
|
|
// });
|
|
|
|
// // Get the last row index and append the total row
|
|
// var lastRow = $('row:last', sheet);
|
|
// var rowIndex = parseInt(lastRow.attr('r')) +
|
|
// 2; // Find the next row index
|
|
// var totalRow = '<row r="' + rowIndex + '">' +
|
|
// '<c t="inlineStr" r="AA' + rowIndex +
|
|
// '"><is><t>Total</t></is></c>' + // Insert "Total" in AA
|
|
// '<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) +
|
|
// '</v></c>' + // Insert sum in AB
|
|
// '</row>';
|
|
|
|
// // Append the new total row to the sheet
|
|
// $(sheet).find('sheetData').append(totalRow);
|
|
// },
|
|
// exportOptions: {
|
|
// orthogonal: 'sort'
|
|
// },
|
|
// customizeData: function(data) {
|
|
// for (var i = 0; i < data.body.length; i++) {
|
|
// for (var j = 0; j < data.body[i].length; j++) {
|
|
// // Check if the column is the 9th index (10th column)
|
|
// if (j === 9) {
|
|
// data.body[i][j] = '\u200C' + data.body[i][j];
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
|
|
// }
|
|
|
|
// ],
|
|
dom: "<'row'<'col-sm-6'f><'col-sm-6 text-right'B>>" + // Filter left, buttons right
|
|
"<'row'<'col-sm-12'tr>>" +
|
|
"<'row align-items-center'<'col-5 text-start'i><'col-7 d-flex justify-content-end align-items-center'<'me-2'l>p>>",
|
|
lengthMenu: [[10, 20, 50, 100], [10, 20, 50, 100]],
|
|
buttons: [
|
|
{
|
|
extend: 'collection',
|
|
text: '<span class=" btn-custom"> Export </span><i class="mdi mdi-menu-down"></i>',
|
|
className: 'btn app-btn-secondary ',
|
|
buttons: [
|
|
{
|
|
extend: 'csv',
|
|
text: '<i class="mdi mdi-file-delimited " ></i><span class=" btn-custom"> CSV </span>',
|
|
className: 'app-btn-primary ',
|
|
title: 'IRDA-BAP-CLIENT-List',
|
|
},
|
|
{
|
|
extend: 'excel',
|
|
text: '<i class="mdi mdi-file-excel " ></i><span class=" btn-custom"> EXCEL </span>',
|
|
title: 'IRDA-BAP-CLIENT-List',
|
|
sheetName: 'IRDA-BAP-CLIENT-List',
|
|
className: 'app-btn-primary ',
|
|
customize: function(xlsx) {
|
|
var sheet = xlsx.xl.worksheets['sheet1.xml'];
|
|
var total = 0;
|
|
|
|
// Find cells in column AB (28th column in Excel)
|
|
$('row c[r^="AB"]', sheet).each(function() {
|
|
var value = parseFloat($('v', this)
|
|
.text()); // Get the value inside the cell
|
|
if (!isNaN(value)) {
|
|
total += value;
|
|
}
|
|
});
|
|
|
|
// Get the last row index and append the total row
|
|
var lastRow = $('row:last', sheet);
|
|
var rowIndex = parseInt(lastRow.attr('r')) +
|
|
2; // Find the next row index
|
|
var totalRow = '<row r="' + rowIndex + '">' +
|
|
'<c t="inlineStr" r="AA' + rowIndex +
|
|
'"><is><t>Total</t></is></c>' + // Insert "Total" in AA
|
|
'<c t="n" r="AB' + rowIndex + '"><v>' + total.toFixed(2) +
|
|
'</v></c>' + // Insert sum in AB
|
|
'</row>';
|
|
|
|
// Append the new total row to the sheet
|
|
$(sheet).find('sheetData').append(totalRow);
|
|
},
|
|
exportOptions: {
|
|
orthogonal: 'sort'
|
|
},
|
|
customizeData: function(data) {
|
|
for (var i = 0; i < data.body.length; i++) {
|
|
for (var j = 0; j < data.body[i].length; j++) {
|
|
// Check if the column is the 9th index (10th column)
|
|
if (j === 9) {
|
|
data.body[i][j] = '\u200C' + data.body[i][j];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
}
|
|
]
|
|
}
|
|
],
|
|
language: {
|
|
search: `
|
|
<div class="datatable-search-wrapper" style="position:relative; display:inline-block;">
|
|
_INPUT_
|
|
<i class="mdi mdi-magnify datatable-search-icon"
|
|
style="position:absolute; right:10px; top:50%; transform:translateY(-50%); color:#666;"></i>
|
|
<i class="mdi mdi-close-circle datatable-clear-icon"
|
|
style="position:absolute; right:10px; top:50%; transform:translateY(-50%); color:#666; display:none;"></i>
|
|
</div>`,
|
|
searchPlaceholder: "Search",
|
|
emptyTable: '<div class="text-center text-muted">No Data found</div>'
|
|
},
|
|
paging: true, // Enable pagination
|
|
pageLength: 10, // Set default number of rows per page (optional)
|
|
ordering: false,
|
|
});
|
|
} else {
|
|
console.error("Table atet found.");
|
|
}
|
|
});
|
|
|
|
// ----------------------------------------------------------------------------------------------------
|
|
</script>
|