{#- SPDX-License-Identifier: Apache-2.0 SPDX-FileCopyrightText: 2025 - 2026 BMO Soluciones, S.A. -#} {% extends 'base.html' %} {% block content %}

{{ _('Detalle de Préstamo/Adelanto') }}

{{ _('Volver') }}
{{ _('Información General') }}
{{ _('Estado:') }}
{% if prestamo.estado == 'draft' %} {{ _('Borrador') }} {% elif prestamo.estado == 'pending' %} {{ _('Pendiente') }} {% elif prestamo.estado == 'approved' %} {{ _('Aprobado') }} {% elif prestamo.estado == 'applied' %} {{ _('Aplicado') }} {% elif prestamo.estado == 'paid' %} {{ _('Pagado') }} {% elif prestamo.estado == 'rejected' %} {{ _('Rechazado') }} {% elif prestamo.estado == 'cancelled' %} {{ _('Cancelado') }} {% endif %}
{{ _('Tipo:') }}
{% if prestamo.tipo == 'advance' %} {{ _('Adelanto de Salario') }} {% else %} {{ _('Préstamo') }} {% endif %}
{{ _('Empleado:') }}
{{ prestamo.empleado.primer_nombre }} {{ prestamo.empleado.primer_apellido }}
{{ prestamo.empleado.codigo_empleado }}
{{ _('Fecha de Solicitud:') }}
{{ prestamo.fecha_solicitud.strftime('%d/%m/%Y') }}
{% if prestamo.fecha_aprobacion %}
{{ _('Fecha de Aprobación:') }}
{{ prestamo.fecha_aprobacion.strftime('%d/%m/%Y') }}
{% endif %} {% if prestamo.fecha_desembolso %}
{{ _('Fecha de Desembolso:') }}
{{ prestamo.fecha_desembolso.strftime('%d/%m/%Y') }}
{% endif %} {% if prestamo.motivo %}
{{ _('Motivo:') }}
{{ prestamo.motivo }}
{% endif %}
{{ _('Información Financiera') }}
{{ _('Monto Solicitado:') }}
{% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(prestamo.monto_solicitado) }}
{% if prestamo.monto_aprobado %}
{{ _('Monto Aprobado:') }}
{% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(prestamo.monto_aprobado) }}
{% endif %}
{{ _('Saldo Pendiente:') }}
{% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(prestamo.saldo_pendiente) }}
{{ _('Número de Cuotas:') }}
{{ prestamo.cuotas_pactadas }}
{{ _('Monto por Cuota:') }}
{% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(prestamo.monto_por_cuota or 0) }}
{% if prestamo.tasa_interes and prestamo.tasa_interes > 0 %}
{{ _('Tasa de Interés:') }}
{{ "{:.4f}".format(prestamo.tasa_interes) }}%
{{ _('Tipo de Interés:') }}
{{ prestamo.tipo_interes|title }}
{{ _('Método de Amortización:') }}
{% if prestamo.metodo_amortizacion == 'french' %} {{ _('Francés - Cuota Constante') }} {% elif prestamo.metodo_amortizacion == 'german' %} {{ _('Alemán - Amortización Constante') }} {% else %} {{ prestamo.metodo_amortizacion|title }} {% endif %}
{{ _('Interés Acumulado:') }}
{% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(prestamo.interes_acumulado or 0) }}
{% endif %}
{% if prestamo.estado == 'draft' %} {{ _('Editar') }}
{% endif %} {% if prestamo.estado in ['pending', 'draft'] %} {{ _('Aprobar/Rechazar') }} {% endif %} {% if prestamo.estado in ['approved', 'applied'] and prestamo.saldo_pendiente > 0 %} {{ _('Registrar Pago Extraordinario') }} {{ _('Condonar Deuda') }} {% endif %} {% if prestamo.estado not in ['paid', 'cancelled'] %}
{% endif %} {% if tabla_pago %} {{ _('Exportar Excel') }} {{ _('Exportar PDF') }} {% endif %}
{% if tabla_pago %}
{{ _('Tabla de Pagos') }}
{% for item in tabla_pago %} {% endfor %}
# {{ _('Fecha Estimada') }} {{ _('Cuota') }} {{ _('Interés') }} {{ _('Capital') }} {{ _('Saldo') }}
{{ item.numero }} {% if item.fecha_estimada %} {{ item.fecha_estimada.strftime('%d/%m/%Y') }} {% else %} - {% endif %} {% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(item.cuota) }} {% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(item.interes) }} {% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(item.capital) }} {% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(item.saldo) }}
{% endif %} {% if prestamo.tasa_interes and prestamo.tasa_interes > 0 %}
{{ _('Diario de Intereses') }}
{% if intereses %}
{% for interes in intereses %} {% endfor %}
{{ _('Período') }} {{ _('Días') }} {{ _('Saldo Base') }} {{ _('Tasa (%)') }} {{ _('Interés Calculado') }} {{ _('Saldo Posterior') }} {{ _('Nómina') }}
{{ interes.fecha_desde.strftime('%d/%m/%Y') }} - {{ interes.fecha_hasta.strftime('%d/%m/%Y') }} {{ interes.dias_transcurridos }} {% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(interes.saldo_base) }} {{ "{:.4f}".format(interes.tasa_aplicada) }} {% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(interes.interes_calculado) }} {% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(interes.saldo_posterior) }} {% if interes.nomina_id %} {{ _('Nómina') }} {% else %} - {% endif %}
{% else %}

{{ _('No se han calculado intereses aún.') }}

{% endif %}
{% endif %}
{{ _('Historial de Pagos') }}
{% if abonos %}
{% for abono in abonos %} {% endfor %}
{{ _('Fecha') }} {{ _('Tipo') }} {{ _('Monto Abonado') }} {{ _('Saldo Anterior') }} {{ _('Saldo Posterior') }} {{ _('Comprobante') }} {{ _('Observaciones') }}
{{ abono.fecha_abono.strftime('%d/%m/%Y') }} {% if abono.tipo_abono == 'manual' %} {{ _('Manual') }} {% else %} {{ _('Nómina') }} {% endif %} {% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(abono.monto_abonado) }} {% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(abono.saldo_anterior) }} {% if prestamo.moneda %} {{ prestamo.moneda.simbolo or prestamo.moneda.codigo }} {% endif %} {{ "{:,.2f}".format(abono.saldo_posterior) }} {% if abono.tipo_comprobante %} {{ abono.tipo_comprobante|replace('_', ' ')|title }}:
{{ abono.numero_comprobante }} {% if abono.referencia_bancaria %}
Ref: {{ abono.referencia_bancaria }} {% endif %} {% else %} - {% endif %}
{{ abono.observaciones or '-' }}
{% else %}

{{ _('No hay pagos registrados.') }}

{% endif %}
{% endblock %}