@extends('pdf.layout') @section('content')

Reporte de Facturación

@foreach($invoices as $invoice) @php $paid = $invoice->payments->where('status', 'confirmado')->sum('amount'); $itemsTotal = $invoice->total; @endphp @endforeach
Factura Cliente Fecha Estado Total ($) Cobrado ($)
{{ $invoice->number }} {{ $invoice->serviceOrder->customer->name }} {{ $invoice->issue_date }} {{ $invoice->status == 'paid' ? 'PAGADA' : 'PENDIENTE' }} ${{ number_format($itemsTotal, 2) }}
Bs. {{ number_format($itemsTotal * $rate, 2) }}
${{ number_format($paid, 2) }}
Bs. {{ number_format($paid * $rate, 2) }}

Resumen de Caja

@php $totalInvoiced = $invoices->sum('total'); $totalPaid = $invoices->flatMap->payments->where('status', 'confirmado')->sum('amount'); @endphp
Total Facturado:
${{ number_format($totalInvoiced, 2) }}
Bs. {{ number_format($totalInvoiced * $rate, 2) }}
Total Cobrado:
${{ number_format($totalPaid, 2) }}
Bs. {{ number_format($totalPaid * $rate, 2) }}
Saldo Pendiente:
${{ number_format($totalInvoiced - $totalPaid, 2) }}
Bs. {{ number_format(($totalInvoiced - $totalPaid) * $rate, 2) }}
* Conversión a Bolívares según tasa BCV de Bs. {{ number_format($rate, 2) }}
@endsection