@if (isset($ajax) && $ajax) @php $in_progress = 0; $completed = 0; $total = 0; @endphp @foreach($data as $dt) @php $in_progress = $in_progress + ($dt->in_progress + $dt->new); $completed = $completed + $dt->completed; $total = $total + $dt->total; @endphp {{$dt->year}} @if(($dt->in_progress + $dt->new)>0) {{$dt->in_progress + $dt->new}} @else {{ ($dt->in_progress + $dt->new) }} @endif @if($dt->completed>0) {{$dt->completed}} @else {{$dt->completed}} @endif {{$dt->total}} @endforeach Grand Total {{$in_progress}} {{$completed}} {{$total}} @else

Case Management

Year Ongoing Closed Total
@endif