Actualizar backend/modules/cobranza/logic.py
This commit is contained in:
@@ -10,8 +10,10 @@ class CobranzaLogic:
|
|||||||
def obtener_lista_sectoristas(self, ano, mes):
|
def obtener_lista_sectoristas(self, ano, mes):
|
||||||
return self.processor.obtener_lista_sectoristas(ano, mes)
|
return self.processor.obtener_lista_sectoristas(ano, mes)
|
||||||
|
|
||||||
def obtener_datos_tabla(self, ano, mes, sectorista="TODOS", agrupacion="SEDE"):
|
def obtener_datos_tabla(self, ano, mes, sectorista="TODOS", agrupacion="SEDE",
|
||||||
datos_brutos = self.processor.obtener_datos_procesados(ano, mes, sectorista, agrupacion)
|
sede_filtro="TODOS", prog_filtro="TODOS", venc_hasta=None):
|
||||||
|
datos_brutos = self.processor.obtener_datos_procesados(ano, mes, sectorista, agrupacion,
|
||||||
|
sede_filtro, prog_filtro, venc_hasta)
|
||||||
|
|
||||||
sheet_data = []
|
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_cta_ant = t_cta_cur = t_cta_tot = t_cob_ant = t_cob_cur = t_cob_tot = t_saldo = 0.0
|
||||||
@@ -87,8 +89,8 @@ class CobranzaLogic:
|
|||||||
sheet_data.append(fila_total)
|
sheet_data.append(fila_total)
|
||||||
return sheet_data
|
return sheet_data
|
||||||
|
|
||||||
def obtener_detalle_programa_formateado(self, ano, mes, sectorista, programa):
|
def obtener_detalle_programa_formateado(self, ano, mes, sectorista, programa, venc_hasta=None):
|
||||||
datos_brutos = self.processor.obtener_detalle_programa(ano, mes, sectorista, programa)
|
datos_brutos = self.processor.obtener_detalle_programa(ano, mes, sectorista, programa, venc_hasta)
|
||||||
|
|
||||||
sheet_data = []
|
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_cta_ant = t_cta_cur = t_cta_tot = t_cob_ant = t_cob_cur = t_cob_tot = t_saldo = 0.0
|
||||||
@@ -114,6 +116,7 @@ class CobranzaLogic:
|
|||||||
r1 = (cob_ant / cta_ant) * 100 if cta_ant > 0 else 0.0
|
r1 = (cob_ant / cta_ant) * 100 if cta_ant > 0 else 0.0
|
||||||
r2 = (cob_cur / cta_cur) * 100 if cta_cur > 0 else 0.0
|
r2 = (cob_cur / cta_cur) * 100 if cta_cur > 0 else 0.0
|
||||||
r3 = (cob_tot / cta_tot) * 100 if cta_tot > 0 else 0.0
|
r3 = (cob_tot / cta_tot) * 100 if cta_tot > 0 else 0.0
|
||||||
|
|
||||||
avance_ant = f"{r1:.0f}%" if cta_ant > 0 else ""
|
avance_ant = f"{r1:.0f}%" if cta_ant > 0 else ""
|
||||||
avance_cur = f"{r2:.0f}%" if cta_cur > 0 else ""
|
avance_cur = f"{r2:.0f}%" if cta_cur > 0 else ""
|
||||||
avance_tot = f"{r3:.0f}%" if cta_tot > 0 else ""
|
avance_tot = f"{r3:.0f}%" if cta_tot > 0 else ""
|
||||||
@@ -209,6 +212,11 @@ class CobranzaLogic:
|
|||||||
worksheet.cell(row=row, column=col).number_format = '"S/" #,##0.00'
|
worksheet.cell(row=row, column=col).number_format = '"S/" #,##0.00'
|
||||||
for col in [8, 11, 14]:
|
for col in [8, 11, 14]:
|
||||||
worksheet.cell(row=row, column=col).number_format = '0%'
|
worksheet.cell(row=row, column=col).number_format = '0%'
|
||||||
|
# FCH VENCIMIENTO (col 5): forzar TEXTO para que Excel no reinterprete
|
||||||
|
# la fecha ni le reste un día por zona horaria.
|
||||||
|
celda_fecha = worksheet.cell(row=row, column=5)
|
||||||
|
celda_fecha.value = str(celda_fecha.value)
|
||||||
|
celda_fecha.number_format = '@'
|
||||||
|
|
||||||
for col in worksheet.columns:
|
for col in worksheet.columns:
|
||||||
max_len = 0
|
max_len = 0
|
||||||
|
|||||||
Reference in New Issue
Block a user