From 96d2546dba6c66af2b5fe7ba109b7d388f587a07 Mon Sep 17 00:00:00 2001 From: Flatlogic Bot Date: Tue, 3 Feb 2026 06:08:39 +0000 Subject: [PATCH] Autosave: 20260203-060838 --- flujo_de_caja.php | 63 +++++++++++++-- layout_header.php | 31 ++++++++ panel_inventario.php | 180 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 268 insertions(+), 6 deletions(-) create mode 100644 panel_inventario.php diff --git a/flujo_de_caja.php b/flujo_de_caja.php index 981f38d..61e7522 100644 --- a/flujo_de_caja.php +++ b/flujo_de_caja.php @@ -25,18 +25,51 @@ try { $columns = [ 'bcp_yape', 'b_nacion', 'interbank', 'bbva', 'otros_ingresos', 'tu1', 'tu2', 'tu3', 'fl1', 'fl2', 'fl3', - 'rc_envio', 'rc_contraent', 'total_inversion_publicitaria' + 'rc_envio', 'rc_contraent' ]; ?> + +

Flujo de Caja

Registro y control de los movimientos de ingresos y gastos.

+
+
+ + +
+
+ + +
+ +
+
- + @@ -93,9 +126,8 @@ document.addEventListener('DOMContentLoaded', function() { }; const ingresos = getVal('bcp_yape') + getVal('b_nacion') + getVal('interbank') + getVal('bbva') + getVal('otros_ingresos') + getVal('rc_envio') + getVal('rc_contraent'); - const inversionManual = getVal('total_inversion_publicitaria'); - const inversionAuto = getVal('tu1') + getVal('tu2') + getVal('tu3') + getVal('fl1') + getVal('fl2') + getVal('fl3'); - const totalInversion = inversionManual > 0 ? inversionManual : inversionAuto; + + const totalInversion = getVal('tu1') + getVal('tu2') + getVal('tu3') + getVal('fl1') + getVal('fl2') + getVal('fl3'); const recaudoFinal = ingresos - totalInversion; @@ -107,6 +139,17 @@ document.addEventListener('DOMContentLoaded', function() { // Initial calculation for all rows table.querySelectorAll('tbody tr').forEach(updateTotals); + // Event listener for cell focus to select all content + table.addEventListener('focus', function(e) { + if (e.target.hasAttribute('contenteditable')) { + const range = document.createRange(); + range.selectNodeContents(e.target); + const sel = window.getSelection(); + sel.removeAllRanges(); + sel.addRange(range); + } + }, true); // Use capturing for focus + // Event listener for cell edits table.addEventListener('blur', function(e) { if (e.target.hasAttribute('contenteditable')) { @@ -143,9 +186,17 @@ document.addEventListener('DOMContentLoaded', function() { updateTotals(row); } }, true); // Use capturing to ensure blur event is handled properly + + // Event listener for Enter key to save and not expand + table.addEventListener('keydown', function(e) { + if (e.key === 'Enter' && e.target.hasAttribute('contenteditable')) { + e.preventDefault(); // Prevent new line + e.target.blur(); // Trigger blur to save + } + }); }); \ No newline at end of file +?> diff --git a/layout_header.php b/layout_header.php index 1d19cd5..15c7f72 100644 --- a/layout_header.php +++ b/layout_header.php @@ -80,6 +80,37 @@ $navItems = [ 'text' => 'Gestionar Productos', 'roles' => ['Administrador', 'admin'] ], + 'panel_inventario' => [ + 'icon' => 'fa-warehouse', + 'text' => 'Panel de Inventario', + 'roles' => ['Administrador', 'admin', 'Control Logistico'], + 'submenu' => [ + 'dashboard' => [ + 'url' => 'panel_inventario.php?seccion=dashboard', + 'icon' => 'fa-tachometer-alt', + 'text' => 'Dashboard', + 'roles' => ['Administrador', 'admin', 'Control Logistico'] + ], + 'entrada' => [ + 'url' => 'panel_inventario.php?seccion=entrada', + 'icon' => 'fa-arrow-circle-down', + 'text' => 'Registro de Entrada', + 'roles' => ['Administrador', 'admin', 'Control Logistico'] + ], + 'salida' => [ + 'url' => 'panel_inventario.php?seccion=salida', + 'icon' => 'fa-arrow-circle-up', + 'text' => 'Registro de Salida', + 'roles' => ['Administrador', 'admin', 'Control Logistico'] + ], + 'registro_producto' => [ + 'url' => 'panel_inventario.php?seccion=registro_producto', + 'icon' => 'fa-plus-circle', + 'text' => 'Registro de Producto', + 'roles' => ['Administrador', 'admin', 'Control Logistico'] + ] + ] + ], 'finanzas_group' => [ 'icon' => 'fa-dollar-sign', 'text' => 'Finanzas', diff --git a/panel_inventario.php b/panel_inventario.php new file mode 100644 index 0000000..5ea8121 --- /dev/null +++ b/panel_inventario.php @@ -0,0 +1,180 @@ +prepare("SELECT COUNT(*) FROM products WHERE nombre = ?"); + $stmt->execute([$nombre_producto]); + if ($stmt->fetchColumn() > 0) { + $message = "Error: El producto '{$nombre_producto}' ya existe."; + $message_type = "danger"; + } else { + // Insert new product with default values + $stmt = $pdo->prepare("INSERT INTO products (nombre, unidades_disponibles, cobertura, show_on_panel, order_position) VALUES (?, 0, '[]', 1, 0)"); + if ($stmt->execute([$nombre_producto])) { + $message = "Producto '{$nombre_producto}' registrado con éxito."; + $message_type = "success"; + } else { + $message = "Error al registrar el producto."; + $message_type = "danger"; + } + } + } catch (PDOException $e) { + $message = "Error de base de datos: " . $e->getMessage(); + $message_type = "danger"; + } + } else { + $message = "El nombre del producto no puede estar vacío."; + $message_type = "warning"; + } +} + + +// Set the title based on the section +switch ($seccion) { + case 'entrada': + $pageTitle = "Registro de Entrada"; + break; + case 'salida': + $pageTitle = "Registro de Salida"; + break; + case 'registro_producto': + $pageTitle = "Registro de Nuevo Producto"; + break; + case 'dashboard': + default: + $pageTitle = "Dashboard de Inventario"; + break; +} + +?> + +
+ + + + + +
+
+
Registro de Entrada de Inventario
+
+
+

Esta sección está en construcción. Aquí podrás registrar la entrada de nuevo stock.

+
+
+ +
+
+
Registro de Salida de Inventario
+
+
+

Esta sección está en construcción. Aquí podrás registrar la salida de stock por ventas u otros motivos.

+
+
+ +
+
+
Registrar Nuevo Producto
+
+
+
+
+ + +
+ + +
+
+ query("SELECT nombre, unidades_disponibles, cobertura FROM products ORDER BY nombre ASC"); + $products = $stmt->fetchAll(PDO::FETCH_ASSOC); + } catch (PDOException $e) { + echo "
Error al conectar con la base de datos: " . $e->getMessage() . "
"; + $products = []; + } + ?> +
+
+
Stock de Productos por Ciudad
+
+
+
+
Fecha Ingresos
+ + + + + + + + + + + + + + + + + + + + + + +
ProductoStock TotalCiudades de Cobertura
No hay productos para mostrar.
+ +
+
+
+ + + + +document.title = '" . htmlspecialchars($pageTitle) . "';"; + echo ""; +} +require_once 'layout_footer.php'; +?> \ No newline at end of file