diff --git a/README.md b/README.md index 590d1c1..237c81b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Rendiciones-App +# KSNE-Rendiciones-App ## 🐳 Docker Deployment (Server) diff --git a/app.py b/app.py index b613b10..08f1071 100644 --- a/app.py +++ b/app.py @@ -237,12 +237,12 @@ def worker_dashboard(): companion_id = None # VERIFICACIÓN: Todos los campos de venta deben estar rellenos - if tarjeta is None or mp is None or efectivo is None or not fecha or not turno: + if debito is None or credito is None or mp is None or efectivo is None or not fecha or not turno: flash("Error: Todos los campos (Fecha, Turno, Tarjeta, MP y Efectivo) son obligatorios. Use 0 si no hubo ventas.", "danger") return redirect(url_for('worker_dashboard')) # CÁLCULOS ADICIONALES (Para lógica de negocio o auditoría futura) - total_digital = tarjeta + mp + total_digital = debito + credito + mp total_ventas_general = total_digital + efectivo # Insertar Cabecera de Rendición @@ -671,15 +671,17 @@ def edit_rendicion(id): if companion_id == "": companion_id = None - # Campos de dinero - tarjeta = request.form.get('venta_tarjeta', '0').replace('.', '') + # ¡ADIÓS venta_tarjeta! Capturamos débito y crédito separados + debito = request.form.get('venta_debito', '0').replace('.', '') + credito = request.form.get('venta_credito', '0').replace('.', '') mp = request.form.get('venta_mp', '0').replace('.', '') efectivo = request.form.get('venta_efectivo', '0').replace('.', '') gastos = request.form.get('gastos', '0').replace('.', '') observaciones = request.form.get('observaciones', '').strip() try: - tarjeta = int(tarjeta) if tarjeta else 0 + debito = int(debito) if debito else 0 + credito = int(credito) if credito else 0 mp = int(mp) if mp else 0 efectivo = int(efectivo) if efectivo else 0 gastos = int(gastos) if gastos else 0 @@ -690,12 +692,13 @@ def edit_rendicion(id): conn = sqlite3.connect(DB_NAME) c = conn.cursor() + # Actualizamos los nombres de las columnas en el UPDATE c.execute(''' UPDATE rendiciones SET fecha=?, turno=?, worker_id=?, modulo_id=?, companion_id=?, - venta_tarjeta=?, venta_mp=?, venta_efectivo=?, gastos=?, observaciones=? + venta_debito=?, venta_credito=?, venta_mp=?, venta_efectivo=?, gastos=?, observaciones=? WHERE id=? - ''', (fecha, turno, worker_id, modulo_id, companion_id, tarjeta, mp, efectivo, gastos, observaciones, id)) + ''', (fecha, turno, worker_id, modulo_id, companion_id, debito, credito, mp, efectivo, gastos, observaciones, id)) conn.commit() conn.close() diff --git a/templates/admin_rendiciones.html b/templates/admin_rendiciones.html index 00d174a..ecf3f4c 100644 --- a/templates/admin_rendiciones.html +++ b/templates/admin_rendiciones.html @@ -31,7 +31,7 @@ Acciones - + {% for r in rendiciones %} {{ r[1] }} @@ -39,37 +39,17 @@ {{ r[3] }} {{ r[4] }} - ${{ "{:,.0f}".format((r[5] or 0) + (r[17] or 0) + (r[6] or 0) + (r[7] or 0)).replace(',', '.') }} + ${{ "{:,.0f}".format((r[5] or 0) + (r[6] or 0) + (r[7] or 0) + (r[8] or 0)).replace(',', '.') }} - ${{ "{:,.0f}".format(r[8] or 0).replace(',', '.') }} + ${{ "{:,.0f}".format(r[9] or 0).replace(',', '.') }}
- - - - - + + +
- {{ rendicion_detail_modal(r, r[14], r[15], r[16]) }} + {{ rendicion_detail_modal(r, r[15], r[16], r[17]) }} {{ edit_rendicion_modal(r, workers, modulos) }} {{ confirm_modal( @@ -98,11 +78,12 @@ function calcTotalEdit(id) { const getVal = (inputId) => parseInt(document.getElementById(inputId).value.replace(/\D/g, '')) || 0; - const tarjeta = getVal(`edit_tarjeta_${id}`); + const debito = getVal(`edit_debito_${id}`); + const credito = getVal(`edit_credito_${id}`); const mp = getVal(`edit_mp_${id}`); const efectivo = getVal(`edit_efectivo_${id}`); - const total = tarjeta + mp + efectivo; + const total = debito + credito + mp + efectivo; document.getElementById(`display_nuevo_total_${id}`).innerText = '$' + total.toLocaleString('es-CL'); } diff --git a/templates/macros/modals.html b/templates/macros/modals.html index dbb8b38..6d9731f 100644 --- a/templates/macros/modals.html +++ b/templates/macros/modals.html @@ -201,8 +201,8 @@
Acompañante
- {% if rendicion[10] %} - {{ rendicion[10] }} + {% if rendicion[11] %} + {{ rendicion[11] }} {% else %} Sin acompañante {% endif %} @@ -216,19 +216,23 @@
- Tarjetas: + Débito: ${{ "{:,.0f}".format(rendicion[5] or 0).replace(',', '.') }}
- Mercado Pago: + Crédito: ${{ "{:,.0f}".format(rendicion[6] or 0).replace(',', '.') }}
- Efectivo: + Mercado Pago: ${{ "{:,.0f}".format(rendicion[7] or 0).replace(',', '.') }}
+
+ Efectivo: + ${{ "{:,.0f}".format(rendicion[8] or 0).replace(',', '.') }} +
- {% set total_declarado = rendicion[5] + rendicion[6] + rendicion[7] %} + {% set total_declarado = (rendicion[5] or 0) + (rendicion[6] or 0) + (rendicion[7] or 0) + (rendicion[8] or 0) %}
Total Declarado: ${{ "{:,.0f}".format(total_declarado).replace(',', '.') }} @@ -247,12 +251,12 @@
Monto Gastos: - -${{ "{:,.0f}".format(rendicion[8] or 0).replace(',', '.') }} + -${{ "{:,.0f}".format(rendicion[9] or 0).replace(',', '.') }}
Observaciones:

- {{ rendicion[9] if rendicion[9] else "Sin observaciones." }} + {{ rendicion[10] if rendicion[10] else "Sin observaciones." }}

@@ -321,11 +325,18 @@
Declaración de Dinero
-
- +
+
$ - + +
+
+
+ +
+ $ +
diff --git a/templates/worker_dashboard.html b/templates/worker_dashboard.html index e44230d..b1f807c 100644 --- a/templates/worker_dashboard.html +++ b/templates/worker_dashboard.html @@ -128,14 +128,14 @@
-
+
$
-
+
$ @@ -143,7 +143,6 @@
-