<?php
$StrCmd=V($_POST['TxtAc']);
//-------------------------++++
$EmiRuc=V($_POST['EmiRuc']);			
$EmiNom=V($_POST['EmiNom']);		
$FacSer=V($_POST['FacSer']);		
$FacNum=V($_POST['FacNum']);		
$Dex=V($_POST['Dex']);
$Hax=V($_POST['Hax']);
$CliRuc=V($_POST['CliRuc']);
$CliNom=V($_POST['CliNom']);
$CuoFecVenDex=V($_POST['CuoFecVenDex']);
$CuoFecVenHax=V($_POST['CuoFecVenHax']);
$CuoPag=V($_POST['CuoPag']);
//++
if(strlen($CuoPag)==0)$CuoPag="NO";
//++
$EmiRuc_=$EmiRuc."%";
$EmiNom_=$EmiNom."%";
$FacSer_=$FacSer."%";
$FacNum_=$FacNum."%";
$Dex_=Xmldex_($Dex);
$Hax_=Xmlhax_($Hax);
$CliRuc_=$CliRuc."%";
$CliNom_=$CliNom."%";
$CuoFecVenDex_=Xmldex_($CuoFecVenDex);
$CuoFecVenHax_=Xmlhax_($CuoFecVenHax);
//++
$FF="ID_XML>0 AND EMI_RUC LIKE '$EmiRuc_' AND 
	 EMI_NOM LIKE '$EmiNom_' AND 
	 SER LIKE '$FacSer_' AND NUM LIKE '$FacNum_' AND 
	 FEC>='$Dex_' AND FEC<='$Hax_' AND 
	 CLI_RUC LIKE '$CliRuc_' AND CLI_NOM LIKE '$CliNom_' AND 
	 C_FEC>='$CuoFecVenDex_' AND C_FEC<='$CuoFecVenHax_' AND 
	 C_ANU='NO' AND FEP<>'1900-01-01' ";
//++
if(strlen($CuoFecVenDex)>0){
	$FF=$FF." AND FEP>='".$CuoFecVenDex_."' ";
}
if(strlen($CuoFecVenHax)>0){
	$FF=$FF." AND FEP<='".$CuoFecVenHax_."' ";
}
//++
if($CuoPag=="NO"){
	$FF=$FF." AND CUO_PAG_TOT=0 ";
}else{
	if($CuoPag=="SI"){
		$FF=$FF." AND CUO_PAG_TOT>0 ";
	}
}
//++
$LStrTR=gn("count(*)","vis_ges_xml_cuo",$FF);
$LStrPag=V($_POST['TxtPag']);
if($StrCmd=="F"){$LStrPag="1";}
$VP_RegXPag=19;	
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);
?>
