<? 
$nivel = $_GET["nivel"];
$nombrevar =$_GET["nombreuser"];
$hoy=date("Y-m-d");
$ano=date("Y");
require_once('../../../conf/connection.php');
$nombreuser =$_GET["nombreuser"];
//extraer sucursal
       $query_sucu="SELECT * FROM user_sistem WHERE nombre='$nombreuser'";
	   $res_sucu=mysql_query($query_sucu);
	   $sucu=mysql_result($res_sucu,0,"sucursal");
//nombre suscursal
	   $query_nom="SELECT * FROM sucu WHERE codsucu='$sucu'";
	   $res_nom=mysql_query($query_nom);
	   $nom_sucu=mysql_result($res_nom,0,"nombre");
            
?>
<!DOCTYPE html>
<html dir="ltr" lang="en-US">
<head>
  

    <meta charset="utf-8">
    <title>INVENTARIO</title>
    <meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width">

    <!--[if lt IE 9]><script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
    <link rel="stylesheet" href="../../../style.css" media="screen">
    <!--[if lte IE 7]><link rel="stylesheet" href="../style.ie7.css" media="screen" /><![endif]-->
    <link rel="stylesheet" href="../../../style.responsive.css" media="all">

    <script src="../../../jquery.js"></script>
    <script src="../../../script.js"></script>
    <script src="../../../script.responsive.js"></script>

<link href="../../calendario/calendar-blue.css" rel="stylesheet" type="text/css">
	<script type="text/JavaScript" language="javascript" src="../../calendario/calendar.js"></script>
	<script type="text/JavaScript" language="javascript" src="../../calendario/lang/calendar-sp.js"></script>
	<script type="text/JavaScript" language="javascript" src="../../calendario/calendar-setup.js"></script>

<style>.art-content .art-postcontent-0 .layout-item-0 { border-top-width:1px;border-top-style:solid;border-top-color:#B1C9C7;margin-top: 10px;margin-bottom: 10px;  }
.art-content .art-postcontent-0 .layout-item-1 { border-right-style:solid;border-right-width:1px;border-right-color:#B1C9C7; padding-right: 10px;padding-left: 10px;  }
.ie7 .art-post .art-layout-cell {border:none !important; padding:0 !important; }
.ie6 .art-post .art-layout-cell {border:none !important; padding:0 !important; }

</style>
    <script>
$(document).ready(function(){
// Demo 5
$('#identidad').Rut({
  on_error: function(){ alert('Rut incorrecto'); },
  format_on: 'keyup' 
});
$("#content > ul").tabs();
});

function cerrar() {
			window.close();
		}
		
</script>  
 <script type="text/javascript" src="../js/jquery-1.6.2.js"></script>
   <script src="../js/jquery.Rut.js" type="text/javascript"></script>
  <script type="text/javascript" src="../../../funciones/scripts.js"></script>
  <script type="text/javascript">

 //He aqui la magia de AJAX gracias al Framework JQuery!
  $(document).ready(function(){
	  //programamos el vento click del boton enviar del formulario
	  $("#enviar").click(function() {
		  
		  //Variables del formulario
		  var cod=frm_add.codigo.value;
		  var fam=frm_add.familia.value;
		 
		   
		  //preguntamos si no hay campos vacios
		  if(cod!="" && fam!="" )
		  {
		      //Enviamos mediante el metodo post de JQuery $.post("archivo.php",{parametros}, callback);
		      $.post("add_reg.php", {enviar:frm_add.enviar.value, codigo:cod, familia:fam }, function(output){
			    //El parametro output, recibe como salida lo generado por el script php
				alert(output);
				//con esta linea limpiamos el formulario
				document.frm_add.reset();
		      });
		  }
		  else
		  {
			  alert("Campos obligatorios (*) vacios!");
		  }
	  });
  });
</script>
</head>
<body>
<div id="art-main">

<div class="art-sheet clearfix">
            <div class="art-layout-wrapper">
                <div class="art-content-layout">
                  <div class="art-content-layout-row">
                    <div class="art-layout-cell art-content"><article class="art-post art-article">
                                
                                                
                                <div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout">
    <div class="art-content-layout-row">
    <div class="art-layout-cell layout-item-1" style="width: 100%" >
        <h3>informe de costos por familia | Sucursal: <? echo $nom_sucu; ?></h3>
     <p >
      <?php
					  	$query_familias="SELECT * FROM familias  ORDER BY nombre ASC";
						$res_familias=mysql_query($query_familias);
						$contador=0;
						?>
      <form id="formulario" name="formulario" method="post" action="verifica.php" >
        <input type="hidden" id="sucu" name="sucu" value="<? echo $sucu ?>">
				<fieldset><legend>Verificar registro </legend>
                <table class="fuente8" width="98%" cellspacing=0 cellpadding=3 border=0>					
					 
					  <tr>
					    <td width="8%">FAMILIA: </td>
					    <td colspan="5"><select id="AcboFamilias" name="AcboFamilias" class="comboGrande">
					      
					      <option value=""></option>
                          <option value="0">Todas las familias</option>
					      <?php
								while ($contador < mysql_num_rows($res_familias)) { ?>
					      <option value="<?php echo mysql_result($res_familias,$contador,"codfamilia")?>"><?php echo mysql_result($res_familias,$contador,"nombre")?></option>
					      <? $contador++;
								} ?>
					      </select></td>
					   
					    </tr>
					  <tr>
					    <td>FORMATO: </td>
					    <td colspan="5"><select id="tipo" name="tipo" class="comboMedio">
					      <option value="0"></option>
					      <option value="1">MICROSOFT EXCEL(.XLS)</option>
					      </select></td>
					    </tr>
					  <tr>
					    <td width="8%">DESDE:</td>
					    <td width="10%"><input id="desde" type="text" name="desde" value="" ></td>
					    <td width="4%">
                        <img src="../../../images/postdateicon.png" name="Image1" id="Image1">
        <script type="text/javascript">
					Calendar.setup(
					  {
					inputField : "desde",
					ifFormat   : "%Y-%m-%d",
					button     : "Image1"
					  }
					);
		</script>
                        </td>
					    <td width="4%">HASTA:</td>
					    <td width="9%"><input id="hasta" type="text" name="hasta" value="<? echo $hoy ?>" ></td>
					    <td width="65%">
                        <img src="../../../images/postdateicon.png" name="Image2" id="Image2">
        <script type="text/javascript">
					Calendar.setup(
					  {
					inputField : "hasta",
					ifFormat   : "%Y-%m-%d",
					button     : "Image2"
					  }
					);
		</script>
                        </td>
					    </tr>
					  <tr>
					    <td colspan="6"><input type="hidden" value="1" id="consignacion" name="consignacion" class="comboPequeno">				        </td>
					    </tr>
					  <tr>
					    <td colspan="6" align="right">
                        <input name="submit" width="69" type="submit" class="art-button"id="submit" value="Buscar"> 
                        <input name="button" type="reset" class="art-button"  id="button" value="Limpiar"></td>
				      </tr>
					</table>
		</fieldset>
	
      </form></p>
     <p align="left">  
     <div id="resultado">
     </div></p>
    
    </div>
    </div>
</div>
<div class="art-content-layout-br layout-item-0">
</div></div>


</article></div>
                    </div>
                </div>
            </div><footer class="art-footer">

<p>Copyright © <? echo $ano; ?>. All Rights Reserved.</p>
</footer>

    </div>
    <p class="art-page-footer">
        <span id="art-footnote-links">Informatica Francisco Arias E.I.R.L.</span>
    </p>
</div>


</body></html>