{% extends 'base.html.twig' %} {% block title %}{{ 'documento.title'|trans }} CxP{% endblock %} {% block page_title %}{{ 'documento.title'|trans }}{% endblock %} {% block breadcrumb %} {% endblock %} {% block content_header %} {% endblock %} {% block content %} {% set documentFilterQuery = app.request.query.all|filter((value, key) => key != 'page') %} {% set documentFilterChips = [] %} {% if filters.selected.proveedor %} {% set documentProviderLabel = filters.selected.proveedor %} {% for proveedor in filters.proveedores %} {% if filters.selected.proveedor == proveedor.id %} {% set documentProviderLabel = proveedor.nombre %} {% endif %} {% endfor %} {% set documentFilterChips = documentFilterChips|merge([{ label: 'filter.supplier'|trans, value: documentProviderLabel, url: path('documento_index', documentFilterQuery|filter((value, key) => key != 'proveedor_id')|merge({page: 1})) }]) %} {% endif %} {% if filters.selected.tipo %} {% set documentTypeLabel = filters.selected.tipo %} {% for tipo in filters.tipos %} {% if filters.selected.tipo == tipo.id %} {% set documentTypeLabel = tipo.codigo ~ ' - ' ~ tipo.nombre %} {% endif %} {% endfor %} {% set documentFilterChips = documentFilterChips|merge([{ label: 'filter.type'|trans, value: documentTypeLabel, url: path('documento_index', documentFilterQuery|filter((value, key) => key != 'tipo_documento_id')|merge({page: 1})) }]) %} {% endif %} {% if filters.selected.estado %} {% set documentStatusLabel = filters.selected.estado %} {% for est in filters.estatus %} {% if filters.selected.estado == est.value %} {% set documentStatusKey = {'': 'filter.all', '1': 'status.pending', '2': 'status.partial', '3': 'status.paid', '4': 'status.pending_withholding', pendiente: 'documento.saldo_pendiente'}[est.value]|default(null) %} {% set documentStatusLabel = documentStatusKey ? documentStatusKey|trans : est.label %} {% endif %} {% endfor %} {% set documentFilterChips = documentFilterChips|merge([{ label: 'filter.status'|trans, value: documentStatusLabel, url: path('documento_index', documentFilterQuery|filter((value, key) => key != 'estado')|merge({page: 1})) }]) %} {% endif %} {% if siteScope.modo == 'sitio' %} {% set documentSiteLabel = siteScope.selectedSitioId %} {% for sitio in filters.sitios %} {% if siteScope.selectedSitioId == sitio.id %} {% set documentSiteLabel = sitio.nombre %} {% endif %} {% endfor %} {% set documentFilterChips = documentFilterChips|merge([{ label: 'filter.site'|trans, value: documentSiteLabel, url: path('documento_index', documentFilterQuery|filter((value, key) => key not in ['sitio_id', 'sitio_scope'])|merge({page: 1})) }]) %} {% endif %} {% if filters.selected.vencimiento_desde %} {% set documentFilterChips = documentFilterChips|merge([{ label: 'filter.from'|trans, value: filters.selected.vencimiento_desde, url: path('documento_index', documentFilterQuery|filter((value, key) => key != 'vencimiento_desde')|merge({page: 1})) }]) %} {% endif %} {% if filters.selected.vencimiento_hasta %} {% set documentFilterChips = documentFilterChips|merge([{ label: 'filter.to'|trans, value: filters.selected.vencimiento_hasta, url: path('documento_index', documentFilterQuery|filter((value, key) => key != 'vencimiento_hasta')|merge({page: 1})) }]) %} {% endif %} {% if filters.selected.q %} {% set documentFilterChips = documentFilterChips|merge([{ label: 'filter.search'|trans, value: filters.selected.q, url: path('documento_index', documentFilterQuery|filter((value, key) => key != 'q')|merge({page: 1})) }]) %} {% endif %} {% if filters.selected.retencion %} {% set documentFilterChips = documentFilterChips|merge([{ label: 'documento.retenciones'|trans, value: 'button.yes'|trans, url: path('documento_index', documentFilterQuery|filter((value, key) => key != 'retencion')|merge({page: 1})) }]) %} {% endif %} {% set hasActiveFilters = documentFilterChips|length > 0 %} {% set documentClearQuery = documentFilterQuery |filter((value, key) => key not in ['proveedor_id', 'tipo_documento_id', 'estado', 'sitio_id', 'sitio_scope', 'vencimiento_desde', 'vencimiento_hasta', 'q', 'retencion']) |merge({page: 1}) %} {% if erpSyncJob %} {% set payload = erpSyncJob.payload ?? {} %}
Migracion ERP CxP #{{ erpSyncJob.id }}
Estado: {{ erpSyncJob.estado }} · {{ erpSyncJob.progreso }}% {% if payload.processed is defined and payload.total is defined and payload.total %} · {{ payload.processed }} de {{ payload.total }} documentos revisados {% endif %}
{% if is_granted('ROLE_ADMIN') %} Ver jobs {% endif %}
{% endif %} {# Filters #}

{{ 'filter.title'|trans }}

{% include 'components/_filter_chips.html.twig' with { chips: documentFilterChips, clear_url: path('documento_index', documentClearQuery) } only %}
{# KPI Cards #}

{{ filters.selected.proveedor or filters.selected.tipo or filters.selected.estado or filters.selected.q or filters.selected.retencion or siteScope.modo == 'sitio' ? 'Resumen segun filtros aplicados' : 'Resumen de todos los sitios autorizados' }}

Datos actualizados
Saldo Abierto
{{ resumen.abiertos }}
Por Vencer (15 dias)
{{ resumen.por_vencer }}
Pagados del Mes
{{ resumen.pagados_mes }}
Retenciones Pendientes
{{ resumen.retenciones }}
{# Table #}

Listado de documentos

Mostrando {{ pagination.start }} a {{ pagination.end }} de {{ pagination.total }} registros

{% for key, value in app.request.query.all %} {% if key not in ['limit', 'page'] and value is not iterable %} {% endif %} {% endfor %} por pagina
{% for doc in documents %} {% else %} {% endfor %}
Listado de documentos
{{ 'documento.proveedor'|trans }} {{ 'documento.serie'|trans }} / {{ 'documento.numero'|trans }} {{ 'documento.fecha_vencimiento'|trans }} {{ 'documento.total_neto'|trans }} {{ 'documento.saldo_pendiente'|trans }} {{ 'table_columns.status'|trans }} {{ 'table.actions'|trans }}
{{ doc.proveedor }} {{ doc.serie_numero }} {% if doc.tiene_relacionado %} Relacionado {% endif %} {{ doc.vencimiento }}
{{ doc.total }}
{% if doc.total_base and doc.total_base != doc.total %}
Base: {{ doc.total_base }}
{% endif %}
{{ doc.saldo }}
{% if doc.saldo_base and doc.saldo_base != doc.saldo %}
Base: {{ doc.saldo_base }}
{% endif %}
{% if doc.estado == 'Pagado' %} {{ 'status.paid'|trans }} {% elseif doc.estado == 'Pendiente retencion' %} {{ 'status.pending_withholding'|trans }} {% elseif doc.estado == 'Pendiente' %} {{ 'status.pending'|trans }} {% else %} {{ doc.estado }} {% endif %}
{% if is_granted('ROLE_OPERADOR') and doc.saldo_val > 0 %} {{ 'dashboard.register_payment'|trans }} {% endif %} {{ 'button.view'|trans }}
{% if hasActiveFilters %}

{{ 'empty.no_results_title'|trans }}

{{ 'empty.no_results_copy'|trans }}

{% else %}

{{ 'empty.no_data_title'|trans }}

{{ 'empty.no_data_copy'|trans }}

{% endif %}
{% if pagination.pages > 1 %} {% set queryBase = app.request.query.all|merge({'limit': pagination.limit}) %}
{{ 'table.page_of'|trans({'%page%': pagination.page, '%pages%': pagination.pages}) }}
{% if pagination.page > 1 %} {{ 'table.previous'|trans }} {% else %} {{ 'table.previous'|trans }} {% endif %} {% if pagination.page < pagination.pages %} {{ 'table.next'|trans }} {% else %} {{ 'table.next'|trans }} {% endif %}
{% endif %}
{% endblock %}