From 0f6c837d352d23de0612fae84875f18b00aa7870 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Thu, 16 Jul 2026 20:42:39 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20campo=20n=C3=BAmero=20de=20recibo=20al?= =?UTF-8?q?=20pagar=20con=20tarjeta?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- migrations/20260716_numero_recibo_tarjeta.sql | 2 ++ migrations/run_pendientes.php | 1 + modules/turnero/api/create_solicitud.php | 7 ++++--- modules/turnero/views/recepcion.php | 18 +++++++++++++++--- 4 files changed, 22 insertions(+), 6 deletions(-) create mode 100644 migrations/20260716_numero_recibo_tarjeta.sql diff --git a/migrations/20260716_numero_recibo_tarjeta.sql b/migrations/20260716_numero_recibo_tarjeta.sql new file mode 100644 index 0000000..cc5c801 --- /dev/null +++ b/migrations/20260716_numero_recibo_tarjeta.sql @@ -0,0 +1,2 @@ +ALTER TABLE turnero_solicitudes + ADD COLUMN IF NOT EXISTS numero_recibo VARCHAR(40) NULL DEFAULT NULL AFTER metodo_pago; diff --git a/migrations/run_pendientes.php b/migrations/run_pendientes.php index 3b557f3..d6c6f5e 100644 --- a/migrations/run_pendientes.php +++ b/migrations/run_pendientes.php @@ -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(); diff --git a/modules/turnero/api/create_solicitud.php b/modules/turnero/api/create_solicitud.php index 39043f3..a3530cc 100644 --- a/modules/turnero/api/create_solicitud.php +++ b/modules/turnero/api/create_solicitud.php @@ -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(); diff --git a/modules/turnero/views/recepcion.php b/modules/turnero/views/recepcion.php index 0c5fcaf..0d0c0b7 100644 --- a/modules/turnero/views/recepcion.php +++ b/modules/turnero/views/recepcion.php @@ -795,6 +795,11 @@ document.addEventListener('DOMContentLoaded', function() { + +
+ +
@@ -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();