From e5415b11e74da70c8ebfa919c29e1fdaba559f1b Mon Sep 17 00:00:00 2001 From: Shiro-Nek0 Date: Sat, 21 Mar 2026 02:05:18 -0300 Subject: [PATCH] tarjetas divididas creo y texto chikito yipiiiii :33 :D --- app.py | 33 +++++++++++++++++++------------- templates/admin_rendiciones.html | 4 +++- templates/macros/navbar.html | 13 ++++++++++--- templates/worker_dashboard.html | 18 ++++++++++++----- 4 files changed, 46 insertions(+), 22 deletions(-) diff --git a/app.py b/app.py index a33ac29..b613b10 100644 --- a/app.py +++ b/app.py @@ -54,11 +54,12 @@ def init_db(): c.execute('''CREATE TABLE IF NOT EXISTS rendiciones (id INTEGER PRIMARY KEY AUTOINCREMENT, worker_id INTEGER NOT NULL, - companion_id INTEGER, -- Nueva columna + companion_id INTEGER, modulo_id INTEGER NOT NULL, fecha DATE NOT NULL, turno TEXT NOT NULL, - venta_tarjeta INTEGER DEFAULT 0, + venta_debito INTEGER DEFAULT 0, + venta_credito INTEGER DEFAULT 0, venta_mp INTEGER DEFAULT 0, venta_efectivo INTEGER DEFAULT 0, gastos INTEGER DEFAULT 0, @@ -225,7 +226,8 @@ def worker_dashboard(): return 0 # <--- Cambiado de None a 0 # Captura y validación de campos obligatorios - tarjeta = clean_and_validate(request.form.get('venta_tarjeta')) + debito = clean_and_validate(request.form.get('venta_debito')) + credito = clean_and_validate(request.form.get('venta_credito')) mp = clean_and_validate(request.form.get('venta_mp')) efectivo = clean_and_validate(request.form.get('venta_efectivo')) gastos = clean_and_validate(request.form.get('gastos')) or 0 @@ -244,7 +246,12 @@ def worker_dashboard(): total_ventas_general = total_digital + efectivo # Insertar Cabecera de Rendición - c.execute('''INSERT INTO rendiciones (worker_id, companion_id, modulo_id, fecha, turno, venta_tarjeta, venta_mp, venta_efectivo, gastos, observaciones) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''', (session['user_id'], companion_id, modulo_id, fecha, turno, tarjeta, mp, efectivo, gastos, obs)) + c.execute('''INSERT INTO rendiciones + (worker_id, companion_id, modulo_id, fecha, turno, + venta_debito, venta_credito, venta_mp, venta_efectivo, gastos, observaciones) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)''', + (session['user_id'], companion_id, modulo_id, fecha, turno, + debito, credito, mp, efectivo, gastos, obs)) rendicion_id = c.lastrowid # Insertar Productos (Solo aquellos con cantidad > 0) @@ -590,15 +597,15 @@ def admin_rendiciones(): # Añadimos worker_id (11), companion_id (12) y modulo_id (13) a la consulta c.execute(''' - SELECT r.id, r.fecha, w.name, m.name, r.turno, - r.venta_tarjeta, r.venta_mp, r.venta_efectivo, r.gastos, r.observaciones, - c_w.name, r.worker_id, r.companion_id, r.modulo_id - FROM rendiciones r - JOIN workers w ON r.worker_id = w.id - JOIN modulos m ON r.modulo_id = m.id - LEFT JOIN workers c_w ON r.companion_id = c_w.id - ORDER BY r.fecha DESC, r.id DESC - ''') + SELECT r.id, r.fecha, w.name, m.name, r.turno, + r.venta_debito, r.venta_credito, r.venta_mp, r.venta_efectivo, r.gastos, r.observaciones, + c_w.name, r.worker_id, r.companion_id, r.modulo_id + FROM rendiciones r + JOIN workers w ON r.worker_id = w.id + JOIN modulos m ON r.modulo_id = m.id + LEFT JOIN workers c_w ON r.companion_id = c_w.id + ORDER BY r.fecha DESC, r.id DESC + ''') rendiciones_basicas = c.fetchall() rendiciones_completas = [] diff --git a/templates/admin_rendiciones.html b/templates/admin_rendiciones.html index e4f8288..00d174a 100644 --- a/templates/admin_rendiciones.html +++ b/templates/admin_rendiciones.html @@ -38,7 +38,9 @@ {{ r[2] }} {{ r[3] }} {{ r[4] }} - ${{ "{:,.0f}".format((r[5] or 0) + (r[6] or 0) + (r[7] or 0)).replace(',', '.') }} + + ${{ "{:,.0f}".format((r[5] or 0) + (r[17] or 0) + (r[6] or 0) + (r[7] or 0)).replace(',', '.') }} + ${{ "{:,.0f}".format(r[8] or 0).replace(',', '.') }}
diff --git a/templates/macros/navbar.html b/templates/macros/navbar.html index 1d777dd..f35dd02 100644 --- a/templates/macros/navbar.html +++ b/templates/macros/navbar.html @@ -1,8 +1,15 @@