tarjetas divididas creo y texto chikito yipiiiii :33 :D
This commit is contained in:
33
app.py
33
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 = []
|
||||
|
||||
@@ -38,7 +38,9 @@
|
||||
<td class="align-middle">{{ r[2] }}</td>
|
||||
<td class="align-middle"><span class="badge bg-info text-dark">{{ r[3] }}</span></td>
|
||||
<td class="align-middle">{{ r[4] }}</td>
|
||||
<td class="align-middle">${{ "{:,.0f}".format((r[5] or 0) + (r[6] or 0) + (r[7] or 0)).replace(',', '.') }}</td>
|
||||
<td class="align-middle">
|
||||
${{ "{:,.0f}".format((r[5] or 0) + (r[17] or 0) + (r[6] or 0) + (r[7] or 0)).replace(',', '.') }}
|
||||
</td>
|
||||
<td class="align-middle text-danger">${{ "{:,.0f}".format(r[8] or 0).replace(',', '.') }}</td>
|
||||
<td class="text-end">
|
||||
<div class="btn-group" role="group">
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
<nav class="navbar navbar-expand-lg bg-body-tertiary shadow-sm border-bottom mb-4">
|
||||
<div class="container">
|
||||
<a class="navbar-brand d-flex align-items-center fw-bold text-primary-emphasis" href="{{ url_for('index') }}">
|
||||
<i class="bi bi-receipt-cutoff me-2 fs-4 text-info"></i>
|
||||
<span>MikuTBD</span>
|
||||
<a class="navbar-brand d-flex flex-column align-items-start text-primary-emphasis" href="{{ url_for('index') }}" style="gap: 0;">
|
||||
|
||||
<div class="d-flex align-items-center">
|
||||
<i class="bi bi-receipt-cutoff fs-3 text-info me-2"></i>
|
||||
<span class="fw-bold fs-4">KSNE</span>
|
||||
</div>
|
||||
|
||||
<small class="text-muted fw-normal d-none d-sm-block" style="font-size:0.6rem; letter-spacing: 0.3px; margin-top: -5px;">
|
||||
Key Sales & Net Earnings.
|
||||
</small>
|
||||
</a>
|
||||
|
||||
<button class="navbar-toggler border-0" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav">
|
||||
|
||||
@@ -114,11 +114,18 @@
|
||||
<div class="card-header bg-info text-dark">Resumen Financiero</div>
|
||||
<div class="card-body">
|
||||
<div class="row g-3 mb-4">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Venta Tarjeta</label>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Venta Débito</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="text" class="form-control money-input sale-input" placeholder="0" name="venta_tarjeta" id="venta_tarjeta" required>
|
||||
<input type="text" class="form-control money-input sale-input" name="venta_debito" id="venta_debito" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<label class="form-label">Venta Crédito</label>
|
||||
<div class="input-group">
|
||||
<span class="input-group-text">$</span>
|
||||
<input type="text" class="form-control money-input sale-input" name="venta_credito" id="venta_credito" required>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
@@ -283,12 +290,13 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
return parseInt(el.value.replace(/\D/g, '')) || 0;
|
||||
};
|
||||
|
||||
const tarjeta = getVal('venta_tarjeta');
|
||||
const debito = getVal('venta_debito');
|
||||
const credito = getVal('venta_credito');
|
||||
const mp = getVal('venta_mp');
|
||||
const efectivo = getVal('venta_efectivo');
|
||||
const gastos = getVal('gastos');
|
||||
|
||||
const totalDigital = tarjeta + mp;
|
||||
const totalDigital = debito + credito + mp;
|
||||
const totalGeneral = (totalDigital + efectivo) - gastos;
|
||||
|
||||
displayDigital.value = totalDigital.toLocaleString('es-CL');
|
||||
|
||||
Reference in New Issue
Block a user