From 92e3a3f0f990088634212925079b7dec6541bed5 Mon Sep 17 00:00:00 2001 From: Shiro-Nek0 Date: Tue, 10 Mar 2026 23:22:50 -0300 Subject: [PATCH] dicom evidence update --- app.py | 25 ++++---- templates/checkout.html | 82 +------------------------ templates/dicom.html | 112 ++++++++++++++++++++++++++++++----- templates/macros/modals.html | 57 ++++++++++++++++++ templates/sales.html | 64 ++------------------ 5 files changed, 170 insertions(+), 170 deletions(-) diff --git a/app.py b/app.py index d597cfc..80937fe 100644 --- a/app.py +++ b/app.py @@ -178,7 +178,7 @@ def checkout(): @login_required def dicom(): with sqlite3.connect(DB_FILE) as conn: - debtors = conn.execute('SELECT id, name, amount, notes, datetime(last_updated, "localtime") FROM dicom ORDER BY amount DESC').fetchall() + debtors = conn.execute('SELECT id, name, amount, notes, datetime(last_updated, "localtime"), image_url FROM dicom ORDER BY amount DESC').fetchall() return render_template('dicom.html', active_page='dicom', user=current_user, debtors=debtors) @app.route('/sales') @@ -474,29 +474,26 @@ def update_dicom(): name = data.get('name', '').strip() amount = float(data.get('amount', 0)) notes = data.get('notes', '') - action = data.get('action') # 'add' or 'pay' + image_url = data.get('image_url', '') + action = data.get('action') if not name or amount <= 0: return jsonify({"error": "Nombre y monto válidos son requeridos"}), 400 - # If we are giving them credit (Fiar), their balance drops into the negative if action == 'add': amount = -amount - try: - with sqlite3.connect(DB_FILE) as conn: - cur = conn.cursor() - # Upsert logic: if they exist, modify debt. If they don't, create them. - cur.execute('''INSERT INTO dicom (name, amount, notes, last_updated) - VALUES (?, ?, ?, CURRENT_TIMESTAMP) + with sqlite3.connect(DB_FILE) as conn: + cur = conn.cursor() + cur.execute('''INSERT INTO dicom (name, amount, notes, image_url, last_updated) + VALUES (?, ?, ?, ?, CURRENT_TIMESTAMP) ON CONFLICT(name) DO UPDATE SET amount = amount + excluded.amount, notes = excluded.notes, - last_updated = CURRENT_TIMESTAMP''', (name, amount, notes)) - conn.commit() - return jsonify({"status": "success"}), 200 - except Exception as e: - return jsonify({"error": str(e)}), 500 + image_url = CASE WHEN excluded.image_url != "" THEN excluded.image_url ELSE dicom.image_url END, + last_updated = CURRENT_TIMESTAMP''', (name, amount, notes, image_url)) + conn.commit() + return jsonify({"status": "success"}), 200 @app.route('/api/dicom/', methods=['DELETE']) @login_required diff --git a/templates/checkout.html b/templates/checkout.html index 0cee550..69240ab 100644 --- a/templates/checkout.html +++ b/templates/checkout.html @@ -1,5 +1,5 @@ {% extends "macros/base.html" %} -{% from 'macros/modals.html' import confirm_modal, scanner_modal %} +{% from 'macros/modals.html' import confirm_modal, scanner_modal, render_receipt %} {% block title %}Caja{% endblock %} @@ -16,54 +16,11 @@ -moz-appearance: textfield; appearance: textfield; } - - @media print { - body * { - visibility: hidden; - } - - #receipt-print-zone, #receipt-print-zone * { - visibility: visible; - } - - #receipt-print-zone { - position: absolute; - left: 0; - top: 0; - width: 58mm; - padding: 0; - margin: 0; - display: block !important; - font-family: 'Courier New', Courier, monospace; - font-size: 10px; - color: #000; - } - - .container-fluid, .main, body { - margin: 0 !important; - padding: 0 !important; - background: #fff !important; - } - } - - .receipt-table { - width: 100%; - border-collapse: collapse; - font-family: monospace; - font-size: 12px; - } - - .receipt-header { - text-align: center; - margin-bottom: 10px; - border-bottom: 1px dashed #000; - padding-bottom: 5px; - } - {% endblock %} {% block content %} + {{ render_receipt() }} {% call confirm_modal('removeConfirmModal', 'Quitar Producto', 'btn-danger-discord', 'Quitar', 'executeRemoveItem()') %} ¿Estás seguro de que quieres quitar del carrito? {% endcall %} @@ -117,41 +74,7 @@ -
-
-

SekiPOS

-
Comprobante de Venta
-
- Ticket Nº -
-
-
- - - - - - - - - - -
CantDescTotal
-
- TOTAL: - -
-
- RECIBIDO: - -
-
- VUELTO: - -
-
¡Gracias por su compra!
-