Actualizar backend/modules/cobranza/processor.py
This commit is contained in:
@@ -387,7 +387,8 @@ class CobranzaProcessor:
|
||||
return data.get("DEFAULT", "LIMA")
|
||||
|
||||
def obtener_datos_procesados(self, ano, mes, sectorista_filtro="TODOS", agrupacion="SEDE",
|
||||
sede_filtro="TODOS", prog_filtro="TODOS", venc_hasta=None):
|
||||
sede_filtro="TODOS", prog_filtro="TODOS", venc_hasta=None,
|
||||
mats_retirar=None):
|
||||
fecha_filtro, fecha_filtro_siguiente = self.obtener_fechas_filtro(ano, mes)
|
||||
hoy = datetime.now()
|
||||
# Filtro adicional por F. Vencimiento: solo cuotas con vencimiento <= venc_hasta.
|
||||
@@ -565,9 +566,20 @@ class CobranzaProcessor:
|
||||
if llave not in frecuencias_fecha_venc: frecuencias_fecha_venc[llave] = {}
|
||||
frecuencias_fecha_venc[llave][f] = frecuencias_fecha_venc[llave].get(f, 0) + 1
|
||||
|
||||
# Saldo POR RETIRAR por grupo: suma el saldo de los alumnos marcados POR RETIRAR
|
||||
# (mats_retirar) usando el tracking por (matricula, llave).
|
||||
saldo_retirar_por_llave = {}
|
||||
if mats_retirar:
|
||||
_mr = set(str(m) for m in mats_retirar)
|
||||
for (mat, llave), track in alumnos_tracking.items():
|
||||
if str(mat) in _mr:
|
||||
saldo_al = (track["suma"] - track["resta"]) - track["cobrado"]
|
||||
if round(saldo_al, 2) > 0:
|
||||
saldo_retirar_por_llave[llave] = saldo_retirar_por_llave.get(llave, 0.0) + saldo_al
|
||||
|
||||
datos_limpios = []
|
||||
llaves_ordenadas = sorted(datos_agrupados.keys())
|
||||
|
||||
|
||||
asesores_validos = []
|
||||
if agrupacion == "ASESOR":
|
||||
asesores_validos = [s for s in self.obtener_lista_sectoristas(ano, mes) if s != "TODOS"]
|
||||
@@ -620,7 +632,9 @@ class CobranzaProcessor:
|
||||
'FCH_VENC_MODA': moda_fecha,
|
||||
'CTA_COB_ANT': cta_cob_ant, 'CTA_COB_MES_CURSO': cta_cob_curso, 'TOTAL_CTA_COB': total_cta,
|
||||
'COB_ANT': cobrado_meses_ant, 'RATIO_1': ratio_1, 'COB_MES_CURSO': cobrado_mes_curso, 'RATIO_2': ratio_2,
|
||||
'TOTAL_COBRADO': total_cobrado_sede, 'RATIO_3': ratio_3, 'SALDO': saldo_sede, 'OPCIONES': " ≡ ▼ "
|
||||
'TOTAL_COBRADO': total_cobrado_sede, 'RATIO_3': ratio_3, 'SALDO': saldo_sede,
|
||||
'SALDO_RETIRAR': round(saldo_retirar_por_llave.get(llave, 0.0), 2),
|
||||
'OPCIONES': " ≡ ▼ "
|
||||
})
|
||||
|
||||
if agrupacion == "PROGRAMA":
|
||||
|
||||
Reference in New Issue
Block a user