<?php
 
session_start();
$com = "A";
include("DMMYSQLG.php");
include("DSA3000.php");
include("DMMYSQLG.php");
require_once("DFJQUERY.inc");
?>
<html>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<style type="text/css">
<!--
.Estilo18 {color: #FFFFFF}
.Estilo23 {font-size: 11px; font-weight: bold; }
-->
</style>
<body>
<form name="frm1" method="post" action="" enctype="multipart/form-data">
  <p>&nbsp;</p>
  <div id="width_wrapper" align="center">
  <table width="658" border="0" align="center" bordercolor="#FFCC00" bordercolordark="#FFCC00">
    <tr>
      <td colspan="5" class="titulo">AGREGAR PROVEEDOR </th>    </tr>
    <tr>
      <th width="93" style="#FFCC00"><span class="Estilo23">DESCRIPCION</span></th>
      <td colspan="4"><input name="tap2" id="tap2" type="text" 
		  onBlur="may(this)" size="60"
		<?php

			if(isset($_REQUEST['tap2'])){ 
				echo 'value="' . $_REQUEST['tap2'] .  '"';
			}
		?>></td>
    </tr>
      
      <tr>
        <th style="#FFCC00"><span class="Estilo23">CALLE Y NUMERO</span></th>
        <td width="215"><input name="calle" type="text" id="calle" tabindex="1"
	  onBlur="may(this)" size="30"
	  		<?php

				if(isset($_POST['calle'])){ //este es el truco
					echo 'value="' . $_POST['calle'] .  '"';
				}
			?>/></td>
        <th style="#FFCC00"><span class="Estilo23">COLONIA</span></th>
        <td width="215"><span class="Estilo18">
          <input type="hidden" name="tcol1" id="tcve" value="<?php
 echo $_REQUEST['tcve'];?>">
          <input name="tcol" type="text" id="tcol" value="<?php
 echo $_REQUEST['tcol'];?>" size="20" tabindex="2">
          <input name="?3" type="button" value="....." onClick="window.open('DX40000_AG1.php?retPag=AL10200_AG.php','popuppage','width=750,height=300,top=100,left=50,scrollbars=yes,menubar=yes,status=yes')" >
        </span></td>
      </tr>
      <tr>
        <th width="100" style="#FFCC00"><span class="Estilo23">CODIGO POSTAL</span></th>
		<td><input name="tcp" type="text" onKeyPress="return validar(event)" value="<?php
 echo $_REQUEST['tcp'];?>" size="20" maxlength="5" tabindex="3"></td>
      <th style="#FFCC00"><span class="Estilo23">PAIS</span></th>
      <td><span class="Estilo18">
        <select name="pais" id="pais" onChange="javascript: document.getElementById('frm1').submit()" tabindex="4">
          <option value="">-----SELECCIONE-----</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>
      </span></td>
      </tr>
    <tr>
      <th height="29" style="#FFCC00"><span class="Estilo23">ESTADO</span></th>
      <td><span class="Estilo18">
        <select name="estados" onChange="javascript: document.getElementById('frm1').submit()" tabindex="5">
          <option  value="">-----SELECCIONE-----</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>
      </span></td>
      <th width="100" style="#FFCC00"><span class="Estilo23">MUNICIPIO</span></th>
      <td><span class="Estilo18">
        <select name="tmun" id="tmun" tabindex="6" >
          <option  value="">-----SELECCIONE-----</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>
      </span></td>
      </tr>
    <tr>
      <th height="29" style="#FFCC00"><span class="Estilo23">TELEFONO 1</span></th>
      <td><label>
        <input name="tel1" type="text" id="tel1" tabindex="7"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['tel1'])){ //este es el truco
					echo 'value="' . $_POST['tel1'] .  '"';
				}
			?>/>
      </label></td>
      <th style="#FFCC00"><span class="Estilo23">TELEFONO 2</span></th>
      <td><label>
        <input name="tel2" type="text" id="tel2" tabindex="8"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['tel2'])){ //este es el truco
					echo 'value="' . $_POST['tel2'] .  '"';
				}
			?>/>
      </label></td>
    </tr>
    <tr>
      <th height="29" style="#FFCC00"><span class="Estilo23">FAX</span></th>
      <td><label>
        <input name="fax" type="text" id="fax" tabindex="9"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['fax'])){ //este es el truco
					echo 'value="' . $_POST['fax'] .  '"';
				}
			?>/>
      </label></td>
      <th style="#FFCC00"><span class="Estilo23">CURP</span></th>
      <td><label>
        <input name="curp" type="text" id="curp" tabindex="10"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['curp'])){ //este es el truco
					echo 'value="' . $_POST['curp'] .  '"';
				}
			?>/>
      </label></td>
    </tr>
    <tr>
      <th height="29" style="#FFCC00"><span class="Estilo23">PAGINA WEB</span></th>
      <td><label>
        <input name="web" type="text" id="web" tabindex="11"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['web'])){ //este es el truco
					echo 'value="' . $_POST['web'] .  '"';
				}
			?>/>
      </label></td>
      <th style="#FFCC00"><span class="Estilo23">E-MAIL</span></th>
      <td><label>
        <input name="mail" type="text" id="mail" tabindex="12"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['mail'])){ //este es el truco
					echo 'value="' . $_POST['mail'] .  '"';
				}
			?>/>
      </label></td>
    </tr>
    <tr>
      <th height="29" style="#FFCC00"><span class="Estilo23">R.F.C.</span></th>
      <td><label>
        <input name="rfc" type="text" id="rfc" tabindex="13"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['rfc'])){ //este es el truco
					echo 'value="' . $_POST['rfc'] .  '"';
				}
			?>/>
      </label></td>
      <th style="#FFCC00"><span class="Estilo23">CONTACTO</span></th>
      <td colspan="2"><label>
        <input name="contacto" type="text" id="contacto" tabindex="14"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['contacto'])){ //este es el truco
					echo 'value="' . $_POST['contacto'] .  '"';
				}
			?>/>
      </label></td>
    </tr>
    <tr>
      <th height="29" style="#FFCC00"><span class="Estilo23">PROVEEDOR DE </span></th>
      <td colspan="4"><label>
      <select name="proveedor" id="proveedor" onChange="javascript: document.getElementById('frm1').submit()" tabindex="9">
        <option value="">-----SELECCIONE-----</option>
        <?php
 
		include("DMMYSQLG.php");
