<?
ini_set('error_reporting',1);
session_start();
if ($_SESSION['estado'] != "ON")
		{
		?>
		<script>
			parent.location.href = 'index.php';
		</script>
		<? 
		exit();
		}
$id_empresa = $_SESSION['ss_empresa'];
$id_user = $_SESSION['ss_user'];
$id_autoriza=37;

include("../conex.php");
include("../autoriza.php");
if ($editar==0)  
{
?>
		<script>
		alert ("No Autorizado");
		parent.location.href = 'index.php';
		</script>
	<? 
	exit();
}
$get_cod_nombres = $_GET["cp"];
$id_bodega = $_GET["bod"];

$sql_bpro = "SELECT * FROM tipo_dcto WHERE id = $get_cod_nombres";
$res_bpro = mysql_query($sql_bpro,$enlace);

if (mysql_fetch_object ($res_bpro))
	{
	$id_dcto = mysql_result($res_bpro, 0, "id");
	$sql_descripcion = mysql_result($res_bpro, 0, "descripcion");
	}
	
$sql_bpro = "SELECT * FROM tipo_dcto, tipo_dcto_num_bodega WHERE tipo_dcto.Id = $get_cod_nombres AND tipo_dcto.id=id_dcto AND id_bodega=$id_bodega";
$res_bpro = mysql_query($sql_bpro,$enlace);
$sql_valor=0;
$sql_tope=0;
$sql_id=0;
if (mysql_fetch_object ($res_bpro))
	{
	$sql_id = mysql_result($res_bpro, 0, "tipo_dcto_num_bodega.id");
	$sql_valor = mysql_result($res_bpro, 0, "correlativo");		
	$sql_tope = mysql_result($res_bpro, 0, "tope");	
	}
	



?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Mantenimiento de documentos</title>
<style type="text/css">
<!--
.Estilo11 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10px; }
body {
	background-color: #CCCCCC;
	margin-left: 0px;
	margin-top: 3px;
	margin-right: 0px;
	margin-bottom: 0px;
}
select {
	clear: right;
	float: left;
	height: auto;
	width: 267px;
}
-->
</style>
</head>

<body>
<div align="center">
<form action="guardae_dcto.php" method="post" enctype="multipart/form-data" name="form1" target="_self">
  <div align="center">Editar Tipo Documento </div>
  <table border="1" align="center" cellpadding="1" cellspacing="0">
  <tr>
    <td>Tipo Documento </td>
    <td><input name="nombre" type="text" class="textboxnormal" id="nombre" size="40" maxlength="40" value="<?=$sql_descripcion?>" readonly="1"></td>
  </tr>
    <tr>
    <td>Bodega:</td>
    <td><select name="id_bodega" id="id_bodega" style="width:278px">
						<?
							$sqlBodega = "SELECT Id, descripcion FROM bodega WHERE id=$id_bodega ORDER BY descripcion";
							$resultado = mysql_query($sqlBodega, $enlace);
								for($cont=0;(mysql_fetch_object ($resultado));$cont++)
								{
									$seleccionado=($txtBodega==mysql_result($resultado, $cont, "Id"))?"selected":"";
						?>
							<option value="<?=mysql_result($resultado, $cont, "Id");?>" <?=$seleccionado;?> ><?=mysql_result($resultado, $cont, "descripcion");?></option>
						<?						
								}
					
						?>
				  </select>   </td>
  </tr>
  <tr>
    <td>Correlativo </td>
    <td><input name="valor" type="text" class="textboxnormal" id="valor" size="40" maxlength="40" onKeyPress="return valida(event)" value="<?=$sql_valor?>"></td>
  </tr>
    <td>Tope </td>
    <td><input name="tope" type="text" class="textboxnormal" id="tope" size="40" maxlength="40" onKeyPress="return valida(event)" value="<?=$sql_tope?>"></td>
  </tr>
</table>

  <div align="center">
    <input name="Submit" type="button" class="botones" value="GRABAR" onClick="enviar(form1)">
  </div>
   <input name="id" type="text" class="textboxnormal" id="id"  value="<?=$sql_id?>" style="visibility:hidden">
  <input name="id_dcto" type="text" class="textboxnormal" id="id_dcto"  value="<?=$id_dcto?>" style="visibility:hidden">
  <input name="id_bodega" type="text" class="textboxnormal" id="id_bodega"  value="<?=$id_bodega?>" style="visibility:hidden">
  </table>
  </form>
  
<form action="muestra_folio_sii.php" method="post" name="form2" enctype="multipart/form-data"  target="mainFrame" >

 <table width="200" border="0" align="center">
             <td width="65%" ><input type="submit" name="Submit2" value="Subir Folios de SII" />
               <span class="combos">
             <input name="reserva" type="file" id="reserva" size="40" onBlur="LimitAttach(this,7);" />
             </span></td>
                
 </table>
  </form>

</div>
</body>
</html>


<script type="text/javascript" src="../css/validarut.js"></script>
<script language="javascript">
var nav4 = window.Event ? true : false;
<!-- Ingreso solo letras -->
function valida(evt){
var key = nav4 ? evt.which : evt.keyCode;
	if (key==13) document.form1.txtrsoc.focus()
	return (key <= 13 || (key >= 48 && key <= 57) || (key == 46));
	}

function enviar(form)
{
	if (form.nombre.value==0)
		{
		alert ("Ingrese el tipo de documento")
		form.nombre.focus();
		return false;
		}

form.submit();	
}
function LimitAttach(tField,iType) 
{
file=tField.value;
if (iType==1) { 
extArray = new Array(".gif",".jpg",".png",".bmp");
}
if (iType==2) {
extArray = new Array(".swf");
}
if (iType==3) {
extArray = new Array(".exe",".sit",".zip",".tar",".swf",".mov",".hqx",".ra",".wmf",".mp3",".qt",".med",".et");
}
if (iType==4) {
extArray = new Array(".mov",".ra",".wmf",".mp3",".qt",".med",".et",".wav");
}
if (iType==5) {
extArray = new Array(".html",".htm",".shtml");
}
if (iType==6) {
extArray = new Array(".doc",".xls",".ppt");
}
if (iType==7) {
extArray = new Array(".xml");
}

allowSubmit = false;
if (!file) return;

while (file.indexOf("\\") != -1) file = file.slice(file.indexOf("\\") + 1);
ext = file.slice(file.indexOf(".")).toLowerCase();
for (var i = 0; i < extArray.length; i++) {
if (extArray[i] == ext) {
allowSubmit = true;
break;
}
} 

if (!allowSubmit) 
{
alert("Usted sólo puede subir archivos con extensiones " + (extArray.join(" ")) + "\nPor favor seleccione un nuevo archivo");
}
} 

	  
</script>