hola
This commit is contained in:
@@ -44,7 +44,7 @@ class FirebirdService:
|
||||
return False, "No hay conexión activa", []
|
||||
try:
|
||||
cur = self.conn.cursor()
|
||||
if params:
|
||||
if params is not None:
|
||||
cur.execute(query, params)
|
||||
else:
|
||||
cur.execute(query)
|
||||
@@ -53,3 +53,15 @@ class FirebirdService:
|
||||
return True, "", [dict(zip(columns, row)) for row in rows]
|
||||
except Exception as e:
|
||||
return False, str(e), []
|
||||
|
||||
|
||||
def get_firebird_from_config(configs: dict) -> tuple:
|
||||
fb = FirebirdService()
|
||||
ok, msg = fb.connect(
|
||||
configs.get("firebird_host", "localhost"),
|
||||
int(configs.get("firebird_port", 3050)),
|
||||
configs.get("firebird_database", ""),
|
||||
configs.get("firebird_user", "SYSDBA"),
|
||||
configs.get("firebird_password", "masterkey"),
|
||||
)
|
||||
return fb, ok, msg
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
@@ -49,6 +50,16 @@ def generar_procedimiento(row: dict, consecutivo: int) -> dict:
|
||||
}
|
||||
|
||||
|
||||
def agrupar_por_factura(rows: list, factura_default: str = "") -> dict:
|
||||
grupos = defaultdict(lambda: {"factura": "", "procedimientos": []})
|
||||
for row in rows:
|
||||
doc_key = (row.get("tipo_doc_paciente", "CC"), row.get("num_doc_paciente", ""))
|
||||
fact = row.get("num_factura", factura_default)
|
||||
grupos[(fact, doc_key)]["factura"] = fact
|
||||
grupos[(fact, doc_key)]["procedimientos"].append(dict(row))
|
||||
return grupos
|
||||
|
||||
|
||||
def generar_transaccion(
|
||||
factura: str,
|
||||
num_doc_obligado: str,
|
||||
|
||||
Reference in New Issue
Block a user