<?php
	session_start();
	include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
	if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
	//-------------------------
	$StrId=V($_POST['TxtId']);
	$StrCmd=V($_POST['TxtAc']);
	//-------------------------
	$StrAlm=V($_POST['CboAlm']);		
	$StrAlmD=V($_POST['CboAlmD']);
	$StrSN=V($_POST['CboSN']);		
	$StrNum=V($_POST['TxtNum']);		
	$StrDex=V($_POST['TxtDex']);		
	$StrHax=V($_POST['TxtHax']);
	$CboVa=V($_POST['CboVa']);
	//-------------------------
	if(strlen($StrAlm)==0) $StrAlm=GetSO("alm_nombre","almacenes","","alm_nombre");	
	if(strlen($StrAlmD)==0) $StrAlmD=GetSO("alm_nombre","almacenes","","alm_nombre");		
	//-------------------------
	if(strlen($StrSN)==0) $StrSN="NO";
	$StrNum_=$StrNum."%";
	if(strlen($StrDex)==0){
		$StrDex_="2000-01-01";
	}else{
		$StrDex_=ToDate($StrDex);
	}
	if(strlen($StrHax)==0){
		$StrHax_="2020-12-01";
	}else{
		$StrHax_=ToDate($StrHax);
	}
	//-------------------------
	$StrSN_=substr($StrSN,0,1);
	
	$CboVa_=T($CboVa);
	//-------------------------	
	$FF="ID>0 AND ORI LIKE '$StrAlm' AND DES LIKE '$StrAlmD' AND 
		 NUM LIKE '$StrNum_' AND FEC >= '$StrDex_' AND 
		 FEC <= '$StrHax_' AND ANU LIKE '$StrSN_' AND VAL LIKE '$CboVa_'";
		 
	$LStrTR=gn("count(*)","vtransferencias",$FF);	
	$LStrPag=V($_POST['TxtPag']);	
	if($StrCmd=="F"){$LStrPag="1";}						
	$VP_RegXPag=15;
	//-------------------------
	$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);
	
$IdUsu=$_SESSION['SYS_USER_ID'];
$AT=gs("at","usuarios","id_usuario=$IdUsu");
?>



<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Transferencia - Buscar</title>
<!----------------------------------------->
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></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;}

</style>

<!----------------------------------------->
<script>
$(document).ready(function(){  
   Inicializar();
   jF("CboAlm");
});
</script>
<!----------------------------------------->

<body  <?php echo $LStrMsg;?>  >
<div align="center">

<div class="mM" align="left" style="font-size:12px">
<?php
$HTM=file_get_contents("http://inversionessounduniversal.com/ventas/phpmnu.php?USER_ID=$IdUsu");
echo $HTM;
?>
</div>

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


<!----------------------------------------->
<div id="DivT" class="dT"  style="width:1250px;">
<img src="b.png" class="iT" />
<div class="tT">TRANSFERENCIAS - BUSCAR</div>
</div>
<!----------------------------------------->

<div class="s1" style="left: 35px; top: 117px; width: 166px;">
ALMACEN ORIGEN</div>
<select name="CboAlm" id="CboAlm" 
class="lt"  style="left: 33px; top: 134px; width:170px" 
tabindex="<?php echo ++$TI;?>">
<?php
$s="SELECT alm_nombre FROM almacenes WHERE id_almacen>= 0 ORDER BY alm_nombre";
$result = grs($s);
while ($row = $result->fetch_row()){
if($StrAlm==$row[0]){
echo "<option value=\"$row[0]\" selected=\"selected\">$row[0]</option>";
}else{
echo "<option value=\"$row[0]\" >$row[0]</option>";
}
}
?>
</select>

<div class="s1" style="left: 216px; top: 117px; width: 149px;">
ALMACEN DESTINO</div>
<select name="CboAlmD" id="CboAlmD" 
class="lt"  style="left: 214px; top: 134px; width:150px" 
tabindex="<?php echo ++$TI;?>">
<?php echo ListALM($StrAlmD); ?>
</select>


<div class="s1" style="left: 375px; top: 117px; width: 74px;">
NUMERO</div>
<input name="TxtNum" type="text" id="TxtNum" 
class="lt"  style="left: 376px; top: 134px; width: 83px;" 
value="<?php echo $StrNum;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 468px; top: 117px; width: 45px;">
DESDE</div>
<input name="TxtDex" type="text" id="TxtDex" 
class="fe"  style="left: 468px; top: 134px; width:70px" 
value="<?php echo $StrDex;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 550px; top: 117px; width: 60px;">
HASTA</div>
<input name="TxtHax" type="text" id="TxtHax" 
class="fe"  style="left: 550px; top: 134px; width: 70px" 
value="<?php echo $StrHax;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 631px; top: 117px; width: 75px;">
ANULADO</div>
<select name="CboSN" id="CboSN" 
class="lt"  style="left: 632px; top: 134px; width:80px" 
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO("aux_nom","auxiliar","aux_des='SN'",$StrSN,"N","S");?>
</select>

<div class="s1" style="left: 721px; top: 117px; width: 75px;">
VALIDADO</div>
<select name="CboVa" id="CboVa" 
class="lt"  style="left: 722px; top: 134px; width: 94px" 
tabindex="<?php echo ++$TI;?>">
<?php echo FCBO("aux_nom","auxiliar","aux_des='SN'",$CboVa,"S","N");?>
</select>

<!----------------------------------------->
<?php $VOLVER="transferenciasv.php";?>
<?php include("botones_b.php");?>;

<!-----------------------------------------> 

<div class="datagrid" style="position: absolute; left: 35px; top: 165px; width: 1180px; height: 400px; overflow: auto">
<table width="100%">
<thead>
<tr>
<td colspan="13" align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>

<tr>
<th width="31%">ORIGEN</th>
<th width="35%">DESTINO</th>
<th width="20%">NUMERO</th>
<th width="11%">FECHA</th>
<th width="3%">&nbsp;</th>
</tr>
</thead>
<tbody>
<?php		  		

	$s="SELECT ID,ORI,DES,NUM,DATE_FORMAT(FEC,'%d-%m-%y')
		FROM vtransferencias 
		WHERE ".$FF." 
		ORDER BY ORI,DES,NUM,FEC  ";
	
	$result = grs($s);				
	while ($row = $result->fetch_row()){

		?>	
        <tr onDblClick="location.href='transferenciasv.php?Id=<?php echo $row[0];?>&Pag=0'">
        <!----------------------------------------------->
        <td><?php echo $row[1];?></td>
        <td><?php echo $row[2];?></td>
        <td><?php echo $row[3];?></td>
        <td><?php echo $row[4];?></td>
        <!----------------------------------------------->
        <td bgcolor="#FFFFFF" align="center">
        <a href="transferenciasv.php?Id=<?php echo $row[0];?>&Pag=0">
        <img src="img/b_edit.png"  border="0"/></a></td>
        </tr>
        <?php
	}
?>		  
       
</tbody>
</table>
</div>
    
<!----------------------------------------->    
<?php include("ocultos.php");?>

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