<?php
session_start();
include("DMMYSQLG.php");
include('DZ38000.php'); //FUNCION DE CONTEO DE ARCHIVOS
include('DZ32000.php'); //ALMACEN
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="es-es">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
    <link rel="stylesheet" href="css/menu.css" type="text/css"/>
    <script type="text/javascript"  src="js/jquery.js"></script>
    <script type="text/javascript"  src="js/menu.js"></script>


    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    </head>

    <?php
    $user = $_SESSION['num_usu'];
    $select = "select * from cmodulo left join cpermiso_grupo on url=modulo_url where servicio='almacen' and  grupo_id in (select cgrupo_id from cusuario_grupo where dxopemaex_oper=$user)order by order_parent,order_child asc";
    $query = mysqli_query($con ,$select);
    $total = mysqli_num_rows($query);

    $con = 0;
    $parent = "";
    ?> 

    <body>

        <div id="menu">
            <ul>
                <!--<li class="salir"><a href="../servicios.php" target="_top" class="salir">SALIR</a></li>-->
                <?php
                if ($total == 0) {

                    $select = "select * from cmodulo left join cpermiso_grupo on url=modulo_url where servicio='almacen'  GROUP BY id order by order_parent,order_child asc";
                    $query = mysqli_query($con ,$select);
                    $total = mysqli_num_rows($query);
//                    echo "no hay registros";
                    //  echo "<li class='salir'><a href='../servicios.php' target='_top' class='salir'>SALIR</a></li>";
                }
                while ($row = mysqli_fetch_array($query)) {
                    if ($con == 0) {
                        $parent = $row['modulo_parent'];
                        echo "<li ><a href='#'>" . trim($parent) . "</a>";
                        echo "<ul>";
                        $con++;
                    }
                    if ($row['modulo_parent'] == $parent) {
                        echo "<li ><a href=" . $row['url'] . ">" . $row['nombre'] . "</a></li>";
                        $con++;
                    } else {
                        $parent = $row['modulo_parent'];
                        echo "</ul></li>";
                        if ($row['order_child'] == "-1") {
                            echo "<li class='salir'><a href=" . $row['url'] . " target='_top' class='salir'>" . trim($parent) . "</a>";
                            echo "<ul>";
                        } else {
                            echo "<li><a href='#'>" . trim($parent) . "</a>";
                            echo "<ul>";
                            echo "<li ><a href=" . $row['url'] . ">" . $row['nombre'] . "</a></li>";
                        }
                        $con++;
                    }
                }
                ?>    
            </ul>  
        </div>

        <div class="info" STYLE="color:#000;    font-size:16px; width: 1000px;display: block;margin:auto;font-weight: bold; height: auto;" >
            <div style="margin:auto; width: 1000px; display: block;   top: 290px;position: relative">

                <div style="float: left; background: yellow"> 
                    <pre style="position: absolute;bottom: 0;left: 0;left: 15px">        
           TEPECO2008 TRUST S. DE R.L. DE C.V.
Direccion: Camino ala cantera S/N col. Lomas de Taxco
        CP.40210 Tel: 01 (762)622 5609
             rfc: TTR161116834 </pre>    
                </div>        
            </div>

        </div>        
    </body>
</html>
