<?php
 
session_start();
$com = "M";
include("DMMYSQLG.php");
include("DSA3000.php");
include('JQUERY.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>!!! SELECCIONE UN REGISTRO !!!</h2>';
	echo '<meta content="1; url=cat_cajeros_PR.php"  HTTP-EQUIV="REFRESH">';
}else{
	include('cat_cajeros_CL.php');
	$varible_clase = new clase();
	$res=$varible_clase->lista_busqueda($_POST["bot"]);
	$dt_catven=mysqli_fetch_array($res);
?>
<body
<?php
 
if(isset($_POST['bot3'])){
	echo ' onLoad="deshab()"';
}
?>
>
<form  name="frm1" method="post" action="">
<input name="bot" type="hidden" value="<?php
 echo $_POST["bot"]?>">
<table  align="center">
  <tr>
    <th colspan="6" class=\"titulo\"><div align="center">MODIFICAR VENDEDOR(A) / CAJERO(A)</div></th>
  </tr>
  <tr>
    <td colspan="2" nowrap>Numero de Vendedor(a)/Cajero(a):</td>
    <td colspan="2" nowrap><input name="t0" type="text" id="t0" tabindex="1" readonly value="<?php echo $dt_catven['cod_ven'];?>"></td>
    <td nowrap>Contrase&ntilde;a:</td>
    <td nowrap><input name="t10" type="password" id="10" tabindex="2"  onKeyPress="return validar(event)" onChange="javascript:document.frm1.submit();" <?php

			if(isset($_REQUEST['t10'])){ 
				$query=mysqli_query($con ,"select codigo from ctmeser");
				while ($regc=mysqli_fetch_array($query)){
				if ($_REQUEST['t10']==$regc['codigo'])
				$usua=1;
				}
				$query2=mysqli_query($con ,"select pasw from dgcatven");
				while ($regc2=mysqli_fetch_array($query2)){
				if ($_REQUEST['t10']==$regc2['pasw'])
				$usua=1;
				}
				
				if ($usua==1){
				echo 
				"<script type='text/javascript'>
				'¡¡¡¡¡¡LA CONTRASEÑA YA ES USADA POR OTRO USUARIO!!!!!'
				</script ";
				}else {
				echo 'value="' . $_REQUEST['t10'] .  '"';
				}
			}else {
				echo 'value="' . $dt_catven['pasw'].  '"';
			}
		?> ></td>

  </tr>
  <tr>
    <td nowrap>Nombre : </td>
    <td nowrap><input name="t1" type="text" id="t1" tabindex="3" value="<?php echo $dt_catven['nom_ven'];?>"></td>
    <td nowrap>Apellido Paterno: </td>
    <td nowrap><input name="t2" type="text" id="t2" tabindex="4"  value="<?php echo $dt_catven['ap_pat_ven'];?>"></td>
    <td nowrap>Apellido Materno:</td>
    <td nowrap><input name="t3" type="text" id="t3" tabindex="5"  value="<?php echo $dt_catven['ap_mat_ven'];?>"></td>
  </tr>
  <tr>
    <tH colspan="6" nowrap><div align="center">DATOS PERSONALES </div></tH>
  </tr>
  <tr>
    <td nowrap>Direccion:</td>
    <td colspan="3" nowrap><input name="t4" type="text" id="t4" tabindex="6" size="50" value="<?php echo $dt_catven['direccion'];?>"></td>
    <td nowrap>Telefono:</td>
    <td nowrap><input name="t5" type="text" id="t5" tabindex="7" value="<?php echo $dt_catven['telefono'];?>"></td>
  </tr>
  <tr style="display:none">
    <td nowrap>RFC:</td>
    <td nowrap><input name="t6" type="text" id="t6" tabindex="8" value="<?php echo $dt_catven['rfc_ven'];?>"></td>
    <td nowrap>Empresa : </td>
    <td nowrap><input name="t7" type="text" id="t7" tabindex="9" value="<?php echo $dt_catven['nom_empr'];?>"></td>
    <td nowrap>% de Comision:</td>
    
  </tr>
  <tr style="display:none">
    <th colspan="6" nowrap>DATOS GENERALES </th>
  </tr>
  <tr style="display:none">
    <td nowrap>Tipo de Persona:</td>
    <td colspan="2" nowrap><select name="tip_per" id="tip_per" tabindex="11">
      <option value="C" <?php
 if (!(strcmp("C", $dt_catven['tip_per']))) {echo "selected=\"selected\"";} ?>>CAJERO(A)</option>
      <option value="V" <?php
 if (!(strcmp("V", $dt_catven['tip_per']))) {echo "selected=\"selected\"";} ?>>VENDEDOR(A)</option>
      <option value="VC" <?php
 if (!(strcmp("VC", $dt_catven['tip_per']))) {echo "selected=\"selected\"";} ?>>CAJERO(A)/VENDOR(A)</option>
    </select></td>
    <td colspan="3" nowrap><label>Tipo de Acceso:
      <select name="tip_acc" id="tip_acc" tabindex="12">
         <option value="P" <?php
 if (!(strcmp("P", $dt_catven['tip_acc']))) {echo "selected=\"selected\"";} ?>>Personal</option>
         <option value="G" <?php
 if (!(strcmp("G", $dt_catven['tip_acc']))) {echo "selected=\"selected\"";} ?>>General</option>
          </select>
      Status:
      <select name="sta" id="sta" tabindex="13">
        <option value="1" <?php
 if (!(strcmp(1, $dt_catven['sta']))) {echo "selected=\"selected\"";} ?>>Activo</option>
        <option value="0" <?php
 if (!(strcmp(0, $dt_catven['sta']))) {echo "selected=\"selected\"";} ?>>Inactivo</option>
      </select>
    </label></td>
  </tr>
  <tr style="#CCCCCC">
    <td colspan="6" nowrap><div align="center" class="tdeli">Acceso</div></td>
  </tr>
  <tr>
    <td colspan="6" nowrap><div align="center">
      <?php

			@$sql=mysqli_query($con ,"select * from dgtipven");
			$numTipVen=mysqli_num_rows($sql);
		?>
      <select name="tip_ven[]" size="<?php echo $numTipVen;?>" multiple id="tip_ven[]" tabindex="14" style="width:40%;">
        <?php
  
		while(@$reg=mysqli_fetch_array($sql)){
			if(strstr($dt_catven['aceso'],$reg['tip_ven']))
				echo '<option value="'. $reg['tip_ven'] .'" selected>'.$reg['des_tipven'].'</option>';
			else
				echo '<option value="'. $reg['tip_ven'] .'">'.$reg['des_tipven'].'</option>';
		}
		?>
      </select>
    </div></td>
  </tr>
  <tr>
    <td colspan="6"><div align="center">
      <input type="button" name="Submit2" value="Modificar" onClick="openpage('cat_cajeros_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('cat_cajeros_PR.php','_self')"/>
    </div></td>
  </tr>
</table>
</form>
 </body>
<?php
 
mysqli_close($con);
}
?>
</html>