Actualizar backend/modules/cobranza/logic.py
This commit is contained in:
@@ -11,12 +11,15 @@ class CobranzaLogic:
|
||||
return self.processor.obtener_lista_sectoristas(ano, mes)
|
||||
|
||||
def obtener_datos_tabla(self, ano, mes, sectorista="TODOS", agrupacion="SEDE",
|
||||
sede_filtro="TODOS", prog_filtro="TODOS", venc_hasta=None):
|
||||
sede_filtro="TODOS", prog_filtro="TODOS", venc_hasta=None,
|
||||
mats_retirar=None):
|
||||
datos_brutos = self.processor.obtener_datos_procesados(ano, mes, sectorista, agrupacion,
|
||||
sede_filtro, prog_filtro, venc_hasta)
|
||||
sede_filtro, prog_filtro, venc_hasta,
|
||||
mats_retirar)
|
||||
|
||||
sheet_data = []
|
||||
t_cta_ant = t_cta_cur = t_cta_tot = t_cob_ant = t_cob_cur = t_cob_tot = t_saldo = 0.0
|
||||
t_saldo_ret = 0.0
|
||||
|
||||
for d in datos_brutos:
|
||||
grupo = d.get('GRUPO', '')
|
||||
@@ -34,6 +37,7 @@ class CobranzaLogic:
|
||||
cob_tot = float(d.get('TOTAL_COBRADO', 0.0))
|
||||
r3 = float(d.get('RATIO_3', 0.0))
|
||||
saldo = float(d.get('SALDO', 0.0))
|
||||
saldo_ret = float(d.get('SALDO_RETIRAR', 0.0))
|
||||
opciones = d.get('OPCIONES', ' ≡ ▼ ')
|
||||
|
||||
t_cta_ant += cta_ant
|
||||
@@ -43,6 +47,7 @@ class CobranzaLogic:
|
||||
t_cob_cur += cob_cur
|
||||
t_cob_tot += cob_tot
|
||||
t_saldo += saldo
|
||||
t_saldo_ret += saldo_ret
|
||||
|
||||
avance_ant = f"{r1:.0f}%" if cta_ant > 0 else ""
|
||||
avance_cur = f"{r2:.0f}%" if cta_cur > 0 else ""
|
||||
@@ -54,7 +59,7 @@ class CobranzaLogic:
|
||||
f"S/ {cta_ant:,.0f}", f"S/ {cob_ant:,.0f}", avance_ant,
|
||||
f"S/ {cta_cur:,.0f}", f"S/ {cob_cur:,.0f}", avance_cur,
|
||||
f"S/ {cta_tot:,.0f}", f"S/ {cob_tot:,.0f}", avance_tot,
|
||||
f"S/ {saldo:,.0f}", opciones
|
||||
f"S/ {saldo:,.0f}", f"S/ {saldo_ret:,.0f}", opciones
|
||||
]
|
||||
else:
|
||||
fila = [
|
||||
@@ -62,7 +67,7 @@ class CobranzaLogic:
|
||||
f"S/ {cta_ant:,.0f}", f"S/ {cob_ant:,.0f}", avance_ant,
|
||||
f"S/ {cta_cur:,.0f}", f"S/ {cob_cur:,.0f}", avance_cur,
|
||||
f"S/ {cta_tot:,.0f}", f"S/ {cob_tot:,.0f}", avance_tot,
|
||||
f"S/ {saldo:,.0f}", opciones
|
||||
f"S/ {saldo:,.0f}", f"S/ {saldo_ret:,.0f}", opciones
|
||||
]
|
||||
sheet_data.append(fila)
|
||||
|
||||
@@ -76,7 +81,7 @@ class CobranzaLogic:
|
||||
f"S/ {t_cta_ant:,.0f}", f"S/ {t_cob_ant:,.0f}", f"{r_tot_1:.0f}%",
|
||||
f"S/ {t_cta_cur:,.0f}", f"S/ {t_cob_cur:,.0f}", f"{r_tot_2:.0f}%",
|
||||
f"S/ {t_cta_tot:,.0f}", f"S/ {t_cob_tot:,.0f}", f"{r_tot_3:.0f}%",
|
||||
f"S/ {t_saldo:,.0f}", ""
|
||||
f"S/ {t_saldo:,.0f}", f"S/ {t_saldo_ret:,.0f}", ""
|
||||
]
|
||||
else:
|
||||
fila_total = [
|
||||
@@ -84,7 +89,7 @@ class CobranzaLogic:
|
||||
f"S/ {t_cta_ant:,.0f}", f"S/ {t_cob_ant:,.0f}", f"{r_tot_1:.0f}%",
|
||||
f"S/ {t_cta_cur:,.0f}", f"S/ {t_cob_cur:,.0f}", f"{r_tot_2:.0f}%",
|
||||
f"S/ {t_cta_tot:,.0f}", f"S/ {t_cob_tot:,.0f}", f"{r_tot_3:.0f}%",
|
||||
f"S/ {t_saldo:,.0f}", ""
|
||||
f"S/ {t_saldo:,.0f}", f"S/ {t_saldo_ret:,.0f}", ""
|
||||
]
|
||||
sheet_data.append(fila_total)
|
||||
return sheet_data
|
||||
|
||||
Reference in New Issue
Block a user