diff --git a/db/migrations/066_create_inversion_general_table.sql b/db/migrations/066_create_inversion_general_table.sql new file mode 100644 index 0000000..8a6862f --- /dev/null +++ b/db/migrations/066_create_inversion_general_table.sql @@ -0,0 +1,8 @@ +CREATE TABLE IF NOT EXISTS inversion_general ( + id INT AUTO_INCREMENT PRIMARY KEY, + fecha DATE NOT NULL, + tipo_gasto VARCHAR(100) NOT NULL, + monto DECIMAL(10, 2) NOT NULL, + descripcion VARCHAR(255) DEFAULT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); diff --git a/edit_gasto.php b/edit_gasto.php new file mode 100644 index 0000000..fe4841f --- /dev/null +++ b/edit_gasto.php @@ -0,0 +1,112 @@ +prepare("UPDATE inversion_general SET fecha = ?, tipo_gasto = ?, monto = ?, descripcion = ? WHERE id = ?"); + $stmt->execute([$fecha, $tipo_gasto, $monto, $descripcion, $update_id]); + header("Location: inversion_general.php?month={$month_redirect}&year={$year_redirect}&status=updated"); + exit; + } else { + header("Location: edit_gasto.php?id={$update_id}&month={$month_redirect}&year={$year_redirect}&status=error"); + exit; + } +} + +// Fetch the expense to edit +$stmt = $pdo->prepare("SELECT * FROM inversion_general WHERE id = ?"); +$stmt->execute([$id]); +$gasto = $stmt->fetch(PDO::FETCH_ASSOC); + +if (!$gasto) { + header("Location: inversion_general.php?status=not_found"); + exit; +} + +$pageTitle = 'Editar Gasto'; +include 'layout_header.php'; +?> + +
Esta sección está en construcción.
+