<?php
 
session_start();
include("DMMYSQLG.php");
include("DSA1000.php");
include("DMMYSQLG.php");
?>
<html>
<head>
<title>CENTRO COSTOS</title>
</head>
<link rel="stylesheet" href="css/estilo1.css" type="text/css"/>
<script type="text/javascript" language="JavaScript1.2" src="DSSCRIPT.js"></script>
<body>
<?php

$b = $_REQUEST["bot"]; 
$reg=$_POST["m1"];
$result = mysqli_query($con ,"SELECT * FROM dgcatpro WHERE cod_pro = $reg");
if(!$result){
	echo "no se pudo";
}
if($b == "eliminar"){
?>
<form name="frm1" method="post" action="">
  <table border='1' align="center">
    <tr>
	  <th><div align="center">Codigo del Proveedor: </div></th>
      <th><div align="center">Apellido Paterno:</div></th>
      <th><div align="center">Spellido Materno: </div></th>
      <th><div align="center">Nombre (s):</div></th>
	  <th><div align="center">Codigo:</div></th>
	  <th><div align="center">RFC:</div></th>
	  <th><div align="center">Cuenta Contable:</div></th>
    </tr>
    <tr>
      <?php

	while(@$row = mysqli_fetch_array($result))
	{
		  echo "<td>" . $row["cod_pro"] . "</td>";
		  echo "<td>" . $row["ap_pat_pro"] . "</td>";
		  echo "<td>" . $row["ap_mat_pro"] . "</td>";
		  echo "<td>" . $row["nom_pro"] . "</td>";
		  echo "<td>" . $row["codigo"] . "</td>";
		  echo "<td>" . $row["rfc_pro"] . "</td>";
		  echo "<td>" . $row["cta_con"] . "</td>";
	}
	mysqli_close($con);
?>
    </tr>
  </table>
  <? echo '<input name="n_reg" type="hidden" value="' . $reg . '" />';?>
  <div align="center">
	 
	<input type="submit" name="Submit" value="Borrar Registro" onClick="openpage('eliminar_catpro.php')">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
     
    <input type="submit" name="Submit2" value="Regresar" onClick="openpage('catpro.php')">
    
  </div>
</form>
<?php

}if($b == "modificar"){
?>

<form  name="frm1" method="post" action="modificar_perfis.php">
  <table width="579"  align="center">
    <tr>
		  <th colspan="2" class=\"titulo\"><div align="center">CATALOGO DE PROVEEDORES</div></th>
    </tr>
    <tr>
      <td>Modificar Apellido Paterno : </td>
      <td><? 
		while(@$dato = mysqli_fetch_array ($result) ){ 
		echo '<input type="hidden" name="tcp" value ="' . $dato['cod_pro'] . '"/>';
		echo '<input name="tp" type="text"  value="' . $dato['ap_pat_pro'] . '"/>';
		}
		?></td>
    </tr>
    <tr>
      <td>Modificar Apellido Materno : </td>
      <td><? 
	  $result = mysqli_query($con ,"SELECT * FROM dgcatpro WHERE cod_pro = $reg");
		while(@$dato = mysqli_fetch_array ($result) ){ 
		echo '<input name="tm" type="text"  value="' . $dato['ap_mat_pro'] . '"/>';
		}
		?></td>
    </tr>
    <tr>
      <td>Modificar Nombre (s): </td>
      <td><? 
	  $result = mysqli_query($con ,"SELECT * FROM dgcatpro WHERE cod_pro = $reg");
		while(@$dato = mysqli_fetch_array ($result) ){ 
		echo '<input name="tn" type="text"  value="' . $dato['nom_pro'] . '"/>';
		}
		?></td>
    </tr>
    <tr>
      <td>RFC:</td>
      <td><? 
	  $result = mysqli_query($con ,"SELECT * FROM dgcatpro WHERE cod_pro = $reg");
		while(@$dato = mysqli_fetch_array ($result) ){ 
		echo '<input name="trf" type="text"  value="' . $dato['rfc_pro'] . '"/>';
		}
		?></td>
    </tr>
    <tr>
      <td width="203">Cuenta Contable: </td>
      <td width="360"><? 
	  $result = mysqli_query($con ,"SELECT * FROM dgcatpro WHERE cod_pro = $reg");
		while(@$dato = mysqli_fetch_array ($result) ){ 
		echo '<input name="tcc" type="text"  value="' . $dato['cta_con'] . '"/>';
		}
		?></td>
    </tr>
    <tr>
      <td colspan="2"><div align="center">
          <input type="submit" name="Submit2" value="Modificar" onClick="openpage('modificar_catpro.php')"/>
          &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="submit" name="Submit" value="Regresar" onClick="openpage('catpro.php')"/>
           
      </div></td>
    </tr>
  </table>
</form>
<?php

}if($b == "desplegar"){
?>
<form name="frm1" method="post" action="perfis.php">
  <table border='1' align="center">
    <tr>
      <th><div align="center">Codigo del Proveedor: </div></th>
      <th><div align="center">Apellido Paterno:</div></th>
      <th><div align="center">Spellido Materno: </div></th>
      <th><div align="center">Nombre (s):</div></th>
	  <th><div align="center">Codigo:</div></th>
	  <th><div align="center">RFC:</div></th>
	  <th><div align="center">Cuenta Contable:</div></th>
    </tr>
    <tr>
      <?php

	while(@$row = mysqli_fetch_array($result))
	{
		  echo "<td>" . $row["cod_pro"] . "</td>";
		  echo "<td>" . $row["ap_pat_pro"] . "</td>";
		  echo "<td>" . $row["ap_mat_pro"] . "</td>";
		  echo "<td>" . $row["nom_pro"] . "</td>";
		  echo "<td>" . $row["codigo"] . "</td>";
		  echo "<td>" . $row["rfc_pro"] . "</td>";
		  echo "<td>" . $row["cta_con"] . "</td>";
	}
	mysqli_close($con);
?>
    </tr>
  </table>
  <? echo '<input name="n_reg" type="hidden" value="' . $reg . '" />';?>
  <div align="center">
    <input type="submit" name="Submit2" value="Regresar" >
    
  </div>
</form> 
<?php

}if($b == "Imprimir Solicitud"){
?>
<div align="center">
	<form action="imp_per_fis.php" method="post" target="_blank">
				<input name="n_reg" type="hidden" value="<?php
 echo $reg ?>"/>
				Usted Quiere: <input name="Entrar" value="Imprimir Solicitud Parte 1" type="submit"/> <br>
	</form>
	<form action="imp_per_fis2.php" method="post" target="_blank">
				<input name="n_reg" type="hidden" value=" <?php
 echo $reg ?>  "/>
				Usted Quiere: <input name="Entrar" value="Imprimir Solicitud Parte 2" type="submit"/> <br>
	</form>			
 	<form action="perfis.php" method="post" target="_self">
				Se agrego el registro click para <input name="Entrar" value="Regresar..." type="submit"/>
	</form>			
</div>
<?php

}
?>
</body>
</html>
