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:
Lizandro Guarnizo
2026-07-16 20:42:39 -05:00
co-authored by Claude Sonnet 4.6
parent 7506f63627
commit 0f6c837d35
4 changed files with 22 additions and 6 deletions
@@ -0,0 +1,2 @@
ALTER TABLE turnero_solicitudes
ADD COLUMN IF NOT EXISTS numero_recibo VARCHAR(40) NULL DEFAULT NULL AFTER metodo_pago;
+1
View File
@@ -14,6 +14,7 @@ $pendientes = [
'20260703_solicitud_medico.sql',
'20260707_turnero_consent_origen_lugar.sql',
'20260716_lab_eps_ciudades.sql',
'20260716_numero_recibo_tarjeta.sql',
];
$pdo = Database::getInstance()->getConnection();
+4 -3
View File
@@ -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
? (float) $datos['total_cobrado'] : 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;
$numOrden = isset($datos['numero_orden']) ? trim((string) $datos['numero_orden']) : null;
$embarazada = !empty($datos['embarazada']) ? 1 : 0;
@@ -123,14 +124,14 @@ try {
$stmt = $pdo->prepare(
"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,
nit_empresa, subgrupo_id, autorizacion, diag_ppal, items_precio, creado_por)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
);
$stmt->execute([
$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(),
]);
$solicitudId = (int) $pdo->lastInsertId();
+15 -3
View File
@@ -795,6 +795,11 @@ document.addEventListener('DOMContentLoaded', function() {
</select>
</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 -->
<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">
@@ -1547,8 +1552,12 @@ function descartarRips() {
}
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-recibo').classList.toggle('d-none', !tarjeta);
if (!tarjeta) document.getElementById('inp-recibo').value = '';
const inp = document.getElementById('inp-total');
inp.readOnly = combinado;
inp.style.background = combinado ? '#e9ecef' : '';
@@ -1718,6 +1727,7 @@ async function guardarSolicitud() {
numero_orden: document.getElementById('inp-consecutivo').value.trim() || null,
total_cobrado: parseFloat(document.getElementById('inp-total').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' ? {
efectivo: parseFloat(document.getElementById('comb-efectivo').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('bloque-medico').style.display = '';
descartarRips();
document.getElementById('sel-pago').value = '';
document.getElementById('inp-total').value = '';
document.getElementById('sel-pago').value = '';
document.getElementById('inp-total').value = '';
document.getElementById('inp-recibo').value = '';
document.getElementById('panel-recibo').classList.add('d-none');
document.getElementById('inp-obs').value = '';
resetPagoCombinado();
resetMedico();