<?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;
}
//-------------------------
$StrId=V($_POST['TxtId']);
$StrCmd=V($_POST['TxtAc']);
//-------------------------
$StrEmp=V($_POST['CboEmp']);
$StrCom=V($_POST['CboCom']);
$StrSer=V($_POST['TxtSer']);
$StrNum=V($_POST['TxtNum']);
$StrDex=V($_POST['TxtDex']);
$StrHax=V($_POST['TxtHax']);
$StrPro=V($_POST['TxtPro']);
$StrSN=V($_POST['CboSN']);
$StrNro=V($_POST['TxtNro']);
$StrUsu=V($_POST['CboUsu']);
//-------------------------
if(strlen($StrEmp)==0)$StrEmp=GE("S");
if(strlen($StrUsu)==0)$StrUsu="TODOS";
//
if(strlen($StrCom)==0) $StrCom="TODOS";	
if(strlen($StrSN)==0) $StrSN="NO";	
$StrSN_=$StrSN;
//-------------------------
if($StrCom=="TODOS"){
$StrCom_="%";
}else{
$StrCom_=$StrCom;
}
$StrSer_="%".$StrSer;
$StrNum_="%".$StrNum;	
$StrDex_=val_dex($StrDex);
$StrHax_=val_hax($StrHax);
$StrPro_=$StrPro."%";
if(strlen($StrNro)==0){
$StrNro_="%";
}else{
$StrNro_=$StrNro;
}
$StrUsu_=LIKE($StrUsu);
//-------------------------
$FF="ID>0 AND COM LIKE '$StrCom_' AND CSER LIKE '$StrSer_' AND ".
"CNUM LIKE '$StrNum_' AND FEC>='$StrDex_' AND  ".
"FEC<='$StrHax_' AND CLI LIKE '$StrPro_' AND ".
"ANU LIKE '$StrSN_' AND NUM LIKE '$StrNro_' AND USU LIKE '$StrUsu_' ";
//

$LStrTR=gn("count(*)","vis_cobrox",$FF);
$LStrPag=V($_POST['TxtPag']);	
if($StrCmd=="F"){$LStrPag="1";}
$VP_RegXPag=20;	
$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>Cobros - Buscar</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/funciones.js"></script>
<script>
$(document).ready(function(){
   $("#TxtDex").mask("99-99-99");    
   $("#TxtHax").mask("99-99-99");    
});
</script>
<script language="javascript">
$(document).ready(function() {
	$(".botonExcel").click(function(event) {
		$("#datos_a_enviar").val( $("<div>").append( $("#Exportar_a_Excel").eq(0).clone()).html());
		$("#FormularioExportacion").submit();
});
});
</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:#006699;
	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}
