@extends('layouts.enterprise') @section('title', 'Ver movimientos') @section('content') @php $isAccountant = request()->routeIs('accountant.*'); $indexRoute = $isAccountant ? route('accountant.incomes.index') : route('admin.incomes.index'); $linkRouteName = $isAccountant ? 'accountant.incomes.link' : 'admin.incomes.link'; $notLinkableRouteName = $isAccountant ? 'accountant.incomes.not_linkable' : 'admin.incomes.not_linkable'; $clientRouteName = $isAccountant ? 'accountant.incomes.client' : 'admin.incomes.client'; $classificationRouteName = $isAccountant ? 'accountant.incomes.classification' : 'admin.incomes.classification'; $classificationOptions = $classificationOptions ?? \App\Models\FinancialMovement::classificationOptions(); $taxDetailOptions = $taxDetailOptions ?? \App\Models\FinancialMovement::taxDetailOptions(); $defaultClassification = 'all'; $hasActiveFilters = (($filters['q'] ?? '') !== '') || (($filters['type'] ?? 'all') !== 'all') || (($filters['linked'] ?? 'all') !== 'all') || (($filters['classification'] ?? $defaultClassification) !== $defaultClassification) || (($filters['request_id'] ?? null) !== null) || (($filters['client_id'] ?? null) !== null) || (($filters['request_q'] ?? '') !== '') || !empty($filters['date_from'] ?? null) || !empty($filters['date_to'] ?? null); $freeGeneratedInvoices = collect($generatedInvoiceCatalog ?? [])->filter(function ($entry) { return !($entry['is_linked'] ?? false); }); $freeGeneratedInvoicesByAmount = $freeGeneratedInvoices->groupBy(function ($entry) { return number_format((float) ($entry['total'] ?? 0), 2, '.', ''); }); $classificationBadgeClassMap = [ \App\Models\FinancialMovement::CLASSIFICATION_NORMAL => 'badge-normal', \App\Models\FinancialMovement::CLASSIFICATION_PROVIDER_REQUESTS => 'badge-provider', \App\Models\FinancialMovement::CLASSIFICATION_TAXES => 'badge-taxes', \App\Models\FinancialMovement::CLASSIFICATION_PAYROLL => 'badge-payroll', \App\Models\FinancialMovement::CLASSIFICATION_BANK => 'badge-bank', \App\Models\FinancialMovement::CLASSIFICATION_OTHERS => 'badge-other', \App\Models\FinancialMovement::CLASSIFICATION_NOT_LINKABLE => 'badge-not-linkable', ]; @endphp

Ver movimientos

Ingresos relacionados con prefacturas y egresos relacionados con solicitudes.

@if(session('ok'))
{{ session('ok') }}
@endif @if($errors->any())
@endif
Filtros @if($hasActiveFilters) Activos @endif
@if($hasClassificationColumn ?? false)
@endif
@if(($filters['request_id'] ?? null) !== null) @endif
Limpiar Resultados: {{ $movements->total() }} @if(($filters['request_id'] ?? null) !== null) Solicitud #{{ $filters['request_id'] }} @endif
Total ingresos: ${{ number_format($incomesTotal, 2) }} Total egresos: ${{ number_format($expensesTotal, 2) }}
@foreach(($pipefyRequestCatalog ?? []) as $option) @endforeach
@forelse($movements as $movement) @php $isIncome = $movement->movement_type === \App\Models\FinancialMovement::TYPE_INCOME; $linkedRequest = $movement->pipefyRequest; $linkedGeneratedInvoice = $movement->generatedInvoice; $isLockedLink = $movement->pipefy_request_id !== null || ($movement->generated_invoice_id ?? null) !== null; $hasExplicitClassification = is_string($movement->classification) ? trim($movement->classification) !== '' : $movement->classification !== null; $movementClassification = $movement->classification ?: \App\Models\FinancialMovement::CLASSIFICATION_NORMAL; $classificationLabel = $hasExplicitClassification ? \App\Models\FinancialMovement::classificationLabel($movementClassification) : 'Sin categoria'; $classificationBadgeClass = $hasExplicitClassification ? ($classificationBadgeClassMap[$movementClassification] ?? 'badge-normal') : 'badge-unset'; $requestDisplay = $linkedRequest ? (($linkedRequest->project_name ?: 'Sin PROJECT NAME').' | JN: '.($linkedRequest->title ?: '-').' | RC: '.($linkedRequest->rc_list ?: '-').' | ID:'.$linkedRequest->id) : ''; $amountKey = number_format((float) $movement->amount, 2, '.', ''); $matchingGeneratedInvoices = $isIncome ? ($freeGeneratedInvoicesByAmount->get($amountKey, collect())) : collect(); $isNotLinkable = (bool) ($movement->is_not_linkable ?? false); $taxDetail = $movement->tax_detail ?? null; $taxDetailLabel = $taxDetail ? \App\Models\FinancialMovement::taxDetailLabel($taxDetail) : null; @endphp @empty @endforelse
Fecha Tipo Concepto Depositos Retiros Cod. Trans. Cliente Proyecto / JN / RC Relacion y categoria
{{ $movement->movement_date?->format('Y-m-d') }} {{ $isIncome ? 'Ingreso' : 'Egreso' }} {{ $movement->concept }} {{ $isIncome ? '$'.number_format((float) $movement->amount, 2) : '-' }} {{ !$isIncome ? '$'.number_format((float) $movement->amount, 2) : '-' }} {{ $movement->transaction_code ?: '-' }} @if($movement->client)
{{ $movement->client->name }}
@if($movement->client->rfc) {{ $movement->client->rfc }} @endif @else - @endif
@if($linkedRequest)
{{ $linkedRequest->project_name ?: 'Sin PROJECT NAME' }}
JN: {{ $linkedRequest->title ?: '-' }}
RC: {{ $linkedRequest->rc_list ?: '-' }}
@elseif($isNotLinkable) No relacionable (ID 0) @else Sin relacionar @endif
Sin movimientos cargados todavia.
{{ $movements->onEachSide(1)->links('vendor.pagination.enterprise') }}
@endsection @push('scripts') @endpush @push('styles') @endpush