<?php
 @session_start(); 
  $vg_login=$_SESSION["usuario"];
 if($vg_login<>""){}
 else
  {echo "<script>";
   echo "window.location='index.php';";
   echo "</script>";
  }	

include "parametros.php";
require_once ('Mobile_Detect.php');
$detect = new Mobile_Detect(); 
if ($detect->isMobile()==false)  {  $tipodispo=2;  }
else  {  $tipodispo=1;}  

//include "periodo.php"; 
include "conexion.php"; 

?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title><?php  echo $descripcion; ?></title>
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
  <link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css">
  <link rel="stylesheet" href="dist/css/adminlte.min.css">
  <link rel="stylesheet" href="plugins/overlayScrollbars/css/OverlayScrollbars.min.css">

  <link rel="icon" type="image/png" href="icono.ico"/>
</head>
<body class="hold-transition sidebar-mini layout-fixed" data-panel-auto-height-mode="height">

<div class="wrapper">

  <!-- Navbar -->
  <nav class="main-header navbar navbar-expand navbar-white navbar-light">
    <!-- Left navbar links -->
    <ul class="navbar-nav">
      <li class="nav-item">
        <a class="nav-link" data-widget="pushmenu" href="#" role="button"><i class="fas fa-bars"></i></a>
      </li>
    
    </ul>
    <!-- Right navbar links -->
    <ul class="navbar-nav ml-auto">
      <li class="nav-item">
        <a class="nav-link" data-widget="fullscreen" href="#" role="button">
          <i class="fas fa-expand-arrows-alt"></i>
        </a>
      </li>
     
    </ul>
  </nav>
  <!-- /.navbar -->

  <!-- Main Sidebar Container -->
  <aside class="main-sidebar sidebar-dark-primary elevation-4">
    <!-- Brand Logo -->
    <center>
      <a href="sivi.php" class="brand-link">   
        <img src="imagenes/logocliente.png" alt="SIVI" width='50%' >         
      </a>  
    </center>
        <center>
            <?php
        //<a href="#" data-toggle="modal" data-target="#fotoperfil-lg" class="d-block"><img src="dist/img/user2-160x160.jpg" class="img-circle elevation-2" alt="User Image" width='50px' height='50px'></a>
        ?>
          <font color='#ffffff'><strong> 
            <?php echo $nombreusuario; ?><br>
            <?php echo $nperfil; ?></strong>
            </font>
     </center>
    

    <!-- Sidebar -->
    <div class="sidebar">

    <!-- Sidebar Menu -->
      <nav class="mt-2">
       
      
      <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
      
    <!-- configuracion -->
      <?php
       $sql_contarmodulomenu =mysqli_query($conexion,"SELECT count(*) FROM modulo_usuario 
                           where usuario='".$vg_login."'
                           and modulo in (select id from modulo_menu where nombre='PARAMETROS')");
       while($datosmm= mysqli_fetch_row($sql_contarmodulomenu)){  $contarmodulomenu=$datosmm[0];		}	
       if($contarmodulomenu>=1)
        {
          ?>	
          <li class="nav-item">
            <a href="#" class="nav-link">
            <i class="nav-icon fas fa-object-group"></i>
              <p>
                CONFIGURACION
                <i class="fas fa-angle-left right"></i>                
              </p>
            </a>
              <ul class="nav nav-treeview">
                <?php
                    $sql_menunota =mysqli_query($conexion,"SELECT ruta,titulo,id,modulof,orden FROM menu_sistema where modulo='PARAMETROS' and mostrar='S'
                                        order by orden asc");
                    while($datosnota= mysqli_fetch_row($sql_menunota))
                        {  $ruta=$datosnota[0];
                            $titulo=$datosnota[1];
                            $idtitulo=$datosnota[2];
                            $modulof=$datosnota[3];
                            $contarmodulo=0;
                                $sql_menuperfil =mysqli_query($conexion,"SELECT count(*) FROM modulo_perfil
                                                                        where perfil='".$perfil."' and modulo='".$modulof."'");
                                while($datosperfil= mysqli_fetch_row($sql_menuperfil))  {  $contarmodulo=$datosperfil[0]; }
                              if($contarmodulo>=1)
                                {
                            ?>
                                <li class="nav-item">
                                  <?php
                                      if($tipodispo==2)
                                      {
                                      ?>
                                      <a href="<?php echo $ruta; ?>" target="SIVI" class="nav-link"> <i class="far fa-circle nav-icon"></i> <?php echo $titulo;?></a>                                        
                                      <?php
                                      }
                                      ?> 
                                      <?php
                                      if($tipodispo==1)
                                      {
                                      ?>                                
                                      <a href="<?php echo $ruta; ?>" target="SIVI" ><?php echo $titulo;?></a>                                  
                                      <?php
                                      }
                                  ?>  
                                </li>
                            <?php  
                                }
                        }
                ?>  
            </ul>
          </li>
        <?php
        }
       ?>  
    <!-- configuracion -->
      
    <!-- VENTAS -->
       <?php          
					$sql_contarmodulomenu =mysqli_query($conexion,"SELECT count(*) FROM modulo_usuario 
															where usuario='".$vg_login."'
															and modulo in (select id from modulo_menu where nombre='VENTAS')");
					while($datosmm= mysqli_fetch_row($sql_contarmodulomenu)){  $contarmodulomenu=$datosmm[0];		}	
					if($contarmodulomenu>=1)
					 {
            ?>	
                <li class="nav-item">
                    <a href="#" class="nav-link">
                  <i class="nav-icon fas fa-calculator"></i>
                    <p>
                    VENTAS
                      <i class="fas fa-angle-left right"></i>                
                    </p>
                  </a>
                    <ul class="nav nav-treeview">
                    
                      <?php
                          
                          $sql_menunota =mysqli_query($conexion,"SELECT ruta,titulo,id,modulof FROM menu_sistema where modulo='VENTAS' and mostrar='S'
                                              order by id asc");
                          while($datosnota= mysqli_fetch_row($sql_menunota))
                              {  $ruta=$datosnota[0];
                                  $titulo=$datosnota[1];
                                  $idtitulo=$datosnota[2];
                                  $modulof=$datosnota[3];
                                  $contarmodulo=0;
                                  $sql_menuperfil =mysqli_query($conexion,"SELECT count(*) FROM modulo_perfil
                                                                          where perfil='".$perfil."' and modulo='".$modulof."'");
                                  while($datosperfil= mysqli_fetch_row($sql_menuperfil))  {  $contarmodulo=$datosperfil[0]; }
                                if($contarmodulo>=1)
                                  {
                                  ?>
                                    <li class="nav-item">
                                      
                                      <?php
                                          if($tipodispo==2)
                                          {
                                          ?>
                                          <a href="<?php echo $ruta; ?>" target="SIVI" class="nav-link"> <i class="far fa-circle nav-icon"></i> <?php echo $titulo;?></a>       
                                          <?php
                                          }
                                          ?> 
                                          <?php
                                          if($tipodispo==1)
                                          {
                                          ?>                                
                                          <a href="<?php echo $ruta; ?>" target="SIVI"><?php echo $titulo;?></a>                                  
                                          <?php
                                          }
                                      ?>  
                                    </li>
                                  <?php 
                                  } 
                              }
                      ?>  
                  </ul>
                </li> 
              <?php
           }
          ?>
    <!-- VENTAS -->


    <!-- FACTURAR -->
  <!-- VENTAS -->
       <?php          
					$sql_contarmodulomenu =mysqli_query($conexion,"SELECT count(*) FROM modulo_usuario 
															where usuario='".$vg_login."'
															and modulo in (select id from modulo_menu where nombre='FACTURAR')");
					while($datosmm= mysqli_fetch_row($sql_contarmodulomenu)){  $contarmodulomenu=$datosmm[0];		}	
					if($contarmodulomenu>=1)
					 {
            ?>	
                <li class="nav-item">
                    <a href="#" class="nav-link">
                  <i class="nav-icon fas fa-columns"></i>
                    <p>
                    FACTURAR
                      <i class="fas fa-angle-left right"></i>                
                    </p>
                  </a>
                    <ul class="nav nav-treeview">
                    
                      <?php
                          
                          $sql_menunota =mysqli_query($conexion,"SELECT ruta,titulo,id,modulof FROM menu_sistema where modulo='FACTURAR' and mostrar='S'
                                              order by id asc");
                          while($datosnota= mysqli_fetch_row($sql_menunota))
                              {  $ruta=$datosnota[0];
                                  $titulo=$datosnota[1];
                                  $idtitulo=$datosnota[2];
                                  $modulof=$datosnota[3];
                                  $contarmodulo=0;
                                  $sql_menuperfil =mysqli_query($conexion,"SELECT count(*) FROM modulo_perfil
                                                                          where perfil='".$perfil."' and modulo='".$modulof."'");
                                  while($datosperfil= mysqli_fetch_row($sql_menuperfil))  {  $contarmodulo=$datosperfil[0]; }
                                if($contarmodulo>=1)
                                  {
                                  ?>
                                    <li class="nav-item">
                                      
                                      <?php
                                          if($tipodispo==2)
                                          {
                                          ?>
                                          <a href="<?php echo $ruta; ?>" target="SIVI" class="nav-link"> <i class="far fa-circle nav-icon"></i> <?php echo $titulo;?></a>       
                                          <?php
                                          }
                                          ?> 
                                          <?php
                                          if($tipodispo==1)
                                          {
                                          ?>                                
                                          <a href="<?php echo $ruta; ?>" target="SIVI"><?php echo $titulo;?></a>                                  
                                          <?php
                                          }
                                      ?>  
                                    </li>
                                  <?php 
                                  } 
                              }
                      ?>  
                  </ul>
                </li> 
              <?php
           }
          ?>
    <!-- FACTURAR -->
    
          <!-- COMPRAS -->
        <?php
          $sql_contarmodulomenu =mysqli_query($conexion,"SELECT count(*) FROM modulo_usuario 
                                      where usuario='".$vg_login."'
                                      and modulo in (select id from modulo_menu where nombre='compras')");
                  while($datosmm= mysqli_fetch_row($sql_contarmodulomenu)){  $contarmodulomenu=$datosmm[0];		}	
                  if($contarmodulomenu>=1)
                  {
                      ?>							
                      <li class="nav-item">
                        <a href="#" class="nav-link">
                        <i class="nav-icon fas fa-th"></i>                        
                          <p>
                             COMPRAS
                            <i class="right fas fa-angle-left"></i>
                          </p>
                        </a>
                        
                        <ul class="nav nav-treeview">
                            <?php
                              //include "conexion.php";
                              $sql_menunota =mysqli_query($conexion,"SELECT ruta,titulo,id,orden FROM menu_sistema where modulo='compras' and mostrar='S' order by orden asc");
                              while($datosnota= mysqli_fetch_row($sql_menunota))
                              {  $ruta=$datosnota[0];
                                 $titulo=$datosnota[1];
                                 $idtitulo=$datosnota[2];
                                ?>
                                <li class="nav-item">
                                <?php
                                  if($tipodispo==2)
                                  {
                                  ?>
                                  <a href="<?php echo $ruta; ?>"  class="nav-link"><i class="far fa-circle nav-icon"></i> <?php echo $titulo;?> </a>
                                  <?php
                                  }
                                  ?> 
                                  <?php
                                  if($tipodispo==1)
                                  {
                                  ?>
                                  <a href="<?php echo $ruta; ?>" target="InfSia"><?php echo $titulo;?></a>
                                  <?php
                                  }
                                  ?>  
                                </li>
                                <?php  
                              }
                            ?> 
                        </ul>
                      </li>
                      <?php
                  }
                 ?>   

                  
                 

    <!-- SEGURIDAD -->
         <?php
         
         $sql_contarmodulomenu =mysqli_query($conexion,"SELECT count(*) FROM modulo_usuario 
                             where usuario='".$vg_login."'
                             and modulo in (select id from modulo_menu where nombre='SEGURIDAD')");
         while($datosmm= mysqli_fetch_row($sql_contarmodulomenu)){  $contarmodulomenu=$datosmm[0];		}	
         if($contarmodulomenu>=1)
          {
              ?>	
              <li class="nav-item">
                <a href="#" class="nav-link">
                  <i class="nav-icon fas fa-cogs"></i>
                  <p>
                  SEGURIDAD
                    <i class="fas fa-angle-left right"></i>                
                  </p>
                </a>
                  <ul class="nav nav-treeview">                  
                    <?php                        
                        $sql_menunota =mysqli_query($conexion,"SELECT ruta,titulo,id,modulof FROM menu_sistema where modulo='SEGURIDAD' and mostrar='S'
                                            order by id asc");
                        while($datosnota= mysqli_fetch_row($sql_menunota))
                            {  $ruta=$datosnota[0];
                                $titulo=$datosnota[1];
                                $idtitulo=$datosnota[2];
                                $modulof=$datosnota[3];
                                $contarmodulo=0;
                                $sql_menuperfil =mysqli_query($conexion,"SELECT count(*) FROM modulo_perfil
                                                                        where perfil='".$perfil."' and modulo='".$modulof."'");
                                while($datosperfil= mysqli_fetch_row($sql_menuperfil))  {  $contarmodulo=$datosperfil[0]; }
                                if($contarmodulo>=1)
                                {
                                ?>
                                  <li class="nav-item">
                                    <?php
                                        if($tipodispo==2)
                                        {
                                        ?>
                                       <a href="<?php echo $ruta; ?>" target="SIVI" class="nav-link"> <i class="far fa-circle nav-icon"></i> <?php echo $titulo;?></a>      
                                        <?php
                                        }
                                        ?> 
                                        <?php
                                        if($tipodispo==1)
                                        {
                                        ?>                                
                                        <a href="<?php echo $ruta; ?>" target="SIVI"><?php echo $titulo;?></a>                                  
                                        <?php
                                        }
                                    ?>  
                                  </li>
                                <?php  
                                }
                            }
                    ?>  

                
                
                  
                </ul>
              </li> 
              <?php
          }
          
         ?>
     <!-- hse -->
     <center>
      <br>  
        <li class="nav-item"  >   
              <a href="exit.php" class="btn btn-outline-white border-0 p-2 mr-1" title="Cerrar Session">
                            Cerrar Sesión <i class="fa fa-sign-out-alt text-150"></i>
              </a>
            <br>
        </li>            
    </center>
     <br>
    

  </ul>
      </nav>
      <!-- /.sidebar-menu -->
    </div>
    <!-- /.sidebar -->
  </aside>

  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper iframe-mode" data-widget="iframe" data-loading-screen="750">
  <div class="nav navbar navbar-expand navbar-white navbar-light border-bottom p-0">
    
    <div class="nav-item dropdown">
        <a class="nav-link bg-dark dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">Close</a>

        <div class="dropdown-menu mt-0">
          <a class="dropdown-item" href="#" data-widget="iframe-close" data-type="all">Close All</a>
          <a class="dropdown-item" href="#" data-widget="iframe-close" data-type="all-other">Close All Other</a>
        </div>
      </div>
      <a class="nav-link bg-light" href="#" data-widget="iframe-scrollleft"><i class="fas fa-angle-double-left"></i></a>
      <ul class="navbar-nav overflow-hidden" role="tablist"></ul>
      <a class="nav-link bg-light" href="#" data-widget="iframe-scrollright"><i class="fas fa-angle-double-right"></i></a>
      <a class="nav-link bg-light" href="#" data-widget="iframe-fullscreen"><i class="fas fa-expand"></i></a>
    </div>
    <div class="tab-content">

  
  </div>



      <div class="tab-empty">
        <h2 class="display-4">
        <br><br>
        <center>
          <table width='80%'>
          <tr>
                <td width='100%'> <center><img src="imagenes/logocliente.png" width='70%' ></center></td>
          </tr>
          </table   
        </center>   
        </h2>
      </div>
      <div class="tab-loading">
        <div>
        <h2 class="display-4">
          PROCESANDO <i class="fa fa-sync fa-spin"></i></h2>
        </div>
        <div>
               
      </div>
    </div>
  </div>
  
  <!-- /.content-wrapper -->
  <footer class="main-footer">
  <strong>Copyright &copy; 2026 SAGAODONTOLOGICA</a>.</strong>
    All rights reserved. 
    <div class="float-right d-none d-sm-inline-block">
      <b><a href="https://www.sinweb.com.co" target='_blanck'> (SIWEB) </a></b>
    </div>
  </footer>

 
  
</div>



<script src="plugins/jquery/jquery.min.js"></script>
<script src="plugins/jquery-ui/jquery-ui.min.js"></script>
<script>
  $.widget.bridge('uibutton', $.ui.button)
</script>
<script src="plugins/bootstrap/js/bootstrap.bundle.min.js"></script>
<script src="plugins/overlayScrollbars/js/jquery.overlayScrollbars.min.js"></script>
<script src="dist/js/adminlte.js"></script>
<script src="dist/js/demo.js"></script>

</body>
</html>
