<?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;
}
//++++++	
$StrGT="";
$VP_RegXPag=14;
$LStrMsg="";
$LStrFoc="";
$LStrMM="";
$LStrPag=V($_POST['TxtPag']);
$LStrTR=gn("count(*)","usuarios","id_usuario>0");
include("usuarios_fun.php");
if(strlen($StrEmp)==0){
	$StrEmp="TODOS";
}
?>
<!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>Usuarios</title>
<script type="text/javascript" src="fe/funcionez.js"></script>
<script type="text/javascript" src="fe/usuarios25.js"></script>
<link rel="stylesheet" type="text/css" href="css/multi.css"  />
<style type="text/css">
<!--
body {
	background-color: #CCC;
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}

.centrarFrm {height:750px;width:1000px;position:relative;top:0px;background-color:#006699;}

#Layer2 {
	position:absolute;
	left:409px;
	top:205px;
	width:82px;
	height:24px;
	z-index:1;
}
.Estilo1 {
	font-family: Arial, Helvetica, sans-serif;
	font-weight: bold;
	color: #FFFFFF;
}
.f2 {font-family: Arial, Helvetica, sans-serif; font-weight: bold; color: #FFFFFF; font-size: 12px; }
.Estilo3 {color: #FFFFFF; font-size: 12px; font-family: Arial, Helvetica, sans-serif;}
.z4 {color: #000099}
.z5 {color: #000000}
#Frm center #DivFRM #layer .Estilo1 strong {
	color: #900;
}

-->
</style>

</head>
<body  <?php echo $LStrMsg;?>>
<form id="Frm" name="Frm" method="post" action="usuarios.php" autocomplete="off" >
<center> 
  <div Id="DivFRM"  class="centrarFrm" >
   
    <div id="layer4" style="position:absolute; left: 23px; top: 85px; width: 935px; height: 26px;">
      <div align="left" class="f2">
        <input name="CmdG" type="button" id="CmdG"
		<?php
		if(strlen($StrId)==0){
			echo "value=\"Guardar\"";
		}else{
			echo "value=\"Modificar\"";
		}
		?>
		onclick="fGuardar();" style="width:80px" tabindex="8"/>
		<input name="CmdB" type="button" id="CmdC" value="Nuevo" onclick="fCancelar();"  tabindex="9"/>
		<input name="CmdB" type="button" id="CmdZ" 
         value="Menu" onclick="fBuscar('menu.php');"  tabindex="10"/>
      </div>
    </div>
    
    <div id="layer3" style="position: absolute; left: 24px; top: 394px; width: 961px; height: 308px; overflow: auto">
      <div align="left" class="f2">
        <table width="943" height="19" border="1" cellpadding="0" cellspacing="0">
<tr  >
<td colspan="11" bgcolor="#FFFFFF" align="center">
<?php
if($LStrTR>$VP_RegXPag){
if($LStrPag==0){
echo "<input style=\"width:40px\" name=\"CmdNP\" type=\"button\" id=\"CmdNP\" value=\"|&lt;\" tabindex=\"5\" onclick=\"fPrimero();\" disabled=\"disabled\"/>";
echo "<input style=\"width:40px\" name=\"CmdNA\" type=\"button\" id=\"CmdNA\" value=\"<\" tabindex=\"6\" onclick=\"fAnterior();\" disabled=\"disabled\" />";
}else{
echo "<input style=\"width:40px\" name=\"CmdNP\" type=\"button\" id=\"CmdNP\" value=\"|&lt;\" tabindex=\"5\" onclick=\"fPrimero();\"/>";
echo "<input style=\"width:40px\" name=\"CmdNA\" type=\"button\" id=\"CmdNA\" value=\"<\" tabindex=\"6\" onclick=\"fAnterior();\"/>";
}
if($LStrPag==(floor($LStrTR / $VP_RegXPag)) ){
echo "<input style=\"width:40px\" name=\"CmdNS\" type=\"button\" id=\"CmdNS\" value=\">\" tabindex=\"7\" onclick=\"fSiguiente();\"  disabled=\"disabled\" />";
echo "<input style=\"width:40px\" name=\"CmdNU\" type=\"button\" id=\"CmdNU\" value=\"&gt;|\" tabindex=\"8\" onclick=\"fUltimo();\"  disabled=\"disabled\"/>";				
}else{
echo "<input style=\"width:40px\" name=\"CmdNS\" type=\"button\" id=\"CmdNS\" value=\">\" tabindex=\"7\" onclick=\"fSiguiente();\" />";
echo "<input style=\"width:40px\" name=\"CmdNU\" type=\"button\" id=\"CmdNU\" value=\"&gt;|\" tabindex=\"8\" onclick=\"fUltimo();\"/>";				
}
}
?>
</td>
</tr>
<tr>
<td width="105" bgcolor="#999999"><span class="z4">NOMBRE</span></td>
<td width="142" bgcolor="#999999"><span class="z4">ALMACEN ASIGNADO</span></td>
<td width="302" bgcolor="#999999"><span class="z4">NOM. Y APE.</span></td>
<td width="41" bgcolor="#999999"><span class="z4">HAB</span></td>
<td width="41" bgcolor="#999999"><span class="z4">E.V.</span></td>
<td width="41" bgcolor="#999999"><span class="z4">M.V.</span></td>
<td width="41" bgcolor="#999999"><span class="z4">A.V.</span></td>
<td width="41" bgcolor="#999999"><span class="z4">E.T.</span></td>
<td width="41" bgcolor="#999999"><span class="z4">M.P.</span></td>
<td width="41" bgcolor="#999999"><span class="z4">M.V.</span></td>
<td width="41" bgcolor="#999999"><span class="z4">.</span></td>
</tr>
<?php
	$StrTemp=$LStrPag * $VP_RegXPag;
	$s="SELECT id_usuario,nom,id_alm,nomape,hab,ev,mv,av,et,mp,mb FROM usuarios
		WHERE id_usuario> 0 ORDER BY nom ";

	if($LStrTR<=$VP_RegXPag){
	}else{
		$s=$s." LIMIT $StrTemp,$VP_RegXPag";
	}		  				
	$result = grs($s);
	while ($row = $result->fetch_row()){
echo "<tr ondblclick=\"fActivar($row[0]);\">";
echo "<td bgcolor=\"#FFFFFF\"><span class=\"z5\">$row[1]</span></td>";
if($row[2]==0){
	$StrAlmT="TODOS";
}else{
	$StrAlmT=gs("alm_obs","almacenes","id_almacen=$row[2]");
}
echo "<td bgcolor=\"#FFFFFF\"><span class=\"z5\">$StrAlmT</span></td>";
echo "<td bgcolor=\"#FFFFFF\"><span class=\"z5\">$row[3]</span></td>";
echo "<td bgcolor=\"#FFFFFF\"><span class=\"z5\">$row[4]</span></td>";
echo "<td bgcolor=\"#FFFFFF\"><span class=\"z5\">$row[5]</span></td>";
echo "<td bgcolor=\"#FFFFFF\"><span class=\"z5\">$row[6]</span></td>";
echo "<td bgcolor=\"#FFFFFF\"><span class=\"z5\">$row[7]</span></td>";
echo "<td bgcolor=\"#FFFFFF\"><span class=\"z5\">$row[8]</span></td>";
echo "<td bgcolor=\"#FFFFFF\"><span class=\"z5\">$row[9]</span></td>";
echo "<td bgcolor=\"#FFFFFF\"><span class=\"z5\">$row[10]</span></td>";
echo "<td bgcolor=\"#FFFFFF\" align=\"center\">
	 <a href=\"javascript:void(0)\" onclick=\"fActivar($row[0]);\">
	 <img src=\"img/b_edit.png\"  border=\"0\"/>
	 </a>
	 </td>";
echo "</tr>";
				}

		  ?>		  

        </table>
      </div>
    </div>
    
    

<input type="button" name="CmdRan" 
id="CmdRan" value="Cambiar password a todos" 
onclick="fReasignar();"   style="position: absolute; left: 29px; top: 713px; width: 240px; height: 25px;"
<?php
if(strlen($StrId)==0 || $StrId==0){
echo " disabled=\"disabled\"	";
}
?>
>


    <div id="layer" style="position:absolute; left: 116px; top: 21px; width: 412px; height: 45px; z-index: 100;">
      <div align="left" class="Estilo1">
        <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; ?>" />
      <strong>USUARIOS</strong></div>
    </div>
    


<div id="LblTit" style="position:absolute; left: 52px; top: 15px; width: 64px; z-index: 100;">
<div align="left" class="Estilo1">
<img src="img/usuarios.png" width="48" height="48" /></div>
</div>
<div id="layer8" style="position:absolute; left: 0px; top: 0px; width:1000px; height: 79px; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; z-index: 0;">
<div align="left" class="Estilo1">        
</div>
</div>


<div class="cs2" style="left:24px; top: 130px; width: 134px;">
NOMBRE DE USUARIO</div>
<input name="TxtNom" type="text" id="TxtNom" 
style="position:absolute; left: 24px; top: 147px; width: 173px;" 
tabindex="1"  
onKeyDown="return SoloTextoEx(event,'TxtPass');" 
value="<?php echo $StrNom;?>" maxlength="15" />

<div class="cs2" style="left: 217px; top: 130px; width: 87px;">
PASSWORD</div>
<input name="TxtPass" type="password" id="TxtPass" 
style="position:absolute; left: 215px; top: 147px; width: 101px;" 
tabindex="2"  
onkeydown="return SoloTextoEx(event,'TxtPass2');" 
value="<?php echo $StrPass;?>" maxlength="10" />

<div class="cs2" style="left: 334px; top: 130px; width: 83px;">
PASSWORD</div>
<input name="TxtPass2" type="password" id="TxtPass2" style="position:absolute; left: 335px; top: 147px; width: 97px;" 
tabindex="3"  
onkeydown="return SoloTextoEx(event,'CboEmp');" 
value="<?php echo $StrPass2;?>" maxlength="10" />

<div class="cs2" style="left:455px; top: 130px; width: 133px;">
EMPRESA ASIGNADA</div>
<select name="CboEmp" id="CboEmp" 
style="position: absolute; left: 455px; top: 147px; width: 241px;" 
onkeydown="return SoloTextoEx(event,'CboAlm');" 
onchange="CboEmp_OC();" tabindex="4">
<?php	
	echo FCBO_("emp_nomc","empresas","id_emp>0",$StrEmp,"S","N");
?>
</select>

<div class="cs2" style="left: 709px; top: 130px; width: 195px;">
ALMACEN ASIGNADO</div>
<select name="CboAlm" id="CboAlm" style="position: absolute; left: 709px; top: 147px; width: 266px;" 
onkeydown="return SoloTextoEx(event,'TxtFull');" tabindex="4">  
<?php	
	if($StrEmp=="TODOS"){
		echo "<option value=\"TODOS\" selected=\"selected\">TODOS</option>";
	}else{
		echo FCBO_("ANC","vis_almacenes","ENC='$StrEmp'",$StrAlm,"S","N");
	}
	
?>
</select>

<div class="cs2" style="left:24px; top: 178px; width: 185px;">
NOMBRES Y APELLIDOS</div>
<input name="TxtFull" type="text" id="TxtFull" 
style="position:absolute; left: 24px; top: 198px; width: 236px;" 
tabindex="5"  
onkeydown="return SoloTextoEx(event,'CboHab');" 
value="<?php echo $StrFull;?>" maxlength="100" />

<div class="cs2" style="left: 284px; top: 178px; width: 102px;">
HABILITADO</div>
<select name="CboHab" id="CboHab" style="position:absolute; left: 281px; top: 198px; width: 107px;" 
onkeydown="return SoloTextoEx(event,'CboPdv');" tabindex="6">
<?php
if($StrHab=="SI"){
echo "<option value=\"SI\" selected=\"selected\">SI</option>";
echo "<option value=\"NO\">NO</option>";
}else{
echo "<option value=\"SI\">SI</option>";
echo "<option value=\"NO\" selected=\"selected\">NO</option>";
}
?>
</select>

<div class="cs2" style="left:400px; top: 178px; width: 114px;">
PUNTO DE VENTA</div>
<select name="CboPdv" id="CboPdv" 
style="position:absolute; left:400px; top:196px; width: 178px;" 
onkeydown="return SoloTextoEx(event,'CboVen');" tabindex="4">  
<?php	
	echo FCBO_("ANC","vis_almacenes","IDA>0",$StrPdv,"S","N");	
?>
</select>

<div class="cs2" style="left:591px; top: 178px; width: 258px;">
VENDEDOR / CAJERO / FACTURACION</div>
<select name="CboVen" id="CboVen" 
style="position:absolute; left: 591px; top: 196px; width: 230px;"
onkeydown="return SoloTextoEx(event,'CmdG');" tabindex="15" >
<?php
echo FCBO_("NOMBRE","vpersonal","ID>0 AND (CARGO='VENDEDOR' OR CARGO='CAJERO' OR CARGO='FACTURACION')",$StrVen,"N","S");
?>
</select>
<?php
$CUR_USU_KOD=vbval(V($_SESSION['SYS_USER_ID']));
$CUR_USU_NOM=gs("nom","usuarios","id_usuario=".$CUR_USU_KOD);
?>

<input name="CUR_USU_NOM" id="CUR_USU_NOM" type="text" value="<?php echo $CUR_USU_NOM;?>" />
<script>
function fReasignar(){
	var cur_usu_nom=gv("CUR_USU_NOM");
	if(pre("¿Esta seguro que desea reasignar accesos, esta accion afectara a todos los usuarios menos al usuario actual ("+cur_usu_nom+")?")){
		SM("RND_PAS");
	}
}
</script>
<input type="button" name="CmdLoad" 
id="CmdLoad" value="Configurar menu" 
onclick="fMenuConfig();" tabindex="7"  style="position:absolute; left: 829px; top: 194px; width: 148px; height: 25px;"
<?php
	if(strlen($StrId)==0 || $StrId==0){
		echo " disabled=\"disabled\"	";
	}
?>
>


<div style="position:absolute; left: 22px; top: 233px; width: 126px; height: 25px;">
<div align="left" class="f2">
<input name="CH_EV" tabindex="10" type="checkbox"  id="CH_EV" value="1" 
<?php if($Str_EV=="1"){echo " checked=\"checked\" ";}	?>
/>
ELIMINAR VENTA</div>
</div>

<div id="layer17" style="position:absolute; left: 155px; top: 233px; width: 145px; height: 25px;">
<div align="left" class="f2">
<input name="CH_MV" tabindex="10" type="checkbox" 
id="CH_MV" value="1" 
<?php if($Str_MV=="1"){echo " checked=\"checked\" ";}	?>
/>
MODIFICAR VENTA</div>
</div>

<div  style="position:absolute; left: 303px; top: 233px; width: 138px; height: 25px;">
<div align="left" class="f2">
<input name="CH_AV" tabindex="10" type="checkbox" 
id="CH_AV" value="1"  
 <?php if($Str_AV=="1"){echo " checked=\"checked\" ";}	?>
/>
ANULAR VENTA</div>
</div>

<div  style="position:absolute; left:448px; top: 233px; width: 197px; height: 25px;">
<div align="left" class="f2">
<input name="CH_ET" tabindex="10" type="checkbox" 
id="CH_ET" value="1"  
<?php if($Str_ET=="1"){echo " checked=\"checked\" ";}	?>
/>
ELIMINAR TRANSFERENCIA</div>
</div>

<div  style="position:absolute; left:658px; top: 233px; width: 156px; height: 25px;">
<div align="left" class="f2">
<input name="CH_MP" tabindex="10" type="checkbox" 
id="CH_MP" value="1"  
<?php if($Str_MP=="1"){echo " checked=\"checked\" ";}	?>
/>
MODIFICAR PRECIOS</div>
</div>

<div  style="position:absolute; left:821px; top: 233px; width: 171px; height: 25px;">
<div align="left" class="f2">
<input name="CH_MB" tabindex="10" type="checkbox" 
id="CH_MB" value="1"  
<?php if($Str_MB=="1"){echo " checked=\"checked\" ";}	?>
/>
MODIFICAR VENDEDOR</div>
</div>


<div  style="position: absolute; left: 22px; top: 259px; width: 400px; height: 25px;">
<div align="left" class="f2">
<input name="CH_GII_MOD_COR" tabindex="10" type="checkbox" 
id="CH_GII_MOD_COR" value="1"  
<?php if($CH_GII_MOD_COR=="1"){echo " checked=\"checked\" ";}	?>
/>
MODIFICAR CORRELATIVO DE GUIAS INTERNAS</div>
</div>




<div class="cs2" style="left: 24px; top: 304px; width: 353px; color:#FC0">HABILITAR ELIMINAR PARA LOS SIGUIENTES MODULOS</div>

<div  style="position: absolute; left: 22px; top: 326px; width: 108px; height: 25px;">
<div align="left" class="f2">
<input name="CH_ELI_CON"  type="checkbox" 
id="CH_ELI_CON" value="1"  
<?php if($Str_ELI_CON=="1"){echo " checked=\"checked\" ";}	?>
/>
CONTRATOS</div>
</div>

<div  style="position: absolute; left: 132px; top: 326px; width: 171px; height: 25px;">
<div align="left" class="f2">
<input name="CH_ELI_CON_ING" type="checkbox" 
id="CH_ELI_CON_ING" value="1"  
<?php if($Str_ELI_CON_ING=="1"){echo " checked=\"checked\" ";}	?>
/>
CONTRATOS INGRESOS</div>
</div>

<div  style="position: absolute; left: 307px; top: 326px; width: 110px; height: 25px;">
<div align="left" class="f2">
<input name="CH_ELI_DEV" type="checkbox" 
id="CH_ELI_DEV" value="1"  
<?php if($Str_ELI_DEV=="1"){echo " checked=\"checked\" ";}	?>
/>
DEVOLUCION</div>
</div>

<div  style="position: absolute; left: 426px; top: 326px; width: 104px; height: 25px;">
<div align="left" class="f2">
<input name="CH_ELI_DEV_DEJ" type="checkbox" 
id="CH_ELI_DEV_DEJ" value="1"  
<?php if($Str_ELI_DEV_DEJ=="1"){echo " checked=\"checked\" ";}	?>
/>
DEV. (DEJA)</div>
</div>

<div  style="position: absolute; left: 531px; top: 326px; width: 83px; height: 25px;">
<div align="left" class="f2">
<input name="CH_ELI_COB"  type="checkbox" 
id="CH_ELI_COB" value="1"  
<?php if($Str_ELI_COB=="1"){echo " checked=\"checked\" ";}	?>
/>
COBROS</div>
</div>

<div  style="position: absolute; left: 618px; top: 326px; width: 171px; height: 25px;">
<div align="left" class="f2">
<input name="CH_ELI_COB_TRA" type="checkbox" 
id="CH_ELI_COB_TRA" value="1"  
<?php if($Str_ELI_COB_TRA=="1"){echo " checked=\"checked\" ";}	?>
/>
COB.TRANSFERENCIAS</div>
</div>

<div  style="position: absolute; left: 792px; top: 326px; width: 87px; height: 25px;">
<div align="left" class="f2">
<input name="CH_ELI_EGR"  type="checkbox" 
id="CH_ELI_EGR" value="1"  
<?php if($Str_ELI_EGR=="1"){echo " checked=\"checked\" ";}	?>
/> 
EGRESOS
</div>
</div>

<div  style="position: absolute; left: 885px; top: 326px; width: 87px; height: 25px;">
<div align="left" class="f2">
<input name="CH_ELI_ING"  type="checkbox" 
id="CH_ELI_ING" value="1"  
<?php if($Str_ELI_ING=="1"){echo " checked=\"checked\" ";}	?>
/> 
INGRESOS
</div>
</div>



<div  style="position: absolute; left: 22px; top: 354px; width: 141px; height: 25px;">
<div align="left" class="f2">
<input name="CH_ELI_GII"  type="checkbox" 
id="CH_ELI_GII" value="1"  
<?php if($Str_ELI_GII=="1"){echo " checked=\"checked\" ";}	?>
/> 
GUIA INTERNA
</div>
</div>









</div>
</center>	
</form>
</body>
</html>
