New Report BDS CHanges-2 - VADIVEL J 2025-10-25
This commit is contained in:
parent
564dcc642d
commit
4590bc45b8
@ -113,8 +113,91 @@ table.dataTable tbody td {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if (isset($report_list)) { ?>
|
||||
<?php foreach($report_list as $index => $row){ ?>
|
||||
<?php if (isset($report_list)) {
|
||||
|
||||
// empty array to initialize for policies per insurer per month
|
||||
|
||||
$uniquePoliciesReport = [];
|
||||
|
||||
// irrespective of months or multiple months
|
||||
$uniqueAgreedAmountList = [];
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
foreach($report_list as $index => $row){
|
||||
|
||||
$policy_no = $row['policy_no'];
|
||||
|
||||
$policy_updated_month = $row['policy_issue_month'];
|
||||
|
||||
$policy_type = $row['policy_type'];
|
||||
|
||||
$statement_status = $row['statement_uploaded'];
|
||||
|
||||
$client_name = $row['client_name'];
|
||||
|
||||
$insurer_branch_name = $row['insurer_branch_name'];
|
||||
|
||||
|
||||
|
||||
$uniqueRecord = "$policy_no-$policy_updated_month-$policy_type-$client_name-$insurer_branch_name" ;
|
||||
|
||||
// irrespective of months or multiple months
|
||||
$uniqueAgreedAmountPerInsurer = "$policy_no-$policy_type-$client_name-$insurer_branch_name" ;
|
||||
|
||||
|
||||
|
||||
if(isset($uniquePoliciesReport[$uniqueRecord]) && $statement_status == "no statement uploaded" ){
|
||||
continue ;
|
||||
}
|
||||
else if(isset($uniquePoliciesReport[$uniqueRecord]) && $statement_status == "statement uploaded" ){
|
||||
unset($uniquePoliciesReport[$uniqueRecord]);
|
||||
}else{
|
||||
|
||||
if(isset($uniqueAgreedAmountList[$uniqueAgreedAmountPerInsurer]) ){
|
||||
$uniqueAgreedAmountList[$uniqueAgreedAmountPerInsurer] -= $row['billed_amt'];
|
||||
$row['total_irda_amt'] = 0;
|
||||
$row['outstanding_amt'] = $uniqueAgreedAmountList[$uniqueAgreedAmountPerInsurer];
|
||||
$row['multiple_months'] = true;
|
||||
}
|
||||
else{
|
||||
$row['outstanding_amt'] = $row['total_irda_amt'] - $row['billed_amt'];
|
||||
$uniqueAgreedAmountList[$uniqueAgreedAmountPerInsurer] = $row['total_irda_amt'] ;
|
||||
$row['multiple_months'] = false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$uniquePoliciesReport[$uniqueRecord] = $row;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$report_list = array_values($uniquePoliciesReport);
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<?php foreach($report_list as $index => $row){
|
||||
|
||||
?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?> <a href="<?php
|
||||
if($row['action_type'] == "inception"){
|
||||
@ -123,8 +206,9 @@ table.dataTable tbody td {
|
||||
echo base_url('policy_tranction/endorsement/list') . '?pt_id=' . $row['id'] ;
|
||||
}
|
||||
?>" class="mdi mdi-pencil" ></a> </td>
|
||||
<td style="display: none;"><?php echo $row['user_name'] ?: 'N/A'; ?></td>
|
||||
<td ><?php echo $row['statement_uploaded'] == 'statement uploaded' && $row['multiple_months'] == true ? 'rewards': $row['user_name']??'N/A' ; ?></td>
|
||||
<td><?php echo $row['policy_issue_month'] ?: 'N/A'; ?></td>
|
||||
<td style="display: none;"><?php echo $row['statement_uploaded'] ?: 'N/A'; ?></td>
|
||||
<!-- <td style="display: none;"><?php echo $row['revenue_type'] ?: 'N/A'; ?></td> -->
|
||||
<td style="display: none;"><?php echo $row['client_type'] ?: 'N/A'; ?></td>
|
||||
<td><?php echo $row['client_name'] ?: 'N/A'; ?></td>
|
||||
@ -149,17 +233,13 @@ table.dataTable tbody td {
|
||||
<td class="right-align-input"><?php echo $row['total_premium']; ?></td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_bp_per']; ?> %</td>
|
||||
<td class="right-align-input"><?php echo $row['agreed_tp_or_ter_per'];?> %</td>
|
||||
<td class="right-align-input" style="display: none;"><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
|
||||
|
||||
<?php $total_irda_amt = empty($row['total_irda_amt']) ? $row['exp_amt'] : $row['total_irda_amt']; ?>
|
||||
<td class="right-align-input" onclick="showCoShareStatementDetails(this)" data-id="<?= $row['pt_id'] ?>"><?php echo $total_irda_amt; ?></td>
|
||||
<td class="right-align-input" ><?php echo isset($row['reward']) ? $row['reward'] : '0.00'; ?></td>
|
||||
<!-- Agreed Amount as total_irda_amt -->
|
||||
<td class="right-align-input" onclick="showCoShareStatementDetails(this)" data-id="<?= $row['pt_id'] ?>"><?php echo $row['total_irda_amt']; ?></td>
|
||||
<!-- invoiced amount as billed_amt -->
|
||||
<td class="right-align-input"><?php echo empty($row['billed_amt']) ? '0.00' : $row['billed_amt'] ?></td>
|
||||
<!-- <td class="right-align-input"><?php echo empty($row['unbilled_amt']) ? '0.00' : $row['unbilled_amt']?></td> -->
|
||||
<?php
|
||||
$unbilled_amt = $row['total_irda_amt'] - $row['billed_amt'];
|
||||
$unbilled_amt = $unbilled_amt == 0 && $row['billed_amt'] == 0 ? $total_irda_amt : $unbilled_amt ;
|
||||
?>
|
||||
<td class="right-align-input"><?php echo number_format((float)$unbilled_amt,2, '.', '')?></td>
|
||||
<!-- Outstanding Amount (Agreed amount - invoice amount) -->
|
||||
<td class="right-align-input"><?php echo number_format((float)$row['outstanding_amt'],2, '.', '')?></td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
@ -394,7 +474,8 @@ $(document).ready(function() {
|
||||
$(sheet).find('sheetData').append(totalRow);
|
||||
},
|
||||
exportOptions: {
|
||||
orthogonal: 'sort'
|
||||
orthogonal: 'sort' ,
|
||||
columns: ':not(:eq(3))' // skip the same 4th column
|
||||
},
|
||||
customizeData: function (data) {
|
||||
for (var i = 0; i < data.body.length; i++) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user