$sql = mysqli_query($con ,"SELECT * FROM falmacen  WHERE t1 = 'ACTIVO'");
while($reg=mysqli_fetch_array($sql)){
	if($_POST['proveedor']==$reg['np_desc1'] ){
		echo '<option value="' . $reg['np_desc1'] . '" selected>' . $reg['np_desc1'] . '</option>';
	}else{
		echo '<option value="' . $reg['np_desc1'] . '">' . $reg['np_desc1'] . '</option>';
	
	}
	
}

?>
      </select>
      </label>        <label></label></td>
      </tr>
    <tr>
      <th height="13" style="#FFCC00"><span class="Estilo23">PRIORIDAD  DE PROVEEDOR</span></th>
      <td><input name="numero" type="text" id="numero" tabindex="17"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['numero'])){ //este es el truco
					echo 'value="' . $_POST['numero'] .  '"';
				}
			?>/></td>
      <th style="#FFCC00"><span class="Estilo23">DIAS DE CREDITO</span></th>
      <td colspan="2"><input name="dias" type="text" id="dias" tabindex="16"
	  onBlur="may(this)" size="25"
	  		<?php

				if(isset($_POST['dias'])){ //este es el truco
					echo 'value="' . $_POST['dias'] .  '"';
				}
			?>/></td>
    </tr>
    <tr>
      <th height="14" style="#FFCC00"><span class="Estilo23">STATUS</span></th>
      <td colspan="4"><select name="select" tabindex="18">
        <option value="ACTIVO"<?php
 if($_REQUEST['select']=="ACTIVO") echo 'selected';?>>ACTIVO</option>
        <option value="INACTIVO"<?php
 if($_REQUEST['select']=="INACTIVO") echo 'selected';?>>INACTIVO</option>
      </select></td>
      </tr>
    <tr>
      <td colspan="5" class="titulo">
               
        <div align="center">
          <input name="Submit22" type="Button" class="original" tabindex="19" onClick="openpage('AL10200_AC.php','_self')" value="Guardar">
          <input name="Submit2" type="Button" class="bot_WsW" tabindex="20" onClick="envia1('AL10200_PR.php','_self')" value="Regresar">
        </div>        </td>
      </tr>
    </table>
  </div>
</form>
</body>
</html>
<?php
 mysqli_close($con);?>
