diff --git a/assets/uploads/vouchers/69988c4617737-Screenshot_29.png b/assets/uploads/vouchers/69988c4617737-Screenshot_29.png new file mode 100644 index 0000000..2240da4 Binary files /dev/null and b/assets/uploads/vouchers/69988c4617737-Screenshot_29.png differ diff --git a/assets/uploads/vouchers/69988ed8545e6-228.png b/assets/uploads/vouchers/69988ed8545e6-228.png new file mode 100644 index 0000000..ae38cee Binary files /dev/null and b/assets/uploads/vouchers/69988ed8545e6-228.png differ diff --git a/db/migrations/065_create_liquidaciones_provincia_table.sql b/db/migrations/065_create_liquidaciones_provincia_table.sql new file mode 100644 index 0000000..47a0222 --- /dev/null +++ b/db/migrations/065_create_liquidaciones_provincia_table.sql @@ -0,0 +1,8 @@ +CREATE TABLE IF NOT EXISTS liquidaciones_provincia ( + id INT AUTO_INCREMENT PRIMARY KEY, + fecha DATE NOT NULL, + provincia VARCHAR(255) NOT NULL, + monto DECIMAL(10, 2) DEFAULT 0.00, + estado VARCHAR(255) DEFAULT '', + UNIQUE KEY fecha_provincia (fecha, provincia) +); diff --git a/layout_header.php b/layout_header.php index cd93323..859148d 100644 --- a/layout_header.php +++ b/layout_header.php @@ -150,6 +150,12 @@ $navItems = [ 'icon' => 'fa-box', 'text' => 'Productos', 'roles' => ['Administrador', 'admin', 'Control Logistico'] + ], + 'liquidaciones_provincia' => [ + 'url' => 'liquidaciones_provincia.php', + 'icon' => 'fa-file-invoice-dollar', + 'text' => 'Liquidaciones Provincia', + 'roles' => ['Administrador', 'admin', 'Control Logistico'] ] ] ], diff --git a/liquidaciones_provincia.php b/liquidaciones_provincia.php new file mode 100644 index 0000000..809ba5c --- /dev/null +++ b/liquidaciones_provincia.php @@ -0,0 +1,210 @@ +prepare("SELECT fecha, provincia, monto, estado FROM liquidaciones_provincia WHERE MONTH(fecha) = ? AND YEAR(fecha) = ?"); +$stmt->execute([$month, $year]); +$data = $stmt->fetchAll(PDO::FETCH_ASSOC); + +// Organize data for easy access +$liquidaciones = []; +foreach ($data as $row) { + $liquidaciones[$row['fecha']][$row['provincia']] = [ + 'monto' => $row['monto'], + 'estado' => $row['estado'] + ]; +} + +?> + + + +
+

Liquidaciones Provincia

+

Tabla de liquidaciones por provincia para el mes seleccionado.

+ +
+
+ + +
+
+ + +
+ +
+ +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
FechaESTADO
TOTAL0.00
+
+
+ + + + \ No newline at end of file diff --git a/registrar_salida_manual_api.php b/registrar_salida_manual_api.php index caf70ed..6fbc164 100644 --- a/registrar_salida_manual_api.php +++ b/registrar_salida_manual_api.php @@ -46,7 +46,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { // 3. Registrar el movimiento $sql_movement = "INSERT INTO stock_movements (product_id, sede_id, type, quantity, movement_date) - VALUES (:product_id, :sede_id, 'salida_manual', :quantity, NOW())"; + VALUES (:product_id, :sede_id, 'salida', :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); diff --git a/save_liquidaciones_provincia.php b/save_liquidaciones_provincia.php new file mode 100644 index 0000000..c1d2971 --- /dev/null +++ b/save_liquidaciones_provincia.php @@ -0,0 +1,34 @@ +prepare($sql); + $stmt->execute(['fecha' => $fecha, 'provincia' => $provincia, 'valor' => $valor]); + + echo json_encode(['success' => true]); + } catch (PDOException $e) { + http_response_code(500); + echo json_encode(['success' => false, 'message' => $e->getMessage()]); + } + } else { + http_response_code(400); + echo json_encode(['success' => false, 'message' => 'Invalid column name.']); + } +} else { + http_response_code(400); + echo json_encode(['success' => false, 'message' => 'No data received.']); +} +?> \ No newline at end of file