<?php
ini_set("session.cookie_lifetime",60*60*10);
ini_set("session.gc_maxlifetime", 60*60*10);
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");

if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
//
if(vbval($_SESSION['SYS_USER_GI'])!=USU_GET_GI($_SESSION['SYS_USER_ID'])){
	JsDir("cerrar.php");	
	return;
}

$_SESSION['SYS_USER_ALM']=gs("alm_obs","almacenes","id_almacen=".$_SESSION['SYS_USER_ID_ALM']);
if(strlen($_SESSION['SYS_USER_ALM'])==0){
	$_SESSION['SYS_USER_ALM']="%";
}
$IdUsuario=$_SESSION['SYS_USER_ID'];
if($IdUsuario==0){
	$SS_USER_NAME="< 'ADM_SYSTEM' >";
}else{
	$SS_USER_NAME=gs("nom","usuarios","id_usuario=$IdUsuario");
}
$CHI=trim($_SESSION['SYS_USER_CH']);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Sistema OnLine</title>
<script type="text/javascript" src="fe/funciones.js"></script>
<style type="text/css">   
a:link   
{   
 text-decoration:none;
 color:#FFF
}   
a:visited {
color:#FFF
}
a:hover {
color:#FDF000
}

</style>
<style type="text/css">
<!--
body {
	background-color: #CCC;
	background-image: url();
	color: #666;
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}
.centrarFrm{
	width:1100px;
	height:800px;
	position:absolute;
	left:<?php echo "50%";?>;
	top:<?php echo "50%";?>;
	background-color:#346D98;
	margin:<?php echo "-400px";?> 0 0 <?php echo "-550px";?>;
}


.AB{
	position:absolute;
	z-index: 2;
	text-align: left;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 12px;
	font-weight: bold;
	height: 18px;
	width:154px;
}
.TI{
	position:absolute;
	z-index: 2;
	text-align: left; 
	font-family: Arial, Helvetica, sans-serif; 
	font-size: 14px;
	font-weight: bold;
	color:#FF0;
	width:154px;
}
#Frm center #DivFRM #layer .Estilo1 strong {
	color: #900;
}
.f2 {
	font-family: Arial, Helvetica, sans-serif;
	color: #999;
	font-size: 12px;
}
.f21 {	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	color: #FFF;
	font-size: 12px;
}
-->
</style>

</head>
<body  >
<form id="Frm" name="Frm" method="post" action="menu.php">
<input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
<input name="TxtAc" type="hidden" id="TxtAc" value="" />
<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
<center> 
<div Id="DivFRM"  class="centrarFrm" >
<div id="layer5" style="left: 2px; top: 94px; width: 900px">
<div style=" position:absolute; left: 0px; top: 0px; width: 1100px; height: 79px; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; z-index: 0">
  <div id="layer" style="position:absolute; left: 113px; top: 17px; width: 506px; height: 24px; z-index: 100; font-weight: bold; font-family: Verdana; color: #900; font-size: 24px;">
    <div align="left" >
      
      <strong>LQ IMPORT &amp; EXPORT</strong></div>
  </div>
  <div id="layer9" style="position:absolute; left: 116px; top: 54px; width: 446px; height: 18px; z-index: 100; font-size:11px; font-family: Arial, Helvetica, sans-serif; color: #000;">
    <div align="left" > <strong>USUARIO :</strong> 
    <?php
		echo $SS_USER_NAME;
	?>
    </div>
  </div>
