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

$id_empresa = $_SESSION['ss_empresa'];
$fec_libro = $_SESSION['ss_fecha_libro'];
if ($id_empresa == '')
		{
		?>
		<script>
			parent.location.href = '../mant_empresa/index.php';
		</script>
		<? 
		exit();
		}







$id_user = $_SESSION['ss_user'];


/*Sesiones*/
include("../conex.php");


if ($txtfecha=='') $txtfecha = $fec_libro;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Documento sin t&iacute;tulo</title>
<script language="JavaScript" src="../css/cal.js" type="text/JavaScript"></script>
<style type="text/css">
<!--
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>
</head>
<body>
<div align="center">

<form id="form1" name="form1" method="post" action="muestra.php" target="mainFrame">
<div align="center">

<table width="250" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td width="100%" align="center">Seleccione mes del libro</td>
	</tr>
	<tr>
		<td width="100%" align="center">
			<input name="txtfecha" id="txtfecha" type="text" style="border-width:0; background-color:#CCCCCC; text-align:right" align="right" value="<?=$txtfecha?>" size="5" />
	  </td>

	</tr>
</table>
<table width="250" border="0" align="center" cellpadding="0" cellspacing="0">
	<tr>
		<td width="100%" align="right">
			<select name="tdcto" id="tdcto" style="background-color:#CCCCCC;width:100%;" onChange="javascript:form1.submit();">
			<option value="0" selected>SELECCIONE TIPO DOCUMENTO
			<option value="0">TODOS
			<option value="1">BOLETAS
			<option value="2">GUIAS
            <option value="3">FACTURAS, NC, ND y Electronicas
			</select>
		</td>
	</tr>
</table>
<table width="418" border="0" align="center">
	<tr>
		<td width="500">
		<input type="button" name="Submit" value="Ver Libro"  onClick="fun_ver_libro()"/>	
        <input type="button" name="Submit2" value="Salida Excel SII" onClick="fun_envia_sii()"/>
        <input type="submit" name="libro_legal" value="Ver Libro Legal"/>
        <input type="submit" name="Submit3" value="Salir"  onClick="fun_salir();" />		
        </td>
	</tr>
</table>
</form>
<div id="div1">
<form action="lee_libro_xml_compra.php" method="post" name="form2" enctype="multipart/form-data"  target="mainFrame">

<table border="0" align="center">
		     <td>Captura Libro Compra XML SII</td>
               <td><input type="submit" name="Submit2" value="Subir DTE" /></td>
             <td><span class="combos"> 
           <input name="reserva" type="file" id="reserva" size="40" onBlur="LimitAttach(this,7);">   </span></td>
</table>
</form>
</div>

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

<script language="javascript">
function fun_salir()
	{
	window.top.open('','_parent','');window.top.close();
	}

function fun_ver_libro()
	{
	document.form1.action='muestra.php';
	document.form1.submit();
	}
	
function fun_excel()
	{
	document.form1.action='muestra1.php';
	document.form1.submit();
	}
function fun_envia_sii()
	{
	document.form1.action='muestra_sii.php';
	document.form1.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>
 