diff --git a/app/Models/PolicyTransactionModel.php b/app/Models/PolicyTransactionModel.php index 1d752149..44a0550d 100644 --- a/app/Models/PolicyTransactionModel.php +++ b/app/Models/PolicyTransactionModel.php @@ -2477,6 +2477,12 @@ pt.id AS id, pt.endorsement_no, pt.ref, + + pt.data_received_date, + pt.renewal_date, + pt.installment, + nhance_branch.branch_name as nhance_branch, + DATE_FORMAT(pt.policy_issue_date, '%d %b %Y') AS policy_issue_date, DATE_FORMAT(pcsd.pt_policy_issue_date, '%b %Y') AS policy_issue_month, pt.month as statement_month, @@ -2559,6 +2565,7 @@ LEFT JOIN user_profiles su ON pt.sales_generated_by = su.id LEFT JOIN user_profiles se ON pt.serviced_by = se.id LEFT JOIN user_profiles created_user ON pt.created_by = created_user.id + LEFT JOIN nhance_branch ON pt.issuer_branch = nhance_branch.id WHERE pt.is_active = 1 AND pcsd.is_active = 1 @@ -2573,6 +2580,12 @@ pt.id AS id, pt.endorsement_no, pt.ref, + + pt.data_received_date, + pt.renewal_date, + pt.installment, + nhance_branch.branch_name as nhance_branch, + DATE_FORMAT(pt.policy_issue_date, '%d %b %Y') AS policy_issue_date, DATE_FORMAT(IF(insq.month IS NULL, pcsd.pt_policy_issue_date, insq.month),'%b %Y') AS policy_issue_month, insq.month as statement_month, @@ -2694,6 +2707,7 @@ LEFT JOIN user_profiles su ON pt.sales_generated_by = su.id LEFT JOIN user_profiles se ON pt.serviced_by = se.id LEFT JOIN user_profiles created_user ON pt.created_by = created_user.id + LEFT JOIN nhance_branch ON pt.issuer_branch = nhance_branch.id WHERE pt.is_active = 1 AND pcsd.is_active = 1 diff --git a/app/Views/policy_transaction_endorsement_list.php b/app/Views/policy_transaction_endorsement_list.php index 5d739144..1fbc415c 100644 --- a/app/Views/policy_transaction_endorsement_list.php +++ b/app/Views/policy_transaction_endorsement_list.php @@ -346,9 +346,11 @@ table.dataTable thead th { Edit - - Delete - + + + Delete + + diff --git a/app/Views/policy_transaction_inception_list.php b/app/Views/policy_transaction_inception_list.php index ae82bc2c..82054906 100644 --- a/app/Views/policy_transaction_inception_list.php +++ b/app/Views/policy_transaction_inception_list.php @@ -337,9 +337,12 @@ table.dataTable tbody td { Edit - - Delete - + + + + Delete + + diff --git a/app/Views/policy_transaction_inception_list_2.php b/app/Views/policy_transaction_inception_list_2.php index c5aedf93..0096365d 100644 --- a/app/Views/policy_transaction_inception_list_2.php +++ b/app/Views/policy_transaction_inception_list_2.php @@ -337,9 +337,11 @@ table.dataTable tbody td { Edit - - Delete - + + + Delete + + diff --git a/app/Views/report_bds.php b/app/Views/report_bds.php index fc51a5c8..db84e64e 100644 --- a/app/Views/report_bds.php +++ b/app/Views/report_bds.php @@ -109,13 +109,19 @@ table.dataTable tbody td { Agreed Amount Invoiced Amount Outstanding Amount + Salse Person + Service Person + Nhance Branch + Installment + Data Received Date + Renewal Date $row){ ?> - +   - + - + % @@ -186,6 +192,12 @@ table.dataTable tbody td { number_format((float)$row['unbilled_amount'],2, '.', ''); ?> + + + + + + @@ -546,6 +558,33 @@ $(document).ready(function() { // $('#total_billed').text(totalBilled.toFixed(2)); // $('#total_unbilled').text(totalUnbilled.toFixed(2)); + var getUniqueUnbilled = function(colIndex) { + + var rows = api.rows({ search: 'applied' }).nodes(); // get filtered nodes + var maxRowPerId = {}; // store only the greatest row + + $(rows).each(function() { + var rowId = $(this).data('id'); // read data-id + var rowIndex = $(this).index(); // row index + + // Keep only the greatest row index per data-id + if (!maxRowPerId[rowId] || rowIndex > maxRowPerId[rowId]) { + maxRowPerId[rowId] = rowIndex; + } + }); + + var total = 0; + + // Now sum only the selected rows + $.each(maxRowPerId, function(id, rowIndex) { + var value = api.cell(rowIndex, colIndex).data(); + value = parseFloat((typeof value === 'string') ? value.replace(/[^0-9.\-]+/g, '') : value) || 0; + total += value; + }); + + return total; + }; + // Helper to sum numeric values safely var getTotal = function(colIndex) { return api.column(colIndex, { search: 'applied' }).data() @@ -563,17 +602,16 @@ $(document).ready(function() { var totalRewards = getTotal(24); var totalIrda = getTotal(25); var totalBilled = getTotal(26); - var totalUnbilled = getTotal(27); + // var totalUnbilled = getTotal(27); // Update the totals section above the table $('#total_premium').text(totalPremium.toFixed(2)); $('#total_rewards').text(totalRewards.toFixed(2)); $('#total_irda').text(totalIrda.toFixed(2)); $('#total_billed').text(totalBilled.toFixed(2)); + // $('#total_unbilled').text(totalUnbilled.toFixed(2)); + var totalUnbilled = getUniqueUnbilled(27); $('#total_unbilled').text(totalUnbilled.toFixed(2)); - - - } }); } else { @@ -641,9 +679,9 @@ function appendTableData(data) { } $('table tbody').on('click', 'td', function () { - var index = $(this).index(); - console.log('Clicked TD index:', index); + var colIndex = $(this).index(); + var rowIndex = $(this).closest('tr').index(); + console.log('Row:', rowIndex, 'Column:', colIndex); }); - \ No newline at end of file