</div>
<div style="left: 24px; top: 8px; width: 57px" class="AB"> <img src="lmenu.png" /> </div>
<?php
	$BX=30;$BY=110;$BZ=220;$BS=22;$c=0;$cc=0;
	$od="<div style=\"left:";$cd="</div>";
	$im="<img src=\"wm.png\"/>";
	$xt="px;top:";$ca="px\" class=\"AB\">";$ct="px;\" class=\"TI\">";	
	$cols=gn("max(col)","menu","");
	if($IdUsuario==0){
		for($c=1;$c<=$cols;$c++){
			if(gn("count(*)","menu","col=$c")>0){
				$cc=$cc+1;$l_m=$BX + (($cc-1)*$BZ);		
				$t_m=$BY;$m_it=0;
				$s_m="SELECT nombre,ord,nl,id_menu,ni FROM menu WHERE col=$c ORDER BY ord";
				$result_m = grs($s_m);		
				while ($row_m = $result_m->fetch_row()){			
					echo $od.($l_m+10).$xt.$t_m.$ct;
					//
					$nii=$row_m[4];
					if($nii>0){
						$StrJPG=$nii.".jpg";
					}else{
						$StrJPG="gdemo.png";
					}
					if($CHI=="S"){
						echo "<img src=\"$StrJPG\" width=\"198\" height=\"27\" />";
					}else{
						echo $row_m[0];
					}
					//									
					echo $cd;			
					$t_m=$t_m + (30* $row_m[2]);
					$s="SELECT sm,url,nl,ni FROM menus WHERE id_menu=$row_m[3] ORDER BY orden";
					$result = grs($s);		
					while ($row = $result->fetch_row()){
						$sm=$row[0];$ur=$row[1];$nl=$row[2];						
						echo $od.$l_m.$xt.$t_m.$ca;
						echo $im.$cd;echo $od.($l_m+20).$xt.$t_m.$ca;
						//
						$nii=$row[3];						
						if($nii>0){
							$StrJPG=$nii.".jpg";
						}else{
							$StrJPG="jdemo.png";
						}												
						if($CHI=="S"){
							echo "<a href=\"$ur\"><img src=\"$StrJPG\" width=\"198\" height=\"27\" /></a>".$cd;	
							$t_m=$t_m + (28);	
						}else{
							echo "<a href=\"$ur\">$sm</a>".$cd;	
							$t_m=$t_m + (18 * $nl);						
						}
						//
					}			
					$t_m=$t_m + (30* $row_m[2]);			
				}
			}
		}
	}else{
		for($c=1;$c<=$cols;$c++){
			if(gn("count(*)","vusu_mem","COL=$c AND IDU=$IdUsuario AND VA>0")>0){
				$cc=$cc+1;$l_m=$BX + (($cc-1)*$BZ);		
				$t_m=$BY;$m_it=0;
				$s_m="SELECT ME,MO,ML,IDM FROM vusu_men WHERE 
					 COL=$c AND IDU=$IdUsuario AND VA>0 
					 GROUP BY ME,MO,ML,IDM ORDER BY MO";
				$result_m = grs($s_m);		
				while ($row_m = $result_m->fetch_row()){			
					echo $od.($l_m+10).$xt.$t_m.$ct;
					//
					$nii=gn("ni","menu","id_menu=".$row_m[3]);
					//echo $nii."@".$row_m[3]."#";
					if($nii>0){
						$StrJPG=$nii.".jpg";
					}else{
						$StrJPG="gdemo.png";
					}
					if($CHI=="S"){
						echo "<img src=\"$StrJPG\" width=\"198\" height=\"27\" />";
					}else{
						echo $row_m[0];
					}
					//					
					echo $cd;			
					$t_m=$t_m + (30* $row_m[2]);
					$s="SELECT SM,UR,SL,IDS FROM vusu_men WHERE 
						IDM=$row_m[3] AND IDU=$IdUsuario AND VA>0 
						GROUP BY SM,UR,SL,IDS ORDER BY SO";
					$result = grs($s);		
					while ($row = $result->fetch_row()){
						$sm=$row[0];$ur=$row[1];$nl=$row[2];
						echo $od.$l_m.$xt.$t_m.$ca;
						echo $im.$cd;echo $od.($l_m+20).$xt.$t_m.$ca;
						//
						$nii=$row[3];
						$nii=gn("ni","menus","id=$nii");						
						if($nii>0){
							$StrJPG=$nii.".jpg";
						}else{
							$StrJPG="jdemo.png";
						}												
						if($CHI=="S"){
							echo "<a href=\"$ur\"><img src=\"$StrJPG\" width=\"198\" height=\"27\" /></a>".$cd;	
							$t_m=$t_m + (28);	
						}else{
							echo "<a href=\"$ur\">$sm</a>".$cd;	
							$t_m=$t_m + (18 * $nl);						
						}
						//				
					}			
					$t_m=$t_m + (30* $row_m[2]);			
				}
			}
		}
	}

?>
</div>
<div id="layer3" style="position:absolute; left: 0px; top: 77px; width: 1100px; background-color: #FFCC00; layer-background-color: #FFCC00; border: 1px none #000000; height:5px;">
  <div align="left" class="f21"></div>
</div>
<div style="position:absolute; left: 0px; top: 774px; width: 1100px; height: 25px; background-color: #2B5B80; layer-background-color: #2B5B80; border: 1px none #000000; z-index: 0">
  <div id="layer2" style="position:absolute; left: 0px; top: 5px; width: 1100px;">
    <div align="center" class="f2">Lima - Peru - <?php echo date("Y");?></div>
  </div>
</div>
</div>
</center>	
</form>
</body>
</html>
