<?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="";
	$LStrMsg="";
	$LStrFoc="";
	$LStrMM="";
	//-------------------------
	$StrCmd=V($_POST['TxtAc']);
	$StrValor=V($_POST['TxtValor']);
	$StrValorAct="";
	//-------------------------
	if(strlen($StrCmd)==0){
		$StrValor=gs("valor","valores","dato='T_CAMBIO'");
	}
	//FUNCIONES DE ACTUALIZACION+++++++++++
	if($StrCmd=="M"){
		if(strlen($StrValor)==0){
			$LStrMsg="Ingrese el tipo de cambio correspondiente";
			$LStrFoc="document.getElementById('TxtValor').focus();";						
			$StrGT="S";
		}
		if(strlen($StrGT)==0){
			$s="UPDATE valores SET valor='$StrValor' WHERE dato='T_CAMBIO'";
			ejt($s);
			//BIT
			$_BIT_MOD_ID="0";
			$_BIT_SQL_CAB=$s;
			$_BIT_SQL_DET="";
			$_BIT_PHP="tcambio.php";
			$_BIT_ID=BIT_ADD("MANTENIMIENTO","TIPO DE CAMBIO","MODIFICAR",$_BIT_MOD_ID,$_BIT_SQL_CAB,$_BIT_SQL_DET,$_BIT_PHP);
			BIT_DET_ADD($_BIT_ID,$s);
			//BIT	
			if($LStrMM=="S")	$LStrMsg="Datos actualizados";
			$LStrFoc="document.getElementById('TxtValor').focus();";
			$LStrMsg="El tipo de cambio ha sido actualizado a : $StrValor";
			$LStrFoc="document.getElementById('TxtValor').focus();";						
			$StrGT="S";
		}
	}	
	$StrValorAct=gs("valor","valores","dato='T_CAMBIO'");
	//////////////////////////////////
	if($StrGT=="S"){
		if(strlen($LStrMsg)>0){
			if(strlen($LStrFoc)==0){
				$LStrMsg="onload=\"alert('$LStrMsg');\"";
			}else{
				$LStrMsg="onload=\"alert('$LStrMsg');$LStrFoc;\"";
			}
		}else{
			if(strlen($LStrFoc)>0){
				$LStrMsg="onload=\"$LStrFoc;\"";
			}
		}
	}else{
		$LStrFoc="document.getElementById('TxtValor').focus();";
		$LStrMsg="onload=\"$LStrFoc;\"";
	}
?>
<!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>Tipo de cambio</title>
<script type="text/javascript" src="fe/funciones.js"></script>
<script type="text/javascript" src="fe/tcambio.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:700px;
     height:600px;
     position:absolute;
     left:<?php echo "50%";?>;
     top:<?php echo "50%";?>;
	 background-color:#006699;
	 margin:<?php echo "-300px";?> 0 0 <?php echo "-350px";?>;

}
#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="tcambio.php">
<center> 
  <div Id="DivFRM"  class="centrarFrm" >
    <div id="layer5" style="position:absolute; left: 60px; top: 157px; width: 157px;">
      <div align="left" class="f2">TIPO DE CAMBIO</div>
    </div>
    <div id="layer4" style="position:absolute; left: 60px; top: 85px; width: 442px; height: 26px;">
      <div align="left" class="f2">
        <input name="CmdB" type="button" id="CmdG" value="Modificar"	
		onclick="fGuardar();" style="width:80px" tabindex="2"/>
        <input name="CmdB" type="button" id="CmdZ" 
         value="Menu" onclick="fBuscar('menu.php');"  tabindex="3"/>
      </div>
    </div>
    <div id="layer" style="position:absolute; left: 116px; top: 21px; width: 412px; 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>TIPO DE CAMBIO</strong></div>
  </div>
          <input name="TxtValor" type="text" id="TxtValor" style="position:absolute; left: 60px; top: 177px; width: 173px;" 
          value="<?php echo $StrValor;?>"  
          onKeyDown="return SoloNum(this,event,'CmdG');" 
          tabindex="1" />

    <div id="LblTit" style="position:absolute; left: 52px; top: 15px; width: 64px; z-index: 100;">
    <div align="left" class="Estilo1"><img src="img/tcambio.png" width="56" height="52" /></div>
  </div>
    <div id="layer8" style="position:absolute; left: 0px; top: 0px; width: 700px; 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="layer3" style="position:absolute; left: 63px; top: 231px; width: 157px;">
      <div align="left" class="f2">VALOR ACTUAL</div>
    </div>
    <div id="layer6" style="position:absolute; left: 90px; top: 251px; width: 415px; font-weight: bold; font-family: Verdana, Geneva, sans-serif; font-size: 50px; color: #FFF; height: 216px;">
      <div align="left" >
      <?php
	  	echo $StrValorAct;
	  ?>
      </div>
    </div>
    <div id="layer7" style="position:absolute; left: 64px; top: 252px; width: 27px;">
      <div align="left" class="f2">S/.</div>
    </div>
  </div>
</center>	
        </form>
</body>
</html>
