nhance/app/Views/claims_mis_vidal.php
2026-08-07 10:19:31 +05:30

870 lines
31 KiB
PHP

<?php
/** @var array $report */
/** @var array $view_model */
/** @var int $policy_id */
/** @var string $pdf_url */
/** @var bool $embed */
use App\Libraries\VidalMisReportService as VidalFmt;
$embed = $embed ?? false;
$report = $report ?? [];
$vm = $view_model ?? ($report['view_model'] ?? $report);
$meta = $report['meta'] ?? ($vm['meta'] ?? []);
$header = $report['header'] ?? ($vm['header'] ?? []);
$toc = $vm['toc'] ?? ($report['toc'] ?? []);
$icr = $vm['icr'] ?? [];
$hosp = $vm['hospitalization'] ?? [];
$memberGender = $vm['member_gender'] ?? [];
$memberAge = $vm['member_age'] ?? [];
$claimsAge = $vm['claims_age'] ?? [];
$claimsAmount = $vm['claims_amount'] ?? [];
$ailments = $vm['ailments'] ?? [];
$hospitals = $vm['hospitals'] ?? [];
$cmSummary = $vm['cashless_member_summary'] ?? [];
$tat = $vm['tat'] ?? [];
$mom = $vm['month_on_month'] ?? [];
$payout = $vm['payout'] ?? [];
$chartGender = $vm['chart_gender'] ?? [];
$chartAge = $vm['chart_age'] ?? [];
$ageRelations = ['Self', 'Spouse', 'Partner', 'Child', 'Parents', 'In Law', 'Other'];
$logoSrc = !empty($embed)
? (rtrim(ROOTPATH, '/\\') . '/public/assets/images/vidal_mis.png')
: base_url('public/assets/images/vidal_mis.png');
$num = static function ($n, int $d = 0): string {
return VidalFmt::fmtNum($n, $d);
};
$pct = static function ($n, int $d = 0, bool $withSymbol = true): string {
return VidalFmt::fmtPct($n, $d, $withSymbol);
};
$pct2 = static function ($n): string {
return VidalFmt::fmtPct($n, 2, true);
};
$cellCa = static function ($cell) use ($num): array {
$c = is_array($cell) ? $cell : [];
return [
'count' => $num($c['count'] ?? 0),
'amount' => $num($c['amount'] ?? 0),
];
};
$genderMax = 1;
foreach ($chartGender as $g) {
$genderMax = max($genderMax, (int) ($g['male'] ?? 0) + (int) ($g['female'] ?? 0));
}
$ageMax = 1;
foreach ($chartAge as $a) {
$ageMax = max($ageMax, (int) ($a['total'] ?? 0));
}
$ageBarColor = static function (string $dominant): string {
return match (true) {
$dominant === 'Child' => '#4472c4',
str_contains($dominant, 'Self') => '#264478',
str_contains($dominant, 'Parents') => '#ffc000',
default => '#70ad47',
};
};
/** DomPDF-safe horizontal bar (nested table widths). */
$renderBar = static function (float $pct, string $color): void {
$filled = (int) max(0, min(100, round($pct)));
$empty = 100 - $filled;
echo '<table width="100%" cellspacing="0" cellpadding="0"><tr>';
if ($filled > 0) {
echo '<td width="' . $filled . '%" style="background:' . esc($color) . ';height:10px;font-size:1px;line-height:1px;">&nbsp;</td>';
}
if ($empty > 0) {
echo '<td width="' . $empty . '%" style="background:#f2f2f2;height:10px;font-size:1px;line-height:1px;">&nbsp;</td>';
}
if ($filled === 0 && $empty === 0) {
echo '<td width="100%" style="background:#f2f2f2;height:10px;font-size:1px;line-height:1px;">&nbsp;</td>';
}
echo '</tr></table>';
};
$renderRelationClaimRow = static function (
string $label,
array $row,
array $ageRelations,
bool $isTotal = false
) use ($num, $pct2, $cellCa): void {
$cls = $isTotal ? ' class="total-row"' : '';
echo '<tr' . $cls . '><td class="rowlabel">' . esc($label) . '</td>';
foreach ($ageRelations as $rel) {
$ca = $cellCa($row[$rel] ?? []);
echo '<td>' . esc($ca['count']) . '</td><td class="num">' . esc($ca['amount']) . '</td>';
}
$tot = $cellCa($row['total'] ?? ($row['_total'] ?? []));
echo '<td>' . esc($tot['count']) . '</td><td class="num">' . esc($tot['amount']) . '</td>';
$pct = $row['pct'] ?? [];
if (is_array($pct) && (isset($pct['count']) || isset($pct['amount']))) {
echo '<td>' . esc($pct2($pct['count'] ?? 0) . ' / ' . $pct2($pct['amount'] ?? 0)) . '</td>';
} else {
echo '<td></td>';
}
echo '</tr>';
};
$renderRelationPctRow = static function (array $colPct, array $ageRelations) use ($pct): void {
echo '<tr><td class="rowlabel">%</td>';
foreach ($ageRelations as $rel) {
$p = $colPct[$rel] ?? [];
if (is_array($p)) {
echo '<td>' . esc($pct($p['count'] ?? 0)) . '</td><td>' . esc($pct($p['amount'] ?? 0)) . '</td>';
} else {
echo '<td>' . esc($pct($p)) . '</td><td></td>';
}
}
echo '<td>' . esc($pct(100)) . '</td><td>' . esc($pct(100)) . '</td><td></td></tr>';
};
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Vidal Health - Corporate Analysis Report</title>
<style>
:root {
--blue: #0072bc;
--header-blue: #dbe9f5;
--group-header: #b9d6ec;
--border: #888;
--text: #111;
--muted: #444;
--male: #4472c4;
--female: #ed7d31;
}
* { box-sizing: border-box; }
body {
font-family: DejaVu Sans, Arial, Helvetica, sans-serif;
font-size: 11px;
color: var(--text);
background: #e8e8e8;
margin: 0;
padding: 20px 0;
}
.page {
background: #fff;
width: 900px;
margin: 0 auto 20px auto;
padding: 18px 28px 28px 28px;
border: 1px solid #ccc;
}
.header-top {
border-bottom: 1.5px solid #2f5f8f;
padding-bottom: 6px;
margin-bottom: 8px;
text-align: left;
}
.logo-block {
display: block;
text-align: left;
margin: 0;
padding: 0;
line-height: 0;
}
.brand-logo {
height: 72px;
width: auto;
max-width: 420px;
object-fit: contain;
object-position: left top;
display: block;
margin: 0;
padding: 0;
}
.addr-line {
font-size: 10px;
font-weight: bold;
margin-top: 10px;
line-height: 1.35;
text-align: left;
}
.report-title {
text-align: left;
font-weight: bold;
font-size: 12px;
margin: 8px 0 6px 0;
}
.top-grid-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 14px;
}
.top-grid-table > tbody > tr > td {
vertical-align: top;
width: 50%;
padding: 0 16px 0 0;
border: none;
}
.top-grid-table > tbody > tr > td:last-child { padding: 0 0 0 16px; }
.policy-details table { border-collapse: collapse; }
.policy-details td { padding: 1px 6px 1px 0; font-size: 11px; border: none; text-align: left; }
.policy-details td.label { font-weight: bold; }
.section-label { font-weight: bold; text-decoration: underline; margin-bottom: 4px; }
.toc ol { margin: 0; padding-left: 18px; font-size: 11px; line-height: 1.6; }
h3.section-title {
font-size: 12px;
font-weight: bold;
margin: 12px 0 6px 0;
border-bottom: 1px solid #999;
padding-bottom: 2px;
}
table.section-wrap {
width: 100%;
border-collapse: collapse;
margin: 0;
}
table.section-wrap > tbody > tr > td {
border: none;
padding: 0;
vertical-align: top;
}
table.data {
border-collapse: collapse;
width: 100%;
font-size: 10.5px;
margin-bottom: 6px;
}
table.data th, table.data td {
border: 1px solid var(--border);
padding: 3px 5px;
text-align: center;
}
table.data th {
background: var(--header-blue);
font-weight: bold;
}
table.data td.rowlabel, table.data th.rowlabel { text-align: left; }
table.data tr.total-row td {
font-weight: bold;
background: #f2f2f2;
}
.group-header { background: var(--group-header) !important; }
table.data td.num, table.data th.num { text-align: right; }
.two-col-table {
width: 100%;
border-collapse: collapse;
margin-bottom: 8px;
}
.two-col-table > tbody > tr > td {
vertical-align: top;
width: 50%;
padding: 0 10px 0 0;
border: none;
}
.two-col-table > tbody > tr > td:last-child { padding: 0 0 0 10px; }
.notes-box {
font-size: 9.5px;
border: 1px solid #aaa;
padding: 6px 10px;
background: #fafafa;
margin-top: 4px;
line-height: 1.5;
}
.summary-mini { margin-top: 6px; }
.summary-mini table { border-collapse: collapse; }
.summary-mini td, .summary-mini th {
border: 1px solid var(--border);
padding: 3px 8px;
font-size: 10.5px;
}
.chart-container { width: 100%; }
table.bar-chart {
width: 100%;
border-collapse: collapse;
font-size: 9.5px;
}
table.bar-chart td {
border: none;
padding: 2px 0;
vertical-align: middle;
}
table.bar-chart td.bar-label { width: 70px; text-align: left; white-space: nowrap; }
table.bar-chart td.bar-track { padding: 1px 0; }
table.bar-chart td.bar-track table {
width: 100%;
border-collapse: collapse;
border: 1px solid #ccc;
}
table.bar-chart td.bar-track table td {
height: 12px;
font-size: 1px;
line-height: 1px;
padding: 0;
border: none;
}
table.bar-chart td.bar-value { width: 80px; padding-left: 6px; text-align: left; white-space: nowrap; font-size: 9px; }
.legend { margin-top: 6px; font-size: 9.5px; }
.legend-swatch { width: 10px; height: 10px; display: inline-block; margin-right: 4px; vertical-align: middle; }
.legend span { margin-right: 12px; }
.footer-disclaimer {
font-size: 8.5px;
color: var(--muted);
border-top: 1px solid #ccc;
margin-top: 20px;
padding-top: 6px;
line-height: 1.4;
}
.small-note { font-size: 9.5px; margin: 2px 0 6px 0; }
.table-narrow { width: 60%; }
.table-tat { width: 40%; }
.page-break { page-break-before: always; }
.keep-together { page-break-inside: avoid; }
@media print {
body { background: #fff; padding: 0; }
.page { box-shadow: none; border: none; margin: 0 auto; }
}
<?php if (!empty($embed)): ?>
body { background: #fff; padding: 0; }
.page {
width: 100%;
max-width: none;
margin: 0;
padding: 10px 12px;
border: none;
}
.brand-logo { height: 64px; width: auto; max-width: 380px; object-fit: contain; object-position: left top; }
.addr-line { font-size: 8px; font-weight: bold; margin-top: 8px; line-height: 1.3; text-align: left; }
.report-title { margin: 4px 0 4px 0; font-size: 11px; }
.top-grid-table { margin-bottom: 6px; }
.top-grid-table > tbody > tr > td { padding: 0 10px 0 0; }
.top-grid-table > tbody > tr > td:last-child { padding: 0 0 0 10px; }
.policy-details td { font-size: 9px; padding: 0 4px 0 0; }
.toc ol { font-size: 9px; line-height: 1.35; padding-left: 16px; }
.two-col-table > tbody > tr > td { padding: 0 6px 0 0; }
.two-col-table > tbody > tr > td:last-child { padding: 0 0 0 6px; }
table.data { font-size: 8px; table-layout: fixed; }
table.data th, table.data td { padding: 2px 2px; word-wrap: break-word; }
h3.section-title { margin: 8px 0 3px 0; font-size: 10px; }
table.bar-chart { font-size: 8px; }
table.bar-chart td.bar-label { width: 55px; }
table.bar-chart td.bar-track table td { height: 10px; }
table.bar-chart td.bar-value { width: 70px; font-size: 7.5px; }
.table-narrow { width: 70%; }
.table-tat { width: 45%; }
.summary-mini table { font-size: 8.5px; }
.notes-box { font-size: 7.5px; page-break-inside: avoid; }
.footer-disclaimer { font-size: 7px; }
.page { padding: 8px 10px; }
table.section-wrap { page-break-inside: avoid; }
.intro-block, .section-block { page-break-inside: avoid; }
<?php endif; ?>
</style>
</head>
<body>
<div class="page">
<table class="section-wrap intro-block">
<tr><td>
<!-- HEADER: logo + address above blue line -->
<div class="header-top">
<div class="logo-block">
<img src="<?= esc($logoSrc) ?>" alt="Vidal Health" class="brand-logo">
</div>
<div class="addr-line">
<b>Corporate Office :</b> Tower-2, 1st floor, SJR I Park, Plot No: 13,14,15 , EPIP Zone, Whitefield, Bangalore-560066<br>
Phone: 91-80-40125678 &nbsp; Fax : 91-80-41159215 &nbsp; Email: care@vidalhealthtpa.com &nbsp; Website : www.vidalhealthtpa.com
</div>
</div>
<div class="report-title">Corporate Analysis Report</div>
<!-- POLICY DETAILS + TOC -->
<table class="top-grid-table">
<tr>
<td class="policy-details">
<div class="section-label">Policy Details:</div>
<table>
<tr><td class="label">Corporate Name:</td><td><?= esc($header['corporate_name'] ?? '') ?></td></tr>
<tr><td class="label">Insurer Policy Number:</td><td><?= esc($header['policy_number'] ?? '') ?></td></tr>
<tr><td class="label">Policy Start Date:</td><td><?= esc($header['start'] ?? '') ?></td></tr>
<tr><td class="label">Policy End Date:</td><td><?= esc($header['end'] ?? '') ?></td></tr>
<tr><td class="label">Total Premium:(in Rs.)</td><td><?= esc($num($header['premium'] ?? 0)) ?></td></tr>
<tr><td class="label">Earned Premium:(in Rs.)</td><td><?= esc($num($header['earned'] ?? 0)) ?></td></tr>
<tr><td class="label">Lives Covered:(in Nos.)</td><td><?= esc($num($header['lives'] ?? 0)) ?></td></tr>
<tr><td class="label">Report Generated By(Broker):</td><td><?= esc($header['generated_by'] ?? '') ?></td></tr>
<tr><td class="label">Report Generated Date:</td><td><?= esc($header['generated_at'] ?? ($meta['generated_at'] ?? '')) ?></td></tr>
</table>
</td>
<td class="toc">
<div class="section-label">Table of Contents</div>
<ol>
<?php foreach (($toc ?: []) as $item): ?>
<li><?= esc((string) $item) ?></li>
<?php endforeach; ?>
</ol>
</td>
</tr>
</table>
</td></tr>
</table>
<!-- 1. ICR -->
<table class="section-wrap section-block">
<tr><td>
<h3 class="section-title">1. Incurred Claims Ratio (ICR):</h3>
<table class="data">
<tr>
<th class="rowlabel">Claim Status</th>
<th colspan="2">Cashless</th>
<th colspan="2">Member</th>
<th colspan="2">Total</th>
</tr>
<tr>
<th></th><th>Nos.</th><th>Amt. (in Rs.)</th><th>Nos.</th><th>Amt. (in Rs.)</th><th>Nos.</th><th>Amt. (in Rs.)</th>
</tr>
<?php foreach (($icr['rows'] ?? []) as $row):
$isIncurred = str_contains((string) ($row['label'] ?? ''), 'Incurred');
$c = $cellCa($row['cashless'] ?? []);
$m = $cellCa($row['member'] ?? []);
$t = $cellCa($row['total'] ?? []);
?>
<tr<?= $isIncurred ? ' class="total-row"' : '' ?>>
<td class="rowlabel"><?= esc($row['label'] ?? '') ?></td>
<td><?= esc($c['count']) ?></td><td class="num"><?= esc($c['amount']) ?></td>
<td><?= esc($m['count']) ?></td><td class="num"><?= esc($m['amount']) ?></td>
<td><?= esc($t['count']) ?></td><td class="num"><?= esc($t['amount']) ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php
$sum = $icr['summary'] ?? [];
$dr = $sum['disposal_rate'] ?? [];
$cpc = $sum['cpc'] ?? [];
?>
<div class="summary-mini">
<table>
<tr><td>ICR On EP*</td><td colspan="2"></td><td><b><?= esc($pct($sum['icr_on_ep'] ?? 0, 1)) ?></b></td></tr>
<tr><td>Incidence Rate</td><td colspan="2"></td><td><b><?= esc($pct($sum['incidence_rate'] ?? 0, 1)) ?></b></td></tr>
<tr>
<td>Disposal Rate</td>
<td><?= esc($pct($dr['cashless'] ?? 0)) ?></td>
<td><?= esc($pct($dr['member'] ?? 0)) ?></td>
<td><b><?= esc($pct($dr['total'] ?? 0)) ?></b></td>
</tr>
<tr>
<td>Cost per Claims(CPC)</td>
<td><?= esc($num($cpc['cashless'] ?? 0)) ?></td>
<td><?= esc($num($cpc['member'] ?? 0)) ?></td>
<td><b><?= esc($num($cpc['total'] ?? 0)) ?></b></td>
</tr>
</table>
</div>
</td></tr>
</table>
<!-- 2. Hospitalisation Type -->
<table class="section-wrap section-block">
<tr><td>
<h3 class="section-title">2. Hospitalisation Type Details:</h3>
<table class="data">
<tr>
<th class="rowlabel">Claim Subtype</th>
<th colspan="2">Cashless</th>
<th colspan="2">Member</th>
</tr>
<tr><th></th><th>Nos.</th><th>Amt. (in Rs.)</th><th>Nos.</th><th>Amt. (in Rs.)</th></tr>
<?php foreach (($hosp['rows'] ?? []) as $row):
$c = $cellCa($row['cashless'] ?? []);
$m = $cellCa($row['member'] ?? []);
?>
<tr>
<td class="rowlabel"><?= esc($row['label'] ?? '') ?></td>
<td><?= esc($c['count']) ?></td><td class="num"><?= esc($c['amount']) ?></td>
<td><?= esc($m['count']) ?></td><td class="num"><?= esc($m['amount']) ?></td>
</tr>
<?php endforeach;
$ht = $hosp['total'] ?? [];
$hc = $cellCa($ht['cashless'] ?? []);
$hm = $cellCa($ht['member'] ?? []);
?>
<tr class="total-row">
<td class="rowlabel">Total</td>
<td><?= esc($hc['count']) ?></td><td class="num"><?= esc($hc['amount']) ?></td>
<td><?= esc($hm['count']) ?></td><td class="num"><?= esc($hm['amount']) ?></td>
</tr>
</table>
<div class="small-note">*Considering Only Settled ,Approved and UTR Awaiting (Cheque Pending)</div>
<div class="notes-box">
<b>Notes:</b><br>
ICR = (Settled Amt + Outstanding Amt) / Annual Premium<br>
ICR on EP* = (Settled Amt + Outstanding Amt) / Earned Premium<br>
Earned Premium = Prorated premium as on report generated date<br>
Cost Per Claim(CPC) = Approved Amt / Number of Events(Main Claims) for IPD + Daycare Cases<br>
Incidents Rate = No of Claim Events/ Lives<br>
Disposal Rate = (Settled+Rejected+Awaiting UTR+Cancelled / Claims Reported)<br>
* EP- Earned Premium ; O/S - Outstanding<br>
* Event = Main Claims Only (Excluding Prepost and Addendum)
</div>
</td></tr>
</table>
<!-- 3. Member Details - Relationship & Gender -->
<table class="section-wrap section-block">
<tr><td>
<h3 class="section-title">3. Member Details - Relationship &amp; Gender wise :</h3>
<table class="two-col-table">
<tr>
<td class="tbl-side">
<table class="data">
<tr><th class="rowlabel">Relation</th><th>Male</th><th>Female</th><th>Total</th><th>%</th></tr>
<?php foreach (($memberGender['rows'] ?? []) as $row): ?>
<tr>
<td class="rowlabel"><?= esc($row['relation'] ?? '') ?></td>
<td><?= esc($num($row['male'] ?? 0)) ?></td>
<td><?= esc($num($row['female'] ?? 0)) ?></td>
<td><?= esc($num($row['total'] ?? 0)) ?></td>
<td><?= esc($pct2($row['pct'] ?? 0)) ?></td>
</tr>
<?php endforeach;
$mgt = $memberGender['total'] ?? [];
$mgp = $memberGender['pct_gender'] ?? [];
?>
<tr class="total-row">
<td class="rowlabel">Total</td>
<td><?= esc($num($mgt['male'] ?? 0)) ?></td>
<td><?= esc($num($mgt['female'] ?? 0)) ?></td>
<td><?= esc($num($mgt['total'] ?? 0)) ?></td>
<td><?= esc($pct2(100)) ?></td>
</tr>
<tr>
<td class="rowlabel">%</td>
<td><?= esc($pct($mgp['male'] ?? 0)) ?></td>
<td><?= esc($pct($mgp['female'] ?? 0)) ?></td>
<td><?= esc($pct(100)) ?></td>
<td></td>
</tr>
</table>
</td>
<td class="chart-side">
<div class="chart-container">
<table class="bar-chart">
<?php foreach ($chartGender as $g):
$rel = (string) ($g['relation'] ?? '');
$male = (int) ($g['male'] ?? 0);
$female = (int) ($g['female'] ?? 0);
$total = $male + $female;
$w = ($total / $genderMax) * 100;
$color = ($female > $male) ? '#ed7d31' : '#4472c4';
?>
<tr>
<td class="bar-label"><?= esc($rel) ?></td>
<td class="bar-track"><?php $renderBar($w, $color); ?></td>
<td class="bar-value"><?= esc($num($total)) ?></td>
</tr>
<?php endforeach; ?>
</table>
<div class="legend">
<span><span class="legend-swatch" style="background:#4472c4;"></span>Male</span>
<span><span class="legend-swatch" style="background:#ed7d31;"></span>Female</span>
</div>
</div>
</td>
</tr>
</table>
</td></tr>
</table>
<!-- 4. Member Details Age Band -->
<table class="section-wrap section-block">
<tr><td>
<h3 class="section-title">4. Member Details - Age Band &amp; Relationship wise :</h3>
<table class="two-col-table">
<tr>
<td class="tbl-side">
<table class="data">
<tr>
<th class="rowlabel">AgeBand</th>
<?php foreach ($ageRelations as $rel): ?><th><?= esc($rel) ?></th><?php endforeach; ?>
<th>Total</th><th>%</th>
</tr>
<?php foreach (($memberAge['rows'] ?? []) as $row): ?>
<tr>
<td class="rowlabel"><?= esc($row['band'] ?? '') ?></td>
<?php foreach ($ageRelations as $rel): ?>
<td><?= esc($num($row[$rel] ?? 0)) ?></td>
<?php endforeach; ?>
<td><?= esc($num($row['total'] ?? 0)) ?></td>
<td><?= esc($pct2($row['pct'] ?? 0)) ?></td>
</tr>
<?php endforeach;
$mat = $memberAge['total'] ?? [];
$mac = $memberAge['col_pct'] ?? [];
?>
<tr class="total-row">
<td class="rowlabel">Total</td>
<?php foreach ($ageRelations as $rel): ?>
<td><?= esc($num($mat[$rel] ?? 0)) ?></td>
<?php endforeach; ?>
<td><?= esc($num($mat['_total'] ?? 0)) ?></td>
<td><?= esc($pct2(100)) ?></td>
</tr>
<tr>
<td class="rowlabel">%</td>
<?php foreach ($ageRelations as $rel): ?>
<td><?= esc($pct($mac[$rel] ?? 0)) ?></td>
<?php endforeach; ?>
<td><?= esc($pct(100)) ?></td>
<td></td>
</tr>
</table>
</td>
<td class="chart-side">
<div class="chart-container">
<table class="bar-chart">
<?php foreach ($chartAge as $a):
$total = (int) ($a['total'] ?? 0);
$w = ($total / $ageMax) * 100;
$dom = (string) ($a['dominant'] ?? '');
$color = $ageBarColor($dom);
$label = $num($total) . ($dom !== '' ? ' (' . $dom . ')' : '');
?>
<tr>
<td class="bar-label"><?= esc($a['band'] ?? '') ?></td>
<td class="bar-track"><?php $renderBar($w, $color); ?></td>
<td class="bar-value"><?= esc($label) ?></td>
</tr>
<?php endforeach; ?>
</table>
<div class="legend">
<span><span class="legend-swatch" style="background:#264478;"></span>Self</span>
<span><span class="legend-swatch" style="background:#a5a5a5;"></span>Spouse</span>
<span><span class="legend-swatch" style="background:#ffc000;"></span>Parents</span>
<span><span class="legend-swatch" style="background:#4472c4;"></span>Child</span>
<span><span class="legend-swatch" style="background:#70ad47;"></span>In Law/Other</span>
</div>
</div>
</td>
</tr>
</table>
</td></tr>
</table>
<!-- 5. Claims Approved Age Band -->
<h3 class="section-title">5. Claims Approved - Age Band &amp; Relationship wise :</h3>
<table class="data">
<tr>
<th class="rowlabel">Age Band</th>
<?php foreach ($ageRelations as $rel): ?><th colspan="2"><?= esc($rel) ?></th><?php endforeach; ?>
<th colspan="2">Total</th><th>Total %</th>
</tr>
<tr>
<th></th>
<?php foreach ($ageRelations as $_): ?><th>No.</th><th>Amt.(Rs.)</th><?php endforeach; ?>
<th>No.</th><th>Amt.(Rs.)</th><th>No.%/Amt.%</th>
</tr>
<?php foreach (($claimsAge['rows'] ?? []) as $row):
$renderRelationClaimRow((string) ($row['band'] ?? ''), $row, $ageRelations);
endforeach;
$cat = $claimsAge['total'] ?? [];
$totalRow = $cat;
$totalRow['total'] = $cat['_total'] ?? [];
$totalRow['pct'] = ['count' => 100, 'amount' => 100];
$renderRelationClaimRow('Total', $totalRow, $ageRelations, true);
$renderRelationPctRow($claimsAge['col_pct'] ?? [], $ageRelations);
?>
</table>
<div class="small-note">* Count is only for Approved Claims(Settled and Awaiting UTR(Cheque Pending)) .</div>
<!-- 6. Claims Approved Amount Band -->
<h3 class="section-title">6. Claims Approved - Amount Band &amp; Relationship wise :</h3>
<table class="data">
<tr>
<th class="rowlabel">Amount Band</th>
<?php foreach ($ageRelations as $rel): ?><th colspan="2"><?= esc($rel) ?></th><?php endforeach; ?>
<th colspan="2">Total</th><th>Total %</th>
</tr>
<tr>
<th></th>
<?php foreach ($ageRelations as $_): ?><th>No.</th><th>Amt.(Rs.)</th><?php endforeach; ?>
<th>No.</th><th>Amt.(Rs.)</th><th>No.%/Amt.%</th>
</tr>
<?php foreach (($claimsAmount['rows'] ?? []) as $row):
$renderRelationClaimRow((string) ($row['band'] ?? ''), $row, $ageRelations);
endforeach;
$amtT = $claimsAmount['total'] ?? [];
$amtTotalRow = $amtT;
$amtTotalRow['total'] = $amtT['_total'] ?? [];
$amtTotalRow['pct'] = ['count' => 100, 'amount' => 100];
$renderRelationClaimRow('Total', $amtTotalRow, $ageRelations, true);
$renderRelationPctRow($claimsAmount['col_pct'] ?? [], $ageRelations);
?>
</table>
<div class="small-note">* Count is only for Approved Claims(Settled and Awaiting UTR (Cheque Pending)). &nbsp; * Banding for Incurred Amount</div>
<!-- 7. Ailment wise -->
<h3 class="section-title">7. Claims Approved - Top 15 Ailment wise :</h3>
<table class="data">
<tr>
<th class="rowlabel">Ailment Group</th>
<?php foreach ($ageRelations as $rel): ?><th colspan="2"><?= esc($rel) ?></th><?php endforeach; ?>
<th colspan="2">Total</th><th>Total %</th>
</tr>
<tr>
<th></th>
<?php foreach ($ageRelations as $_): ?><th>No.</th><th>Amt.(Rs.)</th><?php endforeach; ?>
<th>No.</th><th>Amt.(Rs.)</th><th>No.%/Amt.%</th>
</tr>
<?php foreach (($ailments['rows'] ?? []) as $row):
$renderRelationClaimRow((string) ($row['ailment'] ?? ''), $row, $ageRelations);
endforeach;
$ailT = $ailments['total'] ?? [];
$ailTotalRow = $ailT;
$ailTotalRow['total'] = $ailT['_total'] ?? [];
$ailTotalRow['pct'] = ['count' => 100, 'amount' => 100];
$renderRelationClaimRow('Total', $ailTotalRow, $ageRelations, true);
$renderRelationPctRow($ailments['col_pct'] ?? [], $ageRelations);
?>
</table>
<div class="small-note">* Count is only for Approved Claims(Settled and Awaiting UTR (Cheque Pending)) .</div>
<!-- 8. Top 15 Hospitals -->
<h3 class="section-title">8. Top 15 Cashless Hospital wise utilization:</h3>
<table class="data">
<tr>
<th class="rowlabel">Hospital_ID</th>
<th class="rowlabel">Hospital_Name</th>
<th>No of Claims</th>
<th>Amount</th>
</tr>
<?php if (($hospitals ?? []) === []): ?>
<tr><td class="rowlabel" colspan="4">No cashless hospital utilization</td></tr>
<?php else: foreach ($hospitals as $h): ?>
<tr>
<td class="rowlabel"><?= esc($h['hospital_id'] ?? '') ?></td>
<td class="rowlabel"><?= esc($h['hospital_name'] ?? '') ?></td>
<td><?= esc($num($h['count'] ?? 0)) ?></td>
<td class="num"><?= esc($num($h['amount'] ?? 0)) ?></td>
</tr>
<?php endforeach; endif; ?>
</table>
<!-- 9. Cashless & Member Summary -->
<h3 class="section-title">9. Claims Approved - Cashless &amp; Member Summary:</h3>
<table class="data table-narrow">
<tr>
<th class="rowlabel">Type of claim</th>
<th>Events</th><th>Events%</th><th>Amount</th><th>Amount%</th>
</tr>
<?php foreach (($cmSummary['rows'] ?? []) as $row): ?>
<tr>
<td class="rowlabel"><?= esc($row['label'] ?? '') ?></td>
<td><?= esc($num($row['count'] ?? 0)) ?></td>
<td><?= esc($pct2($row['count_pct'] ?? 0)) ?></td>
<td class="num"><?= esc($num($row['amount'] ?? 0)) ?></td>
<td><?= esc($pct2($row['amount_pct'] ?? 0)) ?></td>
</tr>
<?php endforeach;
$cmt = $cmSummary['total'] ?? [];
?>
<tr class="total-row">
<td class="rowlabel">TOTAL</td>
<td><?= esc($num($cmt['count'] ?? 0)) ?></td>
<td><?= esc($pct2(100)) ?></td>
<td class="num"><?= esc($num($cmt['amount'] ?? 0)) ?></td>
<td><?= esc($pct2(100)) ?></td>
</tr>
</table>
<!-- 10. TAT -->
<h3 class="section-title">10. Turn Around Time (TAT) :</h3>
<div class="small-note"><b>Claim Process TAT :</b></div>
<table class="data table-tat">
<tr><th class="rowlabel">TAT Band</th><th>Nos.</th><th>%</th></tr>
<?php foreach (($tat['rows'] ?? []) as $row): ?>
<tr>
<td class="rowlabel"><?= esc($row['band'] ?? '') ?></td>
<td><?= esc($num($row['count'] ?? 0)) ?></td>
<td><?= esc($pct2($row['pct'] ?? 0)) ?></td>
</tr>
<?php endforeach; ?>
<tr class="total-row">
<td class="rowlabel">Total</td>
<td><?= esc($num($tat['total'] ?? 0)) ?></td>
<td><?= esc($pct2(100)) ?></td>
</tr>
</table>
<div class="small-note">Note: Only Settled,Awaiting UTR, Approved and Rejected claims are considered<br>* LDR to Decision date<br>* only for Member claims</div>
<!-- 11. Month on Month -->
<h3 class="section-title">11. Month on Month</h3>
<table class="data">
<tr>
<th class="rowlabel">Admission Month</th>
<th colspan="2">Hospitalization and Daycare</th>
<th colspan="2">Other than Hospitalization</th>
<th colspan="2">Total</th>
</tr>
<tr>
<th></th>
<th>Inc Count</th><th>Inc Amount</th>
<th>Inc Count</th><th>Inc Amount</th>
<th>Inc Count</th><th>Inc Amount</th>
</tr>
<?php foreach (($mom['rows'] ?? []) as $row):
$h = $cellCa($row['hosp'] ?? []);
$o = $cellCa($row['other'] ?? []);
$t = $cellCa($row['total'] ?? []);
?>
<tr>
<td class="rowlabel"><?= esc($row['month'] ?? '') ?></td>
<td><?= esc($h['count']) ?></td><td class="num"><?= esc($h['amount']) ?></td>
<td><?= esc($o['count']) ?></td><td class="num"><?= esc($o['amount']) ?></td>
<td><?= esc($t['count']) ?></td><td class="num"><?= esc($t['amount']) ?></td>
</tr>
<?php endforeach;
$mt = $mom['total'] ?? [];
$mh = $cellCa($mt['hosp'] ?? []);
$mo = $cellCa($mt['other'] ?? []);
$mtt = $cellCa($mt['total'] ?? []);
?>
<tr class="total-row">
<td class="rowlabel">TOTAL</td>
<td><?= esc($mh['count']) ?></td><td class="num"><?= esc($mh['amount']) ?></td>
<td><?= esc($mo['count']) ?></td><td class="num"><?= esc($mo['amount']) ?></td>
<td><?= esc($mtt['count']) ?></td><td class="num"><?= esc($mtt['amount']) ?></td>
</tr>
</table>
<!-- 12. Payout Ratio -->
<h3 class="section-title">12. Payout Ratio</h3>
<table class="data table-narrow">
<tr><th>Claimed Amount</th><th>Settled Amount</th><th>Payout %</th></tr>
<tr>
<td class="num"><?= esc($num($payout['claimed'] ?? 0)) ?></td>
<td class="num"><?= esc($num($payout['settled'] ?? 0)) ?></td>
<td><?= esc($pct($payout['payout_pct'] ?? 0)) ?></td>
</tr>
</table>
<!-- Footer -->
<div class="footer-disclaimer">
<b>DISCLAIMER:</b> Confidential information, not intended for public dissemination. Vidal Health Insurance TPA Pvt ltd makes no representations or warranties, express, implied or otherwise, regarding the accuracy and
completeness of the information, and shall have no liability resulting from the use of the information. The Receiving Party will use information received in a safe and prudent manner and is responsible for all risk or loss arising
out of its use of such information. Data will be refreshed on every day night. Report is based on previous Day Data.
</div>
</div>
</body>
</html>