.Estilo5 {color: #000000}

-->
</style>

</head>
<body  <?php echo $StrMsg;?>>
<div Id="DivFRM"  class="centrarFrm" >
<form id="Frm" name="Frm" method="post" action="cobrox_buscar.php">

<div class="s1" style="left: 313px; top: 101px; width: 58px;">
NUMERO
</div>
<input name="CmdV" type="button" id="CmdV"  
style="position:absolute; left: 79px; top: 50px; width: 60px;"
value="Volver" onclick="fVolver('cobrox.php');" />

<div id="layer3" style="position:absolute; left: 25px; top: 147px; width: 1055px; height: 423px;">
<div align="left" class="f2">
<table id="Exportar_a_Excel" width="1034" height="19" border="1" cellpadding="0" cellspacing="0">

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

</tr>
<tr>
<td width="75" bgcolor="#999999" style="color:#000">N&ordm;COBRO</td>            
<td width="83" bgcolor="#999999" style="color:#000">FECHA</td>
<td width="112" bgcolor="#999999" style="color:#000">COMPROBANTE</td>
<td width="92" bgcolor="#999999" style="color:#000">NUMERO</td> 
<td width="501" bgcolor="#999999" style="color:#000">CLIENTE</td>            
<td width="89" bgcolor="#999999" style="color:#000" align="right">TOTAL</td>
<td width="43" bgcolor="#999999" style="color:#000">ANU</td> 
<td width="43" bgcolor="#999999" style="color:#000">USUARIO</td> 
<td width="21" bgcolor="#999999">&nbsp;</td>
</tr>
<?php		  		
$StrTemp=$StrPag * $VP_RegXPag;
$ss="SELECT ID,NUM,DATE_FORMAT(FEC,'%d-%m-%y'),COM,CSER,CNUM,".
	"SUBSTRING(CLI,1,52),TOTAL,ANU,USU  
	 FROM vis_cobrox WHERE $FF ORDER BY ID DESC ";		
//echo $ss;		
$X1="<td bgcolor=\"#FFFFFF\"><span class=\"Estilo5\">";
$X1B="<td bgcolor=\"#FFFFFF\" align=\"right\"><span class=\"Estilo5\">";
$X2="</span></td>";
$s=PagSql($ss,$LStrPag,$VP_RegXPag,$LStrTR);
$result = grs($s);				
while ($row = $result->fetch_row()){
$SER=$row[4];
$NUM=$row[5];
if(strlen($SER)>0){
$NUM=$SER."-".$NUM;
}
echo "<tr 
ondblclick=\"location.href='cobrox.php?Id=$row[0]&Pag=0';\">";
echo $X1.$row[1].$X2;		
echo $X1.$row[2].$X2;
echo $X1.$row[3].$X2;
echo $X1.$NUM.$X2;
echo $X1.$row[6].$X2;
echo $X1B.NF3($row[7]).$X2;
echo $X1.$row[8].$X2;
echo $X1.$row[9].$X2;

echo "<td bgcolor=\"#FFFFFF\" align=\"center\">
<a href=\"cobrox.php?Id=$row[0]&Pag=0\" >
<img src=\"img/b_edit.png\"  border=\"0\"/>
</a>
</td>";
echo "</tr>";
}

?>		  

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

    <div id="layer" style="position:absolute; left: 79px; top: 30px; width: 412px; height: 24px;">
      <div align="left" class="Estilo1">COBROS TRANSFERENCIA - BUSCAR
        <input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
        <input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
		<input name="TxtAc" type="hidden" id="TxtAc" value="" />
<input name="FEC_SERVER" type="hidden" id="FEC_SERVER" value="<?php echo date("d-m-y");?>"/>  
      </div>
    </div>
<input name="TxtNum" type="text" id="TxtNum" 
style="left: 314px; top: 117px; width: 58px;"
tabindex="3"
onblur="_N(this);"  
onkeydown="return SoloTextoEx(event,'TxtDex');"
value="<?php echo $StrNum;?>" maxlength="6" />

    <div id="LblTit" style="position:absolute; left: 20px; top: 25px; width: 64px;">
    <div align="left" class="Estilo1"><img src="img/buscar.png" width="57" height="60" /></div>
  </div>	
<input name="CmdB" type="button" id="CmdB" 
style="position:absolute; left: 1020px; top: 117px; width: 62px;" 
value="Filtrar" onclick="fFiltrar();"  tabindex="8"/>
<div class="s1" style="left: 385px; top: 85px; width: 45px;">
DESDE
</div>
<div class="EV" style="left: 381px; top: 101px; width: 88px; color:#FF0"><u><a onclick="fFecServer('TxtDex')">(dd-mm-yy) +</a></u></div>



<input name="TxtDex" type="text" id="TxtDex" 
style="left: 383px; top: 117px; width: 61px;" value="<?php echo $StrDex;?>"  
onkeydown="return SoloFec(this,event,'TxtHax');"
tabindex="4" />

<input name="TxtPro" type="text" id="TxtPro" 
style="left: 528px; top: 117px; width: 192px;" value="<?php echo $StrPro;?>"  
onkeydown="return SoloTextoEx(event,'CboSN');" 
tabindex="6" />
<div class="s1" style="left: 530px; top: 101px; width: 100px;">
CLIENTE
</div>
<div class="s1" style="left: 459px; top: 85px; width: 60px;">
HASTA
</div>
<div class="EV" style="left: 455px; top: 101px; width: 88px; color:#FF0"><u><a onclick="fFecServer('TxtHax')">(dd-mm-yy) +</a></u></div>
<input name="TxtHax" type="text" id="TxtHax" 
style="left: 456px; top: 117px; width: 60px;" 
value="<?php echo $StrHax;?>"  
onkeydown="return SoloFec(this,event,'TxtPro');"
tabindex="5" />

<div class="s1" style="left: 148px; top: 101px; width: 102px;"> COMPROBANTE
</div>
<select name="CboEmp" id="CboEmp" 
style="position:absolute; left:24px; top:117px; width: 119px;" 
onkeydown="return SoloTextoEx(event,'CboAlm');" tabindex="1">
<?php 
	echo LE($StrEmp,"S","N"); 
?>
</select>

<select name="CboCom" id="CboCom" 
style="left: 147px; top: 117px; width: 102px;"  tabindex="1"
onkeydown="return SoloTextoEx(event,'TxtSer');">
<?php
echo FCBO_("com_nombre","comprobantes",
"com_nombre IN ('FACTURA','BOLETA','PROFORMA','FACT. ELEC.','BOL. ELEC.')",$StrCom,"S","N");
?>
</select>
<div class="s1" style="left: 27px; top: 101px; width: 102px;">
EMPRESA
</div>
<div class="s1" style="left: 257px; top: 101px; width: 46px;">
  SERIE
</div>
<input name="TxtSer" type="text" id="TxtSer"
style="left: 257px; top: 117px; width: 47px;"
tabindex="2"  onblur="_S(this);"  
onkeydown="return SoloTextoEx(event,'TxtNum');" value="<?php echo $StrSer;?>" maxlength="4" />
<div class="s1" style="left: 732px; top: 101px; width: 75px;">
ANULADO
</div>
<select name="CboSN" id="CboSN" 
style="left: 730px; top: 117px; width: 81px;"  tabindex="7"
onkeydown="return SoloTextoEx(event,'TxtNro');">
<?php
if($StrSN=="" || $StrSN=="NO"){
AD("NO",1);	AD("SI",0);
}else{
AD("NO",0);	AD("SI",1);
}
?>
</select>

<div class="s1" style="left: 819px; top: 101px; width: 101px;">
N&ordm; COBRO.
</div>
<input name="TxtNro" type="text" id="TxtNro" 
style="left: 819px; top: 117px; width: 66px;" value="<?php echo $StrNro;?>"  
onkeydown="return SoloTextoEx(event,'CboUsu');"
tabindex="8" />

<div class="s1" style="left:901px; top: 101px; width: 88px;"> USUARIO
</div>
<select name="CboUsu" id="CboUsu" 
style="width:111px; position:absolute; left: 898px; top: 117px;" 
onkeydown="return SoloTextoEx(event,'CmdB');" 
tabindex="6" 
>
<?php
	echo FCBO("USU","vis_usuarios_cargos","CAR='CAJERO'",$StrUsu,"S","N");
?>
</select>


</form>

<form action="ficheroExcel.php" method="post" target="_blank" id="FormularioExportacion" >
<div style="position:absolute; left: 156px; top: 50px; width: 45px; height: 15px;">  
<input name="" type="button" class="botonExcel" value="Exportar" />
<input type="hidden" id="datos_a_enviar" name="datos_a_enviar" />
</div>
</form>
</div>
</body>
</html>

