<?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="";
$LStrMsg="";
$LStrFoc="";
$LStrMM="";
//
$POL_USU_PER_ELI=USU_PER_GET_EX("ELI_CON_ING");
//
$LStrPag=V($_POST['TxtPag']);
include("contratos_ingresos_fun.php");
$VP_RegXPag=20;
$LStrTR=gn("count(*)","vis_contratos_ingresos","");
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);
?>
<!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>Contratos Ingresos</title>
<script src="jquery-1.7.2.min.js" type="text/javascript"></script>
<script src="jquery.maskedinput.min.js" type="text/javascript"></script>
<script type="text/javascript" src="fe/funcionez.js"></script>
<script type="text/javascript" src="fe/contratos_ingresos4.js"></script>
<script>
LK=0;
$(document).ready(function(){
   $("#TxtFec").mask("99-99-99"); 
   var pol_usu_per_eli=gv("POL_USU_PER_ELI");
   if(jVal(pol_usu_per_eli)==0){
	   document.getElementById("CmdE").disabled=true;
   }    
});
</script>
<link rel="stylesheet" type="text/css" href="basic.css"  />
<style type="text/css">
<!--
body {
	background-color: #CCC;
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}
.centrarFrm{
	width:1100px;
	height:600px;
	position:absolute;
    left:<?php echo "50%";?>;
    top:<?php echo "50%";?>;
	background-color:#666666;
	margin:<?php echo "-300px";?> 0 0 <?php echo "-550px";?>;
}
#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;}
.s4 {color: #000099}
.s5 {color: #000000}
#Frm center #DivFRM #layer .Estilo1 strong {
	color: #900;
}

-->
</style>

</head>
<body  <?php echo $LStrMsg;?>>
<form id="Frm" name="Frm" method="post" action="contratos_ingresos.php">
<center> 
<div Id="DivFRM"  class="centrarFrm" >
<div class="EV" style="left: 392px; top: 130px; ; width: 88px; color:#FF0"><u><a onclick="fFecServer('TxtFec')">(dd-mm-yy) +</a></u></div>



<div class="s1" style="left: 31px; top: 130px; width: 92px;">
Nº INGRESO</div>
<input name="TxtNro" type="text" id="TxtNro" 
style="left:31px; top: 150px; width: 80px; background-color:#CCCCCC" 
readonly="readonly"
value="<?php echo $StrNro;?>"  
onKeyDown="return SoloTextoEx(event,'TxtFec');"  
tabindex="1" />

<div class="s1" style="left:131px; top: 130px; width: 92px;"> EMPRESA
</div>
<select name="CboEmp" id="CboEmp" 
style="position:absolute; left:131px; top:150px; width: 118px;" 
onchange="EM_OC();"
onkeydown="return SoloTextoEx(event,'TxtFec');" tabindex="2">
<?php 
	echo LE($StrEmp,"N","S"); 
?>
</select>

<div class="s1" style="position:absolute; left:266px; top: 130px; width: 106px;">
PUNTO DE VENTA</div>
<select name="CboAlm" id="CboAlm" 
style="left: 266px; top: 150px; width:105px;" 
onkeydown="return SoloTextoEx(event,'TxtFec');" 
tabindex="3" >
<?php
	echo LA($StrEmp,$StrAlm,"N","S");
?>
</select>


  
<div class="s1" style="left: 394px; top: 115px; width: 87px;">
FECHA
</div>
<input name="TxtFec" type="text" id="TxtFec" style="position:absolute; left: 392px; top: 150px; width: 76px;" 
value="<?php echo $StrFec;?>"  
onkeydown="return SoloFec(this,event,'TxtNum');" 
tabindex="4" />
  
<div class="s1" style="left: 480px; top: 130px; width: 98px;">N&ordm; CONTRATO +</div>
<input name="TxtNum" type="text" id="TxtNum" 
style="left: 479px; top: 150px; width: 94px;" 
value="<?php echo $StrNum;?>"   onblur="GetCon();" onfocus="LK=0;"
onkeydown="LK=KEY(event);return SoloNum(this,event,'TxtCob');" 
tabindex="5" />

<div class="s1" style="left: 588px; top: 130px; width: 179px;">
CLIENTE / RAZON SOCIAL</div>
<input name="TxtCli" type="text" id="TxtCli" 
style="left: 586px; top: 150px; width: 264px; background-color:#CCCCCC" 
readonly="readonly"
value="<?php echo $StrCli;?>"  
onKeyDown="return SoloTextoEx(event,'TxtTot');"  
tabindex="6" />

<div class="s1" style="left: 866px; top: 115px; width: 77px;"> TOTAL CONTRATO
</div>
<input name="TxtTot" type="text" id="TxtTot" 
style="left: 867px; top: 150px; width: 93px; background-color:#CCCCCC" 
readonly="readonly"
value="<?php echo $StrTot;?>"  
onKeyDown="return SoloTextoEx(event,'TxtAcu');"  
tabindex="7" />

<div class="s1" style="left: 972px; top: 115px; width: 87px;"> T. ACUENTA CONTRATO
</div>
<input name="TxtAcu" type="text" id="TxtAcu" 
style="left: 973px; top: 150px; width: 107px; background-color:#CCCCCC" 
readonly="readonly"
value="<?php echo $StrAcu;?>"  
onKeyDown="return SoloTextoEx(event,'TxtCob');"  
tabindex="8" />


<div class="s1" style="left:31px; top: 191px; width: 82px;">T. COBRAR</div>
<input name="TxtCob" type="text" id="TxtCob" 
style="position:absolute; left: 31px; top: 211px; width:80px; text-align:right" 
value="<?php echo $StrCob;?>"  
onkeydown="return SoloNum(this,event,'CboMod');" 
tabindex="9"  onkeyup="Cal();"
onfocus="selecciona_value(this);"
/>

<div class="s1" style="left:131px; top: 191px; width: 98px;"> MODALIDAD
</div>
<select name="CboMod" id="CboMod" 
style="width:118px; position:absolute; left: 131px; top: 211px;" 
onkeydown="return SoloTextoEx(event,'CmdG');" 
tabindex="10" 
>
<?php
echo FCBOO_("au_item","auxiliar","au_tab='MODA'",$StrMod,"N","N","au_orden");
?>
</select>

<div class="s1" style="left: 266px; top: 190px; width: 82px;"> SALDO</div>
<input name="TxtSal" type="text" id="TxtSal" 
style="left: 266px; top: 211px; width: 105px; background-color:#CCCCCC" 
readonly="readonly"
value="<?php echo $StrSal;?>"  
onKeyDown="return SoloTextoEx(event,'CmdSel');"  
tabindex="11" />



<div id="layer4" style="position:absolute; left: 30px; top: 85px; width: 442px; height: 26px;">
  <div align="left" class="f2">
<input name="CmdB" type="button" id="CmdG" value="Guardar"
<?php
if(strlen($StrId)>0){
	echo " disabled=\"disabled\" ";
}
?>
onclick="fGuardar();" style="width:80px" tabindex="10"/>
<input name="CmdB" type="button" id="CmdC" value="Nuevo" 
onclick="fCancelar();"  tabindex="11"/>

<input name="CmdB" type="button" id="CmdE" value="Eliminar" onclick="flEliminar();"
<?php
	$OK=0;
	if(vbval($StrAku)>0){
		$OK=1;
		echo " disabled=\"disabled\" ";    
	}
	if($LIMPIAR==1 && $OK==0){
		$OK=1;
		echo " disabled=\"disabled\" ";
	}
	if(strlen($StrCmd)==0 && $OK==0){
		$OK=1;
		echo " disabled=\"disabled\" ";
	}
	if(vbval($StrId)>0 && $OK==0){
		$ANU=gs("ci_anu","contratos_ingresos","id_con_ing=$StrId");
		if($ANU=="SI"){
			 echo " disabled=\"disabled\" ";
		}
	}
?>
 tabindex="12"/>
 
<input name="CmdB" type="button" id="CmdA" value="Anular" onclick="flAnular();"
<?php
	$OK=0;
	if(vbval($StrAku)>0){
		$OK=1;
		echo " disabled=\"disabled\" ";    
	}
	if($LIMPIAR==1 && $OK==0){
		$OK=1;
		echo " disabled=\"disabled\" ";
	}
	if(strlen($StrCmd)==0 && $OK==0){
		$OK=1;
		echo " disabled=\"disabled\" ";
	}
	if(vbval($StrId)>0 && $OK==0){
		$ANU=gs("ci_anu","contratos_ingresos","id_con_ing=$StrId");
		if($ANU=="SI"){
			 echo " disabled=\"disabled\" ";
		}
	}
?>
tabindex="12"/>
 
 
<input name="CmdB" type="button" id="CmdB" 
value="Buscar" onclick="fBuscar('contratos_ingresos_buscar.php');" 
tabindex="15"/>
<input name="CmdB" type="button" id="CmdZ" 
value="Menu" onclick="fBuscar('menu.php');"  tabindex="15"/>
      </div>
</div>
<div id="layer3" style="position:absolute; left: 30px; top: 246px; width: 1051px; height: 336px; overflow:auto">
<div align="left" class="f2">
<table width="1051" height="22" border="1" cellpadding="0" cellspacing="0">

<tr>
<td height="18" colspan="10" bgcolor="#666666" align="center">
<?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?>
</td>
</tr>

<tr>
<td width="70" bgcolor="#999999" style="color:#000">N&ordm;INGRESO</td>
<td width="53" bgcolor="#999999" style="color:#000">FECHA</td>
<td width="89" bgcolor="#999999" style="color:#000">N&ordm;CONTRATO</td>
<td width="327" bgcolor="#999999" style="color:#000">CLIENTE</td>
<td width="102" bgcolor="#999999" style="text-align:right; color:#000">TOT. CONTRATO</td>
<td width="78" bgcolor="#999999" style="text-align:right; color:#000">T. ACUENTA</td>
<td width="67" bgcolor="#999999" style="text-align:right; color:#000">COBRADO</td>
<td width="85" bgcolor="#999999" style="color:#000">MODALIDAD</td>
<td width="66" bgcolor="#999999" style="text-align:right; color:#000">SALDO</td>
<td width="72" bgcolor="#999999" style="color:#000">USUARIO</td>
<td width="18" bgcolor="#999999">&nbsp;</td>
</tr>
<?php
$s="SELECT ID,NUM,DATE_FORMAT(FEC,'%d-%m-%y'),CON_NRO,CLI,
CON_TOT,ACU,TOT,TIP,SAL,USU 
FROM vis_contratos_ingresos ORDER BY ID DESC";
$s=PagSql($s,$LStrPag,$VP_RegXPag,$LStrTR);	
$result = grs($s);
while ($row = $result->fetch_row()){	
	echo "<tr ondblclick=\"fActivar($row[0]);\">";
	echo "<td bgcolor=\"#FFFFFF\"><span class=\"s5\">$row[1]</span></td>";
	echo "<td bgcolor=\"#FFFFFF\"><span class=\"s5\">$row[2]</span></td>";
	echo "<td bgcolor=\"#FFFFFF\"><span class=\"s5\">$row[3]</span></td>";
	echo "<td bgcolor=\"#FFFFFF\"><span class=\"s5\">$row[4]</span></td>";
	echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right\"><span class=\"s5\">".NF3($row[5])."</span></td>";
	echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right\"><span class=\"s5\">".NF3($row[6])."</span></td>";
	echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right\"><span class=\"s5\" >".NF3($row[7])."</span></td>";
	echo "<td bgcolor=\"#FFFFFF\" ><span class=\"s5\" >$row[8]</span></td>";
	echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right\"><span class=\"s5\" >".NF3($row[9])."</span></td>";
	echo "<td bgcolor=\"#FFFFFF\"><span class=\"s5\">$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>
<div id="layer" style="position:absolute; left: 116px; top: 21px; width: 412px; height: 45px; z-index: 100;">
<div align="left" class="Estilo1">

<input name="POL_USU_PER_ELI" type="hidden" id="POL_USU_PER_ELI" value="<?php echo $POL_USU_PER_ELI;?>"/>

<input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
<input name="TxtAc" type="hidden" id="TxtAc" value="" />
<input name="TxtAku" type="hidden" id="TxtAku" value="<?php echo $StrAku;?>" />
<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
<input name="FEC_SERVER" type="hidden" id="FEC_SERVER" value="<?php echo date("d-m-y");?>"/>  
<strong>CONTRATOS - INGRESOS</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/marcas.gif" width="48" height="48" /></div>
</div>
<div id="layer8" 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 align="left" class="Estilo1">        
</div>
</div>
</div>
</center>	
</form>
</body>
</html>
