Files
KSNE/templates/admin_report_modulo.html

161 lines
11 KiB
HTML

{% extends "macros/base.html" %}
{% from "macros/modals.html" import report_filters %}
{% from "macros/ui.html" import back_link %}
{% block title %}Reporte: Finanzas - {{ modulo_name }}{% endblock %}
{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
<div>
{{ back_link(url_for('admin.admin_reportes_index'), 'Volver al Menú') }}
<h2>Resumen Financiero y Medios de Pago</h2>
</div>
<div class="text-end">
<div><strong class="text-primary fs-5">{{ modulo_name }}</strong></div>
<div class="text-muted"><small>Período: {{ mes_nombre }}</small></div>
</div>
</div>
<div class="row g-3 mb-4">
<div class="col-md-3">
<div class="card bg-success text-white shadow-sm h-100 border-0">
<div class="card-body">
<div class="text-uppercase small mb-1 opacity-75">Venta Total Mensual</div>
<h3 class="card-title mb-0">${{ "{:,.0f}".format(totales_mes.venta_total).replace(',', '.') }}</h3>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-info text-dark shadow-sm h-100 border-0">
<div class="card-body">
<div class="text-uppercase small mb-1 opacity-75">Comisiones Generadas</div>
<h3 class="card-title mb-0">${{ "{:,.0f}".format(totales_mes.comision).replace(',', '.') }}</h3>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-danger text-white shadow-sm h-100 border-0">
<div class="card-body">
<div class="text-uppercase small mb-1 opacity-75">Total Gastos</div>
<h3 class="card-title mb-0">-${{ "{:,.0f}".format(totales_mes.gastos).replace(',', '.') }}</h3>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card bg-primary text-white shadow-sm h-100 border-0">
<div class="card-body">
<div class="text-uppercase small mb-1 opacity-75">Venta Total Neto</div>
<h3 class="card-title mb-0">${{ "{:,.0f}".format(totales_mes.credito * 0.97620 + totales_mes.debito * 0.98453 + totales_mes.mp * 0.98691 + totales_mes.efectivo - totales_mes.gastos).replace(',', '.') }}</h3>
</div>
</div>
</div>
</div>
{{ report_filters(
url_for('admin.report_modulo_periodo', modulo_id=modulo_id),
workers_list,
worker_actual,
fecha_inicio,
fecha_fin
) }}
<div class="card shadow-sm border-0">
<div class="card-header border-0 bg-transparent d-flex justify-content-between align-items-center pb-0">
<span class="fw-bold text-muted text-uppercase"><i class="bi bi-calendar3 me-1"></i> Desglose Diario</span>
<a class="btn btn-success btn-sm shadow-sm" href="{{ url_for('admin.report_modulo_exportar_excel', modulo_id=modulo_id, fecha_inicio=fecha_inicio, fecha_fin=fecha_fin, worker_id=worker_actual) }}">
<i class="bi bi-file-earmark-excel-fill me-1"></i> Exportar Detalle Completo (.xlsx)
</a>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-bordered table-striped table-hover table-sm mb-0 text-nowrap" style="font-size: 0.85rem;">
<thead class="table-dark text-center align-middle">
<tr>
<th class="sticky-col py-2" rowspan="2">Día</th>
<th class="py-2 total-column text-success" rowspan="2">VENTA TOTAL</th>
<th class="py-2 text-info" rowspan="2">COMISIÓN</th>
<th class="py-2 text-danger" rowspan="2">GASTOS</th>
<th class="py-1 border-bottom-0" colspan="4">MEDIOS DE PAGO</th>
<th class="py-1 border-bottom-0" colspan="3">COMISIÓN REDELCOM</th>
<th class="py-1 border-bottom-0" colspan="3">TOTALES NETOS</th>
</tr>
<tr>
<th class="py-1 text-muted">Crédito</th>
<th class="py-1 text-muted">Débito</th>
<th class="py-1 text-muted">Mercado Pago</th>
<th class="py-1 text-muted">Efectivo/Dep.</th>
<th class="py-1" style="color:#e5904d">Crédito (-2.38%)</th>
<th class="py-1" style="color:#e5904d">Débito (-1.547%)</th>
<th class="py-1" style="color:#e5904d">MP (-1.309%)</th>
<th class="py-1" style="color:#20c997">REDELCOM Neto</th>
<th class="py-1 text-warning">Efectivo - Gastos</th>
<th class="py-1 text-primary fw-bold">Venta Total Neto</th>
</tr>
</thead>
<tbody>
{% for dia in dias_en_periodo %}
{% set d = data_por_dia[dia] %}
<tr>
<td class="align-middle sticky-col numeric-cell fw-bold text-center">{{ dia }}</td>
<td class="align-middle numeric-cell total-column text-success">
{{ ("$" ~ "{:,.0f}".format(d.venta_total).replace(',', '.')) if d.venta_total > 0 else "-" }}
</td>
<td class="align-middle numeric-cell text-info fw-bold">
{{ ("$" ~ "{:,.0f}".format(d.comision).replace(',', '.')) if d.comision > 0 else "-" }}
</td>
<td class="align-middle numeric-cell text-danger">
{{ ("-$" ~ "{:,.0f}".format(d.gastos).replace(',', '.')) if d.gastos > 0 else "-" }}
</td>
<td class="align-middle numeric-cell text-muted">{{ ("$" ~ "{:,.0f}".format(d.credito).replace(',', '.')) if d.credito > 0 else "-" }}</td>
<td class="align-middle numeric-cell text-muted">{{ ("$" ~ "{:,.0f}".format(d.debito).replace(',', '.')) if d.debito > 0 else "-" }}</td>
<td class="align-middle numeric-cell text-muted">{{ ("$" ~ "{:,.0f}".format(d.mp).replace(',', '.')) if d.mp > 0 else "-" }}</td>
<td class="align-middle numeric-cell text-muted">{{ ("$" ~ "{:,.0f}".format(d.efectivo).replace(',', '.')) if d.efectivo > 0 else "-" }}</td>
{% set red_credito = d.credito * 0.97620 %}
{% set red_debito = d.debito * 0.98453 %}
{% set red_mp = d.mp * 0.98691 %}
{% set redelcom_neto = red_credito + red_debito + red_mp %}
{% set efectivo_menos_gastos = d.efectivo - d.gastos %}
<td class="align-middle numeric-cell" style="color:#e5904d">{{ ("$" ~ "{:,.0f}".format(red_credito).replace(',', '.')) if red_credito > 0 else "-" }}</td>
<td class="align-middle numeric-cell" style="color:#e5904d">{{ ("$" ~ "{:,.0f}".format(red_debito).replace(',', '.')) if red_debito > 0 else "-" }}</td>
<td class="align-middle numeric-cell" style="color:#e5904d">{{ ("$" ~ "{:,.0f}".format(red_mp).replace(',', '.')) if red_mp > 0 else "-" }}</td>
<td class="align-middle numeric-cell" style="color:#20c997">{{ ("$" ~ "{:,.0f}".format(redelcom_neto).replace(',', '.')) if redelcom_neto > 0 else "-" }}</td>
<td class="align-middle numeric-cell text-warning fw-bold">{{ ("$" ~ "{:,.0f}".format(efectivo_menos_gastos).replace(',', '.')) if efectivo_menos_gastos != 0 else "-" }}</td>
<td class="align-middle numeric-cell text-primary fw-bold">{{ ("$" ~ "{:,.0f}".format(redelcom_neto + efectivo_menos_gastos).replace(',', '.')) if (redelcom_neto + efectivo_menos_gastos) != 0 else "-" }}</td>
</tr>
{% endfor %}
</tbody>
<tfoot class="table-group-divider fw-bold bg-dark text-white sticky-bottom">
<tr>
<td class="align-middle sticky-col py-2 text-center">TOTAL</td>
<td class="align-middle numeric-cell py-2 fs-6 text-success border-end border-light">
${{ "{:,.0f}".format(totales_mes.venta_total).replace(',', '.') }}
</td>
<td class="align-middle numeric-cell py-2 text-info">
${{ "{:,.0f}".format(totales_mes.comision).replace(',', '.') }}
</td>
<td class="align-middle numeric-cell py-2 text-danger border-end border-light">
-${{ "{:,.0f}".format(totales_mes.gastos).replace(',', '.') }}
</td>
<td class="align-middle numeric-cell py-2">${{ "{:,.0f}".format(totales_mes.credito).replace(',', '.') }}</td>
<td class="align-middle numeric-cell py-2">${{ "{:,.0f}".format(totales_mes.debito).replace(',', '.') }}</td>
<td class="align-middle numeric-cell py-2">${{ "{:,.0f}".format(totales_mes.mp).replace(',', '.') }}</td>
<td class="align-middle numeric-cell py-2">${{ "{:,.0f}".format(totales_mes.efectivo).replace(',', '.') }}</td>
<td class="align-middle numeric-cell py-2" style="color:#e5904d">${{ "{:,.0f}".format(totales_mes.credito * 0.97620).replace(',', '.') }}</td>
<td class="align-middle numeric-cell py-2" style="color:#e5904d">${{ "{:,.0f}".format(totales_mes.debito * 0.98453).replace(',', '.') }}</td>
<td class="align-middle numeric-cell py-2" style="color:#e5904d">${{ "{:,.0f}".format(totales_mes.mp * 0.98691).replace(',', '.') }}</td>
{% set t_redelcom = totales_mes.credito * 0.97620 + totales_mes.debito * 0.98453 + totales_mes.mp * 0.98691 %}
{% set t_efectivo_menos = totales_mes.efectivo - totales_mes.gastos %}
<td class="align-middle numeric-cell py-2" style="color:#20c997">${{ "{:,.0f}".format(t_redelcom).replace(',', '.') }}</td>
<td class="align-middle numeric-cell py-2 text-warning">${{ "{:,.0f}".format(t_efectivo_menos).replace(',', '.') }}</td>
<td class="align-middle numeric-cell py-2 text-primary fw-bold">${{ "{:,.0f}".format(t_redelcom + t_efectivo_menos).replace(',', '.') }}</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
{% endblock %}