feat: campo número de recibo al pagar con tarjeta
- Campo inp-recibo aparece/desaparece al seleccionar 'Tarjeta' en forma de pago - Se incluye en el payload como numero_recibo y se guarda en turnero_solicitudes - Migración: ADD COLUMN numero_recibo VARCHAR(40) en turnero_solicitudes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
7506f63627
commit
0f6c837d35
@@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE turnero_solicitudes
|
||||||
|
ADD COLUMN IF NOT EXISTS numero_recibo VARCHAR(40) NULL DEFAULT NULL AFTER metodo_pago;
|
||||||
@@ -14,6 +14,7 @@ $pendientes = [
|
|||||||
'20260703_solicitud_medico.sql',
|
'20260703_solicitud_medico.sql',
|
||||||
'20260707_turnero_consent_origen_lugar.sql',
|
'20260707_turnero_consent_origen_lugar.sql',
|
||||||
'20260716_lab_eps_ciudades.sql',
|
'20260716_lab_eps_ciudades.sql',
|
||||||
|
'20260716_numero_recibo_tarjeta.sql',
|
||||||
];
|
];
|
||||||
|
|
||||||
$pdo = Database::getInstance()->getConnection();
|
$pdo = Database::getInstance()->getConnection();
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ $examIds = isset($datos['exam_tipo_ids']) && is_array($datos['exam_tipo_ids'
|
|||||||
$total = isset($datos['total_cobrado']) && $datos['total_cobrado'] !== null
|
$total = isset($datos['total_cobrado']) && $datos['total_cobrado'] !== null
|
||||||
? (float) $datos['total_cobrado'] : null;
|
? (float) $datos['total_cobrado'] : null;
|
||||||
$metodoPago = isset($datos['metodo_pago']) ? trim((string) $datos['metodo_pago']) : null;
|
$metodoPago = isset($datos['metodo_pago']) ? trim((string) $datos['metodo_pago']) : null;
|
||||||
|
$numeroRecibo = !empty($datos['numero_recibo']) ? trim((string) $datos['numero_recibo']) : null;
|
||||||
$obs = isset($datos['observaciones']) ? trim((string) $datos['observaciones']) : null;
|
$obs = isset($datos['observaciones']) ? trim((string) $datos['observaciones']) : null;
|
||||||
$numOrden = isset($datos['numero_orden']) ? trim((string) $datos['numero_orden']) : null;
|
$numOrden = isset($datos['numero_orden']) ? trim((string) $datos['numero_orden']) : null;
|
||||||
$embarazada = !empty($datos['embarazada']) ? 1 : 0;
|
$embarazada = !empty($datos['embarazada']) ? 1 : 0;
|
||||||
@@ -123,14 +124,14 @@ try {
|
|||||||
|
|
||||||
$stmt = $pdo->prepare(
|
$stmt = $pdo->prepare(
|
||||||
"INSERT INTO turnero_solicitudes
|
"INSERT INTO turnero_solicitudes
|
||||||
(turno_id, paciente_id, lugar_id, numero_orden, total_cobrado, metodo_pago, pagos_detalle,
|
(turno_id, paciente_id, lugar_id, numero_orden, total_cobrado, metodo_pago, numero_recibo, pagos_detalle,
|
||||||
observaciones, embarazada, solo_muestras, medico_id,
|
observaciones, embarazada, solo_muestras, medico_id,
|
||||||
nit_empresa, subgrupo_id, autorizacion, diag_ppal, items_precio, creado_por)
|
nit_empresa, subgrupo_id, autorizacion, diag_ppal, items_precio, creado_por)
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
);
|
);
|
||||||
$stmt->execute([
|
$stmt->execute([
|
||||||
$turnoId, $pacienteId, $lugarId, $numOrden,
|
$turnoId, $pacienteId, $lugarId, $numOrden,
|
||||||
$total, $metodoPago ?: null, $pagosDetalle, $obs ?: null, $embarazada, $soloMuestras, $medicoId,
|
$total, $metodoPago ?: null, $numeroRecibo, $pagosDetalle, $obs ?: null, $embarazada, $soloMuestras, $medicoId,
|
||||||
$nitEmpresa, $subgrupoId, $autorizacion, $diagPpal, $itemsPrecio, adminId(),
|
$nitEmpresa, $subgrupoId, $autorizacion, $diagPpal, $itemsPrecio, adminId(),
|
||||||
]);
|
]);
|
||||||
$solicitudId = (int) $pdo->lastInsertId();
|
$solicitudId = (int) $pdo->lastInsertId();
|
||||||
|
|||||||
@@ -795,6 +795,11 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<!-- N.º recibo tarjeta -->
|
||||||
|
<div id="panel-recibo" class="d-none mt-2">
|
||||||
|
<input type="text" id="inp-recibo" class="form-control form-control-sm"
|
||||||
|
placeholder="N.º recibo / aprobación tarjeta" maxlength="40">
|
||||||
|
</div>
|
||||||
<!-- Panel pago combinado -->
|
<!-- Panel pago combinado -->
|
||||||
<div id="panel-combinado" class="d-none mt-2 p-2 border rounded" style="background:#f8fafc">
|
<div id="panel-combinado" class="d-none mt-2 p-2 border rounded" style="background:#f8fafc">
|
||||||
<div class="row g-2 align-items-center mb-1">
|
<div class="row g-2 align-items-center mb-1">
|
||||||
@@ -1547,8 +1552,12 @@ function descartarRips() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function togglePagoCombinado() {
|
function togglePagoCombinado() {
|
||||||
const combinado = document.getElementById('sel-pago').value === 'combinado';
|
const metodo = document.getElementById('sel-pago').value;
|
||||||
|
const combinado = metodo === 'combinado';
|
||||||
|
const tarjeta = metodo === 'tarjeta';
|
||||||
document.getElementById('panel-combinado').classList.toggle('d-none', !combinado);
|
document.getElementById('panel-combinado').classList.toggle('d-none', !combinado);
|
||||||
|
document.getElementById('panel-recibo').classList.toggle('d-none', !tarjeta);
|
||||||
|
if (!tarjeta) document.getElementById('inp-recibo').value = '';
|
||||||
const inp = document.getElementById('inp-total');
|
const inp = document.getElementById('inp-total');
|
||||||
inp.readOnly = combinado;
|
inp.readOnly = combinado;
|
||||||
inp.style.background = combinado ? '#e9ecef' : '';
|
inp.style.background = combinado ? '#e9ecef' : '';
|
||||||
@@ -1718,6 +1727,7 @@ async function guardarSolicitud() {
|
|||||||
numero_orden: document.getElementById('inp-consecutivo').value.trim() || null,
|
numero_orden: document.getElementById('inp-consecutivo').value.trim() || null,
|
||||||
total_cobrado: parseFloat(document.getElementById('inp-total').value) || null,
|
total_cobrado: parseFloat(document.getElementById('inp-total').value) || null,
|
||||||
metodo_pago: document.getElementById('sel-pago').value || null,
|
metodo_pago: document.getElementById('sel-pago').value || null,
|
||||||
|
numero_recibo: document.getElementById('inp-recibo').value.trim() || null,
|
||||||
pagos_detalle: document.getElementById('sel-pago').value === 'combinado' ? {
|
pagos_detalle: document.getElementById('sel-pago').value === 'combinado' ? {
|
||||||
efectivo: parseFloat(document.getElementById('comb-efectivo').value) || 0,
|
efectivo: parseFloat(document.getElementById('comb-efectivo').value) || 0,
|
||||||
transferencia: parseFloat(document.getElementById('comb-transferencia').value) || 0,
|
transferencia: parseFloat(document.getElementById('comb-transferencia').value) || 0,
|
||||||
@@ -2146,8 +2156,10 @@ function resetCheckboxes() {
|
|||||||
document.getElementById('wrap-examenes').classList.remove('disabled');
|
document.getElementById('wrap-examenes').classList.remove('disabled');
|
||||||
document.getElementById('bloque-medico').style.display = '';
|
document.getElementById('bloque-medico').style.display = '';
|
||||||
descartarRips();
|
descartarRips();
|
||||||
document.getElementById('sel-pago').value = '';
|
document.getElementById('sel-pago').value = '';
|
||||||
document.getElementById('inp-total').value = '';
|
document.getElementById('inp-total').value = '';
|
||||||
|
document.getElementById('inp-recibo').value = '';
|
||||||
|
document.getElementById('panel-recibo').classList.add('d-none');
|
||||||
document.getElementById('inp-obs').value = '';
|
document.getElementById('inp-obs').value = '';
|
||||||
resetPagoCombinado();
|
resetPagoCombinado();
|
||||||
resetMedico();
|
resetMedico();
|
||||||
|
|||||||
Reference in New Issue
Block a user