@extends('layouts.admin') @section('content')

Revenue Report

@csrf
@php $totalQuantity = 0; $totalPrice = 0; @endphp @foreach($orders as $order) @php $totalQuantity += $order->qty; $totalPrice += $order->base_total_price; @endphp @endforeach
# Date User Order Code Quantity Price
{{ $loop->iteration }} {{ $order->created_at }} {{ $order->customer_first_name }}
{{ $order->customer_email }}
{{ $order->code }} {{ $order->qty }} Rp. {{ number_format($order->base_total_price, 0, '.', '.') }}
Total Quantity {{ $totalQuantity }} Rp. {{ number_format($totalPrice, 0, '.', '.') }}

Total Revenue per Service

@php $totalRevenuePerService = []; foreach($orders as $order) { if(isset($order->service_name)) { if(!isset($totalRevenuePerService[$order->service_name])) { $totalRevenuePerService[$order->service_name] = 0; } $totalRevenuePerService[$order->service_name] += $order->grand_total; } } @endphp @foreach($totalRevenuePerService as $service => $total) @endforeach
Service Total Revenue
{{ $service }} Rp.{{ number_format($total, 0, '.', '.') }}
@endsection @push('script-alt') @endpush