CHANGE_IRDA_REPORTS : RV

This commit is contained in:
VENKATESHWARAN 2025-01-24 11:16:24 +05:30
parent 5e7d91aa23
commit c59a9cc2ee
3 changed files with 208 additions and 54 deletions

View File

@ -4049,11 +4049,11 @@ class ClientController extends AdminController
$BDSReportController = new BDSReportController();
$data['data'] = $BDSReportController->getBAPInsurerData();
return $this->loadLayout('irda_bap_insurer_report_list', $data);
// $data['data'] = $BDSReportController->getBAPInsurerData();
// return $this->loadLayout('irda_bap_insurer_report_list', $data);
// $data['data'] = $BDSReportController->getBAPClientData();
// return $this->loadLayout('irda_bap_client_report_list', $data);
$data['data'] = $BDSReportController->getBAPClientData();
return $this->loadLayout('irda_bap_client_report_list', $data);
// $data['data'] = $BDSReportController->getClientData(1);
// return $this->loadLayout('irda_client_report_list', $data);

View File

@ -33,6 +33,7 @@ table.dataTable tbody td {
</div>
<div class="table-responsive">
<table id="scroll-horizontal-datatable" class="table w-100 nowrap">
<thead class="bg-light">
<tr>
@ -57,45 +58,37 @@ table.dataTable tbody td {
<th>Policies</th>
<th>Premium</th>
<th>Policies</th>
<th>Premium</th>
<th>Policies</th>
<th>Premium</th>
<th>Policies</th>
<th>Premium</th>
<th>Policies</th>
<th>Premium</th>
<th>Policies</th>
<th>Premium</th>
<th>Policies</th>
<th>Premium</th>
<th>Policies</th>
<th>Premium</th>
<th>Policies</th>
<th>Premium</th>
<th>Policies</th>
<th>Premium</th>
</tr>
</thead>
<tbody>
<?php if (isset($data) && !empty($data)) { ?>
@ -140,6 +133,45 @@ table.dataTable tbody td {
<?php } ?>
</tbody>
<tfoot>
<tr>
<th></th>
<th>Grand Total</th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
</tr>
</tfoot>
</table>
<div>
@ -172,47 +204,9 @@ $(document).ready(function() {
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];
}
}
}
}
}
],
@ -221,8 +215,57 @@ $(document).ready(function() {
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25, // Set default number of rows per page (optional)
pageLength: 20, // Set default number of rows per page (optional)
ordering: false,
footerCallback: function(row, data, start, end, display) {
var api = this.api();
// Helper function to parse numbers
var parseNumber = function(value) {
return typeof value === 'string'
? parseFloat(value.replace(/[\$,]/g, ''))
: typeof value === 'number'
? value
: 0;
};
// Define column groups for total calculations
var columnGroups = [
{ policy: 2, premium: 3 },
{ policy: 4, premium: 5},
{ policy: 6, premium: 7 },
{ policy: 8, premium: 9 },
{ policy: 10, premium: 11 },
{ policy: 12, premium: 13 },
{ policy: 14, premium: 15 },
{ policy: 16, premium: 17 },
{ policy: 18, premium: 19 },
{ policy: 20, premium: 21 }
];
// Loop through each column group to calculate totals and update the footer
columnGroups.forEach(function(group) {
var totalPolicies = api
.column(group.policy)
.data()
.reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var totalPremium = api
.column(group.premium)
.data()
.reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
// Update the footer
$(api.column(group.policy).footer()).html(totalPolicies.toLocaleString());
$(api.column(group.premium).footer()).html(
"" + totalPremium.toLocaleString(undefined, { minimumFractionDigits: 2 })
);
});
}
});
} else {
console.error("Table atet found.");

View File

@ -94,7 +94,9 @@ table.dataTable tbody td {
<th>Revenue</th>
</tr>
</thead>
<tbody>
<?php if (isset($data) && !empty($data)) { ?>
@ -149,6 +151,55 @@ table.dataTable tbody td {
<?php } ?>
</tbody>
<tfoot>
<tr>
<th></th>
<th>Grand Total</th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
<th class="right-align-input"></th>
</tr>
</tfoot>
</table>
<div>
@ -230,8 +281,68 @@ $(document).ready(function() {
searchPlaceholder: "Search..."
},
paging: true, // Enable pagination
pageLength: 25, // Set default number of rows per page (optional)
pageLength: 20, // Set default number of rows per page (optional)
ordering: false,
footerCallback: function(row, data, start, end, display) {
var api = this.api();
// Helper function to parse numbers
var parseNumber = function(value) {
return typeof value === 'string'
? parseFloat(value.replace(/[\$,]/g, ''))
: typeof value === 'number'
? value
: 0;
};
// Define column groups for total calculations
var columnGroups = [
{ policy: 2, premium: 3, revenue: 4 },
{ policy: 5, premium: 6, revenue: 7 },
{ policy: 8, premium: 9, revenue: 10 },
{ policy: 11, premium: 12, revenue: 13 },
{ policy: 14, premium: 15, revenue: 16 },
{ policy: 17, premium: 18, revenue: 19 },
{ policy: 20, premium: 21, revenue: 22 },
{ policy: 23, premium: 24, revenue: 25 },
{ policy: 26, premium: 27, revenue: 28 },
{ policy: 29, premium: 30, revenue: 31 }
];
// Loop through each column group to calculate totals and update the footer
columnGroups.forEach(function(group) {
var totalPolicies = api
.column(group.policy)
.data()
.reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var totalPremium = api
.column(group.premium)
.data()
.reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
var totalRevenue = api
.column(group.revenue)
.data()
.reduce(function(a, b) {
return parseNumber(a) + parseNumber(b);
}, 0);
// Update the footer
$(api.column(group.policy).footer()).html(totalPolicies.toLocaleString());
$(api.column(group.premium).footer()).html(
"" + totalPremium.toLocaleString(undefined, { minimumFractionDigits: 2 })
);
$(api.column(group.revenue).footer()).html(
"" + totalRevenue.toLocaleString(undefined, { minimumFractionDigits: 2 })
);
});
}
});
} else {
console.error("Table atet found.");