<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<?php
include("cls_conexion.php");$CNN=new ClsMySQL();include("conexion23.php");
require_once('cantidad_en_letras.php');
include("sunat_boleta_datos.php");
//
?>
<style type="text/css">
.t_basic{
	padding:0 0 0 0; border:0 0 0 0; border-collapse:collapse;border-spacing: 0px;
}
td{
	vertical-align:top;
}
tr{
	padding:0 0 0 0; border:0 0 0 0;
}
.td_det{
	border: 1px solid; padding-left:0.3rem;
}
.td_det_n{
	border: 1px solid; padding-left:0.3rem; padding-right:0.3rem; text-align:right
}
</style>
<title>BOLETA DE VENTA ELECTRONICA</title>
</head>
<body style="font-family:Tahoma, Geneva, sans-serif; font-size:12px">
<center>
<table width="100%" border="0" class="t_basic" style="max-width:950px">
<tr>
<td width="1%">&nbsp;</td>
<td width="98%">
    <table width="100%" border="0">
    <tr>
    <td width="50%" >
            <table width="100%" border="0" class="t_basic">
            <tr>
            <td style="font-weight:bold"><?php echo $EMP_NOM_COM;?></td>
            </tr>
            <tr>
            <td style="font-weight:bold"><?php echo $EMP_NOM;?></td>
            </tr>
            <tr>
            <td><?php echo $EMP_DIR;?></td>
            </tr>
            <tr>
            <td><?php echo $EMP_DIR_UBI;?></td>
            </tr>
            </table>
    </td>    
    <td width="50%">
    		<table width="100%" border="0" class="t_basic">
            <tr>
            <td style="font-weight:bold" align="center">BOLETA DE VENTA ELECTRONICA</td>
            </tr>
            <tr>
            <td style="font-weight:bold" align="center"><?php echo $EMP_RUC;?></td>
            </tr>
            <tr>
            <td style="font-weight:bold; font-size:16px" align="center"><?php echo $DOC_SER_NUM;?></td>
            </tr>
           
            </table>
    </td>
    </tr>
    </table>

</td>
<td width="1%">&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td></td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td><table width="100%" border="0">
    <tr>
      <td width="14%">FECHA<span style="color:#FFF">_</span>DE<span style="color:#FFF">_</span>EMISION</td>
      <td width="1%">:</td>
      <td width="85%" style="font-weight:bold"><?php echo $DOC_FEC;?></td>
    </tr>
    <tr>
      <td>SEÑOR(ES)</td>
      <td>:</td>
      <td style="font-weight:bold"><?php echo $CLI_NOM;?></td>
    </tr>
    <tr>
      <td><?php echo $CLI_TDI;?></td>
      <td>:</td>
      <td style="font-weight:bold"><?php echo $CLI_NDI;?></td>
    </tr>
    <tr>
      <td>TIPO DE MONEDA</td>
      <td>:</td>
      <td style="font-weight:bold">SOLES</td>
    </tr>
  </table></td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td></td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td>
            <table width="100%" border="3" style="border: 1px solid;border-collapse:collapse; ">
            <tr >
            <td width="10%" class="td_det"><b>CODIGO</b></td>
            <td width="39%" class="td_det"><b>DESCRIPCION</b></td>
            <td width="13%" class="td_det_n"><b>CANT</b></td>
            <td width="13%" class="td_det"><b>UNDIDAD</b></td>
            <td width="17%" class="td_det_n"><b>PRECIO</b></td>
            <td width="21%" class="td_det_n"><b>IMPORTE</b></td>
            </tr>
            <?php
			$s="SELECT * FROM vis_fes_ventas_det WHERE ID_VEN=$KOD ORDER BY CX";
			$rs=grs($s);			
			while($r=$rs->fetch_assoc()){
				$COD=$r['COD']."x".$r['PIE'];
				$DES=$r['DES'];
				$CAN=$r['CAN'];
				$PRE=$r['PRE'];
				$IMP=$r['IMP'];
			?>
            <tr >
            <td width="10%" class="td_det"><?php echo $COD;?></td>
            <td width="39%" class="td_det"><?php echo $DES;?></td>
            <td width="13%" class="td_det_n" align="right"><?php echo $CAN;?></td>
            <td width="13%" class="td_det" >CAJAS</td>
            <td width="17%" class="td_det_n" align="right"><?php echo NF2($PRE * $r['PIE'],3);?></td>
            <td width="21%" class="td_det_n" align="right"><?php echo NF2($IMP,3);?></td>
            <?php
			}
			?>
            </tr>
            </table>
  
  </td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td></td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td>
  
    <table width="100%" border="3" style="border: 1px solid;border-collapse:collapse; ">
    <tr >
    <td style="border: 1px solid;" align="right"><b>Sub total</b></td>
    <td width="21%" style="border: 1px solid;" align="right"><b>S/. <?php echo NF2($DOC_SUB,2)?></b></td>
    </tr>
    <tr >
    <td style="border: 1px solid;" align="right"><b>IGV</b></td>
    <td width="21%" style="border: 1px solid;" align="right"><b>S/. <?php echo NF2($DOC_IGV,2)?></b></td>
    </tr>
    <tr >
    <td style="border: 1px solid;" align="right"><b>Importe Total</b></td>
    <td width="21%" style="border: 1px solid;" align="right"><b>S/. <?php echo NF2($DOC_TOT,2)?></b></td>
    </tr>
    </table>


  </td>
  <td>&nbsp;</td>
</tr>

<tr>
  <td>&nbsp;</td>
  <td><b>SON: <?php echo CantidadEnLetra($DOC_TOT);?></b></td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td></td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td align="center"><img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=<?php echo $CODE_QR;?>" style="width:150px; height:150px" /></td>
  <td>&nbsp;</td>
</tr>
<tr>
  <td>&nbsp;</td>
  <td></td>
  <td>&nbsp;</td>
</tr>

</table>
</center>
</body>
</html>