<? 
require_once('../../../conf/connection.php');
$nivel = $_GET["nivel"];
$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");

$hoy=date("Y-m-d");
$ano=date("Y");


            
?>
<!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>


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> 
function enviar_formulario(){ 
   document.formulario.submit() 
} 
function proveedor(){
			miPopup = window.open("ver_residente.php","residente","width=700,height=380,scrollbars=yes");
			miPopup.focus();
		}

function v_total(){
			miPopup = window.open("calc_venta.php?total_venta_uno="+document.getElementById('total_venta_uno').value+"","residente","width=250,height=150,scrollbars=yes");
			miPopup.focus();
		}

function c_total(){
			miPopup = window.open("calc_compra.php?total_venta_uno="+document.getElementById('total_compra').value+"","residente","width=250,height=150,scrollbars=yes");
			miPopup.focus();
		}

function c_total2(){
			miPopup = window.open("calc_compra2.php?total_venta_uno="+document.getElementById('neto_compra').value+"","residente","width=250,height=150,scrollbars=yes");
			miPopup.focus();
		}

</script> 
<script type='text/javascript' src='jquery-1.7.1.min.js'></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>Agregar Productos (Bodega)</h3>
     <p >
       <form action="add_reg.php" name="formulario" method="post" enctype="multipart/form-data">
       <input type="hidden" name="sucu" id="sucu" value="<? echo $sucu ?>"/>
   <fieldset><legend>Nuevo Registro</legend>
   <table width="713">
     
     <tr>
       <td width="133" height="32" align="right">Código de producto:</td>
       <td colspan="2"><input type="text" name="codigo" id="codigo" autofocus  /></td>
     </tr>
     <tr>
       <td height="30" align="right">Familias: </td>
                  <?    $query_familias="SELECT * FROM grupos WHERE idgrupos='1000'";
						$res_familias=mysql_query($query_familias);
						$contador=0;
				  ?>
       <td colspan="2"><select id="familia" name="familia" >
							
								<option value="<? echo $cd_familia ?>"><?  echo $cd_nombre?></option>
								<?php
								while ($contador < mysql_num_rows($res_familias)) { ?>
								<option value="<?php echo mysql_result($res_familias,$contador,"idgrupos")?>">
								<?php echo mysql_result($res_familias,$contador,"nombre_grupo")?></option>
								<? $contador++;
								} ?>				
								</select></td>
     </tr>
     <tr>
       <td height="15" align="right">Descripción: </td>
       <td colspan="2"><input type="text" name="des" id="des" /></td>
     </tr>
     <tr>
       <td height="2" align="right">Cantidad de ingreso:</td>
       <td colspan="2"><input type="text" name="stock" id="stock" /></td>
     </tr>
     <tr>
       <td height="3" align="right">Unidad de medida: </td>
       <td colspan="2" bgcolor="#1BA160">
        <?    $query_unidad="SELECT * FROM unidad WHERE borrado=0 ORDER BY nombre ASC";
						$res_unidad=mysql_query($query_unidad);
						$contador=0;
				  ?>
       <select id="unidad" name="unidad" >
         <option value="<? echo $unidad ?>">
           <?  echo $unidad?>
           </option>
         <?php
								while ($contador < mysql_num_rows($res_unidad)) { ?>
         <option value="<?php echo mysql_result($res_unidad,$contador,"codunidad")?>"><?php echo mysql_result($res_unidad,$contador,"nombre")?></option>
         <? $contador++;
								} ?>
       </select></td>
     </tr>
     <tr>
       <td height="7" align="right">Stock mínimo: </td>
       <td colspan="2"><input type="text" name="stock_minimo" id="stock_minimo" /></td>
     </tr>
     <tr>
       <td height="26" align="right">Fecha de ingreso:</td>
       <td width="126"><input name="fecha" type="text" id="fecha" value="<? echo $hoy ?>" readonly /></td>
       <td width="438">
       <img src="../../images/postdateicon.png" name="Image1" id="Image1">
        <script type="text/javascript">
					Calendar.setup(
					  {
					inputField : "fecha",
					ifFormat   : "%Y-%m-%d",
					button     : "Image1"
					  }
					);
		</script>
       </td>
     </tr>
      <tr>
        <td height="2" colspan="3" align="left">
         
         

          <fieldset>
         <legend>Detalles de compra</legend>
            
              
            <table width="651" border="0">
              <tr>
                <td width="127">R.U.T. (Proveedor):</td>
                <td width="122"><input name="identidad" style="background-color:#CCC" type="text" id="identidad" readonly /></td>
                <td width="82">
                <img src="../../images/searchicon.png" alt="" width="16" height="16" onClick="proveedor()"></td>
                <td width="302">
                  <input name="nombre" type="text" id="nombre" style="background-color:#CCC"
    size="60"readonly></td>
              </tr>
              <tr>
                <td>NETO:</td>
                <td><input type="text" name="neto_compra" id="neto_compra"></td>
                <td>
                <img src="../../../images/calculadora.jpg" width="16" height="16" onClick="c_total2()">
                </td>
                <td>&nbsp;</td>
              </tr>
              <tr>
                <td>IVA:</td>
                <td colspan="3">
                <input name="iva_compra" type="text" id="iva_compra" style="background-color:#CCC" readonly>
                </td>
              </tr>
              <tr>
                <td>TOTAL: </td>
                <td>
                <input name="total_compra" type="text" id="total_compra" >
               
                </td>
                <td>
                <img src="../../../images/calculadora.jpg" width="16" height="16" onClick="c_total()">
                </td>
                <td>&nbsp;</td>
              </tr>
           </table>
           
           
          </fieldset>
         
          </td>
      </tr>
      <tr>
        <td height="0" colspan="3" align="right">
         
        
         <fieldset>
            <legend>Detalles de venta sucursal</legend>
             
            <table width="406" border="0">
              <tr>
                <td width="75">NETO:</td>
                <td colspan="2">
                <input type="text" name="neto_venta_uno" id="neto_venta_uno"
                style="background-color:#CCC"
                 readonly="readonly"  ></td>
              </tr>
              <tr>
                <td>IVA:</td>
                <td colspan="2">
                <input type="text" name="iva_venta_uno" id="iva_venta_uno"  
                style="background-color:#CCC"
                 readonly="readonly" ></td>
              </tr>
              <tr>
                <td>TOTAL: </td>
                <td width="123">
                <input type="text" name="total_venta_uno" id="total_venta_uno" >
                </td>
                <td width="194"><img src="../../../images/calculadora.jpg" width="16" height="16" onClick="v_total()"></td>
              </tr>
         </table>
         
          </fieldset>
         

        
        
        </td>
        </tr>
      <tr> 
        <td height="-1" colspan="3" align="right"><input name="descuento" type="hidden" id="descuento" value="0" />
          <input type="hidden" name="foto1" id="foto1">
          <input name="obs" type="hidden" id="obs" size="70" /></td>
        </tr>
     
     <tr>
       <td colspan="3" align="right">
         
         <a href="javascript:enviar_formulario()" class="art-button">Guardar</a> 
         <a href="#" onClick="cerrar()" class="art-button">Cerrar ventana</a> 
         
         
         </td>
     </tr>
     
     </table>
</fieldset>
</form>
</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>