@extends('layouts.vertical', ['page_title' => 'Datatables']) @section('css') @endsection @section('content')

{{ $title }}

@php // Helper to get all months from July 2025 to current month $start = \Carbon\Carbon::create(2025, 7, 1); $end = \Carbon\Carbon::now()->startOfMonth(); $months = []; while ($start <= $end) { $months[] = $start->format('F Y'); $start->addMonth(); } $selectedMonth = request()->get('month', \Carbon\Carbon::now()->format('F Y')); $exportHierParams = ''; foreach (request()->get('filter_hier', []) as $exportHierId) { $exportHierParams .= '&filter_hier[]=' . urlencode($exportHierId); } @endphp
@if (isset($buttons)) @foreach ($buttons as $button) {{ $button['title'] }} @endforeach @endif
@if (session()->has('message'))
{{ session()->get('message') }}
@endif @if (session()->has('error'))
{{ session()->get('error') }}
@endif
1. Monthly Summary ( {{ $selectedMonth }} )
Export
@foreach ($monthsummary as $col) @endforeach @foreach ($monthsummarysubmission as $row) @foreach ($monthsummary as $col) @php $val = $row->{$col['key']} ?? ''; @endphp @endforeach @endforeach @foreach (array_slice($monthsummary, 1) as $col) @php $key = $col['key']; @endphp @endforeach
{{ $col['name'] }}
@php if (is_numeric($val)) { if (floor($val) == $val) { echo number_format($val); } else { echo number_format($val, 2); } } else { echo $val; } @endphp
Total @if ($key === 'percent_ach') {{ $monthTotals['units_plan'] > 0 ? round(($monthTotals['units_ach'] / $monthTotals['units_plan']) * 100) : 0 }}% @else @php $totalVal = $monthTotals[$key] ?? 0; if (floor($totalVal) == $totalVal) { echo number_format($totalVal); } else { echo number_format($totalVal, 2); } @endphp @endif
2. Weekly Summary ( {{ $selectedMonth }} )
Export
@foreach ($weeklysummary as $col) @endforeach @foreach ($weeklysummarysubmission as $row) @foreach ($weeklysummary as $col) @php $val = $row->{$col['key']} ?? ''; @endphp @endforeach @endforeach @if (count($weeklysummarysubmission) > 0) @foreach ($weeklysummary as $col) @if ($col['key'] === 'product_name') @continue @elseif ($col['key'] === 'percent_ach') @else @endif @endforeach @endif
{{ $col['label'] }}
@if (is_numeric($val)) {{ number_format($val) }} @else {{ $val }} @endif
Total {{ $weeklyTotals['month_plan'] > 0 ? number_format(($weeklyTotals['units_ach'] / $weeklyTotals['month_plan']) * 100) : 0 }}% {{ number_format($weeklyTotals[$col['key']] ?? 0) }}
3. Center Summary
Export
@foreach ($centersummary as $col) @endforeach @foreach ($centersummarysubmission as $row) @foreach ($centersummary as $col) @php $val = $row->{$col['key']} ?? ''; @endphp @endforeach @endforeach @if ($centerTotals) @foreach ($centersummary as $index => $col) @if ($index === 0) {{-- Skip the first column since "Total" text already there --}} @continue @endif @php $key = $col['key']; $val = $centerTotals->{$key} ?? 0; @endphp @if ($key === 'percent_ach') @php $plan = $centerTotals->centers_plan ?? 0; $ach = $centerTotals->centers_ach ?? 0; $percent = $plan > 0 ? number_format(($ach / $plan) * 100) : 0; @endphp @else @endif @endforeach @endif
{{ $col['name'] }}
@if ($col['key'] === 'percent_ach') {{ round($val) }} @elseif (is_numeric($val)) {{ number_format($val) }} @else {{ $val }} @endif
Total{{ $percent }}%{{ number_format($val) }}
4. Center Trend Summary
Export
@foreach ($centertrendsummary as $col) @endforeach @foreach ($centertrendsummarysubmission as $row) @php $centerTrendRow = (array) json_decode(json_encode($row), true); @endphp @foreach ($centertrendsummary as $col) @php $val = $centerTrendRow[$col['key']] ?? ''; @endphp @endforeach @endforeach @if (count($centertrendsummarysubmission) > 0) @foreach (array_slice($centertrendsummary, 1) as $col) @php $val = $centerTrendTotals[$col['key']] ?? 0; @endphp @endforeach @endif
{{ $col['name'] }}
{{ is_numeric($val) ? number_format($val) : $val }}
Total{{ number_format($val) }}
5. Unit Trend Summary
Export
@foreach ($unittrendsummary as $col) @endforeach @foreach ($unittrendsummarysubmission as $row) @php $unitTrendRow = (array) json_decode(json_encode($row), true); @endphp @foreach ($unittrendsummary as $col) @php $val = $unitTrendRow[$col['key']] ?? ''; @endphp @endforeach @endforeach @if (count($unittrendsummarysubmission) > 0) @foreach (array_slice($unittrendsummary, 1) as $col) @endforeach @endif
{{ $col['name'] }}
{{ is_numeric($val) ? number_format($val) : $val }}
Total{{ number_format($unitTrendTotals[$col['key']] ?? 0) }}
6. Transplant Penetration
Export
@php $tpRows = $transplantPenetrationSubmission ?? []; $tpGet = function ($row, $key, $default = '') { if (is_object($row) && isset($row->{$key})) { return $row->{$key}; } if (is_array($row) && array_key_exists($key, $row)) { return $row[$key]; } return $default; }; $tpGetNested = function ($row, $key, $nestedKey, $default = '') use ($tpGet) { $parent = $tpGet($row, $key, null); if (is_object($parent) && isset($parent->{$nestedKey})) { return $parent->{$nestedKey}; } if (is_array($parent) && array_key_exists($nestedKey, $parent)) { return $parent[$nestedKey]; } return $default; }; $tpFmt = function ($val) { if ($val === null || $val === '') { return ''; } if (is_numeric($val)) { return floor($val) == $val ? number_format($val) : number_format($val, 2); } return $val; }; @endphp @if (!empty($tpRows)) @foreach ($tpRows as $row) @endforeach @else @endif
Transplant Type Monthly Expected no. of Transplant Gennova Share Denovo Plan Gennova Share Switch Plan Gennova Share Grafsol Tx Plan Total Actual Transplants Gennova Share Denovo Actual Gennova Share Switch Actual Gennova Share Grafsol Tx Actual
Week-1 Week-2 Week-3 Week-4 Week-1 Week-2 Week-3 Week-4 Week-1 Week-2 Week-3 Week-4
{{ $tpFmt($tpGet($row, 'Transplant Type')) }} {{ $tpFmt($tpGet($row, 'Monthly Expected no. of Transplant')) }} {{ $tpFmt($tpGet($row, 'Gennova Share Dennovo Plan')) }} {{ $tpFmt($tpGet($row, 'Gennova Share Switch Plan')) }} {{ $tpFmt($tpGet($row, 'Gennova Share Graftsol Tx Plan')) }} {{ $tpFmt($tpGet($row, 'Total Actual Transplants')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Dennovo Actual', 'Week-1')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Dennovo Actual', 'Week-2')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Dennovo Actual', 'Week-3')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Dennovo Actual', 'Week-4')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Switch Actual', 'Week-1')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Switch Actual', 'Week-2')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Switch Actual', 'Week-3')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Switch Actual', 'Week-4')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Graftsol Tx Actual', 'Week-1')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Graftsol Tx Actual', 'Week-2')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Graftsol Tx Actual', 'Week-3')) }} {{ $tpFmt($tpGetNested($row, 'Gennova Share Graftsol Tx Actual', 'Week-4')) }}
No data
7. Transplant Summary
Export
@php $tsRows = $transplantSummarySubmission ?? []; $tsFlat = $transplantSummaryFlat ?? []; $tsGroups = $transplantSummaryGroups ?? []; $tsColCount = count($tsFlat); foreach ($tsGroups as $group) { $tsColCount += count($group['columns'] ?? []); } $tsFlatCount = count($tsFlat); @endphp @foreach ($tsFlat as $i => $col) @endforeach @foreach ($tsGroups as $group) @endforeach @foreach ($tsGroups as $group) @foreach (($group['columns'] ?? []) as $j => $col) @endforeach @endforeach @if (!empty($tsRows) && ($tsColCount ?? 0) > 0) @foreach ($tsRows as $row) @foreach ($tsFlat as $i => $col) @endforeach @foreach ($tsGroups as $group) @foreach (($group['columns'] ?? []) as $j => $col) @endforeach @endforeach @endforeach @else @endif
{{ $col['label'] ?? $col['key'] }} {{ $group['name'] ?? '' }}
{{ $col['label'] ?? $col['key'] }}
{{ $tpFmt($tpGet($row, $col['key'])) }} {{ $tpFmt($tpGet($row, $col['key'])) }}
No data
8. Activity Summary
Export
@foreach (($activitySummaryColumns ?? []) as $col) @endforeach @php $asRows = $activitySummarySubmission ?? []; $asCols = $activitySummaryColumns ?? []; @endphp @if (!empty($asRows) && !empty($asCols)) @foreach ($asRows as $row) @foreach ($asCols as $col) @php $parent = $col['parent'] ?? ''; $child = $col['child'] ?? null; $val = $child === null ? $tpGet($row, $parent) : $tpGetNested($row, $parent, $child); @endphp @endforeach @endforeach @else @endif
first) class="sticky-first-col" @endif>{{ $col['label'] ?? '' }}
{{ $tpFmt($val) }}
No data
@endsection @section('script') @endsection