@extends('layouts.enterprise') @section('title', 'Dashboard Accountant') @section('content')

Facturas pendientes de aprobacion

Facturas en estado recibido, validando o en hold.

Filtros
Limpiar
@if(session('ok'))
{{ session('ok') }}
@endif @if($errors->any())
    @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif @forelse($pendingInvoices as $invoice) @php $invoicePdf = $invoice->files->firstWhere('type', \App\Models\InvoiceFile::TYPE_INVOICE_PDF); $invoiceXml = $invoice->files->firstWhere('type', \App\Models\InvoiceFile::TYPE_INVOICE_XML); $purchaseOrder = $invoice->files->firstWhere('type', \App\Models\InvoiceFile::TYPE_PURCHASE_ORDER); $paymentProof = $invoice->files->firstWhere('type', \App\Models\InvoiceFile::TYPE_PAYMENT_PROOF); $isRejected = $invoice->status === \App\Models\Invoice::STATUS_REJECTED; @endphp @empty @endforelse
ID Proveedor RC PROJECT NAME Estatus Fecha factura Fecha pago Total Comprobante Documentos Acciones
{{ $invoice->id }} {{ $invoice->company?->legal_name }} {{ $invoice->rc_number }}
{{ $invoice->pipefyRequest?->project_name ?: '-' }}
Proyecto: {{ $invoice->pipefyRequest?->title ?: ($invoice->jn_number ?: '-') }}
{{ $invoice->status }} {{ optional($invoice->invoice_date)->format('Y-m-d') }} {{ $isRejected ? '-' : optional($invoice->payment_date)->format('Y-m-d') }} {{ $invoice->total }} @if($isRejected) - @elseif($paymentProof) Ver comprobante @else Sin comprobante @endif @if($invoicePdf) Factura PDF @endif @if($invoiceXml) Factura XML @endif @if($purchaseOrder) OC PDF @endif @if(!$invoicePdf && !$invoiceXml && !$purchaseOrder) Sin archivos @endif
@csrf
@csrf
Cancelar Confirmar rechazo
No hay facturas pendientes.
Mostrando top 10.

Listado de facturas

Vista general similar a /admin/invoices.

Filtros
Limpiar
@forelse($allInvoices as $invoice) @php $proof = $invoice->files->first(); $isRejected = $invoice->status === \App\Models\Invoice::STATUS_REJECTED; $canManagePayment = in_array($invoice->status, [ \App\Models\Invoice::STATUS_APPROVED, \App\Models\Invoice::STATUS_SCHEDULED, \App\Models\Invoice::STATUS_PAID, ], true); $canUploadPaymentProof = $canManagePayment && !$proof; $stepOneLabel = 'Paso 1: Selecciona el comprobante'; $stepTwoLabel = 'Paso 2: Subir comprobante y marcar pagada'; @endphp @empty @endforelse
ID Proveedor RC Estatus Fecha pago Comprobante Acciones
{{ $invoice->id }} {{ $invoice->company?->legal_name }} {{ $invoice->rc_number }} {{ $invoice->status }} {{ $isRejected ? '-' : optional($invoice->payment_date)->format('Y-m-d') }} @if($isRejected) - @elseif($proof) Ver comprobante @else Sin comprobante @endif @if($isRejected) - @elseif($canManagePayment)
@if($canUploadPaymentProof)
@csrf
Ningún archivo seleccionado
@else Comprobante ya cargado @endif
@else Disponible al aprobar @endif
No hay facturas registradas.
Mostrando top 10.

Aprobación de complementos de pago

Revisión obligatoria de complementos para facturas PPD / Forma 99 ya pagadas.

