CHANGE_BDS_REPOR_AND_DELETE_OPTION_ONLY_HEAD
This commit is contained in:
parent
18caa12784
commit
84752c6620
@ -2477,6 +2477,12 @@
|
|||||||
pt.id AS id,
|
pt.id AS id,
|
||||||
pt.endorsement_no,
|
pt.endorsement_no,
|
||||||
pt.ref,
|
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(pt.policy_issue_date, '%d %b %Y') AS policy_issue_date,
|
||||||
DATE_FORMAT(pcsd.pt_policy_issue_date, '%b %Y') AS policy_issue_month,
|
DATE_FORMAT(pcsd.pt_policy_issue_date, '%b %Y') AS policy_issue_month,
|
||||||
pt.month as statement_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 su ON pt.sales_generated_by = su.id
|
||||||
LEFT JOIN user_profiles se ON pt.serviced_by = se.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 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
|
WHERE pt.is_active = 1
|
||||||
AND pcsd.is_active = 1
|
AND pcsd.is_active = 1
|
||||||
@ -2573,6 +2580,12 @@
|
|||||||
pt.id AS id,
|
pt.id AS id,
|
||||||
pt.endorsement_no,
|
pt.endorsement_no,
|
||||||
pt.ref,
|
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(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,
|
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,
|
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 su ON pt.sales_generated_by = su.id
|
||||||
LEFT JOIN user_profiles se ON pt.serviced_by = se.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 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
|
WHERE pt.is_active = 1
|
||||||
AND pcsd.is_active = 1
|
AND pcsd.is_active = 1
|
||||||
|
|||||||
@ -346,9 +346,11 @@ table.dataTable thead th {
|
|||||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getPolicyTransactionDataForEndorsementEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
<a class="dropdown-item btnEdit" data-id="<?= $row['id']; ?>" onclick="getPolicyTransactionDataForEndorsementEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>', <?= $row['policy_type_id'] ?>)">
|
<?php if(get_role_id() == 5): ?>
|
||||||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
<a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>', <?= $row['policy_type_id'] ?>)">
|
||||||
</a>
|
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -337,9 +337,12 @@ table.dataTable tbody td {
|
|||||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>', <?= $row['policy_type_id'] ?>)">
|
|
||||||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
<?php if(get_role_id() == 5): ?>
|
||||||
</a>
|
<a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>', <?= $row['policy_type_id'] ?>)">
|
||||||
|
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -337,9 +337,11 @@ table.dataTable tbody td {
|
|||||||
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
<a class="dropdown-item btnEdit" data-id="<?= $row['id'];?>" onclick="getPolicyTransactionDataForEdit('<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>')">
|
||||||
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
<i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
|
||||||
</a>
|
</a>
|
||||||
<a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>', <?= $row['policy_type_id'] ?>)">
|
<?php if(get_role_id() == 5): ?>
|
||||||
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
<a class="dropdown-item delete" data-id="<?= $row['id'];?>" onclick="removePolicyTransaction(this, '<?= htmlspecialchars($row['id'], ENT_QUOTES) ?>', <?= $row['policy_type_id'] ?>)">
|
||||||
</a>
|
<i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete
|
||||||
|
</a>
|
||||||
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|||||||
@ -109,13 +109,19 @@ table.dataTable tbody td {
|
|||||||
<th>Agreed Amount</th>
|
<th>Agreed Amount</th>
|
||||||
<th>Invoiced Amount</th>
|
<th>Invoiced Amount</th>
|
||||||
<th>Outstanding Amount</th>
|
<th>Outstanding Amount</th>
|
||||||
|
<th style="display: none;">Salse Person</th>
|
||||||
|
<th style="display: none;">Service Person</th>
|
||||||
|
<th style="display: none;">Nhance Branch</th>
|
||||||
|
<th style="display: none;">Installment</th>
|
||||||
|
<th style="display: none;">Data Received Date</th>
|
||||||
|
<th style="display: none;">Renewal Date</th>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<?php if (isset($report_list)) { ?>
|
<?php if (isset($report_list)) { ?>
|
||||||
<?php foreach($report_list as $index => $row){ ?>
|
<?php foreach($report_list as $index => $row){ ?>
|
||||||
<tr>
|
<tr data-id="<?= $row['pt_id'] ?>">
|
||||||
<td><?= $index + 1 ?> <a href="<?php
|
<td><?= $index + 1 ?> <a href="<?php
|
||||||
if(strtolower($row['action_type']) == "policy"){
|
if(strtolower($row['action_type']) == "policy"){
|
||||||
echo base_url('policy_tranction/inception/list') . '?pt_id=' . $row['id'] ;
|
echo base_url('policy_tranction/inception/list') . '?pt_id=' . $row['id'] ;
|
||||||
@ -142,9 +148,9 @@ table.dataTable tbody td {
|
|||||||
<td style="display: none;"><?php echo empty($row['policy_end_date']) ? 'N/A' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
|
<td style="display: none;"><?php echo empty($row['policy_end_date']) ? 'N/A' : date('d/m/Y', strtotime($row['policy_end_date'])); ?></td>
|
||||||
<td style="display: none;"><?php echo $row['ref'] ?: 'N/A'; ?></td>
|
<td style="display: none;"><?php echo $row['ref'] ?: 'N/A'; ?></td>
|
||||||
<td style="display: none;"><?php echo $row['remarks'] ?: 'N/A'; ?></td>
|
<td style="display: none;"><?php echo $row['remarks'] ?: 'N/A'; ?></td>
|
||||||
<td class="right-align-input"><?php echo $row['bp_amt'] ?: '0.00'; ?></td>
|
<td class="right-align-input"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['bp_amt'] ?: '0.00') : '0.00'; ?></td>
|
||||||
<td class="right-align-input"><?php echo $row['tp_or_ter'] ?: '0.00'; ?></td>
|
<td class="right-align-input"><?php echo $row['tp_or_ter'] ?: '0.00'; ?></td>
|
||||||
<td class="right-align-input"><?php echo $row['premium_wo_gst']; ?></td>
|
<td class="right-align-input"><?php echo ($row['total_irda_amt'] != 0.00) ? ($row['premium_wo_gst'] ?: '0.00') : '0.00'; ?></td>
|
||||||
<!-- <td class="right-align-input" style="display: none;"><?php echo $row['gst_amount']; ?></td> -->
|
<!-- <td class="right-align-input" style="display: none;"><?php echo $row['gst_amount']; ?></td> -->
|
||||||
<td class="right-align-input" style="display: none;"><?php echo $row['total_premium'] ?: '0.00'; ?></td>
|
<td class="right-align-input" style="display: none;"><?php echo $row['total_premium'] ?: '0.00'; ?></td>
|
||||||
<td class="right-align-input"><?php echo $row['agreed_bp_per'] ?: '0.00'; ?>%</td>
|
<td class="right-align-input"><?php echo $row['agreed_bp_per'] ?: '0.00'; ?>%</td>
|
||||||
@ -186,6 +192,12 @@ table.dataTable tbody td {
|
|||||||
number_format((float)$row['unbilled_amount'],2, '.', '');
|
number_format((float)$row['unbilled_amount'],2, '.', '');
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
|
<td style="display: none;"><?php echo $row['salse_person_name'] ?: 'N/A'; ?></td>
|
||||||
|
<td style="display: none;"><?php echo $row['service_person_name'] ?: 'N/A'; ?></td>
|
||||||
|
<td style="display: none;"><?php echo $row['nhance_branch'] ?: 'N/A'; ?></td>
|
||||||
|
<td style="display: none;"><?php echo $row['installment'] ?: 'N/A'; ?></td>
|
||||||
|
<td style="display: none;"><?php echo empty($row['data_received_date']) ? 'N/A' : date('d/m/Y', strtotime($row['data_received_date'])) ?></td>
|
||||||
|
<td style="display: none;"><?php echo empty($row['renewal_date']) ? 'N/A' : date('d/m/Y', strtotime($row['renewal_date'])) ?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
@ -546,6 +558,33 @@ $(document).ready(function() {
|
|||||||
// $('#total_billed').text(totalBilled.toFixed(2));
|
// $('#total_billed').text(totalBilled.toFixed(2));
|
||||||
// $('#total_unbilled').text(totalUnbilled.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
|
// Helper to sum numeric values safely
|
||||||
var getTotal = function(colIndex) {
|
var getTotal = function(colIndex) {
|
||||||
return api.column(colIndex, { search: 'applied' }).data()
|
return api.column(colIndex, { search: 'applied' }).data()
|
||||||
@ -563,17 +602,16 @@ $(document).ready(function() {
|
|||||||
var totalRewards = getTotal(24);
|
var totalRewards = getTotal(24);
|
||||||
var totalIrda = getTotal(25);
|
var totalIrda = getTotal(25);
|
||||||
var totalBilled = getTotal(26);
|
var totalBilled = getTotal(26);
|
||||||
var totalUnbilled = getTotal(27);
|
// var totalUnbilled = getTotal(27);
|
||||||
|
|
||||||
// Update the totals section above the table
|
// Update the totals section above the table
|
||||||
$('#total_premium').text(totalPremium.toFixed(2));
|
$('#total_premium').text(totalPremium.toFixed(2));
|
||||||
$('#total_rewards').text(totalRewards.toFixed(2));
|
$('#total_rewards').text(totalRewards.toFixed(2));
|
||||||
$('#total_irda').text(totalIrda.toFixed(2));
|
$('#total_irda').text(totalIrda.toFixed(2));
|
||||||
$('#total_billed').text(totalBilled.toFixed(2));
|
$('#total_billed').text(totalBilled.toFixed(2));
|
||||||
|
// $('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||||
|
var totalUnbilled = getUniqueUnbilled(27);
|
||||||
$('#total_unbilled').text(totalUnbilled.toFixed(2));
|
$('#total_unbilled').text(totalUnbilled.toFixed(2));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
@ -641,9 +679,9 @@ function appendTableData(data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$('table tbody').on('click', 'td', function () {
|
$('table tbody').on('click', 'td', function () {
|
||||||
var index = $(this).index();
|
var colIndex = $(this).index();
|
||||||
console.log('Clicked TD index:', index);
|
var rowIndex = $(this).closest('tr').index();
|
||||||
|
console.log('Row:', rowIndex, 'Column:', colIndex);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user