<?php
 session_start();  
 include("emenux.php");
 include "conecta.php";  
 $sql="select m07001.cod_interno,m07001.glosa,m07001.precio,m07005.stock from m07001 inner join m07005 on m07001.cod_interno=m07005.cod_interno    order by m07001.glosa;";
 $res=mysql_query($sql,$con) or die(mysql_error());
?>
<!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>
<TITLE>Login</TITLE>
<script language="javascript" src="fstandar.js"></script>
<script language="javascript">
 function enviar(){
  window.alert("este proceso tradara unos minutos");
  document.form1.action="http://www.automotriz-vemol.cl/recibeactl3.php";
  document.form1.method="post";
  document.form1.submit();
 }
</script>
<link rel="stylesheet" href="styles.css">
<style type="text/css">
<!--
.Estilo1 {font-size: 12px}
-->
</style>
</HEAD>
<BODY>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" align=center 
border=0>
  <TBODY>
  <TR>
    <TD vAlign=center align=middle height="100%">
      <TABLE height=400 cellSpacing=0 cellPadding=0 width=718 border=0>
        <TBODY>
        <TR>
          <TD width="718" height=22>
            <TABLE height=22 cellSpacing=0 cellPadding=0 width="100%" 
              border=0><TBODY>
              <TR>
                <TD vAlign=top align=left width=24><A 
                  href="index.php"><IMG src="images/xc_left.gif" alt="Inicio" width=24 
                  height=22 
                  border=0></A></TD>
                <TD vAlign=top align=left width="100%"><IMG height=22 
                  src="images/xc_center.gif" width="100%" 
                border=0></TD>
              <TD vAlign=top align=right width=24><IMG height=22 
                  src="images/xc_right.gif" width=24 
              border=0></TD></TR></TBODY></TABLE></TD></TR>
        <TR>
          <TD class=BottomTable vAlign=top 
          background=images/xc_stripes.gif height="100%">
            <TABLE class=IconsTable height=33 cellSpacing=0 cellPadding=0 
            width="100%" border=0>
              <TBODY>
              <TR>
                <TD height="32"><div align="right" class="larger">
                  <div align="right">Vemol</div>
                </div></TD>
                </TR></TBODY></TABLE>
            <form name="form1" id="form1" method="post" action="">
              <table width="719" border="1">
                <tr>
                  <td colspan="4"><div align="center" class="BoldText Estilo1">Actualizaci&oacute;n de stocks y precios a local 2
                    <input name="hdlineas" type="hidden" id="hdlineas" value="<?php echo mysql_num_rows($res) ?>" />
                    <input name="cmdact" type="button" id="cmdact" value="Actualizar" onclick="enviar()"/>
                    <input name="hdpag" type="hidden" id="hdpag" value="<?php echo $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF'])?>"/>
                  </div></td>
                  </tr>
                <tr>
                  <td width="84"><div align="center" class="BoldText">Interno</div></td>
                  <td width="445"><div align="center" class="BoldText">Glosa</div></td>
                  <td width="72"><div align="center" class="BoldText">Stock</div></td>
                  <td width="90"><div align="center" class="BoldText">Precio</div></td>
                  </tr>
				  <?php 
				  $lineas=0;
				  while($fila=mysql_fetch_row($res)){
				   $lineas++;
				   $cod=$fila[0];
				   $gl=$fila[1];
				   $pr=$fila[2];				   
				   $st=$fila[3];
				   if ($gl==""){$gl=" .";}
				   if ($st==""){$st="0";}
				   if ($pr==""){$pr="0";}
				   $lcod="<input type='hidden' name='cod$lineas' value='$cod'>";
				   $lpre="<input type='hidden' name='pre$lineas' value='$pr'>";
				   $lst="<input type='hidden' name='st$lineas' value='$st'>";
				   $lgl="<input type='hidden' name='gl$lineas' value='$gl'>";
                   echo "<tr>
                          <td>$cod $lcod</td>
                          <td>$gl $lgl</td>
                          <td>$st $lst</td>
                          <td>$pr $lpre</td>
                         </tr>";
				    }
					echo "Registgros: " . $lineas;					
				 ?> 				 
				 
             </table>
			 
            </form></TD>
        </TR></TBODY></TABLE></TD></TR></TBODY>
<!-- /Footer -->
<script language="JavaScript" src="menu.js"></script>
<script language="JavaScript" src="menu_tpl.js"></script>
<script language="JavaScript">
	new menu (MENU_ITEMS, MENU_POS);
</script>
</TABLE>
</BODY>
<?php
	mysql_close($con);
?>
</HTML>