@forelse($complementInvoices as $invoice) @php $complementXmlFile = $invoice->files->firstWhere('type', \App\Models\InvoiceFile::TYPE_PAYMENT_COMPLEMENT_XML); $complementPdfFile = $invoice->files->firstWhere('type', \App\Models\InvoiceFile::TYPE_PAYMENT_COMPLEMENT_PDF); $legacyComplementFile = $invoice->files->firstWhere('type', \App\Models\InvoiceFile::TYPE_PAYMENT_COMPLEMENT); $complementStatus = strtolower((string) ($invoice->payment_complement_status ?? 'pending')); @endphp @empty @endforelse
ID Proveedor RC Cargado Complemento Estatus complemento Nota Acciones
{{ $invoice->id }} {{ $invoice->company?->legal_name }} {{ $invoice->rc_number }} {{ optional($invoice->payment_complement_uploaded_at)->format('Y-m-d H:i') ?: '-' }} @if($complementXmlFile) Ver XML @endif @if($complementPdfFile) Ver PDF @endif @if(!$complementXmlFile && !$complementPdfFile && $legacyComplementFile) Ver complemento @endif @if(!$complementXmlFile && !$complementPdfFile && !$legacyComplementFile) Sin archivo @endif @if($complementStatus === 'approved') Aprobado @elseif($complementStatus === 'rejected') Rechazado @else Pendiente @endif {{ $invoice->payment_complement_review_note ?: '-' }}
@csrf
@csrf
Cancelar Confirmar rechazo
No hay complementos pendientes de revisión.
Mostrando top 10.

Estatus por petición (Solicitud)

Seguimiento de avance por proveedores y por monto esperado.

