diff --git a/assets/uploads/vouchers/69975464123ed-060.png b/assets/uploads/vouchers/69975464123ed-060.png new file mode 100644 index 0000000..32bb2d4 Binary files /dev/null and b/assets/uploads/vouchers/69975464123ed-060.png differ diff --git a/assets/uploads/vouchers/6997684ccfa49-5209.png b/assets/uploads/vouchers/6997684ccfa49-5209.png new file mode 100644 index 0000000..be32b1e Binary files /dev/null and b/assets/uploads/vouchers/6997684ccfa49-5209.png differ diff --git a/assets/uploads/vouchers/6997689c14210-795.png b/assets/uploads/vouchers/6997689c14210-795.png new file mode 100644 index 0000000..a830937 Binary files /dev/null and b/assets/uploads/vouchers/6997689c14210-795.png differ diff --git a/assets/uploads/vouchers/69977ef14b814-340.png b/assets/uploads/vouchers/69977ef14b814-340.png new file mode 100644 index 0000000..1e3e70a Binary files /dev/null and b/assets/uploads/vouchers/69977ef14b814-340.png differ diff --git a/assets/uploads/vouchers/69977f59f3508-5054.png b/assets/uploads/vouchers/69977f59f3508-5054.png new file mode 100644 index 0000000..1209d79 Binary files /dev/null and b/assets/uploads/vouchers/69977f59f3508-5054.png differ diff --git a/assets/uploads/vouchers/69977fc996aaf-012.png b/assets/uploads/vouchers/69977fc996aaf-012.png new file mode 100644 index 0000000..5a9d87a Binary files /dev/null and b/assets/uploads/vouchers/69977fc996aaf-012.png differ diff --git a/assets/uploads/vouchers/69979c1eccd74-WhatsApp Image 2026-02-19 at 5.43.17 PM.jpeg b/assets/uploads/vouchers/69979c1eccd74-WhatsApp Image 2026-02-19 at 5.43.17 PM.jpeg new file mode 100644 index 0000000..26fe876 Binary files /dev/null and b/assets/uploads/vouchers/69979c1eccd74-WhatsApp Image 2026-02-19 at 5.43.17 PM.jpeg differ diff --git a/assets/uploads/vouchers/69979e419fbfc-WhatsApp Image 2026-02-19 at 5.46.34 PM.jpeg b/assets/uploads/vouchers/69979e419fbfc-WhatsApp Image 2026-02-19 at 5.46.34 PM.jpeg new file mode 100644 index 0000000..e53ba91 Binary files /dev/null and b/assets/uploads/vouchers/69979e419fbfc-WhatsApp Image 2026-02-19 at 5.46.34 PM.jpeg differ diff --git a/assets/uploads/vouchers/69979fbf1d749-WhatsApp Image 2026-02-19 at 6.12.58 PM.jpeg b/assets/uploads/vouchers/69979fbf1d749-WhatsApp Image 2026-02-19 at 6.12.58 PM.jpeg new file mode 100644 index 0000000..8d318a1 Binary files /dev/null and b/assets/uploads/vouchers/69979fbf1d749-WhatsApp Image 2026-02-19 at 6.12.58 PM.jpeg differ diff --git a/assets/uploads/vouchers/6997a04cbc286-WhatsApp Image 2026-02-19 at 6.16.42 PM.jpeg b/assets/uploads/vouchers/6997a04cbc286-WhatsApp Image 2026-02-19 at 6.16.42 PM.jpeg new file mode 100644 index 0000000..d63602f Binary files /dev/null and b/assets/uploads/vouchers/6997a04cbc286-WhatsApp Image 2026-02-19 at 6.16.42 PM.jpeg differ diff --git a/assets/uploads/vouchers/6997a11567ec6-WhatsApp Image 2026-02-19 at 6.19.11 PM (1).jpeg b/assets/uploads/vouchers/6997a11567ec6-WhatsApp Image 2026-02-19 at 6.19.11 PM (1).jpeg new file mode 100644 index 0000000..13f073a Binary files /dev/null and b/assets/uploads/vouchers/6997a11567ec6-WhatsApp Image 2026-02-19 at 6.19.11 PM (1).jpeg differ diff --git a/assets/uploads/vouchers/6998753bc0004-Screenshot_28.png b/assets/uploads/vouchers/6998753bc0004-Screenshot_28.png new file mode 100644 index 0000000..808a3d7 Binary files /dev/null and b/assets/uploads/vouchers/6998753bc0004-Screenshot_28.png differ diff --git a/assets/uploads/vouchers/69987554c4841-WhatsApp Image 2026-02-20 at 9.49.46 AM.jpeg b/assets/uploads/vouchers/69987554c4841-WhatsApp Image 2026-02-20 at 9.49.46 AM.jpeg new file mode 100644 index 0000000..c0b9139 Binary files /dev/null and b/assets/uploads/vouchers/69987554c4841-WhatsApp Image 2026-02-20 at 9.49.46 AM.jpeg differ diff --git a/db/config.php b/db/config.php index 10ce8c2..9d90766 100644 --- a/db/config.php +++ b/db/config.php @@ -14,6 +14,7 @@ if (!function_exists('db')) { PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC, ]); + $pdo->exec("SET time_zone = '-05:00'"); } return $pdo; } diff --git a/gestiones.php b/gestiones.php index 56c3bc7..59ef4fd 100644 --- a/gestiones.php +++ b/gestiones.php @@ -216,7 +216,7 @@ $(document).ready(function() { "language": { "url": "//cdn.datatables.net/plug-ins/1.10.25/i18n/Spanish.json" }, - "order": [[ , "desc" ]], + "order": [[ 0, "desc" ]], "paging": false, "lengthChange": false, "info": false diff --git a/pedidos.php b/pedidos.php index 20c9e35..6b87d4a 100644 --- a/pedidos.php +++ b/pedidos.php @@ -155,6 +155,7 @@ include 'layout_header.php'; Celular Producto Sede de Envío + Cantidad Monto Total Monto Debe Nº De Orden @@ -176,6 +177,7 @@ include 'layout_header.php'; + @@ -219,7 +221,7 @@ $(document).ready(function() { "language": { "url": "//cdn.datatables.net/plug-ins/1.10.25/i18n/Spanish.json" }, - "order": [[ , "desc" ]], + "order": [[ 0, "desc" ]], "paging": false, "lengthChange": false, "info": false diff --git a/pedidos_en_transito.php b/pedidos_en_transito.php index 3968d70..149b9eb 100644 --- a/pedidos_en_transito.php +++ b/pedidos_en_transito.php @@ -313,7 +313,7 @@ $(document).ready(function() { "language": { "url": "//cdn.datatables.net/plug-ins/1.10.25/i18n/Spanish.json" }, - "order": [[ , "desc" ]], // Adjusted index for new column + "order": [[ 0, "desc" ]], "paging": false, "lengthChange": false, "info": false diff --git a/registrar_entrada_manual_api.php b/registrar_entrada_manual_api.php index 6cb83df..0c8e074 100644 --- a/registrar_entrada_manual_api.php +++ b/registrar_entrada_manual_api.php @@ -20,24 +20,24 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $pdo->beginTransaction(); // 1. Actualizar o insertar en stock_sedes - $sql_stock = "INSERT INTO stock_sedes (id_producto, id_sede, cantidad) - VALUES (:product_id, :sede_id, :cantidad) - ON DUPLICATE KEY UPDATE cantidad = cantidad + :cantidad"; + $sql_stock = "INSERT INTO stock_sedes (product_id, sede_id, quantity) + VALUES (:product_id, :sede_id, :quantity) + ON DUPLICATE KEY UPDATE quantity = quantity + :quantity"; $stmt_stock = $pdo->prepare($sql_stock); $stmt_stock->bindParam(':product_id', $product_id, PDO::PARAM_INT); $stmt_stock->bindParam(':sede_id', $sede_id, PDO::PARAM_INT); - $stmt_stock->bindParam(':cantidad', $cantidad, PDO::PARAM_INT); + $stmt_stock->bindParam(':quantity', $cantidad, PDO::PARAM_INT); $stmt_stock->execute(); // 2. Registrar el movimiento - $sql_movement = "INSERT INTO stock_movements (product_id, sede_id, tipo_movimiento, cantidad, origen) - VALUES (:product_id, :sede_id, 'entrada', :cantidad, 'manual')"; + $sql_movement = "INSERT INTO stock_movements (product_id, sede_id, `type`, quantity, movement_date) + VALUES (:product_id, :sede_id, 'entrada', :quantity, NOW())"; $stmt_movement = $pdo->prepare($sql_movement); $stmt_movement->bindParam(':product_id', $product_id, PDO::PARAM_INT); $stmt_movement->bindParam(':sede_id', $sede_id, PDO::PARAM_INT); - $stmt_movement->bindParam(':cantidad', $cantidad, PDO::PARAM_INT); + $stmt_movement->bindParam(':quantity', $cantidad, PDO::PARAM_INT); $stmt_movement->execute(); $pdo->commit(); diff --git a/registrar_salida_manual_api.php b/registrar_salida_manual_api.php index cc3959c..caf70ed 100644 --- a/registrar_salida_manual_api.php +++ b/registrar_salida_manual_api.php @@ -20,14 +20,14 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $pdo->beginTransaction(); // 1. Verificar stock actual - $sql_check = "SELECT cantidad FROM stock_sedes WHERE id_producto = :product_id AND id_sede = :sede_id FOR UPDATE"; + $sql_check = "SELECT quantity FROM stock_sedes WHERE product_id = :product_id AND sede_id = :sede_id FOR UPDATE"; $stmt_check = $pdo->prepare($sql_check); $stmt_check->bindParam(':product_id', $product_id, PDO::PARAM_INT); $stmt_check->bindParam(':sede_id', $sede_id, PDO::PARAM_INT); $stmt_check->execute(); $current_stock_row = $stmt_check->fetch(PDO::FETCH_ASSOC); - $current_stock = $current_stock_row ? (int)$current_stock_row['cantidad'] : 0; + $current_stock = ($current_stock_row && isset($current_stock_row['quantity'])) ? (int)$current_stock_row['quantity'] : 0; if ($current_stock < $quantity) { $response['message'] = "Stock insuficiente. Stock actual: {$current_stock} unidades."; @@ -37,7 +37,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { } // 2. Actualizar stock_sedes - $sql_update = "UPDATE stock_sedes SET cantidad = cantidad - :quantity WHERE id_producto = :product_id AND id_sede = :sede_id"; + $sql_update = "UPDATE stock_sedes SET quantity = quantity - :quantity WHERE product_id = :product_id AND sede_id = :sede_id"; $stmt_update = $pdo->prepare($sql_update); $stmt_update->bindParam(':quantity', $quantity, PDO::PARAM_INT); $stmt_update->bindParam(':product_id', $product_id, PDO::PARAM_INT); @@ -45,8 +45,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $stmt_update->execute(); // 3. Registrar el movimiento - $sql_movement = "INSERT INTO stock_movements (product_id, sede_id, tipo_movimiento, cantidad, origen) - VALUES (:product_id, :sede_id, 'salida', :quantity, 'manual')"; + $sql_movement = "INSERT INTO stock_movements (product_id, sede_id, type, quantity, movement_date) + VALUES (:product_id, :sede_id, 'salida_manual', :quantity, NOW())"; $stmt_movement = $pdo->prepare($sql_movement); $stmt_movement->bindParam(':product_id', $product_id, PDO::PARAM_INT); $stmt_movement->bindParam(':sede_id', $sede_id, PDO::PARAM_INT);