<?php
 session_start(); 
 include ("emenux.php");
 require ("conecta.php");
$tipo=$_POST['tipo']; 
$numero=sprintf("%010d",$_POST['numero']); 
if ($tipo=="01"){$tipogl="Factura";}
if ($tipo=="02"){$tipogl="Boleta";}
if ($tipo=="03"){$tipogl="Guía";}
$llave=$tipo . $numero;
$sql="select * from m02005 where cod_tipo_d='$tipo' and numero='$numero';";
$res=mysql_query($sql,$con);
while ($fila=mysql_fetch_array($res)){
 $fecha=$fila[2];
 $rut=$fila[4];
 $nombre=$fila[5];  
 $stot=$fila[9];
 $desc=$fila[10];
 $neto=$fila[13];
 $iva=$fila[14];
 $total=$fila[15];
}
?>
<!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>Anulación de documentos</TITLE>
<script language="javascript" src="fstandar.js"></script>
<script language="javascript">
 function anula(tipo,numerof){
  window.open("anular.php?numero=" + numerof + "&tipo=" + tipo);
  //window.alert("anular.php?numero=" + numerof + "&tipo=" + tipo);
 }//fin anula
</script>
<link rel="stylesheet" href="styles.css">
<style type="text/css">
<!--
.Estilo9 {font-size: 12px}
.Estilo12 {font-size: 10px; font-weight: bold; }
.Estilo13 {font-size: 10px}
-->
</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 id="form1" name="form1" method="post" action="">
              <table width="688" height="42" border="1" cellspacing="0">
                <tr>
                  <td width="44" class="BoldText Estilo9"><strong>tipo</strong></td>
                  <td width="83" class="BoldText Estilo9"><?php echo $tipogl ?>&nbsp;</td>
                  <td width="57" class="BoldText Estilo9"><strong>rut</strong></td>
                  <td width="243" class="BoldText Estilo9"><b><?php echo $rut ?>&nbsp;</b></td>
                  <td width="72" class="BoldText Estilo9"><strong>fecha</strong></td>
                  <td width="163" class="BoldText Estilo9"><b><?php echo $fecha ?>&nbsp;</b></td>
                </tr>
                <tr>
                  <td class="BoldText Estilo9"><strong>N&uacute;mero</strong></td>
                  <td class="BoldText Estilo9"><b><?php echo $numero ?>&nbsp;</b></td>
                  <td class="BoldText Estilo9"><strong>Nombre</strong></td>
                  <td colspan="3" class="BoldText Estilo9"><b><?php echo $nombre ?>&nbsp;</b></td>
                </tr>
              </table>
              <br />
              <table width="688" border="1" cellspacing="0">
                <tr>
                  <td width="49"><span class="Estilo12">SubTotal</span></td>
                  <td width="68" align="right"> <span class="Estilo13"><?php echo number_format($stot,0,".",",") ?>&nbsp;</span></td>
                  <td width="49"><span class="Estilo12">(Des.)</span></td>
                  <td width="92"><div align="right"><span class="Estilo13"></span><span class="Estilo13"></span><span class="Estilo13">&nbsp;<?php echo number_format($desc,4,".",",") . "%" ?></span></div></td>
                  <td width="53"><span class="Estilo12">Neto</span></td>
                  <td width="113"><div align="right"><span class="Estilo13">&nbsp;<?php echo number_format($neto,0,".",",") ?></span></div></td>
                  <td width="29"><span class="BoldText Estilo13">Iva</span></td>
                  <td width="83"><div align="right"><span class="Estilo13">&nbsp;<?php echo number_format($iva,0,".",",") ?></span></div></td>
                  <td width="30"><span class="BoldText Estilo13">Total</span></td>
                  <td width="80"><div align="right"><span class="Estilo13">&nbsp;<?php echo number_format($total,0,".",",") ?></span></div></td>
                </tr>
              </table>
              <br />
              <table width="693" border="0">
                <tr>
                  <td width="151">&nbsp;</td>
                  <td width="186">
                    <div align="center">
                      <input name="anular" type="button" id="anular" value="Anular" onclick='<?PHP echo "anula(\"$tipo\",\"$numero\")" ?> ' />
                    </div></td>
                  <td width="174"><div align="center">
                    <input name="detalle" type="button" id="detalle" value="Ver Detalle" />
                  </div></td>
                  <td width="164">&nbsp;</td>
                </tr>
              </table>
              <p><br />
                  </p>
              <p>&nbsp;</p>
            </form>            <p class="Emphasize">&nbsp;</p></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>