<?php
session_start();
include("cls_conexion.php");
$CNN=new ClsMySQL();
include("conexion23.php");
//+++++++++
if(strlen($_SESSION['SYS_USER_ID'])==0){JsDir("login.php");	return;}
//+++++++++++
$HW=V($_SESSION['SYS_HW']);
$IdUsu=vbval(V($_SESSION['SYS_USER_ID']));
//
$StrGT="";
$SYS_MSG="";
$SYS_FOC="";
$OK=1;
$SYS_PAG="";
//+++
$MOD=V($_GET['MOD']);
$KEY=V($_GET['KEY']);
if(strlen($KEY)==0){
	$KEY=V($_POST['KEY']);
	$MOD=V($_POST['MOD']);
}
$KEY=vbval($KEY);
$MOD=vbval($MOD);
//
$PAG_REG_OK=0;
$PAG_RET_OK=0;
//+++
include("ges_facturas_pagar_fun.php");
/*
$VP_RegXPag=100;
$LStrTR=gn("count(*)","ges_empresas","id_emp>0");
$LStrPag=PagGet($LStrPag,$StrCmd,$LStrTR,$VP_RegXPag);	
*/
$TI=0;
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Factura Cuota Pagar</title>
<!--INI_SCRIPT------------------------------------------------------------------------------>
<?php AddJs(); ?>
<script type="text/javascript" src="ja/funciones2027b.js"></script>
<script type="text/javascript" src="ja/ges_facturas_pagar77.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"  />

<link rel="stylesheet" type="text/css" href="tcal.css" />
<script type="text/javascript" src="tcal.js"></script> 

