diff --git a/src/services/estado_cuenta.py b/src/services/estado_cuenta.py index 62b0b5e..1cf9ba9 100644 --- a/src/services/estado_cuenta.py +++ b/src/services/estado_cuenta.py @@ -222,10 +222,13 @@ def generar_pdf( if movimientos: movimientos = _completar_snapshot(movimientos, renglones) st_nota = _estilo("nota", fontSize=7.5, textColor=_GRIS, leading=9) - filas = [["Fecha", "Subcuenta", "Originación", "Movimiento", + filas = [["Fecha", "Subcuenta", "Movimiento", "Capital", "Abonado", "Monto"]] for m in movimientos: sub = f"{m.get('vehiculo') or ''} · {_tipo_label(m)}" + origen = _fecha_es(m.get("fecha_alta") or "") + if origen: + sub += f" ({origen})" celda_sub = [Paragraph(sub, st_celda)] if m.get("nota"): celda_sub.append(Paragraph(str(m["nota"]), st_nota)) @@ -234,22 +237,20 @@ def generar_pdf( filas.append([ _fecha_es(m.get("fecha") or ""), celda_sub, - _fecha_es(m.get("fecha_alta") or "") or "—", _MOV_LABEL.get(m.get("movimiento") or "", m.get("movimiento") or ""), _money(cap) if cap is not None else "—", _money(abo) if abo is not None else "—", _money(m.get("monto")), ]) t = Table(filas, - colWidths=[19 * mm, 41 * mm, 20 * mm, 21 * mm, - None, None, None], + colWidths=[19 * mm, 58 * mm, 22 * mm, None, None, None], repeatRows=1) t.setStyle(TableStyle([ ("FONTNAME", (0, 0), (-1, 0), "Helvetica-Bold"), ("FONTSIZE", (0, 0), (-1, -1), 8), ("TEXTCOLOR", (0, 0), (-1, 0), colors.white), ("BACKGROUND", (0, 0), (-1, 0), _ACCENT), - ("ALIGN", (4, 0), (-1, -1), "RIGHT"), + ("ALIGN", (3, 0), (-1, -1), "RIGHT"), ("VALIGN", (0, 0), (-1, -1), "MIDDLE"), ("ROWBACKGROUNDS", (0, 1), (-1, -1), [colors.white, _FILA_ALT]), ("LINEBELOW", (0, 0), (-1, -1), 0.4, _LINEA), diff --git a/tests/test_estado_cuenta.py b/tests/test_estado_cuenta.py index ca67204..1aa0ad1 100644 --- a/tests/test_estado_cuenta.py +++ b/tests/test_estado_cuenta.py @@ -69,7 +69,8 @@ def test_pdf_contiene_saldos_y_movimientos(): assert "Abono" in txt and "Mes saldado" in txt assert "transferencia BBVA" in txt assert "$6,000.00" in txt - assert "Originación" in txt and "01/06/2026" in txt + assert "(01/06/2026)" in txt # originación en la subcuenta + assert "Originación" not in txt # ya no es columna aparte assert "$20,000.00" in txt # capital de la subcuenta