Cambios
This commit is contained in:
@@ -422,9 +422,7 @@ function guardar()
|
||||
$patente_id = $_POST['patente'] ?? null;
|
||||
|
||||
if ($patente_id) {
|
||||
$stmtValidatePatente = sqlsrv_query($conn,
|
||||
"SELECT id_agente FROM dbo.agentes_aduanales WHERE id_agente = ? AND id_agencia = ? AND activo = 1",
|
||||
[$patente_id, $id_agencia]);
|
||||
$stmtValidatePatente = sqlsrv_query($conn, "SELECT id_agente FROM dbo.agentes_aduanales WHERE id_agente = ? AND id_agencia = ? AND activo = 1", [$patente_id, $id_agencia]);
|
||||
|
||||
if (!$stmtValidatePatente || !sqlsrv_fetch_array($stmtValidatePatente, SQLSRV_FETCH_ASSOC)) {
|
||||
die("❌ La patente seleccionada no es válida para su agencia.");
|
||||
@@ -562,9 +560,9 @@ function guardar()
|
||||
if(!empty($_POST['partidas'])&&is_array($_POST['partidas'])){
|
||||
|
||||
$sqlP = "INSERT INTO dbo.solicitud_importacion_partidas
|
||||
(id_solicitud, descripcion, cantidad_comercial, cantidad_tarifa, valor_factura, peso_bruto, unidad_comercial_id, tasa_preferencial)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
(id_solicitud, descripcion, cantidad_comercial, cantidad_tarifa, valor_factura, peso_bruto, unidad_comercial_id, tasa_preferencial)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
";
|
||||
$partidas_insertadas = 0; // ← contador
|
||||
|
||||
foreach ($_POST['partidas'] as $i => $p) {
|
||||
@@ -637,46 +635,47 @@ function enviarNotificacionNuevaSolicitud($email, $nombreUsuario, $datosSolicitu
|
||||
</div>' : '';
|
||||
|
||||
$mail->Body = "
|
||||
<div style='font-family: Segoe UI, sans-serif; background-color: #f4f6f9; padding: 30px;'>
|
||||
<div style='max-width: 600px; margin: auto; background: #fff; border: 1px solid #ccc; border-radius: 10px;'>
|
||||
<div style='background: linear-gradient(to right, #003366, #0055A5); padding: 20px; text-align: center;'>
|
||||
<h2 style='color: white; margin: 0;'>📥 Nueva Solicitud Registrada</h2>
|
||||
</div>
|
||||
<div style='padding: 20px;'>
|
||||
$tipoNotificacion
|
||||
<p>Hola <strong>" . htmlspecialchars($nombreUsuario) . "</strong>,</p>
|
||||
<p>Tu solicitud de importación ha sido registrada correctamente con los siguientes datos:</p>
|
||||
|
||||
<div style='background: #f8f9fa; padding: 15px; border-radius: 8px; margin: 15px 0;'>
|
||||
<table style='width: 100%; border-collapse: collapse;'>
|
||||
<tr>
|
||||
<td style='padding: 5px 0; font-weight: bold;'>ID Solicitud:</td>
|
||||
<td style='padding: 5px 0;'>$idSolicitud</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='padding: 5px 0; font-weight: bold;'>Número de Factura:</td>
|
||||
<td style='padding: 5px 0;'>$numeroFactura</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='padding: 5px 0; font-weight: bold;'>Fecha:</td>
|
||||
<td style='padding: 5px 0;'>$fechaFactura</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='padding: 5px 0; font-weight: bold;'>Valor:</td>
|
||||
<td style='padding: 5px 0;'>$valorFactura $tipoMoneda</td>
|
||||
</tr>
|
||||
</table>
|
||||
<div style='font-family: Segoe UI, sans-serif; background-color: #f4f6f9; padding: 30px;'>
|
||||
<div style='max-width: 600px; margin: auto; background: #fff; border: 1px solid #ccc; border-radius: 10px;'>
|
||||
<div style='background: linear-gradient(to right, #003366, #0055A5); padding: 20px; text-align: center;'>
|
||||
h2 style='color: white; margin: 0;'>📥 Nueva Solicitud Registrada</h2>
|
||||
</div>
|
||||
<div style='padding: 20px;'>
|
||||
$tipoNotificacion
|
||||
<p>Hola <strong>" . htmlspecialchars($nombreUsuario) . "</strong>,</p>
|
||||
<p>Tu solicitud de importación ha sido registrada correctamente con los siguientes datos:</p>
|
||||
|
||||
<div style='background: #f8f9fa; padding: 15px; border-radius: 8px; margin: 15px 0;'>
|
||||
<table style='width: 100%; border-collapse: collapse;'>
|
||||
<tr>
|
||||
<td style='padding: 5px 0; font-weight: bold;'>ID Solicitud:</td>
|
||||
<td style='padding: 5px 0;'>$idSolicitud</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='padding: 5px 0; font-weight: bold;'>Número de Factura:</td>
|
||||
<td style='padding: 5px 0;'>$numeroFactura</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='padding: 5px 0; font-weight: bold;'>Fecha:</td>
|
||||
<td style='padding: 5px 0;'>$fechaFactura</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style='padding: 5px 0; font-weight: bold;'>Valor:</td>
|
||||
<td style='padding: 5px 0;'>$valorFactura $tipoMoneda</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p>Puedes consultar el estado de tu solicitud accediendo a tu panel de control.</p>
|
||||
<br>
|
||||
<p style='color: #888; font-size: 14px;'>Si no realizaste esta acción, contacta al administrador del sistema.</p>
|
||||
</div>
|
||||
<div style='background: #e9ecef; text-align: center; padding: 10px; font-size: 13px; color: #666;'>
|
||||
© " . date('Y') . " SIIH · Desarrollado por AduanaSoft
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p>Puedes consultar el estado de tu solicitud accediendo a tu panel de control.</p>
|
||||
<br>
|
||||
<p style='color: #888; font-size: 14px;'>Si no realizaste esta acción, contacta al administrador del sistema.</p>
|
||||
</div>
|
||||
<div style='background: #e9ecef; text-align: center; padding: 10px; font-size: 13px; color: #666;'>
|
||||
© " . date('Y') . " SIIH · Desarrollado por AduanaSoft
|
||||
</div>
|
||||
</div>
|
||||
</div>";
|
||||
";
|
||||
|
||||
$envioExitoso = $mail->send();
|
||||
|
||||
@@ -929,8 +928,13 @@ function actualizar()
|
||||
if (!empty($p['id_partida']) && intval($p['id_partida']) > 0) {
|
||||
// ACTUALIZAR partida existente
|
||||
$sql = "UPDATE dbo.solicitud_importacion_partidas SET
|
||||
descripcion = ?, cantidad_comercial = ?, cantidad_tarifa = ?,
|
||||
valor_factura = ?, peso_bruto = ?, unidad_comercial_id = ?, tasa_preferencial = ?
|
||||
descripcion = ?,
|
||||
cantidad_comercial = ?,
|
||||
cantidad_tarifa = ?,
|
||||
valor_factura = ?,
|
||||
peso_bruto = ?,
|
||||
unidad_comercial_id = ?,
|
||||
tasa_preferencial = ?
|
||||
WHERE id_partida = ?
|
||||
AND id_solicitud = ?
|
||||
";
|
||||
@@ -1287,7 +1291,7 @@ function update_status()
|
||||
ON s.id_importador = u.id_usuario
|
||||
WHERE u.id_usuario = ?
|
||||
AND s.id_solicitud = ?
|
||||
";
|
||||
";
|
||||
$stmtNotif = sqlsrv_prepare($conn, $sqlNotif, [$_SESSION['usuario_id'], $id]);
|
||||
|
||||
if ($stmtNotif && sqlsrv_execute($stmtNotif)) {
|
||||
@@ -1858,7 +1862,8 @@ function pdf() {
|
||||
}
|
||||
|
||||
// NUEVA FUNCIÓN: Obtener información del proveedor por clave
|
||||
function obtenerProveedorPorClave($clave) {
|
||||
function obtenerProveedorPorClave($clave)
|
||||
{
|
||||
// Obtener token de la API
|
||||
$token = getApiToken();
|
||||
if (!$token) {
|
||||
@@ -1906,7 +1911,8 @@ function obtenerProveedorPorClave($clave) {
|
||||
return null;
|
||||
}
|
||||
|
||||
function generarHTMLPDF($solicitud, $partidas, $configuracion, $proveedor_info = null) {
|
||||
function generarHTMLPDF($solicitud, $partidas, $configuracion, $proveedor_info = null)
|
||||
{
|
||||
// Formatear fecha
|
||||
$fecha_expedicion = $solicitud['fecha_factura']->format('d/m/Y');
|
||||
$fecha_vencimiento = $solicitud['fecha_factura']->modify('+30 days')->format('d/m/Y');
|
||||
@@ -2047,162 +2053,163 @@ function generarHTMLPDF($solicitud, $partidas, $configuracion, $proveedor_info =
|
||||
}
|
||||
|
||||
$html = '
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Solicitud de Importación</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; font-size: 9px; margin: 0; padding: 15px; line-height: 1.2; }
|
||||
/** Encabezado **/
|
||||
.header { padding-bottom: 50px; }
|
||||
.logo-section { width: 20%; text-align: left; }
|
||||
.logo { max-width: 125px; height: auto; vertical-align: top; }
|
||||
.company-info { width: 60%; text-align: center; vertical-align: top; font-size: 12px; }
|
||||
.company-name { font-weight: bold; font-size: 25px; margin-bottom: 3px; }
|
||||
.invoice-info { width: 20%; text-align: right; vertical-align: top; font-size: 12px; }
|
||||
/** Sección de Información **/
|
||||
.info-section { border: 1px solid black; border-collapse: collapse; width: 100%; table-layout: fixed; }
|
||||
.clave-section { border: 0.5px solid black; border-collapse: collapse; width: 100%; table-layout: fixed; padding-bottom: 15px; }
|
||||
/** Información del Proveedor **/
|
||||
.proveedor-info { width: 100%; }
|
||||
.provedor-info table { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
||||
.p-field { width: 100px; background-color: #d0d0d0; font-weight: bold; text-align: center; font-size: 12px; }
|
||||
.field { border-bottom: 0.5px solid #000; padding: 5px; font-size: 12px; }
|
||||
/** Fechas **/
|
||||
.dates-info { width: 25%; border: 1px solid #000; }
|
||||
.dates-info table { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
||||
.d-field { background-color: #d0d0d0; font-weight: bold; text-align: center; font-size: 12px; }
|
||||
.date { font-weight: bold; text-align: center; font-size: 12px; padding: 7.5px; }
|
||||
/** Partidas **/
|
||||
.products-table { border-collapse: collapse; border: 0.5px solid #000; }
|
||||
.products-table td { border: 0.5px solid #000; padding: 10px; text-align: center; font-size: 10px; }
|
||||
.products-table th { border: 0.5px solid #000; padding: 5px; background-color: #d0d0d0; font-weight: bold; text-align: center; }
|
||||
.text-center { text-align: center; }
|
||||
.text-right { text-align: right; }
|
||||
.font-bold { font-weight: bold; }
|
||||
/** Total **/
|
||||
.totals-section { float: right; width: 250px; }
|
||||
.total-row { display: flex; justify-content: space-between; margin-top: 25px; font-size: 12px; }
|
||||
/** Nota inferior **/
|
||||
.footer-info { }
|
||||
.footer-note { font-size: 10px; background-color: #d0d0d0; padding: 5px; border: 0.5px solid #000; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- ENCABEZADO -->
|
||||
<table class="header" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td class="logo-section">
|
||||
<img src="' . htmlspecialchars($configuracion['logo_url'] ?? 'assets/img/logo_siih.png') . '" alt="Logo" class="logo"><br>
|
||||
</td>
|
||||
<td class="company-info">
|
||||
<div class="company-name">' . htmlspecialchars($solicitud['importador_nombre']) . '</div>
|
||||
<div>' . htmlspecialchars($direccion_completa ?: 'Dirección no disponible') . '</div>
|
||||
<div>RFC: ' . htmlspecialchars($solicitud['importador_rfc'] ?? 'No disponible') . '</div>
|
||||
<div>Tel: ' . htmlspecialchars($solicitud['telefono'] ?? 'No disponible') . '</div>
|
||||
<div>Email: ' . htmlspecialchars($solicitud['correo'] ?? 'No disponible') . '</div>
|
||||
</td>
|
||||
<td class="invoice-info">
|
||||
<div><strong>' . htmlspecialchars($configuracion['nombre_plataforma'] ?? 'Sistema Integral para Importadores de Hidrocarburos') . '</strong></div><br>
|
||||
<div class="invoice-title">Solicitud de Importación</div>
|
||||
<div><strong>No. ' . htmlspecialchars($solicitud['id_solicitud']) . '</strong></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Solicitud de Importación</title>
|
||||
<style>
|
||||
body { font-family: Arial, sans-serif; font-size: 9px; margin: 0; padding: 15px; line-height: 1.2; }
|
||||
/** Encabezado **/
|
||||
.header { padding-bottom: 50px; }
|
||||
.logo-section { width: 20%; text-align: left; }
|
||||
.logo { max-width: 125px; height: auto; vertical-align: top; }
|
||||
.company-info { width: 60%; text-align: center; vertical-align: top; font-size: 12px; }
|
||||
.company-name { font-weight: bold; font-size: 25px; margin-bottom: 3px; }
|
||||
.invoice-info { width: 20%; text-align: right; vertical-align: top; font-size: 12px; }
|
||||
/** Sección de Información **/
|
||||
.info-section { border: 1px solid black; border-collapse: collapse; width: 100%; table-layout: fixed; }
|
||||
.clave-section { border: 0.5px solid black; border-collapse: collapse; width: 100%; table-layout: fixed; padding-bottom: 15px; }
|
||||
/** Información del Proveedor **/
|
||||
.proveedor-info { width: 100%; }
|
||||
.provedor-info table { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
||||
.p-field { width: 100px; background-color: #d0d0d0; font-weight: bold; text-align: center; font-size: 12px; }
|
||||
.field { border-bottom: 0.5px solid #000; padding: 5px; font-size: 12px; }
|
||||
/** Fechas **/
|
||||
.dates-info { width: 25%; border: 1px solid #000; }
|
||||
.dates-info table { width: 100%; border-collapse: collapse; table-layout: fixed; }
|
||||
.d-field { background-color: #d0d0d0; font-weight: bold; text-align: center; font-size: 12px; }
|
||||
.date { font-weight: bold; text-align: center; font-size: 12px; padding: 7.5px; }
|
||||
/** Partidas **/
|
||||
.products-table { border-collapse: collapse; border: 0.5px solid #000; }
|
||||
.products-table td { border: 0.5px solid #000; padding: 10px; text-align: center; font-size: 10px; }
|
||||
.products-table th { border: 0.5px solid #000; padding: 5px; background-color: #d0d0d0; font-weight: bold; text-align: center; }
|
||||
.text-center { text-align: center; }
|
||||
.text-right { text-align: right; }
|
||||
.font-bold { font-weight: bold; }
|
||||
/** Total **/
|
||||
.totals-section { float: right; width: 250px; }
|
||||
.total-row { display: flex; justify-content: space-between; margin-top: 25px; font-size: 12px; }
|
||||
/** Nota inferior **/
|
||||
.footer-info { }
|
||||
.footer-note { font-size: 10px; background-color: #d0d0d0; padding: 5px; border: 0.5px solid #000; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<!-- ENCABEZADO -->
|
||||
<table class="header" cellspacing="0" cellpadding="0" width="100%">
|
||||
<tr>
|
||||
<td class="logo-section">
|
||||
<img src="' . htmlspecialchars($configuracion['logo_url'] ?? 'assets/img/logo_siih.png') . '" alt="Logo" class="logo"><br>
|
||||
</td>
|
||||
<td class="company-info">
|
||||
<div class="company-name">' . htmlspecialchars($solicitud['importador_nombre']) . '</div>
|
||||
<div>' . htmlspecialchars($direccion_completa ?: 'Dirección no disponible') . '</div>
|
||||
<div>RFC: ' . htmlspecialchars($solicitud['importador_rfc'] ?? 'No disponible') . '</div>
|
||||
<div>Tel: ' . htmlspecialchars($solicitud['telefono'] ?? 'No disponible') . '</div>
|
||||
<div>Email: ' . htmlspecialchars($solicitud['correo'] ?? 'No disponible') . '</div>
|
||||
</td>
|
||||
<td class="invoice-info">
|
||||
<div><strong>' . htmlspecialchars($configuracion['nombre_plataforma'] ?? 'Sistema Integral para Importadores de Hidrocarburos') . '</strong></div><br>
|
||||
<div class="invoice-title">Solicitud de Importación</div>
|
||||
<div><strong>No. ' . htmlspecialchars($solicitud['id_solicitud']) . '</strong></div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- SECCIÓN DE INFORMACIÓN DEL PROVEEDOR Y FECHAS -->
|
||||
<table class="info-section" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<!-- PROVEEDOR -->
|
||||
<td>
|
||||
<table class="proveedor-info" cellspacing="0" cellpadding="0">
|
||||
<!-- SECCIÓN DE INFORMACIÓN DEL PROVEEDOR Y FECHAS -->
|
||||
<table class="info-section" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<!-- PROVEEDOR -->
|
||||
<td>
|
||||
<table class="proveedor-info" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="p-field">RAZÓN SOCIAL:</td>
|
||||
<td class="field">' . htmlspecialchars($proveedor_nombre) . '</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="proveedor-info" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="p-field" style="height: 45px;">DIRECCIÓN:</td>
|
||||
<td class="field">' . htmlspecialchars($proveedor_direccion) . '</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="proveedor-info" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="p-field">RFC:</td>
|
||||
<td class="field" style="border-bottom: none;">' . htmlspecialchars($proveedor_rfc) . '</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<!-- FECHAS -->
|
||||
<td class="dates-info">
|
||||
<table cellspacing="0" cellpadding="2">
|
||||
<tr><td class="d-field" style="border-left: 0.5px solid black;">FECHA DE EXPEDICIÓN</td></tr>
|
||||
<tr><td class="date" style="border-bottom: 0.5px solid black;">' . $fecha_expedicion . '</td></tr>
|
||||
<tr><td class="d-field" style="border-left: 0.5px solid black;">FECHA DE VENCIMIENTO</td></tr>
|
||||
<tr><td class="date">' . $fecha_vencimiento . '</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="clave-section" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="p-field">CLAVE:</td>
|
||||
<td class="field" style="border-bottom: none;">' . htmlspecialchars($solicitud['proveedor_clave'] ?? 'No disponible') . '</td>
|
||||
<td class="p-field">TELÉFONO:</td>
|
||||
<td class="field" style="border-bottom: none;">' . htmlspecialchars($proveedor_telefono) . '</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- TABLA DE PRODUCTOS/PARTIDAS -->
|
||||
<table class="products-table" cellspacing="0" cellpadding="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="p-field">RAZÓN SOCIAL:</td>
|
||||
<td class="field">' . htmlspecialchars($proveedor_nombre) . '</td>
|
||||
<th>Producto</th>
|
||||
<th>Unidad de Medida</th>
|
||||
<th>Precio Unitario</th>
|
||||
<th>Cantidad</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="proveedor-info" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="p-field" style="height: 45px;">DIRECCIÓN:</td>
|
||||
<td class="field">' . htmlspecialchars($proveedor_direccion) . '</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="proveedor-info" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="p-field">RFC:</td>
|
||||
<td class="field" style="border-bottom: none;">' . htmlspecialchars($proveedor_rfc) . '</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
<!-- FECHAS -->
|
||||
<td class="dates-info">
|
||||
<table cellspacing="0" cellpadding="2">
|
||||
<tr><td class="d-field" style="border-left: 0.5px solid black;">FECHA DE EXPEDICIÓN</td></tr>
|
||||
<tr><td class="date" style="border-bottom: 0.5px solid black;">' . $fecha_expedicion . '</td></tr>
|
||||
<tr><td class="d-field" style="border-left: 0.5px solid black;">FECHA DE VENCIMIENTO</td></tr>
|
||||
<tr><td class="date">' . $fecha_vencimiento . '</td></tr>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table class="clave-section" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td class="p-field">CLAVE:</td>
|
||||
<td class="field" style="border-bottom: none;">' . htmlspecialchars($solicitud['proveedor_clave'] ?? 'No disponible') . '</td>
|
||||
<td class="p-field">TELÉFONO:</td>
|
||||
<td class="field" style="border-bottom: none;">' . htmlspecialchars($proveedor_telefono) . '</td>
|
||||
</tr>
|
||||
</table>
|
||||
</thead>
|
||||
<tbody>';
|
||||
|
||||
<!-- TABLA DE PRODUCTOS/PARTIDAS -->
|
||||
<table class="products-table" cellspacing="0" cellpadding="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Producto</th>
|
||||
<th>Unidad de Medida</th>
|
||||
<th>Precio Unitario</th>
|
||||
<th>Cantidad</th>
|
||||
<th>Total</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>';
|
||||
// Agregar partidas
|
||||
foreach ($partidas as $partida) {
|
||||
$precio_unitario = (float)($partida['precio_unitario'] ?? 0);
|
||||
$cantidad = (float)($partida['cantidad_comercial'] ?? 0);
|
||||
$valor_partida = (float)($partida['valor_factura'] ?? 0);
|
||||
|
||||
$html .= '
|
||||
<tr>
|
||||
<td>' . htmlspecialchars($partida['descripcion']) . '</td>
|
||||
<td>' . htmlspecialchars($partida['unidad_descripcion'] ?? 'Unidad de servicio (E48)') . '</td>
|
||||
<td>' . $moneda_codigo . ' ' . number_format($precio_unitario > 0 ? $precio_unitario : $valor_partida, 2) . '</td>
|
||||
<td>' . number_format($cantidad > 0 ? $cantidad : 1, 0) . '</td>
|
||||
<td>' . $moneda_codigo . ' ' . number_format($valor_partida, 2) . '</td>
|
||||
</tr>';
|
||||
}
|
||||
|
||||
// Agregar partidas
|
||||
foreach ($partidas as $partida) {
|
||||
$precio_unitario = (float)($partida['precio_unitario'] ?? 0);
|
||||
$cantidad = (float)($partida['cantidad_comercial'] ?? 0);
|
||||
$valor_partida = (float)($partida['valor_factura'] ?? 0);
|
||||
|
||||
$html .= '
|
||||
<tr>
|
||||
<td>' . htmlspecialchars($partida['descripcion']) . '</td>
|
||||
<td>' . htmlspecialchars($partida['unidad_descripcion'] ?? 'Unidad de servicio (E48)') . '</td>
|
||||
<td>' . $moneda_codigo . ' ' . number_format($precio_unitario > 0 ? $precio_unitario : $valor_partida, 2) . '</td>
|
||||
<td>' . number_format($cantidad > 0 ? $cantidad : 1, 0) . '</td>
|
||||
<td>' . $moneda_codigo . ' ' . number_format($valor_partida, 2) . '</td>
|
||||
</tr>';
|
||||
}
|
||||
$html .= '
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
$html .= '
|
||||
</tbody>
|
||||
</table>
|
||||
<!-- NOTA INFERIOR -->
|
||||
<div class="footer-info">
|
||||
<div class="footer-note">' . $total_texto . '</div>
|
||||
</div>
|
||||
|
||||
<!-- NOTA INFERIOR -->
|
||||
<div class="footer-info">
|
||||
<div class="footer-note">' . $total_texto . '</div>
|
||||
</div>
|
||||
<!-- TOTALES -->
|
||||
<div class="totals-section">
|
||||
<div class="total-row text-right">
|
||||
<span><strong>Total:</strong></span>
|
||||
<span><strong>' . $moneda_codigo . ' ' . number_format($total, 2) . '</strong></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TOTALES -->
|
||||
<div class="totals-section">
|
||||
<div class="total-row text-right">
|
||||
<span><strong>Total:</strong></span>
|
||||
<span><strong>' . $moneda_codigo . ' ' . number_format($total, 2) . '</strong></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>';
|
||||
</body>
|
||||
</html>
|
||||
';
|
||||
|
||||
return $html;
|
||||
}
|
||||
Reference in New Issue
Block a user