<?php
session_start();
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
include("phpmnu_fun.php");
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
//
$HW=V($_SESSION['SYS_HW']);
$IdUsu=vbval(V($_SESSION['SYS_USER_ID']));
//
$StrGT="";
$SYS_MSG="";
$SYS_FOC="";
$OK=1;
//
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
$LStrPag=V($_POST['TxtPag']);
//
include("ges_empresas_fun.php");
//
$VP_RegXPag=100;
$LStrTR=gn("count(*)","ges_empresas","id_emp>0");
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
$TI=0;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Empresas</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/ges_empresas.js"></script>
<!--FIN_SCRIPT------------------------------------->
<link rel="stylesheet" type="text/css" href="css/estiloss.css"  />
<link rel="stylesheet" type="text/css" href="css/basic.css"  />
<link rel="stylesheet" type="text/css" href="css/mnu.css"  />

<style type="text/css">
.cF {height:600px;width:1250px;position:relative;top:0px}
.mM {height:34px;width:1250px;position:relative;top:0px;background-color:#09C; z-index:500;}

.tableFixHead          { overflow-y: auto; overflow:auto; border:solid 1px #363636;position: absolute; }
.tableFixHead thead th { position: sticky; top: 0; }
table  {border-collapse:collapse;width:100%;}
th, td {padding: 3px 3px;}
th     {background:#A0A0A0}
</style>
<script>
function FUN_INI(){
  Inicializar();
  //
  SYS_LOAD();
}
</script>
</head>

<body onLoad="FUN_INI()" >
<div align="center">

<div class="mM" align="left" style="font-size:12px">
<?php
echo GEN_MENU($IdUsu);
?>
</div>

<div Id="DivFRM"  class="cF" style="background-color:#FFFFFF;">
<form id="Frm" name="Frm" method="post" autocomplete="off"
action="ges_empresas.php" enctype="multipart/form-data" 
style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" >
<img src="png/ges_home64.png"  class="iT" />
<div class="tT">EMPRESAS</div>
</div>
<!--FIN_TITULO--------------------------------->

<div class="s1" style="left:35px; top: 115px; width: 356px;">
NOMBRE COMERCIAL (Usado en el invoice)</div>
<input name="NomCom"  type="text" id="NomCom"
class="lt" style="left: 35px; top: 135px; width: 410px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $NomCom;?>"/>

<div class="s1" style="left:457px; top: 103px; width: 134px;">
NOMBRE ABREVIADO / CORTO</div>
<input name="NomCor"  type="text" id="NomCor"
class="lt" style="left: 456px; top: 135px; width: 136px"
tabindex="<?php echo ++$TI;?>" maxlength="20"
value="<?php echo $NomCor;?>"/>

<div class="s1" style="left:602px; top: 115px; width: 120px;">
RUC</div>
<input name="Ruc"  type="text" id="Ruc"
class="lt" style="left:602px; top: 135px; width: 104px"
tabindex="<?php echo ++$TI;?>" maxlength="11"
value="<?php echo $Ruc;?>"/>

<div class="s1" style="left:720px; top: 115px; width: 150px;">
DIRECCION</div>
<input name="Dir"  type="text" id="Dir"
class="lt" style="left: 719px; top: 135px; width: 399px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $Dir;?>"/>

<?php if(strlen($Ext)==0)$Ext="NO";?>
<div class="s1" style="left: 1128px; top: 115px; width: 73px;">
EXTERNA</div>
<select name="Ext" id="Ext"  onChange="PRV_OC()"
class="lt" style="left: 1128px; top: 135px; width: 81px" 
tabindex="<?php echo ++$TI;?>">
<?php 
	echo FCBO("aux_nom","auxiliar","aux_id>0 AND aux_des='SN'",$Ext,"N","S");
?>
</select>

<!--INI_BOTONES-------------------------------->
<div id="DivBtn" align="left" 
style="position:absolute; left: 33px; top: 71px; width:1000px; height: 26px;">
<input name="CmdB" type="button" id="CmdG" class="btm" 
<?php GOM($StrId);?>
onclick="fGuardar();"  
tabindex="<?php echo ++$TI;?>"/>

<input name="CmdB" type="button" id="CmdC"  class="btm" 
value="Nuevo" onClick="fCancelar();"  
tabindex="<?php echo ++$TI;?>" />

<input name="CmdB" type="button" id="CmdB" class="btm"
value="Buscar" onClick="fBuscar('ges_empresas_b.php');"  
tabindex="<?php echo ++$TI;?>"/>

<input name="CmdB" type="button" id="CmdE" class="btm" 
value="Eliminar" onClick="fEliminar();"
<?php DIS($StrId);?>
tabindex="<?php echo ++$TI;?>" />
</div>
<!--FIN_BOTONES-------------------------------->
<div  style="position: absolute; left:35px; top: 163px; ; width: 1175px;height: ">
<table width="100%" style="font-family:Arial, Helvetica, sans-serif; font-size:11px">
<thead>
<tr>
<td colspan="10" height="18" align="center">
<?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
</td>
</tr>
</thead>
</table>
</div>

<div class="tableFixHead" style="left:35px; top: 194px;width: 1175px; height: 383px; ">
<table width="100%" style="font-family:Arial, Helvetica, sans-serif; font-size:11px" >
<thead>
<tr>
<th width="32%" align="left">NOMBRE COMERCIAL</th>
<th width="13%" align="left">NOMBRE CORTO</th>
<th width="11%" align="left">RUC</th>
<th width="42%" align="left">DIRECCION</th>
<th width="42%" align="left">EXTERNA</th>
<th width="2%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php
$PX=0;
$s="SELECT * FROM ges_empresas WHERE id_emp>0 ORDER BY emp_nom_com ";	
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);
$rs=grs($s);
while($r=$rs->fetch_assoc()){	
$PX++;
$CSS="";
if($PX%2==0)$CSS=' style="background-color:#D4D4D4" ';
?>
<tr onDblClick="fAc(<?php echo $r['id_emp'];?>);" <?php echo $CSS;?>>
<!----------------------------------------------->
<td><?php echo $r['emp_nom_com'];?></td>
<td><?php echo $r['emp_nom_cor'];?></td>
<td style="font-family:'Courier New', Courier, monospace"><?php echo $r['emp_ruc'];?></td>
<td><?php echo $r['emp_dir'];?></td>
<td><?php echo $r['emp_externa'];?></td>
<!----------------------------------------------->
<td align="center">
<a href="javascript:void(0)" onClick="fAc(<?php echo $r['id_emp'];?>);">
<img src="img/b_edit.png"  border="0"/></a></td>
</tr>
<?php
}
?>		  

</tbody>
</table>
</div>
<!--INI_OCULTOS-------------------------------->
<?php
include("ocultos.php");
?>
<!--INI_OCULTOS-------------------------------->
<input name="SYS_MSG" type="hidden" id="SYS_MSG" value="<?php echo $SYS_MSG;?>" />
<input name="SYS_FOC" type="hidden" id="SYS_FOC" value="<?php echo $SYS_FOC;?>" />
</form>
</div>
</div>
</body>
</html>
