<?php
 
session_start();
$com = "C";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DMMYSQLG.php");
include("DF30000.inc");
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<?php

if ($_POST['bot']==""){
	echo '<h2>!!! SELECCIONA UN REGISTRO... ACTUALIZANDO !!!</h2>';
	echo '<meta content="1; url=DX62000_PR.php"  HTTP-EQUIV="REFRESH">';
}else{
	include('DX62000_CL.php');
	$varible_clase = new clase_tip_cam();
	$res=$varible_clase->lista_busqueda($_POST["bot"]);
	$reg=mysqli_fetch_array($res);
?>
<body
<?php
 
if(isset($_POST['bot3'])){
	echo ' onLoad="deshab()"';
}
?>
>
<form  name="frm1" method="post" action="">
<input name="bot" type="hidden" 
<?php
 
if(isset($_POST['bot'])){ 
	echo 'value="' . $_POST['bot'] .  '"';
}else{
	  echo 'value="' . $reg['llave'] .  '"';
}
?>
>
  <table width="350"  align="center">
    <tr>
      <th colspan="2" class=\"titulo\"><div align="center">TIPO DE CAMBIO </div></th>
    </tr>
    <tr>
      <td width="80">Pais:</td>
      <td width="254"><select name="paises1" onChange="javascript: document.getElementById('frm1').submit()">
<?php

include("DMMYSQLG.php");
if (isset($_REQUEST['paises1'])){
	$p = $_REQUEST['paises1'];
}else{
	$p = $reg['cve_pais'];
}
$sq = mysqli_query($con ,"SELECT * FROM dxpaises");
while($row=mysqli_fetch_array($sq)){
	if($row['cve_pais'] == $p){
		echo '<option value="' . $row['cve_pais'] . '" selected>' . $row['des_pais'].'</option>';
	}else{
		echo '<option value="' . $row['cve_pais'] . '">' . $row['des_pais'].'</option>';
	}
}

/*if(isset($_POST['paises1'])){
	@$resultado2=mysqli_query($con ,"select * from dxpaises where cve_pais='".$_POST['paises1']."'");
	$registro2=mysqli_fetch_array($resultado2);
	echo '<option value="'. $registro2['cve_pais'] .'">'.$registro2['des_pais'] . '</option>';
}elseif(isset($_POST['bot'])){
	@$resultado2=mysqli_query($con ,"select * from dxpaises where cve_pais='".$reg['cve_pais']."'");
	$registro2=mysqli_fetch_array($resultado2);
	echo '<option value="'. $registro2['cve_pais'] .'">'.$registro2['des_pais'] . '</option>';
}
	@$resultado=mysqli_query($con ,"select * from dxpaises");
	while($registro=mysqli_fetch_array($resultado)){
		echo '<option value="' . $registro['cve_pais'] . '">' . $registro['des_pais'] . '</option>';
	}*/			
?>
      </select></td>
    </tr>
    <tr>
      <td>Moneda:</td>
      <td><select name="mon">
        <?php

		//echo $reg["cve_pais"];
$slq = mysqli_query($con ,"SELECT * FROM dxpaimon where cve_pais = '$p'");
while($ro=mysqli_fetch_array($slq)){
	if($ro['cve_mon'] == $reg['cve_mon']){
		echo '<option value="' . $ro['cve_mon'] . '" selected>' . $ro['des_moneda'].'</option>';
	}else{
		echo '<option value="' . $ro['cve_mon'] . '">' .$ro['des_moneda'].'</option>';
	}
}
		
		
/*		
if(isset($_POST['mon'])){ 
	@$resultado1=mysqli_query($con ,"select * from dxpaimon where cve_pais='".$_POST['paises1']."'");
	$registro1=mysqli_fetch_array($resultado1);
	echo '<option value="' . $registro1['cve_mon'] . '">' . $registro1['des_moneda'] . '</option>';
}elseif(isset($_POST['bot'])){
	@$res2=mysqli_query($con ,"select * from dxpaimon where cve_pais='".$reg['cve_pais']."'");
	$regis2=mysqli_fetch_array($res2);
	echo '<option value="'. $regis2['cve_mon'] .'">'.$regis2['des_moneda'] . '</option>';
}
@$resultado1=mysqli_query($con ,"select * from dxpaimon where cve_pais='".$reg['cve_pais']."'");
while($registro1=mysqli_fetch_array($resultado1)){
	echo '<option value="' . $registro1['cve_mon'] . '">' . $registro1['des_moneda'] . '</option>';
}*/
?>
      </select></td>
    </tr>
    <tr>
      <td>Fecha:</td>
      <td><input name="t_des_tipcom" type="text" class="emplea" size="15" readonly 
<?php
 
if(isset($_POST['t_des_tipcom'])){ 
	echo 'value="' . $_POST['t_des_tipcom'] .  '"';
}else{
	$fec1 = $reg['fecha'] ;
	include("DF20000.php");
	echo 'value="' . $f_f .  '"';
}
?>/>
<input name="bot2" id="bot2" type="image" value="Cal" src="logos/cal4.jpg" />
		 <script type="text/javascript">
  Calendar.setup(
    {
      inputField  : "t_des_tipcom",        // ID of the input field
      ifFormat    : "%d/%m/%Y",    // the date format
      button      : "bot2"      // ID of the button
    }
  );
</script></td>
    </tr>
    <tr>
      <td>Tipo de Cambio: </td>
      <td><input name="t_cci" type="text" size="15" 
<?php
 
if(isset($_POST['t_des_tipcom'])){ 
	echo 'value="' . $_POST['t_cci'] .  '"';
}else{
	  echo 'value="' . $reg['tip_cam'] .  '"';
}
?>
	  /></td>
    </tr>
    <tr>
      <td>Paridad (VS) Dolar: </td>
      <td><input name="t_ccc" type="text" size="15"  
	  
	  <?php
 
if(isset($_POST['t_ccc'])){ 
	echo 'value="' . $_POST['t_ccc'] .  '"';
}else{
  echo 'value="' . $reg['par_dll'] .  '"';
}
	  ?>
	   /></td>
    </tr>
    <tr>
      <td colspan="2"><div align="center">
          <input type="button" name="Submit2" value="Modificar" onClick="openpage('DX62000_MC.php','_self')"/>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="button" name="Submit2" value="Regresar" onClick="openpage('DX62000_PR.php','_self')"/>
      </div></td>
    </tr>
  </table>
</form>
 <?php
 
if(isset($_POST['bot3'])){
	echo '<div align="center">
	<form id="form1" name="form1" action="DX62000_PR.php" target="_self">
		<input type="submit" name="submit" value="Regresar">
	</form>
	</div>';
	
}
?>
 </body>
<?php
 
mysqli_close($con);
}
?>
</html>