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

if ($_REQUEST['bot']==""){
	echo '<h2>!!! Selecciona un Registro !!!</h2>';
	echo '<meta content="1; url=DX40000_PR.php"  HTTP-EQUIV="REFRESH">';
}else{
	
	include('DX40000_CL.php');
	$varible_clase = new clase_cli_pro();
	$res=$varible_clase->lista_busqueda($_REQUEST["bot"]);
	//$result=mysqli_fetch_array($res);
	$reg = $_REQUEST['bot'];
	$dato = mysqli_fetch_array ($res);
	if(!isset($_POST['ttipo'])){
		$registro=mysqli_fetch_array(mysqli_query($con ,"select * from geoyos_jc.dxcoloni where cve_col = '".$dato['des_colonia']."'"));
		$_REQUEST['tcol']=$registro['des_colonia'];
		$_REQUEST['tcp']=$dato['cod_pos'];
		$_REQUEST['pais']=$dato['cve_pais'];
		$_REQUEST['estados']=$dato['cve_estado'];
		$_REQUEST['tmun']=$dato['cve_delmun'];
		$_REQUEST['ttel']=$dato['tel'];
		$_REQUEST['tfax']=$dato['fax'];
		$_REQUEST['tmail']=$dato['mail'];
		$_REQUEST['tsuc']=$dato['nom_suc'];
		$_REQUEST['tap']=$dato['ap_paterno'];
		$_REQUEST['tam']=$dato['ap_materno'];
		$_REQUEST['tne']=$dato['nombre'];		
		$_REQUEST['trfc']=$dato['rfc'];
		$_REQUEST['tnom']=$dato['nom_con'];
		$_REQUEST['tappa']=$dato['app_con'];
		$_REQUEST['tapemat']=$dato['apm_con'];
		$_REQUEST['tgiro']=$dato['giro'];
		$_REQUEST['tcalle']=$dato['calle'];
		$_REQUEST['text']=$dato['no_ext'];
		$_REQUEST['tint']=$dato['no_int'];
		$_REQUEST['tntre']=$dato['entre_calle'];
		$_REQUEST['ty']=$dato['y_calle'];
		$_REQUEST['ttit']=$dato['titulo'];
		$_REQUEST['ttipo']=$dato['tipo'];
		$_REQUEST['tgen']=$dato['gener'];
	}
	
	
?>
<body
<?php
 
if(isset($_REQUEST['bot3'])){
	echo ' onLoad="deshab()"';
}
?>
>
<form name="frm1" method="post">
<input name="bot" type="hidden" value="<?php
 echo $_REQUEST['bot'];?>">
<input name="tipAgr" id="tipAgr" type="hidden" value="<?php
 echo $_REQUEST['tipAgr'];?>">
<input name="retAct" id="retAct" type="hidden" value="<?php
 echo $_REQUEST['retAct'];?>">
<input name="botCat" id="botCat" type="hidden" value="<?php
 echo $_REQUEST['botCat'];?>">
  <table width="866"  align="center">
    <tr> 
      <th colspan="6" class="titulo"><div align="center">VERIFICA ALTAS DE CLIENTES 
          / PROVEEDORES / HONORARIOS </div></th>
    </tr>
    <tr> 
      <td>Tipo de persona:</td>
      <?php

		echo '<input type="hidden" name="t1" value ="' . $dato['codigo'] . '"/>';
		?>
      <td><select name="ttipo" id="ttipo" onclick="opciones()">
         <?php

		 	if($_REQUEST['ttipo']=="MORAL"){
				echo '<option selected>MORAL</option>';
			}else{
				echo '<option>MORAL</option>';
			}
			if($_REQUEST['ttipo']=="FISICA CON ACT/EMPRE"){
				echo '<option selected>FISICA CON ACT/EMPRE</option>';
			}else{
				echo '<option>FISICA CON ACT/EMPRE</option>';
			}
			if($_REQUEST['ttipo']=="FISICA SIN ACT/EMPRE"){
				echo '<option selected>FISICA SIN ACT/EMPRE</option>';
			}else{
				echo '<option>FISICA SIN ACT/EMPRE</option>';
			}
		?>
        </select></td>
      <td>Generico: </td>
      <td><select name="tgen" id="tgen">
          <?php

		  if($_REQUEST['tgen']==""){
				echo '<option selected></option>';
			}else{
				echo '<option></option>';
			}
			if($_REQUEST['tgen']=="MASCULINO"){
				echo '<option selected>MASCULINO</option>';
			}else{
				echo '<option>MASCULINO</option>';
			}
		if($_REQUEST['tgen']=="FEMENINO"){
				echo '<option selected>FEMENINO</option>';
			}else{
				echo '<option>FEMENINO</option>';
			}
?>
        </select></td>
      <td>Titulo:</td>
      <td><select name="ttit">
          <option></option>
<?php

	include("DMMYSQLG.php");
	@$resultado=mysqli_query($con ,"select * from dxramtit");
	while($registro=mysqli_fetch_array($resultado)){
		if($_REQUEST['ttit']==$registro['titulo']){
			echo '<option value="' . $registro['titulo'] . '" selected>' . $registro['nom_tit'] . '</option>';
		}else{
			echo '<option value="' . $registro['titulo'] . '">' . $registro['nom_tit'] . '</option>';
		}
	}
	include("DMMYSQLG.php");
?>
       </select></td>
    </tr>
    <tr> 
      <td>Apellido Paterno: </td>
      <td><input name="tap" type="text" 
		<?php

					echo 'value="' . $_REQUEST['tap'] . '"';
		?>
		onKeyUp="may(this)"/></td>
      <td>Apellido Materno: </td>
      <td><input name="tam" type="text" 
		  <?php

						echo 'value="' . $_REQUEST['tam'] . '"';
			?>
	  onKeyUp="may(this)"/></td>
      <td>Nombre o Empresa: </td>
      <td><input type="text" name="tne"
	  		<?php

			echo 'value="' . $_REQUEST['tne'] . '"';
			?>
	  onKeyUp="may(this)"/></td>
    </tr>
    <tr> 
      <td>Fecha de Cedula: </td>
      <td><input name="fec" type="text" class="emplea" readonly id="fec" size="20" maxlength="20"
			<?php

				if(isset($_REQUEST['fec'])){ //este es el truco
					echo 'value="' . $_REQUEST['fec'] .  '"';
				}
				else{
					echo 'value="'.chfecha($dato["fec_nac"],'Y-m-d','d/m/Y').'"';
				}
			?>onkeypress="return soloNumeros(event)"//solo fechas
		/> <input name="reset" id="botas" type="button" value=" ... " /> <script type="text/javascript">
  Calendar.setup(
    {
      inputField  : "fec",        // ID of the input field
      ifFormat    : "%d/%m/%Y",    // the date format
      button      : "botas"      // ID of the button
    }
  );
        </script></td>
      <td>RFC: </td>
      <td colspan="3"><input name="trfc" type="text" size="24" maxlength="13"  onKeyPress="return validar1(event)"
	  	<?php

						echo 'value="' . $_REQUEST['trfc'] . '"';
			?>
	  onKeyUp="may(this)"/></td>
    </tr>
    <tr> 
      <th colspan="6" class="titulo"><div align="center">DIRECCION</div></th>
    </tr>
    <tr> 
      <td>Contacto Nombre </td>
      <td><input type="text" name="tnom"
			<?php

			echo 'value="' . $_REQUEST['tnom'] . '"';
			?>	
		onKeyUp="may(this)"/></td>
      <td>Apellido Paterno: </td>
      <td><input type="text" name="tappa"
	  		<?php

			echo 'value="' . $_REQUEST['tappa'] . '"';
			?>	
	  onKeyUp="may(this)"/></td>
      <td>Apellido Materno:</td>
      <td><input type="text" name="tapemat"
	  		<?php

			echo 'value="' . $_REQUEST['tapemat'] . '"';
			?>
	  onKeyUp="may(this)"/></td>
    </tr>
    <tr> 
      <td>Giro:</td>
      <td><input type="text" name="tgiro"
	  		<?php

			echo 'value="' . $_REQUEST['tgiro'] . '"';
			?>
	  onKeyUp="may(this)"/></td>
      <td>Calle: </td>
      <td><input type="text" name="tcalle"
	  		<?php

				echo 'value="' . $_REQUEST['tcalle'] . '"';
			?>
	  onKeyUp="may(this)"/></td>
      <td># Ext:</td>
      <td><input name="text" type="text" id="text" onKeyPress="return validar1(event)"
	  		<?php

			echo 'value="' . $_REQUEST['text'] . '"';
			?>
			onKeyUp="may(this)"/></td>
    </tr>
    <tr> 
      <td># Int. </td>
      <td><input type="text" name="tint" onBlur="may(this)"
	  		<?php

			echo 'value="' . $_POST['tint'] . '"';
			?>
	onKeyPress="return validar1(event)"/> </td>
      <td>Entre calle: </td>
      <td><input type="text" name="tentre"
	  		<?php

			echo 'value="' . $_REQUEST['tentre'] . '"';
			?>
	  onKeyUp="may(this)"/></td>
      <td>Y:</td>
      <td><input type="text" name="ty"
	  		<?php

			echo 'value="' . $_REQUEST['ty'] . '"';
			?>
	  onKeyUp="may(this)"/></td>
    </tr>
    <tr>
      <td>Colonia:</td>
      <td><input type="hidden" name="tcol1" id="tcve" value="<?php
echo $_REQUEST['tcve'];?>">
          <input type="text" name="tcol" id="tcol" value="<?php
echo $_REQUEST['tcol'];?>">
          <input name="?" type="button" value="..." onClick="window.open('DX40000_AG1.php?retPag=DX40000_MO.php','popuppage','width=750,height=300,top=100,left=50,scrollbars=yes,menubar=yes,status=yes')" ></td>
      <td>Codigo postal:</td>
      <td><input name="tcp" type="text" onKeyPress="return validar(event)" maxlength="5" value="<?php
echo $_REQUEST['tcp'];?>"></td>
      <td>Pais:</td>
      <td><select name="pais" id="pais" onChange="javascript: document.getElementById('frm1').submit()">
          <option value="">----------Selecciona----------</option>
          <?php
   
		  include("DMMYSQLG.php");
			@$resultado=mysqli_query($con ,"select * from dxpaises");
			if(!isset($_REQUEST['pais'])){
				$dt_paises=mysqli_fetch_array($resultado);
				$selPais=$dt_paises['cve_pais'];
				if(mysqli_num_rows($resultado)>0)
					mysqli_data_seek($resultado,0);		
			}
			else{
				$selPais=$_REQUEST['pais'];
			}
			while($registro=mysqli_fetch_array($resultado)){
				if($selPais==$registro['cve_pais']){
					echo '<option value="' . $registro['cve_pais'] . '" selected>' . $registro['des_pais'] . '</option>';
				}else{
					echo '<option value="' . $registro['cve_pais'] . '">' . $registro['des_pais'] . '</option>';
				}
				
			}			
		?>
      </select></td>
    </tr>
    <tr>
      <td height="29">Estado:</td>
      <td><select name="estados" onChange="javascript: document.getElementById('frm1').submit()">
          <option  value="">----------Selecciona----------</option>
          <?php
  
		@$resultado=mysqli_query($con ,"select * from dxestado where cve_pais='$selPais'");
		if(!isset($_REQUEST['estados'])){
			$dt_estado=mysqli_fetch_array($resultado);
			$selEnt=$dt_estado['cve_estado'];
			if(mysqli_num_rows($resultado)>0)
				mysqli_data_seek($resultado,0);		
		}
		else{
			$selEnt=$_REQUEST['estados'];
		}
		while($registro=mysqli_fetch_array($resultado)){
			if($selEnt==$registro['cve_estado'] ){ 
				echo '<option value="' . $registro['cve_estado'] . '" selected>' . $registro['des_estado'] . '</option>';
			}else{
				echo '<option value="' . $registro['cve_estado'] . '">' . $registro['des_estado'] . '</option>';
			}
			
		}
?>
      </select></td>
      <td>Delegacion o Mun: </td>
      <td><select name="tmun" id="tmun" >
          <option  value="">----------Selecciona----------</option>
          <?php
 
		@$resultado=mysqli_query($con ,"select * from dxdelmun where cve_estado='$selEnt' and cve_pais='$selPais'");
		if(!isset($_REQUEST['tmun'])){
			$dt_delmun=mysqli_fetch_array($resultado);
			$selDelMun=$dt_delmun['cve_delmun'];
			if(mysqli_num_rows($resultado)>0)
				mysqli_data_seek($resultado,0);		
		}
		else{
			$selDelMun=$_REQUEST['tmun'];
		}
		while(@$registro=mysqli_fetch_array($resultado)){
			if($selDelMun==$registro['cve_delmun']){ 
				echo '<option value="' . $registro['cve_delmun'] . '" selected>' .$registro['des_delmun'] . '</option>';
			}else{
				echo '<option value="' . $registro['cve_delmun'] . '">' . $registro['des_delmun'] . '</option>';
			}
		}
?>
      </select></td>
      <td>Telefono:</td>
      <td><input name="ttel" type="text" id="ttel"
	 
		onKeyPress="return validar(event)" maxlength="10"
	  <?php

			if(isset($_REQUEST['ttel'])){ //este es el truco
				echo 'value="' . $_REQUEST['ttel'] .  '"';
			}
	  ?>/>        </tr>
    
    <tr>
      <td>Fax:</td>
      <td><input name="tfax" type="text" id="tfax"
	  <?php

			if(isset($_REQUEST['tfax'])){ //este es el truco
				echo 'value="' . $_REQUEST['tfax'] .  '"';
			}
	  ?>	
	  onkeypress="return soloNumeros(event)"/></td>
      <td>e- Mail: </td>
      <td><input name="tmail" type="text" id="tmail"
	   <?php

			if(isset($_REQUEST['tmail'])){ //este es el truco
				echo 'value="' . $_REQUEST['tmail'] .  '"';
			}
	  ?>
	  ></td>
      <td>Sucursal</td>
      <td><input name="tsuc" type="text" id="tsuc" onBlur="may(this)"
	  <?php

			if(isset($_REQUEST['tsuc'])){ //este es el truco
				echo 'value="' . $_REQUEST['tsuc'] .  '"';
			}
	  ?>
	  ></td>
    </tr>
    <tr> 
      <th colspan="6" class="titulo"><div align="center">ACTIVIDAD</div></th>
    </tr>
    <tr> 
      <td colspan="6"><div align="center"> 
          CLIENTE :
          <select name="tact" id="tact">
<?php

if($dato['act1']=="1"){
	echo '<option value="0">NO</option>';
	echo '<option value="1" selected>SI</option>';
}else{
	echo '<option value="0" selected>NO</option>';
	echo '<option value="1" >SI</option>';
}
?>
          </select>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;PROVEEDOR:&nbsp;
          <select name="tact1" id="tact1">
<?php
 
if($dato['act2']=="0"){
	echo '<option value="0" selected>NO</option>';
	echo '<option value="1" >PROVEEDOR</option>';
	echo '<option value="2" >ACREEDOR</option>';
}
if($dato['act2']=="1"){
	echo '<option value="0">NO</option>';
	echo '<option value="1" selected>PROVEEDOR</option>';
	echo '<option value="2" >ACREEDOR</option>';
}
if($dato['act2']=="2"){
	echo '<option value="0" >NO</option>';
	echo '<option value="1" >PROVEEDOR</option>';
	echo '<option value="2" selected>ACREEDOR</option>';
}
?>
                    </select>
</div></td>
    </tr>
    <tr> 
      <td colspan="6">  <div align="center"> 
          <input type="button" name="Submit" value="Eliminar" onClick="openpage('DX40000_EC.php','_self')">
          <?php
if($_REQUEST['tipAgr']==''){?>
		  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
          <input type="button" name="Submit2" value="Regresar" onClick="openpage('DX40000_PR.php','_self')">
          <?php
;}?>
		</div>        </td>
    </tr>
  </table>
</form>
<?php
 
if(isset($_REQUEST['bot3'])){
	echo '<div align="center">
	<form id="form1" name="form1" action="DX40000_PR.php" target="_self">
		<input type="submit" name="submit" value="Regresar">
	</form>
	</div>';
	
}
?>
 </body>
<?php
 
mysqli_close($con);
}
?>
</html>