<style type="text/css">
.cF {height:800px;width:1250px;position:relative;top:0px}
.mM {height:34px;width:1250px;position:relative;top:0px;background-color:#09C; z-index:500;}

.tableFixHead          { overflow-y: auto; overflow:auto; border:solid 1px #363636;position: absolute; }
.tableFixHead thead th { position: sticky; top: 0; }
table  {border-collapse:collapse;width:100%;}
th, td {padding: 3px 3px;}
th     {background:#A0A0A0}
</style>
<script>
function FUN_INI(){
  Inicializar();
  //
  SYS_LOAD();
  //
  document.getElementById("PagRegFec").style.backgroundColor="#FFF";
  document.getElementById("PagRetFec").style.backgroundColor="#FFF";
  //
  var pag=gv("SYS_PAG");
  if(pag=="OK"){
	  alert("Pago registrado");
	  window.opener.POP_ACT();
	  //window.close();
	  return;
  }
  
  /*
  if(jVal(gv("PAG_REG_OK"))==0){
  	document.getElementById("PagRegFec").style.backgroundColor="#FFF";
  }else{
    document.getElementById("PagRegFec").style.backgroundColor="#CCC";
  }
  
  if(jVal(gv("PAG_RET_OK"))==0){
  	document.getElementById("PagRetFec").style.backgroundColor="#FFF";
  }else{
    document.getElementById("PagRetFec").style.backgroundColor="#CCC";
  }
  */
  jF("PagRegFec");
}
</script>
</head>

<body onLoad="FUN_INI()" >
<div align="center">



<div Id="DivFRM"  class="cF" style="background-color:#FFC; width:700px; height:500px">
<form id="Frm" name="Frm" method="post" autocomplete="off"
action="ges_facturas_pagar.php" enctype="multipart/form-data" 
style="margin:0px; padding:0px; display:inline;" onSubmit="return false;">

<input name="KEY" id="KEY" type="hidden" value="<?php echo $KEY;?>">
<input name="MOD" id="MOD" type="hidden" value="<?php echo $MOD;?>">

<input name="TxtAc" id="TxtAc" type="hidden" value="">

<!--INI_TITULO--------------------------------->
<div id="DivT" class="dT" style="width: 700px" >
<img src="png/compras.png"  class="iT" />
<div class="tT" style="width:350px">FACTURA CUOTA PAGAR</div>
</div>
<!--FIN_TITULO--------------------------------->

<div class="s1" style="left: 48px; top: 105px; width: 82px;">
CUOTA NRO</div>
<input name="CuoNro"  type="text" id="CuoNro"
class="lt roi" style="left: 48px; top: 125px; width: 111px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $CuoNro;?>"/>

<div class="s1" style="left: 169px; top: 105px; width: 70px;">FECHA
</div>
<input name="CuoFec"  type="text" id="CuoFec"
class="lt roi" style="left: 169px; top: 125px; width: 100px"
value="<?php echo $CuoFec;?>"
tabindex="<?php echo ++$TI;?>"/>


<div class="s1" style="left: 276px; top: 94px; width: 105px;">FECHA PROGRAMADA
</div>
<input name="CuoFecPro"  type="text" id="CuoFecPro"
class="lt roi" style="left: 276px; top: 125px; width: 122px"
value="<?php echo $CuoFecPro;?>"
tabindex="<?php echo ++$TI;?>"/>


<div class="s1" style="left: 408px; top: 105px; width: 96px;">
TOTAL CUOTA</div>
<input name="CuoTot"  type="text" id="CuoTot"
class="lt rod" style="left: 408px; top: 125px; width: 118px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $CuoTot;?>"/>

<div class="s1" style="left: 540px; top: 105px; width: 99px;">
TIPO
</div>
<input name="CuoTip"  type="text" id="CuoTip"
class="lt roi" style="left: 540px; top: 125px; width: 124px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $CuoTip;?>"/>


<div class="s1" style="left: 48px; top: 154px; width: 98px;">
PAGO REGULAR
</div>
<input name="CuoPagReg"  type="text" id="CuoPagReg"
class="lt rod" style="left: 48px; top: 173px; width: 111px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $CuoPagReg;?>"/>

<div class="s1" style="left: 169px; top: 154px; width: 98px;">
RETENCION
</div>
<input name="CuoPagRet"  type="text" id="CuoPagRet"
class="lt rod" style="left: 169px; top: 173px; width: 100px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $CuoPagRet;?>"/>





<div class="s1" style="left: 276px; top: 154px; width: 66px;">
OBSERVACION
</div>
<input name="CuoObs"  type="text" id="CuoObs"
class="lt roi" style="left: 276px; top: 173px; width: 388px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $CuoObs;?>"/>

<?php
$CMD_CAP="Pagar";
$ROI="";
$ROD="";
if($PagRegTot>0){
	$CMD_CAP="Deshacer pago";
	$ROI="roi";
	$ROD="rod";
}
?>

<div class="s1" style="left: 48px; top: 208px; width: 113px;">
<b>PAGO REGULAR</b>
</div>




<div class="s1" style="left: 263px; top: 205px; width: 394px; color: #333; background-color: #9C6; padding-left: 0.5rem; padding-top: 0.3rem; padding-bottom: 0.3rem">
<b>CLIC EN "TOTAL" PARA ASIGNAR EL MONTO CORRESPONDIENTE</b>
</div>

<div class="s1" style="left: 48px; top: 232px; width: 126px;">
FECHA DE PAGO
</div>
<input name="PagRegFec"  type="text" id="PagRegFec"
class="fez tcal" style="left: 48px; top: 249px; width: 111px" 
value="<?php echo $PagRegFec;?>" 
tabindex="<?php echo ++$TI;?>"/>


<div class="s1" style="left: 169px; top: 232px; width: 66px;"> BANCO
</div>
<select name="PagRegBan" id="PagRegBan"  
class="lt " style="left: 169px; top: 249px; width: 158px" 
tabindex="<?php echo ++$TI;?>">
<?php
	echo FCBO("ban_nom","ges_xml_bancos","id_ban>0",$PagRegBan,"N","S");
	/*
    if($PagRegTot==0){
		
	}else{
		echo FCBO("ban_nom","ges_xml_bancos","id_ban>0 AND ban_nom='$PagRegBan'",$PagRegBan,"N","N");
	}
	*/
?>
</select>



<div class="s1" style="left: 338px; top: 231px; width: 191px;">
NUMERO DE OPERACION
</div>
<input name="PagRegNroOpe"  type="text" id="PagRegNroOpe"
class="lt " style="left: 337px; top: 249px; width: 174px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $PagRegNroOpe;?>"/>

<script>
function fxSet1(){
	if(gv("CmdAddCuo")=="Pagar"){
		sv("PagRegTot",gv("CuoPagReg"));
	}
}
</script>

<?php
$SW_TOT_REG="";
if($PagRegTot>0){
	$SW_TOT_REG=$PagRegTot;
}
?>
<div class="s1" style="left: 525px; top: 230px; width: 72px; cursor: pointer" onClick="fxSet1()" >
<b>TOTAL</b></div>
<input name="PagRegTot"  type="text" id="PagRegTot"
class="ndd " style="left: 523px; top: 249px; width: 108px" 
value="<?php echo $SW_TOT_REG;?>" 
tabindex="<?php echo ++$TI;?>"/>

<input type="button" name="CmdXReg" id="CmdXReg" 
value="X" 
onClick="fxClsReg()"  style="position: absolute; left: 638px; top: 249px; width: 24px; height:22px " />




<div class="s1" style="left: 48px; top: 276px; width: 104px;">
OBSERVACION
</div>
<input name="PagRegObs"  type="text" id="PagRegObs"
class="lt" style="left: 48px; top: 294px; width: 614px"
tabindex="<?php echo ++$TI;?>"
value="<?php echo $PagRegObs;?>"/>

<input type="button" name="CmdAddCuo" id="CmdAddCuo" 
value="<?php echo $CMD_CAP;?>" tabindex="<?php echo ++$TI;?>"
onClick="fxPagar()" <?php echo $DIS; ?>  style="position: absolute; left: 510px; top: 294px; width: 151px; display:none " />


<?php
$RET_CSS=' ';
if(vbval($CuoPagRet)==0){
	$RET_CSS=' style="display:none" ';
}
//
$CMD_CAP="Pagar";
$ROI="";
$ROD="";
if($PagRetTot>0){
	$CMD_CAP="Deshacer pago";
	$ROI="roi";
	$ROD="rod";
}
?>

<div id="DivRet" <?php echo $RET_CSS;?> >
    <div class="s1" style="left: 48px; top: 328px; width: 99px;">
    <b>RETENCION</b>
    </div>
        
    <div class="s1" style="left: 48px; top: 350px; width: 113px;">
    FECHA DE PAGO
    </div>
    
    <input name="PagRetFec"  type="text" id="PagRetFec"
    class="fez tcal "  
    style="left: 48px; top: 368px; width: 111px ;" 
    value="<?php echo $PagRetFec;?>" 
    tabindex="<?php echo ++$TI;?>"/>
    
    <div class="s1" style="left: 169px; top: 350px; width: 110px;"> SERIE - NUMERO
    </div>
    <input name="PagRetNroOpe"  type="text" id="PagRetNroOpe"
    class="lt " style="left: 169px; top: 368px; width: 158px"
    tabindex="<?php echo ++$TI;?>"
    value="<?php echo $PagRetNroOpe;?>"/>
    
    <script>
    function fxSet2(){
		if(gv("CmdRegRet")=="Pagar"){
			sv("PagRetTot",gv("CuoPagRet"));
		}
    }
    </script>
    
    
	<?php
    $SW_TOT_RET="";
    if($PagRetTot>0){
    	$SW_TOT_RET=$PagRetTot;
    }	
    ?>

    <div class="s1" style="left: 340px; top: 350px; width: 73px; cursor: pointer" onClick="fxSet2()">
    <b>TOTAL</b></div>
    <input name="PagRetTot"  type="text" id="PagRetTot"
    class="ndd" style="left: 340px; top: 368px; width: 105px" 
    value="<?php echo $SW_TOT_RET;?>" 
    tabindex="<?php echo ++$TI;?>"/>
    
    <input type="button" name="CmdXRet" id="CmdXRet" 
    value="X" 
    onClick="fxClsRet()"  
    style="position: absolute; left: 451px; top: 368px; width: 24px; height: 22px" />
    
    
    
    
    <input type="button" name="CmdRegRet" id="CmdRegRet" 
    value="<?php echo $CMD_CAP;?>" tabindex="<?php echo ++$TI;?>"
    onClick="fxRetReg()"  
    style="position: absolute; left: 510px; top: 368px; width: 151px; display:none" />

</div>


<input type="button" name="CmdGuardar" id="CmdGuardar" 
value="Guardar" tabindex="<?php echo ++$TI;?>"
onClick="fxPagGuardar()" style="position: absolute; left: 490px; top: 368px; width: 168px;" />
    

<!--INI_OCULTOS-------------------------------->
<input name="SYS_MSG" type="hidden" id="SYS_MSG" value="<?php echo $SYS_MSG;?>" />
<input name="SYS_FOC" type="hidden" id="SYS_FOC" value="<?php echo $SYS_FOC;?>" />
<input name="SYS_PAG" type="hidden" id="SYS_PAG" value="<?php echo $SYS_PAG;?>" />

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

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

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