@extends('template.template') @section('content') @php use App\Models\User; use App\Models\Venda; if (isset($_GET['id']) && $_GET['id']){ $user = User::find($_GET['id']); $vendas = Venda::where('user_id', $user->id)->orderBy('id', 'desc')->get(); $valorTotal = $vendas->sum(function ($venda) { return $venda->product_value + $venda->frame_value; }); $valorTotalComissoes = $vendas->sum('commission'); $valorTotalComissoesPagas = $vendas->sum('commission_paid'); } @endphp
| Total de vendas | {{'R$ ' . number_format(($valorTotal), 2, ',', '.') }} |
| Total de comissão | {{'R$ ' . number_format(($valorTotalComissoes), 2, ',', '.') }} |
| Recebido | {{'R$ ' . number_format(($valorTotalComissoesPagas), 2, ',', '.') }} |
| Pendente | {{'R$ ' . number_format(($valorTotalComissoes - $valorTotalComissoesPagas), 2, ',', '.') }} |