@php $bill = $record->bill; $transactions = $bill?->bodies ?? collect(); $client = $record->client; $clientInvoices = \App\Models\InvoicesHeaderModel::with('bill')->where('client_id', $client->id_client)->get(); $total = $clientInvoices->sum('total_rd'); $pagado = $clientInvoices->sum(fn($invoice) => $invoice->bill?->paid_rd ?? 0); $deuda = $total - $pagado; @endphp
| Factura | Total RD$ | Total USD$ | Pagado RD$ | Pagado USD$ | Pendiente de pago RD$ | Pendiente de pago USD$ |
|---|---|---|---|---|---|---|
| {{ $record->invoice_number }} | {{ number_format($record->total_rd, 2) }} | {{ number_format($record->total_usd, 2) }} | {{ number_format($bill?->paid_rd ?? 0, 2) }} | {{ number_format($bill?->paid_usd ?? 0, 2) }} | {{ number_format($bill?->bill_rd ?? 0, 2) }} | {{ number_format($bill?->bill_usd ?? 0, 2) }} |
— Sin transacciones —
@else| Pago RD$ | Pago USD$ | Tasa | Meotodo de pago | Fecha de pago | ||
|---|---|---|---|---|---|---|
| {{ number_format($transaction->paid_rd, 2) }} | {{ number_format($transaction->paid_usd, 2) }} | {{ $transaction->change_rate }} | @switch($transaction->status) @case('paid_cash')Efectivo | @break @case('paid_transfer')Transferencia | @break @default@endswitch | {{ \Carbon\Carbon::parse($transaction->created_at)->format('d-m-Y h:i') }} |