<?php
	session_start();
	include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
	if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
	//-------------------------	
	$StrGT="";
	$VP_RegXPag=10;
	$LStrMsg="";
	$LStrFoc="";
	$LStrMM="";
	$LStrPag=V($_POST['TxtPag']);
	//$LStrTR=gn("count(*)","marcas","");
	include("cobros_historial_fun.php");
	$StrHWND_PH=$_SESSION['SYS_HW']."_CH";
	
	$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>Clientes - Estado de Cuenta</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones.js"></script>
<script type="text/javascript" src="ja/cobros_historial.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;}

</style>
<script>
$(document).ready(function(){  
   Inicializar();
});
</script>
</head>

<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="cobros_historial.php">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" >
<img src="img/estadodecuenta.png" class="iT" />
<div class="tT">CLIENTES - ESTADO DE CUENTA</div>
</div>
<!--FIN_TITULO--------------------------------->

<div class="s1" style="left: 41px; top: 126px; width: 199px;">
CLIENTE</div>
<input name="TxtPro" type="text" id="TxtPro" 
class="roi" style="position:absolute; left: 38px; top: 143px; width:315px;" 
value="<?php echo $StrPro;?>"  
tabindex="<?php echo ++$TI;?>"/>

<div class="s1" style="left: 433px; top: 126px; width: 86px;">
MONEDA</div>
<select name="CboMon" id="CboMon" 
class="lt" style="left: 431px; top: 143px; width:90px" 
tabindex="<?php echo ++$TI;?>" >
<?php echo FCBOO_("mon_nombre","monedas","id_moneda<>'X'",$StrMon,"N","N","mon_nombre DESC")?> 
</select>

<div id="DivBtn" align="left" style="position:absolute; left: 33px; top: 71px; width:1000px; height: 26px;">
<input name="CmdB" type="button" id="CmdZ" class="btm"
value="Cancelar" onClick="fCancelar();"  
tabindex="<?php echo ++$TI;?>"/> 

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

<div class="s1" style="left: 363px; top: 143px; width: 69px; height: 25px;">
<input type="button" name="CmdSel" id="CmdSel" value="..." 
onclick="OpenWin('clientes_edc_seleccionar.php',800,600)" 
style="width:30px" tabindex="3" 
<?php
if(strlen($StrId)>0){
	echo "disabled=\"disabled\"";
}
?>
/>
<input type="button" 
name="CmdCls" id="CmdCls"  style="width:30px"
value="X" 
onclick="fCls();" tabindex="4"
<?php
if(strlen($StrId)>0){
	echo "disabled=\"disabled\"";
}
?>
/>
</div>


<?php
if(strlen($StrId)>0  && $StrFdp!="EFECTIVO"){
echo "<div class=\"Estilo2\" align=\"left\"";
echo "style=\"position:absolute; left: 37px; top: 241px; width: 108px;\">";
echo "FECHA DE PAGO";
echo "</div>";

}
?>

<div class="s1" style="left: 527px; top: 143px; width: 92px; height: 25px;">
<input name="CmdB" type="button" id="CmdG" value="Procesar"	
onclick="fProcesar();" style="width:80px" tabindex="13"/ >
</div>

<div class="datagrid" style="position: absolute; left: 35px; top: 174px; width: 1180px; height: 388px;">
<table width="100%">
<thead>
<tr>
<td colspan="10" height="18" align="center"><?php echo PagBtn($LStrTR,$VP_RegXPag,$LStrPag);?></td>
</tr>
<tr>
<th width="7%">FECHA</th>
<th width="21%">DOCUMENTO</th>
<th width="7%">NUMERO</th>
<th width="43%">DETALLE</th>
<th width="8%">TOTAL</th>
<th width="8%">A CUENTA</th>
<th width="6%">SALDO</th>
</tr>
</thead>
<tbody>
<?php
if($StrCmd=="Procesar"){
	$s="SELECT DATE_FORMAT(fec,'%d-%m-%y'),doc,num,obs,tot,acuenta,saldo
	FROM edc WHERE hwnd='$StrHWND_CH' ORDER BY fec,gi";
	$result = grs($s);
	while ($row = $result->fetch_row()){
	echo "<tr>";
	echo "<td bgcolor=\"#FFFFFF\">$row[0]</td>";
	echo "<td bgcolor=\"#FFFFFF\">$row[1]</td>";
	echo "<td bgcolor=\"#FFFFFF\" >$row[2]</td>";
	echo "<td bgcolor=\"#FFFFFF\" >$row[3]</td>";
	echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right\" >$row[4]</td>";
	echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right\" >$row[5]</td>";
	echo "<td bgcolor=\"#FFFFFF\" style=\"text-align:right\" >$row[6]</td>";
	echo "</tr>";
	}
}
?>
</tbody>
</table>
</div>


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

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