<?php	
// $cone=$_SESSION['con'];
include "emenux.php";
 require("funciones.php");
 require ("conecta.php");
 $glosa=codsql($_GET['glosa']);
 $rut=$_GET['rut'];
 $sql="select m07001.cod_interno,m07001.cod_barra,m07001.glosa,m07001.precio,m07005.stock,m07005.costo_contable from m07001 inner join m07005 on m07001.cod_interno=m07005.cod_interno  where glosa like '%$glosa%' order by glosa;";  
 $result=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>Busqueda</TITLE>
<!--<script language="javascript" src="fstandar.js"></script>!-->
<link rel="stylesheet" href="styles.css">
<style type="text/css">
<!--
.Estilo1 {color: #0000FF}
.Estilo2 {color: #FF0000}
.Estilo3 {color: #FFFFFF}
-->
</style>

 <SCRIPT language="javascript">  
  
   function envia(interno,glosa,codprov){    
	//document.write(a.substring(4,8));
    opener.document.form1.interno.value = interno;
	opener.document.form1.hdcod.value = interno;
	opener.document.form1.glosa.value = glosa;
	opener.document.form1.codprov.value = codprov;
	opener.document.form1.codprov.focus();
	//seleccionado.substr(seleccionado,9);	
	close(); 
   } 
  </script> 

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /></HEAD>
<BODY>

<TABLE height="56%" cellSpacing=0 cellPadding=0 width="83%" align=left 
border=0>
  <TBODY>
  <TR>
    <TD vAlign=top height="100%">
      <TABLE height=135 cellSpacing=0 cellPadding=0 width=629 border=0>
        <TBODY>
        <TR>
          <TD width="717" 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 width="100%" border="1" cellpadding="0" cellspacing="0" bordercolor="#C4D2E2" class="Emphasize">
            <tr>
              <th width="7%" class="m0l0oout" scope="col"><div align="left" class="m0l0oout Estilo3">Cant.</div></th>
              <th width="13%" class="m0l0oout" scope="col"><p align="left" class="Estilo3">Cod_interno</p></th>
              <th width="15%" class="m0l0oout" scope="col"><div align="left" class="Estilo3">Cod_prove</div></th>
              <th width="43%" class="m0l0oout" scope="col"><div align="center" class="Estilo3">Glosa</div></th>
              <th width="11%" class="m0l0oout Estilo3" scope="col">Precio Unit. </th>
              <th width="11%" class="m0l0oout" scope="col"><p class="Estilo3">Stock</p></th>
			  <th width="11%" class="m0l0oout" scope="col"><p class="Estilo3">Costo</p></th>
            </tr>
            <?php	
				   $indice=0;	
				   //if (strlen($numero)>0){//si#		  
				   //$sqld="select * from m07001 where glosa='$glosa%' ;";
				   //$resd=mysql_query($sqld,$cone) or die(mysql_error());				   
				   while ($filad=mysql_fetch_row($result)){
				    $interno=$filad[0];
					$cprov=codprov($interno,$rut,$con);
					$desc=strtoupper(sacacomilla($filad[2]));
					$pre=number_format($filad[3],0,".",",");
					$stock=$filad[4];
					$costo=number_format($filad[5],2,".",",");
				    echo "<tr>";
					 echo "<td>&nbsp;</td>";
					 echo "<td><a href='javascript:envia(\"$interno\",\"$desc\",\"$cprov\");'>$interno</a></td>";
					 echo "<td>$cprov</td>";
					 echo "<td>$desc</td>";
					 echo "<td align='right'>$pre</td>";
					 echo "<td align='right'>$stock</td>";
					 echo "<td align='right'><a href='ultcom.php?codigo=$interno'>$costo</a></td>";  
					echo "</tr>";
				    }
					//}
				   ?>
            <tr>
              <th class="m0l0oout" scope="col"><div align="left">              </div></th>
              <th class="m0l0oout" scope="col">&nbsp;</th>
              <th class="m0l0oout" scope="col">&nbsp;</th>
              <th class="m0l0oout" scope="col">&nbsp;</th>
              <th class="m0l0oout Estilo3" scope="col"><div align="left">              </div></th>
              <th class="m0l0oout" scope="col">&nbsp;</th>
            </tr>
          </table>
            <p>&nbsp;</p></TD>
        </TR></TBODY></TABLE>
      <span class="Emphasize">ho&ntilde;a</span></TD>
  </TR></TBODY>
</TABLE>
<?php mysql_close($con); ?>
</BODY>
</HTML>

