@php $totalValor = 0; $totalFrete = 0; $totalDesconto = 0; $totalTotal = 0; $cont = 0; @endphp @foreach($orders as $order) @php $cont++; @endphp @php $valor = 0; @endphp @php $total = 0; @endphp @foreach($order->itens as $item) @php $valor += $item->quantity * $item->price; @endphp @endforeach @php $total = $valor + $order->freight - $order->discount; $totalValor += $valor; $totalFrete += $order->freight; $totalDesconto += $order->discount; $totalTotal += $total; @endphp @endforeach
# Cliente Pedido Data Valor (R$) Frete (R$) Desc. (R$) Total (R$)
{{ $cont }} {{ $order->client->client_name }} {{ \App\Helpers\HlpFormatrers::formatOrderNumber($order->id) }} {{ HlpDate::dateDbToBr($order->date) }} {{ number_format($valor, 2, ',', '.') }} {{ number_format($order->freight, 2, ',', '.') }} {{ number_format($order->discount, 2, ',', '.') }} {{ number_format($total, 2, ',', '.') }}
TOTAIS (R$): {{ number_format($totalValor, 2, ',', '.') }} {{ number_format($totalFrete, 2, ',', '.') }} {{ number_format($totalDesconto, 2, ',', '.') }} {{ number_format($totalTotal, 2, ',', '.') }}