ahora si funcan las tarjetas lol
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
# Rendiciones-App
|
# KSNE-Rendiciones-App
|
||||||
|
|
||||||
## 🐳 Docker Deployment (Server)
|
## 🐳 Docker Deployment (Server)
|
||||||
|
|
||||||
|
|||||||
17
app.py
17
app.py
@@ -237,12 +237,12 @@ def worker_dashboard():
|
|||||||
companion_id = None
|
companion_id = None
|
||||||
|
|
||||||
# VERIFICACIÓN: Todos los campos de venta deben estar rellenos
|
# 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")
|
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'))
|
return redirect(url_for('worker_dashboard'))
|
||||||
|
|
||||||
# CÁLCULOS ADICIONALES (Para lógica de negocio o auditoría futura)
|
# 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
|
total_ventas_general = total_digital + efectivo
|
||||||
|
|
||||||
# Insertar Cabecera de Rendición
|
# Insertar Cabecera de Rendición
|
||||||
@@ -671,15 +671,17 @@ def edit_rendicion(id):
|
|||||||
if companion_id == "":
|
if companion_id == "":
|
||||||
companion_id = None
|
companion_id = None
|
||||||
|
|
||||||
# Campos de dinero
|
# ¡ADIÓS venta_tarjeta! Capturamos débito y crédito separados
|
||||||
tarjeta = request.form.get('venta_tarjeta', '0').replace('.', '')
|
debito = request.form.get('venta_debito', '0').replace('.', '')
|
||||||
|
credito = request.form.get('venta_credito', '0').replace('.', '')
|
||||||
mp = request.form.get('venta_mp', '0').replace('.', '')
|
mp = request.form.get('venta_mp', '0').replace('.', '')
|
||||||
efectivo = request.form.get('venta_efectivo', '0').replace('.', '')
|
efectivo = request.form.get('venta_efectivo', '0').replace('.', '')
|
||||||
gastos = request.form.get('gastos', '0').replace('.', '')
|
gastos = request.form.get('gastos', '0').replace('.', '')
|
||||||
observaciones = request.form.get('observaciones', '').strip()
|
observaciones = request.form.get('observaciones', '').strip()
|
||||||
|
|
||||||
try:
|
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
|
mp = int(mp) if mp else 0
|
||||||
efectivo = int(efectivo) if efectivo else 0
|
efectivo = int(efectivo) if efectivo else 0
|
||||||
gastos = int(gastos) if gastos else 0
|
gastos = int(gastos) if gastos else 0
|
||||||
@@ -690,12 +692,13 @@ def edit_rendicion(id):
|
|||||||
conn = sqlite3.connect(DB_NAME)
|
conn = sqlite3.connect(DB_NAME)
|
||||||
c = conn.cursor()
|
c = conn.cursor()
|
||||||
|
|
||||||
|
# Actualizamos los nombres de las columnas en el UPDATE
|
||||||
c.execute('''
|
c.execute('''
|
||||||
UPDATE rendiciones
|
UPDATE rendiciones
|
||||||
SET fecha=?, turno=?, worker_id=?, modulo_id=?, companion_id=?,
|
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=?
|
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.commit()
|
||||||
conn.close()
|
conn.close()
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
<th class="text-end">Acciones</th>
|
<th class="text-end">Acciones</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for r in rendiciones %}
|
{% for r in rendiciones %}
|
||||||
<tr>
|
<tr>
|
||||||
<td class="align-middle">{{ r[1] }}</td>
|
<td class="align-middle">{{ r[1] }}</td>
|
||||||
@@ -39,37 +39,17 @@
|
|||||||
<td class="align-middle"><span class="badge bg-info text-dark">{{ r[3] }}</span></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">{{ r[4] }}</td>
|
||||||
<td class="align-middle">
|
<td class="align-middle">
|
||||||
${{ "{:,.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(',', '.') }}
|
||||||
</td>
|
</td>
|
||||||
<td class="align-middle text-danger">${{ "{:,.0f}".format(r[8] or 0).replace(',', '.') }}</td>
|
<td class="align-middle text-danger">${{ "{:,.0f}".format(r[9] or 0).replace(',', '.') }}</td>
|
||||||
<td class="text-end">
|
<td class="text-end">
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
<button type="button"
|
<button type="button" class="btn btn-sm btn-info text-white" data-bs-toggle="modal" data-bs-target="#viewRendicion{{ r[0] }}" title="Ver Detalle"><i class="bi bi-eye"></i></button>
|
||||||
class="btn btn-sm btn-info text-white"
|
<button type="button" class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#editRendicion{{ r[0] }}" title="Editar Valores Declarados"><i class="bi bi-pencil"></i></button>
|
||||||
data-bs-toggle="modal"
|
<button type="button" class="btn btn-sm btn-danger" data-bs-toggle="modal" data-bs-target="#deleteRendicion{{ r[0] }}" title="Eliminar Rendición"><i class="bi bi-trash"></i></button>
|
||||||
data-bs-target="#viewRendicion{{ r[0] }}"
|
|
||||||
title="Ver Detalle">
|
|
||||||
<i class="bi bi-eye"></i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button type="button"
|
|
||||||
class="btn btn-sm btn-primary"
|
|
||||||
data-bs-toggle="modal"
|
|
||||||
data-bs-target="#editRendicion{{ r[0] }}"
|
|
||||||
title="Editar Valores Declarados">
|
|
||||||
<i class="bi bi-pencil"></i>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<button type="button"
|
|
||||||
class="btn btn-sm btn-danger"
|
|
||||||
data-bs-toggle="modal"
|
|
||||||
data-bs-target="#deleteRendicion{{ r[0] }}"
|
|
||||||
title="Eliminar Rendición">
|
|
||||||
<i class="bi bi-trash"></i>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{ 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) }}
|
{{ edit_rendicion_modal(r, workers, modulos) }}
|
||||||
|
|
||||||
{{ confirm_modal(
|
{{ confirm_modal(
|
||||||
@@ -98,11 +78,12 @@
|
|||||||
function calcTotalEdit(id) {
|
function calcTotalEdit(id) {
|
||||||
const getVal = (inputId) => parseInt(document.getElementById(inputId).value.replace(/\D/g, '')) || 0;
|
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 mp = getVal(`edit_mp_${id}`);
|
||||||
const efectivo = getVal(`edit_efectivo_${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');
|
document.getElementById(`display_nuevo_total_${id}`).innerText = '$' + total.toLocaleString('es-CL');
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -201,8 +201,8 @@
|
|||||||
|
|
||||||
<dt class="col-sm-5 text-muted">Acompañante</dt>
|
<dt class="col-sm-5 text-muted">Acompañante</dt>
|
||||||
<dd class="col-sm-7">
|
<dd class="col-sm-7">
|
||||||
{% if rendicion[10] %}
|
{% if rendicion[11] %}
|
||||||
{{ rendicion[10] }}
|
{{ rendicion[11] }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<span class="text-muted italic small">Sin acompañante</span>
|
<span class="text-muted italic small">Sin acompañante</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -216,19 +216,23 @@
|
|||||||
</dl>
|
</dl>
|
||||||
<hr>
|
<hr>
|
||||||
<div class="d-flex justify-content-between mb-2">
|
<div class="d-flex justify-content-between mb-2">
|
||||||
<span class="text-muted">Tarjetas:</span>
|
<span class="text-muted">Débito:</span>
|
||||||
<span>${{ "{:,.0f}".format(rendicion[5] or 0).replace(',', '.') }}</span>
|
<span>${{ "{:,.0f}".format(rendicion[5] or 0).replace(',', '.') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between mb-2">
|
<div class="d-flex justify-content-between mb-2">
|
||||||
<span class="text-muted">Mercado Pago:</span>
|
<span class="text-muted">Crédito:</span>
|
||||||
<span>${{ "{:,.0f}".format(rendicion[6] or 0).replace(',', '.') }}</span>
|
<span>${{ "{:,.0f}".format(rendicion[6] or 0).replace(',', '.') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex justify-content-between mb-2">
|
<div class="d-flex justify-content-between mb-2">
|
||||||
<span class="text-muted">Efectivo:</span>
|
<span class="text-muted">Mercado Pago:</span>
|
||||||
<span>${{ "{:,.0f}".format(rendicion[7] or 0).replace(',', '.') }}</span>
|
<span>${{ "{:,.0f}".format(rendicion[7] or 0).replace(',', '.') }}</span>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="d-flex justify-content-between mb-2">
|
||||||
|
<span class="text-muted">Efectivo:</span>
|
||||||
|
<span>${{ "{:,.0f}".format(rendicion[8] or 0).replace(',', '.') }}</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
{% 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) %}
|
||||||
<div class="d-flex justify-content-between mt-3 pt-2 border-top">
|
<div class="d-flex justify-content-between mt-3 pt-2 border-top">
|
||||||
<strong class="fs-5">Total Declarado:</strong>
|
<strong class="fs-5">Total Declarado:</strong>
|
||||||
<strong class="fs-5">${{ "{:,.0f}".format(total_declarado).replace(',', '.') }}</strong>
|
<strong class="fs-5">${{ "{:,.0f}".format(total_declarado).replace(',', '.') }}</strong>
|
||||||
@@ -247,12 +251,12 @@
|
|||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<div class="d-flex justify-content-between mb-3">
|
<div class="d-flex justify-content-between mb-3">
|
||||||
<strong class="text-danger">Monto Gastos:</strong>
|
<strong class="text-danger">Monto Gastos:</strong>
|
||||||
<strong class="text-danger">-${{ "{:,.0f}".format(rendicion[8] or 0).replace(',', '.') }}</strong>
|
<strong class="text-danger">-${{ "{:,.0f}".format(rendicion[9] or 0).replace(',', '.') }}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<span class="text-muted d-block mb-1">Observaciones:</span>
|
<span class="text-muted d-block mb-1">Observaciones:</span>
|
||||||
<p class="mb-0 bg-dark p-2 rounded border border-secondary" style="font-size: 0.9em;">
|
<p class="mb-0 bg-dark p-2 rounded border border-secondary" style="font-size: 0.9em;">
|
||||||
{{ rendicion[9] if rendicion[9] else "Sin observaciones." }}
|
{{ rendicion[10] if rendicion[10] else "Sin observaciones." }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -321,11 +325,18 @@
|
|||||||
|
|
||||||
<h6 class="border-bottom pb-2 text-success">Declaración de Dinero</h6>
|
<h6 class="border-bottom pb-2 text-success">Declaración de Dinero</h6>
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-md-4">
|
<div class="col-md-3">
|
||||||
<label class="form-label">Tarjetas</label>
|
<label class="form-label">Débito</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-text">$</span>
|
<span class="input-group-text">$</span>
|
||||||
<input type="text" class="form-control money-input" id="edit_tarjeta_{{ rendicion[0] }}" name="venta_tarjeta" value="{{ rendicion[5] }}" oninput="calcTotalEdit({{ rendicion[0] }})" required>
|
<input type="text" class="form-control" id="edit_debito_{{ rendicion[0] }}" name="venta_debito" value="{{ '{:,.0f}'.format(rendicion[5] or 0).replace(',', '.') }}" oninput="calcTotalEdit({{ rendicion[0] }})">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-3">
|
||||||
|
<label class="form-label">Crédito</label>
|
||||||
|
<div class="input-group">
|
||||||
|
<span class="input-group-text">$</span>
|
||||||
|
<input type="text" class="form-control" id="edit_credito_{{ rendicion[0] }}" name="venta_credito" value="{{ '{:,.0f}'.format(rendicion[6] or 0).replace(',', '.') }}" oninput="calcTotalEdit({{ rendicion[0] }})">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
|
|||||||
@@ -128,14 +128,14 @@
|
|||||||
<input type="text" class="form-control money-input sale-input" name="venta_credito" id="venta_credito" required>
|
<input type="text" class="form-control money-input sale-input" name="venta_credito" id="venta_credito" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-3">
|
||||||
<label class="form-label">Venta Mercado Pago</label>
|
<label class="form-label">Venta Mercado Pago</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-text">$</span>
|
<span class="input-group-text">$</span>
|
||||||
<input type="text" class="form-control money-input sale-input" placeholder="0" name="venta_mp" id="venta_mp" required>
|
<input type="text" class="form-control money-input sale-input" placeholder="0" name="venta_mp" id="venta_mp" required>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4">
|
<div class="col-md-3">
|
||||||
<label class="form-label">Venta Efectivo</label>
|
<label class="form-label">Venta Efectivo</label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<span class="input-group-text">$</span>
|
<span class="input-group-text">$</span>
|
||||||
@@ -143,7 +143,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row g-3 mb-4 p-3 bg-body-secondary rounded shadow-sm">
|
<div class="row g-3 mb-4 p-3 bg-body-secondary rounded shadow-sm">
|
||||||
<div class="col-md-4">
|
<div class="col-md-4">
|
||||||
<label class="form-label text-info fw-bold">Total Digital (Tarjeta + MP)</label>
|
<label class="form-label text-info fw-bold">Total Digital (Tarjeta + MP)</label>
|
||||||
|
|||||||
Reference in New Issue
Block a user