Autosave: 20260516-060447

This commit is contained in:
Flatlogic Bot 2026-05-16 06:04:47 +00:00
parent 40389434b1
commit ca33865e0a
3 changed files with 17 additions and 6 deletions

View File

@ -18,12 +18,12 @@ $stmtHoy = $db->prepare("SELECT COUNT(*) as total_pedidos, SUM(monto_total) as t
$stmtHoy->execute([$hoy]);
$statsHoy = $stmtHoy->fetch(PDO::FETCH_ASSOC);
// 2. Pedidos Pendientes (ROTULADO ?)
$stmtPendientes = $db->query("SELECT COUNT(*) FROM pedidos WHERE estado = 'ROTULADO ?'");
// 2. Pedidos Pendientes (ROTULADO 📦)
$stmtPendientes = $db->query("SELECT COUNT(*) FROM pedidos WHERE estado = 'ROTULADO 📦'");
$pendientes = $stmtPendientes->fetchColumn();
// 3. Recaudo Esperado (En tránsito, En destino, Ruta contraentrega)
$stmtRecaudo = $db->query("SELECT SUM(monto_debe) FROM pedidos WHERE estado IN ('EN TRANSITO ?', 'EN DESTINO ?', 'RUTA_CONTRAENTREGA') AND (estado_pago != 'Pagado' OR estado_pago IS NULL)");
$stmtRecaudo = $db->query("SELECT SUM(monto_debe) FROM pedidos WHERE estado IN ('EN TRANSITO 🚛', 'EN DESTINO 🏬', 'RUTA_CONTRAENTREGA') AND (estado_pago != 'Pagado' OR estado_pago IS NULL)");
$recaudoEsperado = $stmtRecaudo->fetchColumn() ?: 0;
// 4. Stock Crítico (menos de 5 unidades en total entre todas las sedes)

View File

@ -298,7 +298,10 @@ $navItems = [
<i class="fas fa-bars"></i>
</button>
<div class="sidebar">
<a href="pedidos.php" class="navbar-brand"><h3>FLOOWER ERP</h3></a>
<?php
$homeUrl = in_array($userRole, ['Administrador', 'admin']) ? 'dashboard_principal.php' : 'pedidos.php';
?>
<a href="<?php echo $homeUrl; ?>" class="navbar-brand"><h3>FLOOWER ERP</h3></a>
<div class="menu-wrapper">
<ul class="nav flex-column">
<?php

View File

@ -2,7 +2,11 @@
session_start();
if (isset($_SESSION['user_id'])) {
header('Location: pedidos.php');
if (in_array($_SESSION['user_role'], ['Administrador', 'admin'])) {
header('Location: dashboard_principal.php');
} else {
header('Location: pedidos.php');
}
exit();
}
@ -55,7 +59,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Silently fail if session recording fails, don't block login
}
header('Location: pedidos.php');
if (in_array($user['role'], ['Administrador', 'admin'])) {
header('Location: dashboard_principal.php');
} else {
header('Location: pedidos.php');
}
exit();
} else {
$error = 'Invalid username or password.';