<?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="";
	$VP_RegXPag=10;
	$LStrMsg="";
	$LStrFoc="";
	$LStrMM="";
	$LStrPag=V($_POST['TxtPag']);
	//$LStrTR=gn("count(*)","marcas","");
	include("clientes_edc_fun.php");
?>
<!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>Clientes - Estado de Cuenta</title>
<script type="text/javascript" src="fe/funciones.js"></script>
<script type="text/javascript" src="fe/clientes_edc.js"></script>
<style type="text/css">
<!--
body {
	background-color: #CCC;
}
#Layer1 {
	position:absolute;
	left:345px;
	top:115px;
	width:123px;
	height:35px;
	z-index:1;
}
.centrarFrm{
	width:800px;
	height:600px;
	position:absolute;
	left:50%;
	top:50%;
	background-color:#006699;
	margin:-300px 0 0 -400px;
}
#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;}
.Estilo4 {color: #000099}
.Estilo5 {color: #000000}
#Frm center #DivFRM #layer .Estilo1 strong {
	color: #900;
}

-->
</style>

</head>
<body  <?php echo $LStrMsg;?>>
<form id="Frm" name="Frm" method="post" action="clientes_edc.php">
<center> 
  <div Id="DivFRM"  class="centrarFrm" >
    <div id="layer5" style="position:absolute; left: 235px; top: 126px; width: 199px;">
      <div align="left" class="f2">CLIENTE</div>
    </div>
    <div id="layer4" style="position:absolute; left: 30px; top: 86px; width: 556px; 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="13"/ >
		<input name="CmdB" type="button" id="CmdC" value="Nuevo" onclick="fCancelar();"  tabindex="14"/>
		<input name="CmdB" type="button" id="CmdE" value="Eliminar" onclick="fEliminar();"
		<?php
		if(strlen($StrId)==0){
			echo "disabled=\"disabled\"";
		}
		?>
		 tabindex="15"/>
		 <input name="CmdB" type="button" id="CmdB" 
         value="Buscar" onclick="fBuscar('clientes_edc_buscar.php');"  tabindex="16"/>
         <input name="CmdB" type="button" id="CmdZ" 
         value="Menu" onclick="fBuscar('menu.php');"  tabindex="17"/>
         <input name="CmdB" type="button" id="CmdZ" 
         value="Estado de cuenta" onclick="fBuscar('cobros_historial.php');"  tabindex="17"/>
         <input type="hidden" name="TxtIdPro" id="TxtIdPro" />
      </div>
    </div>
    <div id="layer" style="position:absolute; left: 116px; top: 21px; width: 565px; height: 45px; z-index: 100;">
      <div align="left" class="Estilo1">
        <input name="TxtId" type="hidden" id="TxtId" value="<?php echo $StrId;?>"/>
		<input name="TxtAc" type="hidden" id="TxtAc" value="" />
		<input name="TxtPag" type="hidden" id="TxtPag" value="<?php echo $LStrPag; ?>" />
      <strong>CLIENTES - REGISTRAR COBRO</strong></div>
  </div>

          <input name="TxtPro" type="text" id="TxtPro" 
          style="position:absolute; left: 232px; top: 143px; width: 216px; background-color:#CCC" 
          value="<?php echo $StrPro;?>"  
          onKeyDown="return SoloTextoEx(event,'CmdSel');" 
          tabindex="2"  readonly="readonly"/>

    <div id="LblTit" style="position:absolute; left: 52px; top: 15px; width: 64px; z-index: 100;">
    <div align="left" class="Estilo1"><img src="img/emitir_pago.png" width="64" height="64" /></div>
  </div>
    <div id="layer8" style="position:absolute; left: 0px; top: 0px; width: 800px; height: 79px; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; z-index: 0;">
      <div align="left" class="Estilo1">        
      </div>
</div>
    <div id="layer6" style="position:absolute; left: 154px; top: 126px; width: 78px;">
      <div align="left" class="f2">FECHA</div>
    </div>

<input name="TxtFec" type="text" id="TxtFec" 
style="position:absolute; left: 154px; top: 143px; width: 68px;" 
tabindex="1"  
onkeydown="return SoloFec(this,event,'TxtPro');" 
value="<?php echo $StrFec;?>" maxlength="8" />

    <div id="layer9" style="position:absolute; left: 532px; top: 126px; width: 86px;">
      <div align="left" class="f2">MONEDA</div>
    </div>

        <input name="TxtTot" type="text" id="TxtTot" 
        style="position:absolute; left: 700px; top: 143px; width: 61px;; text-align:right" 
          value="<?php echo $StrTot;?>"  
          onkeydown="return SoloNum(this,event,'CboFdp');" 
          tabindex="6" />

<select name="CboMon" id="CboMon" style="position:absolute; left: 531px; top: 143px; width: 91px;" 
onkeydown="return SoloTextoEx(event,'TxtTot');"
onchange="fGetSaldoDol(document.getElementById('TxtIdPro').value,this.value);"
tabindex="5" >
<?php
$s="SELECT mon_nombre FROM monedas ORDER BY mon_nombre DESC";
$result = grs($s);
while ($row = $result->fetch_row()){
if($StrMon==$row[0]){
echo "<option value=\"$row[0]\" selected=\"selected\">$row[0]</option>";
}else{
echo "<option value=\"$row[0]\" >$row[0]</option>";
}
}
?>
</select>


    <div id="layer12" style="position:absolute; left: 702px; top: 126px; width: 54px;">
      <div align="left" class="f2">TOTAL</div>
    </div>
    <div id="layer36" style="position:absolute; left: 460px; top: 143px; width: 69px; height: 25px;">
      <div align="left" class="f2">
<input type="button" name="CmdSel" id="CmdSel" value="..." 
onclick="OpenWin('clientes_edc_seleccionar.php',700,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>
    </div>
    <div id="layer13" style="position:absolute; left: 35px; top: 187px; width: 110px;">
      <div align="left" class="f2">FORMA DE PAGO</div>
    </div>

<select name="CboFdp" id="CboFdp" style="position:absolute; left: 35px; top: 205px; width: 136px;" 
onkeydown="return SoloTextoEx(event,'TxtNdp');" tabindex="7" onchange="fFormaDePago();">
<?php
$s="SELECT nombre FROM fpagos WHERE id_fpago> 0 ORDER BY id_fpago";
$result = grs($s);
while ($row = $result->fetch_row()){
if($StrFdp==$row[0]){
echo "<option value=\"$row[0]\" selected=\"selected\">$row[0]</option>";
}else{
echo "<option value=\"$row[0]\" >$row[0]</option>";
}
}
?>
</select>

    <div id="layer14" style="position:absolute; left: 180px; top: 187px; width: 127px;">
      <div align="left" class="f2">NUMERO DE PAGO</div>
    </div>

        <input name="TxtNdp" type="text" id="TxtNdp" 
        style="position:absolute; left: 179px; top: 205px; width: 134px;" 
          value="<?php echo $StrNdp;?>"  
          onkeydown="return SoloTextoEx(event,'TxtFecVen');" 
          tabindex="8"  readonly="readonly"/>

    <div id="layer16" style="position:absolute; left: 325px; top: 187px; width: 95px;">
      <div align="left" class="f2">FECHA VCTO</div>
    </div>

        <input name="TxtFecVen" type="text" id="TxtFecVen" 
        style="position:absolute; left: 325px; top: 205px; width: 124px;" 
          value="<?php echo  $StrFecVen;?>"  
          onkeydown="return SoloFec(this,event,'CboCom');" 
          tabindex="9"  readonly="readonly"/>

    <div id="layer28" style="position:absolute; left: 511px; top: 170px; width: 116px;">
      <div align="left" class="f2">REFERENCIA  </div>
    </div>

        <select name="CboCom" id="CboCom" style="position:absolute; left: 511px; top: 205px; width: 134px;" 
onkeydown="return SoloTextoEx(event,'TxtSer');" tabindex="10">
          <?php
	$s="SELECT com_nombre FROM comprobantes 
	WHERE id_comprobante>= 0 ORDER BY id_comprobante";
	$result = grs($s);
	while ($row = $result->fetch_row()){
	if($StrCom==$row[0]){
		echo "<option value=\"$row[0]\" selected=\"selected\">$row[0]</option>";
	}else{
		echo "<option value=\"$row[0]\" >$row[0]</option>";
	}
	}
?>
        </select>


    <div id="layer19" 
    style="position:absolute; left: 511px; top: 187px; width: 131px; height: 19px;">
      <div align="left" class="f2">COMPROBANTE</div>
    </div>
    <div id="layer37" style="position:absolute; left: 653px; top: 187px; width: 47px;">
      <div align="left" class="f2">SERIE</div>
    </div>
    <div id="layer30" style="position:absolute; left: 703px; top:187px; width: 64px;">
      <div align="left" class="f2">NUMERO</div>
    </div>

        <input name="TxtSer" type="text" id="TxtSer" style="position:absolute; left: 652px; top: 205px; width: 41px;" 
          value="<?php echo $StrSer;?>"  
          onkeydown="return SoloTextoEx(event,'TxtNum');" 
          tabindex="11" />

        <input name="TxtNum" type="text" id="TxtNum"  style="position:absolute; left: 703px; top: 205px; width: 61px;" 
          value="<?php echo $StrNum;?>"  
          onkeydown="return SoloTextoEx(event,'CmdG');" 
          tabindex="12" />

    <div id="layer21" style="position:absolute; left: 149px; top: 262px; width: 152px; height: 25px;">
      <div align="left" class="f2">
<?php
if(strlen($StrId)>0  && $StrFdp!="EFECTIVO"){
if(strlen($StrFecPag)==0){
echo "<input type=\"button\" name=\"CmdPagar\" ";
echo "id=\"CmdPagar\" value=\"Pagar\" onclick=\"fPagar();\"  style=\"width:150px\"/>";
}else{
echo "<input type=\"button\" name=\"CmdPagar\" ";
echo "id=\"CmdPagar\" value=\"Deshacer pago\" ";
echo "onclick=\"fDeshacer();\"  style=\"width:150px\"/>";
}
}
?>
      </div>
    </div>
    <?php
	if(strlen($StrId)>0  && $StrFdp!="EFECTIVO"){
	echo "<div class=\"f2\" align=\"left\"";
	echo "style=\"position:absolute; left: 37px; top: 241px; width: 108px;\">";
	echo "FECHA DE PAGO";
	echo "</div>";
	
	}
	?>
<div id="layer23" style="position:absolute; left: 37px; top: 261px; width: 101px; height: 25px;">
<?php
if(strlen($StrId)>0 && $StrFdp!="EFECTIVO"){
if(strlen($StrFecPag)==0){
echo "<input name=\"TxtFecPag\" type=\"text\" id=\"TxtFecPag\" ";
echo "style=\"width:100px\" ";
echo "value=\"\"  ";
echo "onkeydown=\"return SoloFec(this,event,'CmdPagar');\" ";
echo "tabindex=\"1\" />";
}else{
echo "<input name=\"TxtFecPag\" type=\"text\" id=\"TxtFecPag\" ";
echo "style=\"width:100px\" ";
echo "value=\"$StrFecPag\"  ";
echo "onkeydown=\"return SoloFec(this,event,'CmdPagar');\" ";
echo "tabindex=\"1\" readonly=\"readonly\" />";
	
}
}
?>
</div>
    
    <div id="layer24" style="position:absolute; left: 626px; top: 126px; width: 63px;">
      <div align="left" class="f2">SALDO</div>
    </div>
<div id="layer26" 
    style="position:absolute; left: 629px; top: 144px; width: 62px; border-style:solid; border-width:1px; height: 20px; background-color: #FFFFFF; layer-background-color:#FFFFFF">
      
  </div>
    <div id="layer25" style="position:absolute; left: 632px; top: 147px; width: 57px; background-color: #FFFFFF; layer-background-color: #FFFFFF; border: 1px none #000000; height: 16px;">
      <div id="DivSaldo" align="right" class="f2" style="color:#00F; z-index:2">
      0.00
      </div>
    </div>
    <div id="layer3" style="position:absolute; left: 34px; top: 126px; width: 79px;">
      <div align="left" class="f2">ALMACEN</div>
    </div>


<select name="CboAlm" id="CboAlm" style="position:absolute; left: 33px; top: 143px; width: 108px;" 
onkeydown="return SoloTextoEx(event,'TxtFec');" tabindex="0">
<?php echo ListALM($StrAlm); ?>
</select>

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