<?php
 session_start(); 
 $d1=0;
 $d2=0;
 $d3=0;
 $st=0; 
 include ("emenux.php");
 include "conecta.php"; 
 $numero=$_GET['numero'];
 $sqle="select * from adae01 where numero='$numero';";
 $rese=mysql_query($sqle,$con) or die(mysql_error());
 if (mysql_num_rows($rese)>0){
  while($filae=mysql_fetch_row($rese)){
   $st=$filae[7];
   $d1=$filae[8];
   $d2=$filae[9];
   $d3=$filae[10];
   $neto=$filae[11];
   $iva=$filae[12];
   $total=$filae[13];
  }//wend
 } //end if
?>
<!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 totaliza(){
  if (event.keyCode==13){
   document.form1.st1.value=document.form1.st.value-Math.round(document.form1.st.value * document.form1.d1.value /100);
   document.form1.d1p.value=document.form1.st.value - document.form1.st1.value;
   document.form1.st2.value=document.form1.st1.value-Math.round(document.form1.st1.value * document.form1.d2.value /100);
   document.form1.d2p.value=(document.form1.st1.value - document.form1.st2.value);   
   document.form1.st3.value=document.form1.st2.value-Math.round(document.form1.st2.value * document.form1.d3.value /100);   
  // window.alert(document.form1.st2.value-Math.round(document.form1.st2.value * document.form1.d3.value /100));
   document.form1.d3p.value=document.form1.st2.value - document.form1.st3.value;  
   document.form1.neto.value=document.form1.st3.value;
   }
 }
 function graba(){
  opener.form1.hdd1.value=document.form1.d1.value;
  opener.form1.hdd2.value=document.form1.d2.value;
  opener.form1.hdd3.value=document.form1.d3.value;
  opener.form1.hdneto.value=document.form1.neto.value;
  opener.form1.hdiva.value=document.form1.iva.value;
  opener.form1.hdtotal.value=document.form1.total.value;  
  opener.grabae();
  window.close();
 }
</script>
<link rel="stylesheet" href="styles.css">
<style type="text/css">
<!--
.Estilo1 {font-size: 14px}
-->
</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="">
            <div align="center"><span class="TableMiddleHead Estilo1">FINALIZACI&Oacute;N DE PEDIDO DE PROVEEDORES </span> </div>
            <table width="716" height="254" border="1">
              <tr>
                <td width="112"><span class="BoldText">NUMERO</span></td>
                <td width="88"><input name="numero" type="text" id="numero" value=<?php echo $numero ?> size="12" mxlength="12" disabled /></td>
                <td colspan="2">&nbsp;</td>
                <td width="112">&nbsp;</td>
                <td width="149"><span class="BoldText">SUB TOTAL </span></td>
                <td width="72"><input name="st" type="text" id="st" value="<?php echo $st ?>" size="12" maxlength="12"  disabled/></td>
                </tr>
              <tr>
                <td><span class="BoldText">DESC1</span></td>
                <td><input name="d1" type="text" id="d1" value="<?php echo $d1 ?>" size="5" maxlength="12" onkeydown="totaliza()"/>
                    <span class="BoldText">%</span></td>
                <td width="25"><div align="right" class="BoldText">
                    <div align="right">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$</div>
                </div></td>
                <td width="112"><input name="d1p" type="text" id="d1p" value="0" size="10" maxlength="12" disabled/></td>
                <td>&nbsp;</td>
                <td><span class="BoldText">SUB TOTAL1 </span></td>
                <td><input name="st1" type="text" id="st1" value="0" size="12" maxlength="12" disabled/></td>
                </tr>
              <tr>
                <td><span class="BoldText">DESC2</span></td>
                <td><input name="d2" type="text" id="d2" value="<?php echo $d2 ?>" size="5" maxlength="12" onkeydown="totaliza()" />
                    <span class="BoldText"> %</span></td>
                <td><div align="right" class="BoldText">
                    <div align="right">$</div>
                </div></td>
                <td><input name="d2p" type="text" id="d2p" value="0" size="10" maxlength="12" disabled/></td>
                <td>&nbsp;</td>
                <td><span class="BoldText">SUB TOTAL2</span></td>
                <td><input name="st2" type="text" id="st2" value="0" size="12" maxlength="12" disabled/></td>
                </tr>
              <tr>
                <td><span class="BoldText">DESC3</span></td>
                <td><input name="d3" type="text" id="d3" value="<?php echo $d3 ?>" size="5" maxlength="12"  onkeydown="totaliza()"/>
                    <span class="BoldText">%</span></td>
                <td><div align="right">$</div></td>
                <td><input name="d3p" type="text" id="d3p" value="0" size="10" maxlength="12" disabled/></td>
                <td>&nbsp;</td>
                <td><span class="BoldText">SUB TOTAL3</span></td>
                <td><input name="st3" type="text" id="st3" value="0" size="12" maxlength="12" disabled/></td>
                </tr>
              <tr>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td colspan="2">&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                <td>&nbsp;</td>
                </tr>
              <tr>
                <td><div align="right" class="BoldText">NETO</div></td>
                <td><input name="neto" type="text" disabled id="neto" value="<?php echo $neto ?>" size="12" maxlength="12" /></td>
                <td colspan="2"><div align="right" class="BoldText">IVA</div></td>
                <td><input name="iva" type="text" disabled id="iva" value="<?php echo $iva ?>" size="12" maxlength="12"/></td>
                <td><div align="right" class="BoldText">TOTAL</div></td>
                <td><input name="total" type="text" disabled id="total" value="<?php echo $total ?>" size="12" maxlength="12"/></td>
                </tr>
              <tr>
                <td><div align="center" class="BoldText">
                    <div align="right">OBSERVACIONES</div>
                </div></td>
                <td colspan="6"><div align="center">
                    <textarea name="obs" cols="80" rows="5" id="obs" value="<?php echo $obs ?>"></textarea>
                </div></td>
              </tr>
              <tr>
                <td>&nbsp;</td>
                <td colspan="3"><div align="center">
                  <input name="grabar" type="button" id="grabar" value="Grabar" onclick="graba()"/>
                </div></td>
                <td><div align="center">
                  <input name="cancelar" type="button" id="cancelar" value="Bot&oacute;n" />
                </div></td>
                <td colspan="2">&nbsp;</td>
                </tr>
            </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>