34786-vm/editar_flujo_de_caja.php
2025-12-12 16:33:10 +00:00

68 lines
3.0 KiB
PHP

<?php
require_once 'includes/header.php';
require_once 'db/config.php';
if (!isset($_GET['id'])) {
header('Location: flujo_de_caja.php');
exit;
}
$id = $_GET['id'];
$pdo = db();
$stmt = $pdo->prepare('SELECT * FROM flujo_de_caja WHERE id = ?');
$stmt->execute([$id]);
$movimiento = $stmt->fetch(PDO::FETCH_ASSOC);
if (!$movimiento) {
header('Location: flujo_de_caja.php');
exit;
}
?>
<div class="container-fluid">
<h1 class="h3 mb-4 text-gray-800">Editar Movimiento de Caja</h1>
<div class="card shadow mb-4">
<div class="card-header py-3">
<h6 class="m-0 font-weight-bold text-primary">Editor de Movimiento</h6>
</div>
<div class="card-body">
<form action="handle_editar_flujo_de_caja.php" method="POST">
<input type="hidden" name="id" value="<?php echo htmlspecialchars($movimiento['id']); ?>">
<div class="row">
<div class="col-md-3 form-group">
<label for="fecha">Fecha</label>
<input type="date" name="fecha" class="form-control" value="<?php echo htmlspecialchars($movimiento['fecha']); ?>" required>
</div>
<div class="col-md-3 form-group">
<label for="bcp_yape">BCP/YAPE</label>
<input type="number" step="0.01" name="bcp_yape" class="form-control" value="<?php echo htmlspecialchars($movimiento['bcp_yape']); ?>">
</div>
<div class="col-md-3 form-group">
<label for="banco_nacion">Banco Nación</label>
<input type="number" step="0.01" name="banco_nacion" class="form-control" value="<?php echo htmlspecialchars($movimiento['banco_nacion']); ?>">
</div>
<div class="col-md-3 form-group">
<label for="interbank">Interbank</label>
<input type="number" step="0.01" name="interbank" class="form-control" value="<?php echo htmlspecialchars($movimiento['interbank']); ?>">
</div>
</div>
<div class="row">
<div class="col-md-3 form-group">
<label for="bbva">BBVA</label>
<input type="number" step="0.01" name="bbva" class="form-control" value="<?php echo htmlspecialchars($movimiento['bbva']); ?>">
</div>
<div class="col-md-3 form-group">
<label for="otros">Otros</label>
<input type="number" step="0.01" name="otros" class="form-control" value="<?php echo htmlspecialchars($movimiento['otros']); ?>">
</div>
</div>
<button type="submit" class="btn btn-primary">Actualizar Movimiento</button>
<a href="flujo_de_caja.php" class="btn btn-secondary">Cancelar</a>
</form>
</div>
</div>
</div>
<?php require_once 'includes/footer.php'; ?>