@extends('template.app') @section('meta') @endsection @section('title') Dashboard @endsection @section('styles') @endsection @section('content')
| Model | @foreach ($branches as $branch) @php $branch_full = $branch->name ?? ''; // or use $branch->branch_name if that's the column $b_name = ''; if (str_contains($branch_full, 'Rajkot')) { $b_name = 'Rajkot'; } elseif (str_contains($branch_full, 'Rjt_1s')) { $b_name = 'Rajkot-1s'; } elseif (str_contains($branch_full, 'Jamnagar')) { $b_name = 'Jamnagar'; } elseif (str_contains($branch_full, 'Junagadh')) { $b_name = 'Junagadh'; } elseif (str_contains($branch_full, 'Morbi')) { $b_name = 'Morbi'; } elseif (str_contains($branch_full, '_M')) { $b_name = 'Mehsana'; } elseif (str_contains($branch_full, '_K')) { $b_name = 'Kadi'; } else { $b_name = $branch_full; // fallback to full name if no match } @endphp{{ $b_name }} | @endforeachTotal |
|---|---|---|
| {{ $fuelType }} | @php $rowTotal = 0; $rowObfIds = []; @endphp @foreach ($branches as $branch) @php $record = collect($records)->firstWhere('branch_id', $branch->id); $branchCount = $record->total ?? 0; // Get obf_ids and convert to array if it's a string $obfIds = $record->obf_ids ?? []; if (!is_array($obfIds)) { $obfIds = is_string($obfIds) ? explode(',', $obfIds) : []; } $rowTotal += $branchCount; $rowObfIds = array_merge($rowObfIds, $obfIds); // For column total later $totalsPerBranchObfIds[$branch->id] = array_merge( $totalsPerBranchObfIds[$branch->id] ?? [], $obfIds ); // For grand total $grandObfIds = array_merge($grandObfIds, $obfIds); @endphp@if ($branchCount > 0) {{ $branchCount }} @else 0 @endif | @endforeach@php $uniqueRowObfIds = array_unique($rowObfIds); @endphp @if (count($uniqueRowObfIds) > 0) {{ count($uniqueRowObfIds) }} @else 0 @endif |
| Total | @php $uniqueGrandObfIds = []; @endphp @foreach ($branches as $branch) @php $branchObfIds = $totalsPerBranchObfIds[$branch->id] ?? []; $uniqueBranchObfIds = array_unique($branchObfIds); $branchTotal = count($uniqueBranchObfIds); $uniqueGrandObfIds = array_merge($uniqueGrandObfIds, $uniqueBranchObfIds); @endphp@if ($branchTotal > 0) {{ $branchTotal }} @else 0 @endif | @endforeach @php $uniqueGrandObfIds = array_unique($uniqueGrandObfIds); $grandTotal = count($uniqueGrandObfIds); @endphp@if ($grandTotal > 0) {{ $grandTotal }} @else 0 @endif |
| Customer Advance | @foreach ($branches as $branch) @php $branch_full = $branch->name ?? ''; // or use $branch->branch_name if that's the column $b_name = ''; if (str_contains($branch_full, 'Rajkot')) { $b_name = 'Rajkot'; } elseif (str_contains($branch_full, 'Rjt_1s')) { $b_name = 'Rajkot-1s'; } elseif (str_contains($branch_full, 'Jamnagar')) { $b_name = 'Jamnagar'; } elseif (str_contains($branch_full, 'Junagadh')) { $b_name = 'Junagadh'; } elseif (str_contains($branch_full, 'Morbi')) { $b_name = 'Morbi'; } elseif (str_contains($branch_full, '_M')) { $b_name = 'Mehsana'; } elseif (str_contains($branch_full, '_K')) { $b_name = 'Kadi'; } else { $b_name = $branch_full; // fallback to full name if no match } @endphp{{ $b_name }} | @endforeachTotal |
|---|---|---|
| {{ $fuelType }} | @foreach ($branches as $branch) @php $record = collect($records)->firstWhere('branch_id', $branch->id); $amount = isset($record->total) ? floor($record->total / 1000) : 0; $obfIds = $record->obf_ids ?? ''; $obfIdsArray = is_string($obfIds) ? explode(',', $obfIds) : []; $rowTotal += $amount; $grandTotalsPerBranch[$branch->id] += $amount; $grandTotal += $amount; $rowObfIds = array_merge($rowObfIds, $obfIdsArray); @endphp@if ($amount > 0) {{ number_format($amount) }} @else {{ number_format($amount) }} @endif | @endforeach@if ($rowTotal > 0) {{ number_format($rowTotal) }} @else {{ number_format($rowTotal) }} @endif |
| Total | @php $grandObfIds = []; @endphp @foreach ($branches as $branch) @php $branchTotal = $grandTotalsPerBranch[$branch->id] ?? 0; $branchObfIds = collect($booking_fuel_type_amt_wise_data) ->flatten() ->filter(fn($item) => $item->branch_id == $branch->id) ->pluck('obf_ids') ->map(fn($ids) => explode(',', $ids)) ->flatten() ->filter() ->unique() ->values() ->all(); $grandObfIds = array_merge($grandObfIds, $branchObfIds); @endphp@if ($branchTotal > 0) {{ number_format($branchTotal) }} @else {{ number_format($branchTotal) }} @endif | @endforeach@if ($grandTotal > 0) {{ number_format($grandTotal) }} @else {{ number_format($grandTotal) }} @endif |
| Model | @foreach ($branches as $branch) @php $branch_full = $branch->name ?? ''; $b_name = ''; if (str_contains($branch_full, 'Rajkot')) { $b_name = 'Rajkot'; } elseif (str_contains($branch_full, 'Rjt_1s')) { $b_name = 'Rajkot-1s'; } elseif (str_contains($branch_full, 'Jamnagar')) { $b_name = 'Jamnagar'; } elseif (str_contains($branch_full, 'Junagadh')) { $b_name = 'Junagadh'; } elseif (str_contains($branch_full, 'Morbi')) { $b_name = 'Morbi'; } elseif (str_contains($branch_full, '_M')) { $b_name = 'Mehsana'; } elseif (str_contains($branch_full, '_K')) { $b_name = 'Kadi'; } else { $b_name = $branch_full; } @endphp{{ $b_name }} | @endforeachTotal |
|---|---|---|
| {{ $modelName }} | @foreach ($branches as $branch) @php $branchTotal = 0; foreach ($fuelTypeData as $fuelData) { $branchTotal += $fuelData[$branch->id]['total'] ?? 0; } $modelTotal += $branchTotal; $branchTotals[$branch->id] = $branchTotal; @endphp@php $obfIds = collect($fuelTypeData)->pluck("{$branch->id}.obf_ids")->flatten()->filter()->all(); @endphp @if ($branchTotal > 0 && count($obfIds)) {{ $branchTotal }} @else {{ $branchTotal }} @endif | @endforeach @php $modelObfIds = collect($fuelTypeData) ->flatMap(function ($fuelData) { return collect($fuelData)->pluck('obf_ids'); })->flatten()->filter()->all(); @endphp@if ($modelTotal > 0 && count($modelObfIds)) {{ $modelTotal }} @else {{ $modelTotal }} @endif |
| {{ $fuelTypes[$fuelTypeId] ?? 'Unknown' }} | @foreach ($branches as $branch) @php $total = $branchData[$branch->id]['total'] ?? 0; $obf_ids = $branchData[$branch->id]['obf_ids'] ?? []; $rowTotal += $total; @endphp@if ($total > 0 && count($obf_ids)) {{ $total }} @else {{ $total }} @endif | @endforeach@php $rowObfIds = collect($branchData)->pluck('obf_ids')->flatten()->filter()->all(); @endphp @if ($rowTotal > 0 && count($rowObfIds)) {{ $rowTotal }} @else {{ $rowTotal }} @endif |
| Total Stock | @php $grandTotal = 0; $grandObfIds = []; @endphp @foreach ($branches as $branch) @php $branchTotal = 0; $branchObfIds = []; foreach ($modelbookingdata as $fuelDataPerModel) { foreach ($fuelDataPerModel as $branchSet) { if (!empty($branchSet[$branch->id])) { $branchTotal += $branchSet[$branch->id]['total'] ?? 0; $branchObfIds = array_merge($branchObfIds, $branchSet[$branch->id]['obf_ids'] ?? []); } } } $grandTotal += $branchTotal; $grandObfIds = array_merge($grandObfIds, $branchObfIds); @endphp@if ($branchTotal > 0 && count($branchObfIds)) {{ $branchTotal }} @else {{ $branchTotal }} @endif | @endforeach@if ($grandTotal > 0 && count($grandObfIds)) {{ $grandTotal }} @else {{ $grandTotal }} @endif |
| Amount Wise | @foreach ($branches as $branch) @php $branch_full = $branch->name ?? ''; $b_name = ''; if (str_contains($branch_full, 'Rajkot')) { $b_name = 'Rajkot'; } elseif (str_contains($branch_full, 'Rjt_1s')) { $b_name = 'Rajkot-1s'; } elseif (str_contains($branch_full, 'Jamnagar')) { $b_name = 'Jamnagar'; } elseif (str_contains($branch_full, 'Junagadh')) { $b_name = 'Junagadh'; } elseif (str_contains($branch_full, 'Morbi')) { $b_name = 'Morbi'; } elseif (str_contains($branch_full, '_M')) { $b_name = 'Mehsana'; } elseif (str_contains($branch_full, '_K')) { $b_name = 'Kadi'; } else { $b_name = $branch_full; } @endphp{{ $b_name }} | @endforeachTotal |
|---|---|---|
| {{ $modelName }} | @foreach ($branches as $branch) @php $branchTotal = 0; foreach ($fuelTypesData as $fuelData) { $branchTotal += $fuelData[$branch->id]['total'] ?? 0; } $modelTotal += $branchTotal; $branchObfIds = collect($fuelTypesData) ->pluck("{$branch->id}.obf_ids") ->flatten() ->filter() ->all(); @endphp@if ($branchTotal > 0) {{ number_format(floor($branchTotal / 1000)) }} @else {{ number_format(floor($branchTotal / 1000)) }} @endif | @endforeach@php $modelObfIds = collect($fuelTypesData) ->flatMap(fn($fuelData) => collect($fuelData)->pluck('obf_ids')) ->flatten() ->filter() ->all(); @endphp @if ($modelTotal > 0) {{ number_format(floor($modelTotal / 1000)) }} @else {{ number_format(floor($modelTotal / 1000)) }} @endif |
| {{ $fuelTypeName }} | @foreach ($branches as $branch) @php $total = $branchData[$branch->id]['total'] ?? 0; $obf_ids = $branchData[$branch->id]['obf_ids'] ?? []; $rowTotal += $total; @endphp@if ($total > 0) {{ number_format(floor($total / 1000)) }} @else {{ number_format(floor($total / 1000)) }} @endif | @endforeach@php $rowObfIds = collect($branchData)->pluck('obf_ids')->flatten()->filter()->all(); @endphp @if ($rowTotal > 0) {{ number_format(floor($rowTotal / 1000)) }} @else {{ number_format(floor($rowTotal / 1000)) }} @endif |
| Total Stock | @php $grandTotal = 0; $grandObfIds = []; @endphp @foreach ($branches as $branch) @php $branchTotal = 0; $branchObfIds = []; foreach ($modelFuelbookingdata as $fuelDataPerModel) { foreach ($fuelDataPerModel as $branchSet) { if (!empty($branchSet[$branch->id])) { $branchTotal += $branchSet[$branch->id]['total'] ?? 0; $branchObfIds = array_merge( $branchObfIds, $branchSet[$branch->id]['obf_ids'] ?? [] ); } } } $grandTotal += $branchTotal; $grandObfIds = array_merge($grandObfIds, $branchObfIds); @endphp@if ($branchTotal > 0) {{ number_format(floor($branchTotal / 1000)) }} @else {{ number_format(floor($branchTotal / 1000)) }} @endif | @endforeach@php $grandObfIds = array_unique($grandObfIds); @endphp @if (count($grandObfIds) > 0) {{ number_format(floor($grandTotal / 1000)) }} @else {{ number_format(floor($grandTotal / 1000)) }} @endif |