diff --git a/app/Views/report_bds.php b/app/Views/report_bds.php index 446f2ada..ff3eba14 100644 --- a/app/Views/report_bds.php +++ b/app/Views/report_bds.php @@ -113,8 +113,91 @@ table.dataTable tbody td {
- - $row){ ?> + + + + + $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); + + ?> + + + + $row){ + + ?>