@extends('layouts.dashboard.superadminapp') @section('title', 'Bill Report') @section('styles') @endsection @section('content') @if(session('success')) @endif @if(session('error')) @endif
Filter Options
@csrf
Reset
@php $totalInvoices = $invoices->count(); $totalAmount = $invoices->sum('total_amount'); $totalItems = $invoices->sum(fn($inv) => $inv->items->count()); $avgAmount = $totalInvoices > 0 ? round($totalAmount / $totalInvoices, 2) : 0; @endphp
{{ $totalInvoices }}
Total Invoices
{{ number_format($totalAmount, 2) }}
Total Amount
{{ $totalItems }}
Total Items
{{ number_format($avgAmount, 2) }}
Avg Invoice Amount
Invoice Details
@foreach($invoices as $inv) @if($inv->items->count()) @foreach($inv->items as $index => $item) @endforeach @else @endif @endforeach
Invoice No Invoice Date Company GST Phone Email Item Description HSN Qty Rate SGST CGST IGST Amount Total
{{ $inv->invoice_no }} {{ $inv->invoice_date ? \Carbon\Carbon::parse($inv->invoice_date)->format('d-m-Y') : '-' }} {{ $inv->company->company ?? '-' }} {{ $inv->gst ?? '-' }} {{ $inv->phone ?? '-' }} {{ $inv->email ?? '-' }} {{ $item->description ?? '-' }} {{ $item->hsn ?? '-' }} {{ $item->quantity ?? 0 }} {{ number_format($item->rate ?? 0, 2) }} {{ number_format($item->sgst ?? 0, 2) }} {{ number_format($item->cgst ?? 0, 2) }} {{ number_format($item->igst ?? 0, 2) }} {{ number_format($item->amount ?? 0, 2) }} {{ number_format($inv->total_amount ?? 0, 2) }}
{{ $inv->invoice_no }} {{ $inv->invoice_date ? \Carbon\Carbon::parse($inv->invoice_date)->format('d-m-Y') : '-' }} {{ $inv->company->company ?? '-' }} {{ $inv->gst ?? '-' }} {{ $inv->phone ?? '-' }} {{ $inv->email ?? '-' }} No items {{ number_format($inv->total_amount ?? 0, 2) }}
Top Companies by Invoice Amount
@php $companyTotals = $invoices->groupBy(fn($inv) => $inv->company->company ?? 'Unknown') ->map(fn($group) => [ 'count' => $group->count(), 'total' => $group->sum('total_amount') ]) ->sortByDesc('total') ->take(5); @endphp @forelse($companyTotals as $company => $data) @empty @endforelse
Company Invoices Total Amount
{{ $company }} {{ $data['count'] }} {{ number_format($data['total'], 2) }}
No data available
Recent Invoices
@forelse($invoices->sortByDesc('invoice_date')->take(5) as $inv) @empty @endforelse
Invoice No Date Amount
{{ $inv->invoice_no }} {{ $inv->invoice_date ? \Carbon\Carbon::parse($inv->invoice_date)->format('d-m-Y') : '-' }} {{ number_format($inv->total_amount ?? 0, 2) }}
No recent invoices
@endsection @section('scripts') @endsection