seccion expediente electronico
This commit is contained in:
@@ -89,7 +89,7 @@ function lista() {
|
||||
LEFT JOIN dbo.choferes c
|
||||
ON f.chofer_id = c.id_chofer
|
||||
WHERE f.id_importador = ?
|
||||
AND f.status = 1
|
||||
AND f.status >= 1
|
||||
ORDER BY f.created_at DESC
|
||||
";
|
||||
$stmt = sqlsrv_query($conn, $sql, [$id_importador]);
|
||||
@@ -169,6 +169,7 @@ function guardar() {
|
||||
$transportista_id = $_POST['transportista_id'] ?? null;
|
||||
$chofer_id = $_POST['chofer_id'] ?? null;
|
||||
$status = isset($_POST['status']) ? 1 : 0;
|
||||
$proveedor_clave = trim($_POST['proveedor_id'] ?? '');
|
||||
|
||||
if (empty($num_factura) || empty($fecha) || empty($transportista_id) || empty($chofer_id)) {
|
||||
die("❌ Faltan campos obligatorios.");
|
||||
@@ -187,7 +188,7 @@ function guardar() {
|
||||
|
||||
$conn = getConnection();
|
||||
|
||||
$params=[
|
||||
$params = [
|
||||
$id_importador,
|
||||
$aduana_seccion,
|
||||
$aduana_seccion,
|
||||
@@ -201,15 +202,19 @@ function guardar() {
|
||||
(int)$transportista_id,
|
||||
(int)$chofer_id,
|
||||
$fotoUrl,
|
||||
$status
|
||||
];
|
||||
$status,
|
||||
$proveedor_clave
|
||||
];
|
||||
|
||||
|
||||
$sql = "INSERT INTO dbo.solicitud_importacion_factura
|
||||
(id_importador, aduana, anexo22_apendice, numero_factura, fecha_factura,
|
||||
numero_pedimento, incoterm, pais_proveedor, tipo_moneda,
|
||||
valor_factura, vinculacion, transportista_id, chofer_id, foto_solicitud_url, status)
|
||||
OUTPUT INSERTED.id_solicitud
|
||||
VALUES (?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
$sql = "INSERT INTO dbo.solicitud_importacion_factura
|
||||
(id_importador, aduana, anexo22_apendice, numero_factura, fecha_factura,
|
||||
numero_pedimento, incoterm, pais_proveedor, tipo_moneda,
|
||||
valor_factura, vinculacion, transportista_id, chofer_id,
|
||||
foto_solicitud_url, status, proveedor_clave)
|
||||
OUTPUT INSERTED.id_solicitud
|
||||
VALUES(?, ?, ?, ?, ?, NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
;
|
||||
|
||||
$stmt = sqlsrv_query($conn, $sql, $params, ['Scrollable' => SQLSRV_CURSOR_KEYSET]);
|
||||
if ($stmt === false) {
|
||||
@@ -461,3 +466,29 @@ function ajax_lista()
|
||||
}
|
||||
|
||||
|
||||
function update_status() {
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
if (!($_SESSION['usuario_id'] ?? false)) {
|
||||
http_response_code(401);
|
||||
echo json_encode(['error'=>'No autorizado']);
|
||||
exit;
|
||||
}
|
||||
$id = intval($_POST['id'] ?? 0);
|
||||
$status = intval($_POST['status'] ?? 0);
|
||||
$conn = getConnection();
|
||||
$sql = "UPDATE dbo.solicitud_importacion_factura
|
||||
SET status=?
|
||||
WHERE id_solicitud=? AND id_importador=?";
|
||||
$params = [$status, $id, $_SESSION['usuario_id']];
|
||||
$stmt = sqlsrv_query($conn, $sql, $params);
|
||||
if ($stmt === false) {
|
||||
http_response_code(500);
|
||||
echo json_encode(['error'=>'Error al actualizar status']);
|
||||
exit;
|
||||
}
|
||||
echo json_encode(['success'=>true]);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user