@forelse($requests as $req) @php $summary = $requestSummaries[$req->id] ?? [ 'providers_total' => 0, 'expected_invoices' => 0, 'providers_with_invoice' => 0, 'providers_partial' => 0, 'providers_without_invoice' => 0, 'completion_percent' => 0, 'is_complete' => false, 'has_expected_amount' => false, 'amount_expected' => null, 'amount_invoiced' => 0, 'amount_pending' => null, 'amount_completion_percent' => 0, 'amount_completion_percent_for_bar' => 0, 'is_amount_complete' => false, 'pending_provider_names' => [], ]; $requestSubtotal = $req->subtotal_cost !== null ? (float) $req->subtotal_cost : (($summary['has_expected_amount'] ?? false) && isset($summary['amount_expected']) ? round(((float) $summary['amount_expected']) / 1.16, 2) : null); $requestSubtotalIva = $requestSubtotal !== null ? round($requestSubtotal * 1.16, 2) : null; @endphp
first) open @endif>
{{ $req->project_name ?: 'Sin PROJECT NAME' }}
Job Number: {{ $req->title ?: '-' }}
RC(s): {{ $req->rc_list ?: '-' }}
Ejecutivo: {{ $req->executive_display ?: '-' }}
Cliente: {{ $req->client_display ?: '-' }}
Prov: {{ $summary['providers_total'] }} Esperadas: {{ $summary['expected_invoices'] }} Con factura: {{ $summary['providers_with_invoice'] }} Parciales: {{ $summary['providers_partial'] ?? 0 }} Pendientes: {{ $summary['providers_without_invoice'] }} Subtotal solicitud: @if($requestSubtotal !== null) ${{ number_format($requestSubtotal, 2) }} @else Sin subtotal @endif @if($requestSubtotalIva !== null) Subtotal + IVA: ${{ number_format($requestSubtotalIva, 2) }} @endif Proveedores: {{ $summary['completion_percent'] }}% Monto: {{ $summary['amount_completion_percent'] }}%
@if($requestSubtotal !== null)
Subtotal solicitud: ${{ number_format($requestSubtotal, 2) }} Subtotal + IVA (16%): ${{ number_format($requestSubtotalIva, 2) }}
@endif
Estado de solicitud: {{ $summary['completion_percent'] }}% ({{ $summary['providers_with_invoice'] }}/{{ $summary['expected_invoices'] }})
Avance por monto: @if($summary['has_expected_amount'] && $summary['amount_expected'] !== null) {{ $summary['amount_completion_percent'] }}% (${{ number_format($summary['amount_invoiced'], 2) }}/${{ number_format($summary['amount_expected'], 2) }}) @else Sin monto esperado @endif
@if($summary['has_expected_amount'] && $summary['amount_pending'] !== null)
Saldo pendiente: ${{ number_format($summary['amount_pending'], 2) }}
@endif
PENDIENTES: {{ count($summary['pending_provider_names']) ? implode(', ', $summary['pending_provider_names']) : 'Todos enviaron.' }}
@forelse($req->providers as $provider) @php $totals = $providerTotals[$provider->id] ?? null; $invoicePdf = $providerInvoicePdfLinks[$provider->id] ?? null; $invoicesCount = (int) ($totals?->invoices_count ?? 0); $invoiced = $totals?->total_invoiced ? (float) $totals->total_invoiced : 0.0; $providerItems = $provider->items ->sortBy('product_index') ->values(); $expectedBase = $provider->total_cost; if ($expectedBase === null) { $itemCostTotal = (float) $providerItems->sum(function ($it) { return (float) ($it->total_cost ?? 0); }); if ($itemCostTotal > 0) { $expectedBase = $itemCostTotal; } } if ($expectedBase === null) { $expectedBase = $provider->total_sale; } if ($expectedBase === null) { $itemSaleTotal = (float) $providerItems->sum(function ($it) { return (float) ($it->total_sale ?? 0); }); if ($itemSaleTotal > 0) { $expectedBase = $itemSaleTotal; } } $expected = $expectedBase !== null ? ((float) $expectedBase * 1.16) : null; $pending = $expected !== null ? max($expected - $invoiced, 0) : null; $providerItemsTotal = (int) ($providerItemsTotals[$provider->id] ?? 0); $providerMatchedCount = (int) ($providerMatchedItems[$provider->id] ?? 0); $pendingApprovalCount = (int) ($providerPendingApprovalCounts[$provider->id] ?? 0); $hasLegacyApprovedInvoices = $invoicesCount > 0 && $providerMatchedCount === 0 && $providerItemsTotal > 0; if ($providerItemsTotal > 0 && !$hasLegacyApprovedInvoices) { $providerStatus = $providerMatchedCount <= 0 ? 'none' : ($providerMatchedCount < $providerItemsTotal ? 'partial' : 'complete'); } else { $providerStatus = $invoicesCount > 0 ? 'complete' : 'none'; } @endphp @empty @endforelse
Proveedor Facturas Monto esperado Monto sin IVA Monto facturado Saldo pendiente Productos Estatus
{{ $provider->provider_name }} {{ $invoicesCount }} {{ $expected !== null ? number_format($expected, 2) : '-' }} {{ $expectedBase !== null ? number_format((float) $expectedBase, 2) : '-' }} {{ number_format($invoiced, 2) }} {{ $pending !== null ? number_format($pending, 2) : '-' }} @if($providerItems->isEmpty()) Sin productos @else
Ver productos ({{ $providerItems->count() }}) @foreach($providerItems as $item) @php $displayCode = $item->concept_code ?: \App\Support\ConceptCodeExtractor::extract( (string) ($item->description ?? ''), (string) ($item->product_name ?? '') ); @endphp @endforeach
# COD Producto Cant.
{{ $item->product_index ?: '-' }} {{ $displayCode ?: '-' }} {{ $item->description ?: ($item->product_name ?: '-') }} {{ $item->quantity ?: '-' }}
@endif
@if($providerStatus === 'none') @if($pendingApprovalCount > 0) {{ $pendingApprovalCount === 1 ? 'Factura pendiente por aprobar' : 'Facturas pendientes por aprobar' }} ({{ $pendingApprovalCount }}) @else Sin factura @endif @elseif($providerStatus === 'partial') Parcial ({{ $providerMatchedCount }}/{{ max(1, $providerItemsTotal) }}) @if($invoicePdf) Ver factura @endif @elseif($invoicePdf) Con factura @else Con factura @endif
Sin proveedores asociados.
@empty
No hay solicitudes para mostrar.
@endforelse

Aprobaciones pendientes de proveedores

Seguimiento de estatus para alta de proveedores.

Filtros
Limpiar
@forelse($pendingProviders as $company) @empty @endforelse
ID Empresa RFC Email Estatus Accion
{{ $company->id }} {{ $company->legal_name }} {{ $company->rfc }} {{ $company->user?->email }} {{ $company->provider_status ?? 'pending' }} Revisar
No hay proveedores pendientes.
Mostrando top 10.
@endsection @push('scripts') @if($errors->any() && old('status') === \App\Models\Invoice::STATUS_REJECTED && old('reject_invoice_id')) @endif @if($errors->any() && old('payment_complement_status') === 'rejected' && old('reject_complement_invoice_id')) @endif @endpush @push('styles') @endpush