702 lines
36 KiB
PHP
702 lines
36 KiB
PHP
<?php include __DIR__ . '/../partials/sidebar_importador.php'; ?>
|
|
|
|
<!DOCTYPE html>
|
|
<html lang="es">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>📄 Manifestación de Valor - Pedimentos</title>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
|
<link href="https://cdn.datatables.net/1.13.4/css/jquery.dataTables.min.css" rel="stylesheet">
|
|
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
|
|
<script src="https://cdn.datatables.net/1.13.4/js/jquery.dataTables.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
|
|
<style>
|
|
table.dataTable thead th { background:#343a40; color:#fff; }
|
|
body { font-family: 'Segoe UI', sans-serif; background-color: #f4f6f9; }
|
|
.sidebar { width: 220px; height: 100vh; background-color: #343a40; position: fixed; top: 0; left: 0; padding-top: 56px; z-index: 1040; }
|
|
.sidebar .nav-link { font-weight: bold; color: white; transition: all 0.3s ease; }
|
|
.sidebar .nav-link:hover, .sidebar .nav-link.active { background-color: #495057; color: #fff; }
|
|
.content { margin-top: 56px; padding: 40px 20px; position: relative; z-index: 1; background-color: #f4f6f9; transition: margin-left 0.3s ease;}
|
|
@media (min-width: 768px) { .content { margin-left: 250px; } }
|
|
@media (max-width: 767.98px) {
|
|
.content { margin-left: 0; }
|
|
.sidebar .nav-link { font-weight: normal; color: #343a40; background-color: transparent; }
|
|
.sidebar .nav-link:hover, .sidebar .nav-link.active { background-color: #e9ecef; color: #212529; }
|
|
}
|
|
.card { border-radius: 12px; }
|
|
.card-hover { transition: all 0.3s ease; cursor: pointer; }
|
|
.card-hover:hover { transform: translateY(-8px) scale(1.02); box-shadow: 0 1rem 2rem rgba(0, 0, 0, 0.15) !important; }
|
|
.fade-in-up { animation: fadeInUp 0.8s ease-out; }
|
|
@keyframes fadeInUp {
|
|
from { opacity: 0; transform: translateY(30px); }
|
|
to { opacity: 1; transform: translateY(0); }
|
|
}
|
|
.btn-animated { transition: all 0.3s ease; position: relative; overflow: hidden; }
|
|
.btn-animated:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2); }
|
|
.btn-animated::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent); transition: left 0.5s; }
|
|
.btn-animated:hover::before { left: 100%; }
|
|
|
|
/* Estilos para facturas seleccionables */
|
|
.factura-item {
|
|
border: 1px solid #dee2e6;
|
|
border-radius: 8px;
|
|
padding: 12px;
|
|
margin-bottom: 8px;
|
|
cursor: pointer;
|
|
transition: all 0.3s ease;
|
|
background-color: #fff;
|
|
}
|
|
.factura-item:hover {
|
|
border-color: #0d6efd;
|
|
box-shadow: 0 2px 8px rgba(13, 110, 253, 0.15);
|
|
transform: translateY(-2px);
|
|
}
|
|
.factura-item.selected {
|
|
border-color: #198754;
|
|
background-color: #d1e7dd;
|
|
box-shadow: 0 3px 10px rgba(25, 135, 84, 0.2);
|
|
}
|
|
.factura-numero {
|
|
font-weight: bold;
|
|
color: #0d6efd;
|
|
font-size: 1.1em;
|
|
}
|
|
.factura-item.selected .factura-numero {
|
|
color: #198754;
|
|
}
|
|
.factura-details {
|
|
font-size: 0.9em;
|
|
color: #6c757d;
|
|
margin-top: 4px;
|
|
}
|
|
.factura-item.selected .factura-details {
|
|
color: #495057;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="content">
|
|
<div class="d-flex justify-content-between align-items-center mb-4">
|
|
<h4 class="animate__animated animate__fadeInDown title-glow">📄 Manifestación de Valor - Pedimentos</h4>
|
|
</div>
|
|
<div class="card p-3 shadow-sm card-hover position-relative h-auto fade-in-up">
|
|
<div class="table-responsive">
|
|
<table id="tablaMvePedimentos" class="display nowrap" style="width:100%">
|
|
<thead>
|
|
<tr>
|
|
<th>ID</th>
|
|
<th>Pedimento</th>
|
|
<th>RFC Cliente</th>
|
|
<th>Nombre Cliente</th>
|
|
<th>Fecha Registro</th>
|
|
<th>Estado</th>
|
|
<th>Acción</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<!-- Los datos se cargan via AJAX -->
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Modal para facturas relacionadas -->
|
|
<div class="modal fade" id="modalFacturasMVE" tabindex="-1" aria-labelledby="modalFacturasMVELabel" aria-hidden="true">
|
|
<div class="modal-dialog modal-xl">
|
|
<div class="modal-content">
|
|
<div class="modal-header bg-primary text-white">
|
|
<h5 class="modal-title" id="modalFacturasMVELabel">Manifestación de Valor - Pedimento <span id="modalPedimento"></span></h5>
|
|
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Cerrar"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="row">
|
|
<div class="col-md-4">
|
|
<div class="card">
|
|
<div class="card-header bg-info text-white">
|
|
<h6 class="mb-0">Facturas del Pedimento</h6>
|
|
</div>
|
|
<div class="card-body" style="max-height: 400px; overflow-y: auto;">
|
|
<div id="facturasRelacionadasContainer">
|
|
<!-- Aquí se cargan las facturas -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-8">
|
|
<div class="card">
|
|
<div class="card-header bg-success text-white d-flex justify-content-between align-items-center">
|
|
<h6 class="mb-0">Catálogo COVE - Factura <span id="facturaSeleccionada">Seleccionar factura</span></h6>
|
|
<div>
|
|
<button class="btn btn-sm btn-outline-light" id="btnArt65">Art. 65 - Incrementables</button>
|
|
<button class="btn btn-sm btn-light" id="btnArt66">Art. 66 - Decrementables</button>
|
|
</div>
|
|
</div>
|
|
<div class="card-body" style="max-height: 500px; overflow-y: auto;">
|
|
<!-- Campos Art. 65 - Incrementables -->
|
|
<div id="art65Section">
|
|
<h6 class="text-success fw-bold mb-3">Artículo 65 - Incrementables</h6>
|
|
|
|
<!-- Gastos realizados por cuenta del Importador -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Gastos de transporte, seguros y conexos (carga y descarga) erogados con posterioridad:</label>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_transporte" id="fecha_transporte">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_transporte" id="importe_transporte">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Información de descuentos especiales -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Información de descuentos especiales para aplicar en el momento de la compraventa:</label>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_descuentos" id="fecha_descuentos">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_descuentos" id="importe_descuentos">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Gastos posteriores a la importación -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Gastos posteriores a la importación por construcción, instalación, armado, montaje, mantenimiento o asistencia técnica:</label>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_posteriores" id="fecha_posteriores">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_posteriores" id="importe_posteriores">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Contribuciones y cuotas compensatorias -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Contribuciones y cuotas compensatorias aplicables en territorio nacional:</label>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_contribuciones" id="fecha_contribuciones">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_contribuciones" id="importe_contribuciones">
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Pagos de importador al vendedor -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Pagos de importador al vendedor por dividendos u otros que no guarden relación directa con las mercancías importadas:</label>
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_pagos_vendedor" id="fecha_pagos_vendedor">
|
|
</div>
|
|
<div class="col-md-4">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_pagos_vendedor" id="importe_pagos_vendedor">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Campos Art. 66 - Decrementables -->
|
|
<div id="art66Section" style="display: none;">
|
|
<h6 class="text-primary fw-bold mb-3">Artículo 66 - Decrementables</h6>
|
|
|
|
<!-- Comisiones y gastos de corretaje -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Comisiones y gastos de corretaje, excepto comisiones de compra:</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_comisiones" id="fecha_comisiones">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_comisiones" id="importe_comisiones">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">¿Está a cargo del importador?:</label>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_comisiones" id="cargo_comisiones_si" value="Si">
|
|
<label class="form-check-label" for="cargo_comisiones_si">Sí</label>
|
|
</div>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_comisiones" id="cargo_comisiones_no" value="No">
|
|
<label class="form-check-label" for="cargo_comisiones_no">No</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Costos de envases -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Costo de los envases o embalajes que formen un todo con las mercancías:</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_envases" id="fecha_envases">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_envases" id="importe_envases">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">¿Está a cargo del importador?:</label>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_envases" id="cargo_envases_si" value="Si">
|
|
<label class="form-check-label" for="cargo_envases_si">Sí</label>
|
|
</div>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_envases" id="cargo_envases_no" value="No">
|
|
<label class="form-check-label" for="cargo_envases_no">No</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Gastos de embalaje -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Gastos de embalaje (mano de obra y/o materiales):</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_embalaje" id="fecha_embalaje">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_embalaje" id="importe_embalaje">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">¿Está a cargo del importador?:</label>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_embalaje" id="cargo_embalaje_si" value="Si">
|
|
<label class="form-check-label" for="cargo_embalaje_si">Sí</label>
|
|
</div>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_embalaje" id="cargo_embalaje_no" value="No">
|
|
<label class="form-check-label" for="cargo_embalaje_no">No</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Gastos de transporte, seguros y conexos -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Gastos de transporte, seguros y conexos (como manejo, carga y descarga) erogados antes de los momentos señalados en el artículo 56, fracción I de la Ley:</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_transporte_dec" id="fecha_transporte_dec">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_transporte_dec" id="importe_transporte_dec">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">¿Está a cargo del importador?:</label>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_transporte_dec" id="cargo_transporte_dec_si" value="Si">
|
|
<label class="form-check-label" for="cargo_transporte_dec_si">Sí</label>
|
|
</div>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_transporte_dec" id="cargo_transporte_dec_no" value="No">
|
|
<label class="form-check-label" for="cargo_transporte_dec_no">No</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Trabajos de ingeniería -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Trabajos de ingeniería, creación y perfeccionamiento, artísticos, diseños, planos y croquis realizados fuera del territorio nacional que sean necesarios para la producción de las mercancías importadas:</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_ingenieria" id="fecha_ingenieria">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_ingenieria" id="importe_ingenieria">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">¿Está a cargo del importador?:</label>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_ingenieria" id="cargo_ingenieria_si" value="Si">
|
|
<label class="form-check-label" for="cargo_ingenieria_si">Sí</label>
|
|
</div>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_ingenieria" id="cargo_ingenieria_no" value="No">
|
|
<label class="form-check-label" for="cargo_ingenieria_no">No</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Regalías y derechos de licencia -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Las regalías y derechos de licencia a pagar como condición de la venta de las mercancías a importar, que no estén incluidos en el precio pagado:</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_regalias" id="fecha_regalias">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_regalias" id="importe_regalias">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">¿Está a cargo del importador?:</label>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_regalias" id="cargo_regalias_si" value="Si">
|
|
<label class="form-check-label" for="cargo_regalias_si">Sí</label>
|
|
</div>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_regalias" id="cargo_regalias_no" value="No">
|
|
<label class="form-check-label" for="cargo_regalias_no">No</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Valor de cualquier parte del producto -->
|
|
<div class="row mb-3">
|
|
<div class="col-12">
|
|
<label class="form-label fw-bold">Valor de cualquier parte del producto de la enajenación, cesión o utilización, posteriores a la importación, que se revierta directa o indirectamente al vendedor:</label>
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Fecha de erogación:</label>
|
|
<input type="date" class="form-control" name="fecha_producto" id="fecha_producto">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">Importe (MN):</label>
|
|
<input type="number" step="0.01" class="form-control" name="importe_producto" id="importe_producto">
|
|
</div>
|
|
<div class="col-md-3">
|
|
<label class="form-label">¿Está a cargo del importador?:</label>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_producto" id="cargo_producto_si" value="Si">
|
|
<label class="form-check-label" for="cargo_producto_si">Sí</label>
|
|
</div>
|
|
<div class="form-check form-check-inline">
|
|
<input class="form-check-input" type="radio" name="cargo_producto" id="cargo_producto_no" value="No">
|
|
<label class="form-check-label" for="cargo_producto_no">No</label>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="mt-3">
|
|
<button type="button" class="btn btn-primary" id="btnGuardarDatosMVE">
|
|
<i class="fas fa-save me-1"></i>Guardar datos MVE
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancelar</button>
|
|
<button type="button" class="btn btn-success" id="btnConfirmarMVE">Solicitar Manifestación ahora</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
|
|
<script>
|
|
$(document).ready(function() {
|
|
var pedimentoSeleccionado = null;
|
|
var facturaSeleccionadaId = null;
|
|
|
|
var tabla = $('#tablaMvePedimentos').DataTable({
|
|
"processing": true,
|
|
"serverSide": true,
|
|
"searchDelay": 500,
|
|
"deferRender": true,
|
|
"ajax": {
|
|
"url": "/IMPORTADORES/catalogo_pedimentos/ajax_lista",
|
|
"type": "GET"
|
|
},
|
|
"columns": [
|
|
{ "data": 0, "name": "IdPrevio" },
|
|
{ "data": 1, "name": "Pedimento" },
|
|
{ "data": 2, "name": "ClienteRFC" },
|
|
{ "data": 3, "name": "ClienteNombre" },
|
|
{ "data": 4, "name": "Timestamp" },
|
|
{
|
|
"data": 5,
|
|
"name": "Status",
|
|
"render": function(data, type, row) {
|
|
if (data === 'Activo') {
|
|
return '<span class="badge bg-success">Activo</span>';
|
|
} else {
|
|
return '<span class="badge bg-secondary">Inactivo</span>';
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"data": null,
|
|
"orderable": false,
|
|
"searchable": false,
|
|
"render": function(data, type, row) {
|
|
const id = row[0];
|
|
const pedimento = row[1];
|
|
return `<button class='btn btn-info btn-sm btn-animated' onclick='abrirModalFacturasMVE(${JSON.stringify(id)}, ${JSON.stringify(pedimento)})'>
|
|
<i class='fas fa-file-invoice-dollar me-1'></i>Solicitar MVE
|
|
</button>`;
|
|
}
|
|
}
|
|
],
|
|
"language": {
|
|
"url": "https://cdn.datatables.net/plug-ins/1.13.4/i18n/es-ES.json"
|
|
},
|
|
"responsive": true,
|
|
"order": [[4, "desc"]],
|
|
"pageLength": 25,
|
|
"lengthMenu": [[10, 25, 50, 100], [10, 25, 50, 100]]
|
|
});
|
|
|
|
window.abrirModalFacturasMVE = function(id, pedimento) {
|
|
pedimentoSeleccionado = id;
|
|
$('#modalPedimento').text(pedimento);
|
|
$('#facturasRelacionadasContainer').html('<div class="text-center py-3"><div class="spinner-border text-primary"></div><div class="mt-2">Cargando facturas...</div></div>');
|
|
$.ajax({
|
|
url: '/IMPORTADORES/solicitud_importacion/ajax_facturas_por_pedimento',
|
|
method: 'GET',
|
|
data: { id_pedimento: id },
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
if (response.success && response.facturas && response.facturas.length > 0) {
|
|
var html = '';
|
|
response.facturas.forEach(function(f) {
|
|
html += `<div class="factura-item" onclick="seleccionarFactura('${f.numero_factura}', ${f.id_factura})">
|
|
<div class="factura-numero">${f.numero_factura}</div>
|
|
<div class="factura-details">Fecha: ${f.fecha} | Monto: $${parseFloat(f.monto).toLocaleString()}</div>
|
|
</div>`;
|
|
});
|
|
$('#facturasRelacionadasContainer').html(html);
|
|
} else {
|
|
$('#facturasRelacionadasContainer').html('<div class="alert alert-warning">No hay facturas relacionadas a este pedimento.</div>');
|
|
}
|
|
},
|
|
error: function() {
|
|
$('#facturasRelacionadasContainer').html('<div class="alert alert-danger">Error al cargar facturas.</div>');
|
|
}
|
|
});
|
|
var modal = new bootstrap.Modal(document.getElementById('modalFacturasMVE'));
|
|
modal.show();
|
|
};
|
|
|
|
window.seleccionarFactura = function(numeroFactura, idFactura) {
|
|
if (!idFactura || idFactura === 'undefined' || idFactura === 'null') {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Error',
|
|
text: 'ID de factura no válido.',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
return;
|
|
}
|
|
|
|
facturaSeleccionadaId = parseInt(idFactura);
|
|
$('#facturaSeleccionada').text(numeroFactura);
|
|
$('.factura-item').removeClass('selected');
|
|
$(`.factura-item:contains(${numeroFactura})`).addClass('selected');
|
|
$('#facturaSeleccionada').removeClass('text-muted').addClass('text-success fw-bold');
|
|
cargarDatosMVEFactura(facturaSeleccionadaId);
|
|
};
|
|
|
|
$('#btnArt65').on('click', function() {
|
|
$('#art65Section').show();
|
|
$('#art66Section').hide();
|
|
$('#btnArt65').removeClass('btn-outline-light').addClass('btn-light');
|
|
$('#btnArt66').removeClass('btn-light').addClass('btn-outline-light');
|
|
});
|
|
|
|
$('#btnArt66').on('click', function() {
|
|
$('#art65Section').hide();
|
|
$('#art66Section').show();
|
|
$('#btnArt65').removeClass('btn-light').addClass('btn-outline-light');
|
|
$('#btnArt66').removeClass('btn-outline-light').addClass('btn-light');
|
|
});
|
|
|
|
function cargarDatosMVEFactura(idFactura) {
|
|
$.ajax({
|
|
url: '/IMPORTADORES/mve/ajax_obtener_datos_factura',
|
|
method: 'GET',
|
|
data: { id_factura: idFactura },
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
if (response.success && response.datos) {
|
|
if (response.datos.art65) {
|
|
const art65 = response.datos.art65;
|
|
$('#fecha_transporte').val(art65.fecha_transporte || '');
|
|
$('#importe_transporte').val(art65.importe_transporte || '');
|
|
$('#fecha_descuentos').val(art65.fecha_descuentos || '');
|
|
$('#importe_descuentos').val(art65.importe_descuentos || '');
|
|
$('#fecha_posteriores').val(art65.fecha_posteriores || '');
|
|
$('#importe_posteriores').val(art65.importe_posteriores || '');
|
|
$('#fecha_contribuciones').val(art65.fecha_contribuciones || '');
|
|
$('#importe_contribuciones').val(art65.importe_contribuciones || '');
|
|
$('#fecha_pagos_vendedor').val(art65.fecha_pagos_vendedor || '');
|
|
$('#importe_pagos_vendedor').val(art65.importe_pagos_vendedor || '');
|
|
}
|
|
|
|
if (response.datos.art66) {
|
|
const art66 = response.datos.art66;
|
|
$('#fecha_comisiones').val(art66.fecha_comisiones || '');
|
|
$('#importe_comisiones').val(art66.importe_comisiones || '');
|
|
$('input[name="cargo_comisiones"][value="' + (art66.cargo_comisiones || '') + '"]').prop('checked', true);
|
|
$('#fecha_envases').val(art66.fecha_envases || '');
|
|
$('#importe_envases').val(art66.importe_envases || '');
|
|
$('input[name="cargo_envases"][value="' + (art66.cargo_envases || '') + '"]').prop('checked', true);
|
|
$('#fecha_embalaje').val(art66.fecha_embalaje || '');
|
|
$('#importe_embalaje').val(art66.importe_embalaje || '');
|
|
$('input[name="cargo_embalaje"][value="' + (art66.cargo_embalaje || '') + '"]').prop('checked', true);
|
|
$('#fecha_transporte_dec').val(art66.fecha_transporte_dec || '');
|
|
$('#importe_transporte_dec').val(art66.importe_transporte_dec || '');
|
|
$('input[name="cargo_transporte_dec"][value="' + (art66.cargo_transporte_dec || '') + '"]').prop('checked', true);
|
|
$('#fecha_ingenieria').val(art66.fecha_ingenieria || '');
|
|
$('#importe_ingenieria').val(art66.importe_ingenieria || '');
|
|
$('input[name="cargo_ingenieria"][value="' + (art66.cargo_ingenieria || '') + '"]').prop('checked', true);
|
|
$('#fecha_regalias').val(art66.fecha_regalias || '');
|
|
$('#importe_regalias').val(art66.importe_regalias || '');
|
|
$('input[name="cargo_regalias"][value="' + (art66.cargo_regalias || '') + '"]').prop('checked', true);
|
|
$('#fecha_producto').val(art66.fecha_producto || '');
|
|
$('#importe_producto').val(art66.importe_producto || '');
|
|
$('input[name="cargo_producto"][value="' + (art66.cargo_producto || '') + '"]').prop('checked', true);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
$('#btnGuardarDatosMVE').on('click', function() {
|
|
if (!facturaSeleccionadaId) {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Seleccionar factura',
|
|
text: 'Por favor selecciona una factura primero.',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
return;
|
|
}
|
|
|
|
if (!pedimentoSeleccionado) {
|
|
Swal.fire({
|
|
icon: 'warning',
|
|
title: 'Error',
|
|
text: 'No se ha seleccionado un pedimento válido.',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
return;
|
|
}
|
|
|
|
const datosArt65 = {
|
|
fecha_transporte: $('#fecha_transporte').val(),
|
|
importe_transporte: $('#importe_transporte').val(),
|
|
fecha_descuentos: $('#fecha_descuentos').val(),
|
|
importe_descuentos: $('#importe_descuentos').val(),
|
|
fecha_posteriores: $('#fecha_posteriores').val(),
|
|
importe_posteriores: $('#importe_posteriores').val(),
|
|
fecha_contribuciones: $('#fecha_contribuciones').val(),
|
|
importe_contribuciones: $('#importe_contribuciones').val(),
|
|
fecha_pagos_vendedor: $('#fecha_pagos_vendedor').val(),
|
|
importe_pagos_vendedor: $('#importe_pagos_vendedor').val()
|
|
};
|
|
|
|
const datosArt66 = {
|
|
fecha_comisiones: $('#fecha_comisiones').val(),
|
|
importe_comisiones: $('#importe_comisiones').val(),
|
|
cargo_comisiones: $('input[name="cargo_comisiones"]:checked').val(),
|
|
fecha_envases: $('#fecha_envases').val(),
|
|
importe_envases: $('#importe_envases').val(),
|
|
cargo_envases: $('input[name="cargo_envases"]:checked').val(),
|
|
fecha_embalaje: $('#fecha_embalaje').val(),
|
|
importe_embalaje: $('#importe_embalaje').val(),
|
|
cargo_embalaje: $('input[name="cargo_embalaje"]:checked').val(),
|
|
fecha_transporte_dec: $('#fecha_transporte_dec').val(),
|
|
importe_transporte_dec: $('#importe_transporte_dec').val(),
|
|
cargo_transporte_dec: $('input[name="cargo_transporte_dec"]:checked').val(),
|
|
fecha_ingenieria: $('#fecha_ingenieria').val(),
|
|
importe_ingenieria: $('#importe_ingenieria').val(),
|
|
cargo_ingenieria: $('input[name="cargo_ingenieria"]:checked').val(),
|
|
fecha_regalias: $('#fecha_regalias').val(),
|
|
importe_regalias: $('#importe_regalias').val(),
|
|
cargo_regalias: $('input[name="cargo_regalias"]:checked').val(),
|
|
fecha_producto: $('#fecha_producto').val(),
|
|
importe_producto: $('#importe_producto').val(),
|
|
cargo_producto: $('input[name="cargo_producto"]:checked').val()
|
|
};
|
|
|
|
$.ajax({
|
|
url: '/IMPORTADORES/mve/ajax_guardar_datos_factura',
|
|
method: 'POST',
|
|
data: {
|
|
id_factura: facturaSeleccionadaId,
|
|
id_pedimento: pedimentoSeleccionado,
|
|
datos_art65: JSON.stringify(datosArt65),
|
|
datos_art66: JSON.stringify(datosArt66)
|
|
},
|
|
dataType: 'json',
|
|
success: function(response) {
|
|
if (response.success) {
|
|
Swal.fire({
|
|
icon: 'success',
|
|
title: 'Datos guardados',
|
|
text: 'Los datos de la Manifestación de Valor han sido guardados correctamente.',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
} else {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Error',
|
|
text: response.message || 'Error al guardar los datos.',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
}
|
|
},
|
|
error: function() {
|
|
Swal.fire({
|
|
icon: 'error',
|
|
title: 'Error',
|
|
text: 'Error de conexión al guardar los datos.',
|
|
confirmButtonText: 'OK'
|
|
});
|
|
}
|
|
});
|
|
});
|
|
|
|
$('#btnConfirmarMVE').on('click', function() {
|
|
$('#modalFacturasMVE').modal('hide');
|
|
Swal.fire({
|
|
icon: 'success',
|
|
title: 'Solicitud enviada',
|
|
text: 'Se ha solicitado la Manifestación de Valor para el pedimento ' + $('#modalPedimento').text(),
|
|
confirmButtonText: 'OK'
|
|
});
|
|
});
|
|
});
|
|
</script>
|
|
</body>
|
|
</html>
|