@extends('layouts.enterprise') @section('title', 'Ver pagos') @section('content')

Ver pagos

Consulta de egresos con el módulo Pagos de la semana.

Pagos de la semana

Rango: {{ $filters['date_from'] }} a {{ $filters['date_to'] }}

@if(session('ok'))
{{ session('ok') }}
@endif @if($errors->any())
@endif @php $hasActiveFilters = (($filters['q'] ?? '') !== '') || (($filters['status'] ?? 'approved_scheduled') !== 'approved_scheduled') || !empty($filters['date_from'] ?? null) || !empty($filters['date_to'] ?? null); @endphp
Filtros @if($hasActiveFilters) Activos @endif
Limpiar
@forelse($payments as $invoice) @php $invoicePdf = $invoice->files->firstWhere('type', \App\Models\InvoiceFile::TYPE_INVOICE_PDF); $proof = $invoice->files->firstWhere('type', \App\Models\InvoiceFile::TYPE_PAYMENT_PROOF); $isRejected = $invoice->status === \App\Models\Invoice::STATUS_REJECTED; $providerFinancialKey = ($invoice->pipefy_request_id && $invoice->pipefy_request_provider_id) ? ((int) $invoice->pipefy_request_id.'|'.(int) $invoice->pipefy_request_provider_id) : null; $providerAmounts = $providerFinancialKey ? ($providerFinancials[$providerFinancialKey] ?? null) : null; $coveredAmount = (float) ($providerAmounts['invoiced_total'] ?? 0); $pendingAmount = (float) ($providerAmounts['pending_total_sale'] ?? 0); $paidAmount = $hasInvoicePayments ? (float) ($invoice->paid_total ?? 0) : ($invoice->status === \App\Models\Invoice::STATUS_PAID ? (float) $invoice->total : 0.0); if ($hasInvoicePayments && $paidAmount <= 0.009 && $invoice->status === \App\Models\Invoice::STATUS_PAID) { $paidAmount = (float) $invoice->total; } $pendingPayment = max(((float) $invoice->total) - $paidAmount, 0); $canRegisterPayment = in_array($invoice->status, [ \App\Models\Invoice::STATUS_APPROVED, \App\Models\Invoice::STATUS_SCHEDULED, \App\Models\Invoice::STATUS_PAID, ], true) && $pendingPayment > 0.009; @endphp @empty @endforelse
ID Proveedor RC PROJECT NAME Estatus Fecha pago Factura Comprobante Total Monto facturado Por facturar Pagado Saldo pago Acciones
{{ $invoice->id }} {{ $invoice->company?->legal_name }} {{ $invoice->rc_number }}
{{ $invoice->pipefyRequest?->project_name ?: '-' }}
{{ $invoice->pipefyRequest?->title ?: '-' }}
{{ $invoice->status }} {{ optional($invoice->payment_date)->format('Y-m-d') }} @if($invoicePdf) Ver factura @else Sin factura @endif @if($proof) Ver comprobante @else Sin comprobante @endif ${{ number_format((float) $invoice->total, 2) }} @if($providerAmounts) ${{ number_format($coveredAmount, 2) }} @else - @endif @if($providerAmounts) ${{ number_format($pendingAmount, 2) }} @else - @endif ${{ number_format($paidAmount, 2) }} ${{ number_format($pendingPayment, 2) }} @if(!$hasInvoicePayments) Ejecuta migraciones @elseif($canRegisterPayment)
@csrf
Saldo pendiente: ${{ number_format($pendingPayment, 2) }}

Marcar como anticipo de pago

Arrastra y suelta tu comprobante aquí
PDF/JPG/PNG · máx. 10 MB
Seleccionar archivo Ningún archivo seleccionado
Cancelar Guardar pago
@else Liquidada @endif @if($hasInvoicePayments && $invoice->payments->isNotEmpty())
Últimos pagos: @foreach($invoice->payments as $movement)
${{ number_format((float) $movement->amount, 2) }} · {{ optional($movement->paid_at)->format('Y-m-d') ?: '-' }} @if($movement->is_advance) · Anticipo @endif
@endforeach
@endif
No hay pagos para mostrar.
Total con filtros: ${{ number_format((float) $totalByFilter, 2) }} Total búsqueda actual: ${{ number_format((float) $totalCurrent, 2) }}
{{ $payments->onEachSide(1)->links('vendor.pagination.enterprise') }}
@endsection @push('scripts') @endpush @push('styles') @endpush