@extends('layouts.app', ['pageSlug' => 'tstats', 'page' => 'Statistics', 'section' => 'transactions']) @section('content')
| Period | Transactions | Income | Expenses | Payments | Cash Balance | Total balance | @foreach ($transactionsperiods as $period => $data) |
|---|---|---|---|---|---|---|---|
| {{ $period }} | {{ $data->count() }} | {{ $data->where('type', 'income')->sum('amount') }} | {{ $data->where('type', 'expense')->sum('amount') }} | {{ $data->where('type', 'payment')->sum('amount') }} | {{ $data->where('payment_method_id', optional($methods->where('name', 'Cash')->first())->id)->sum('amount') }} | {{ $data->sum('amount') }} |
| Client | Purchases | Transactions | Balance | @foreach($clients as $client) |
|---|---|---|---|---|
| {{ $client->name }} {{ $client->document_type }}-{{ $client->document_id }} |
{{ $client->sales->count() }} | {{ $client->transactions->sum('amount') }} | @if ($client->balance > 0) {{ $client->balance }} @elseif ($client->balance < 0.00) {{ $client->balance }} @else {{ $client->balance }} @endif |
| Method | Transactions {{ $date->year }} | Balance {{ $date->year }} | @foreach($methods as $method) |
|---|---|---|---|
| {{ $method->name }} | {{ $transactionsperiods['Year']->where('payment_method_id', $method->id)->count() }} | {{ $transactionsperiods['Year']->where('payment_method_id', $method->id)->sum('amount') }} |
| Period | Sales | Clients | Total Stock | Average C / V | Billed Amount | To Finalize | @foreach ($salesperiods as $period => $data)
|---|---|---|---|---|---|---|
| {{ $period }} | {{ $data->count() }} | {{ $data->groupBy('client_id')->count() }} | {{ $data->where('finalized_at', '!=', null)->map(function ($sale) {return $sale->products->sum('qty');})->sum() }} | {{ $data->avg('total_amount') }} | {{ $data->where('finalized_at', '!=', null)->map(function ($sale) {return $sale->products->sum('total_amount');})->sum() }} | {{ $data->where('finalized_at', null)->count() }} |