<!DOCTYPE html>
<html lang="es-ES">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Boleto A&eacute;reo</title>
<link href="../../maincss.css" rel="stylesheet" type="text/css" />
<link href="../../printcss.css" rel="stylesheet" type="text/css" media="print" />

</head>
<?php
include "../../conn.php";
include "../../class.nroenletraver2.php";
include "../../general.php";
include "../../token.php";

//index.php?pkyTicket=2&user=Luigi&token=123456
$rep=$_GET["rep"];
$tipo=$_GET["tipo"];

$cod_boleto = $_GET["pkyTicket"];
//$mostrar_asiento_cc = $_GET["showCC"];
//$usuario = $_GET["user"];

//$n_decimales = 6;
?>
<body>

<?php

// Inicio impresion boleto

$result = mysqli_query($link, "select a.pkyTicket as cod_boleto, a.fldNumber as numero, a.fldDate as fecha, a.codSupplier as cod_prov, b.fldName as proveedor, a.fldName as nombre, a.fldNIT as nit, a.fldGrossTotal as total_bruto, a.fldExempt as excento, a.fldNetTotal as total_neto, a.fldTaxCredit as cred_fiscal, a.txtDescription as glosa, a.sysEnabled as enabled, a.sysAuthorized as authorized, g.fldName as usuario_reg, a.fldParentComponent as papa, a.cosComponentKey as cod_papa
from
txsTicket a, agnCompany b, accGroup g
where 
a.pkyTicket = '$cod_boleto' and 
a.codSupplier = b.pkyCompany and 
a.sysAuthorizationGroup = g.pkyGroup;");
	while ($row = mysqli_fetch_array($result)) {
		$cod_boleto = $row['cod_boleto'];
		$numero = $row['numero'];
		$fecha = $row['fecha'];
		$cod_prov = $row['cod_prov'];
		$proveedor = $row['proveedor'];
		$nombre = $row['nombre'];
		$nit = $row['nit'];
		$total_bruto = $row['total_bruto'];
		$excento = $row['excento'];
		$total_neto = $row['total_neto'];
		$cred_fiscal = $row['cred_fiscal'];
		$glosa = $row['glosa'];
		$glosa = nl2br($glosa);//quita salto de linea 
		$glosa = str_replace('\n','<br />',$glosa);//reemplaza para salto de linea
		$usuario_reg = $row['usuario_reg'];
		$enabled = $row['enabled'];
		$authorized = $row['authorized'];
		
		//para enlazar al que genero el asiento
		$papa_componente = $row['papa'];
		$papa_codigo = $row['cod_papa'];
		//$usuario = $usuario_det;
		include "../../generadopor.php";
	}
	mysqli_free_result($result);
	

	

?>
<table border="0" align="left" width="100%" cellpadding="5">
<tr><td><?php echo $mostrar_logo_reportes; ?>
</td><td align="right"><b>Fecha: <?php echo date("Y-m-d"); ?><br/>Hora: <?php echo date("H:i:s"); ?><br/>Usuario: <?php echo $usuario; ?></b>
</td></tr></table>
<p><br /><center><font color="#000099" size="+1"><b>Boleto A&eacute;reo</b></font></center></p>

<table border="1" align="center" cellpadding="2" width="80%">
    <TR> 
    <TD width="25%"><b>Cod. Reg.: </b><?php echo $cod_boleto; ?></TD>
    <TD width="25%"><b>Proveedor: </b><?php echo $proveedor; ?></TD>
    <TD width="50%" colspan="2"><b>Fecha: </b><?php echo $fecha; ?></TD>
    </TR>
    <TR>
    <TD><b>N&uacute;mero: </b><?php echo $numero; ?></TD>
    <TD><b>Nombre: </b><?php echo $nombre; ?></TD>
    <TD><b>NIT: </b><?php echo $nit; ?></TD>
    <TD><b>Generado Por: </b><?php echo $papa_enlace; ?></TD>
    </TR>
    <TR>
    <TD><b>Total Bruto: </b><?php echo number_format($total_bruto,$n_decimales); ?></TD>
    <TD><b>Total Neto: </b><?php echo number_format($total_neto,$n_decimales); ?></TD>
    <TD><b>Cr&eacute;dito Fiscal: </b><?php echo number_format($cred_fiscal,$n_decimales); ?></TD>
    <TD><b>Excento: </b><?php echo number_format($excento,$n_decimales); ?></TD>
    </TR>
    <TR>
    <TD colspan="4"><b>Glosa: </b><?php echo $glosa; ?></TD>
    </tr>
</table>

<br />
<?php
    if($enabled == 0){
				printf("<table border='0' align='center' cellpadding='2' width='600'><tr><td align='center'><font color='#FF0000' size='+1'>REGISTRO ANULADO</font></td></tr></table>");
			}
	if($authorized == 0){
				printf("<table border='0' align='center' cellpadding='2' width='600'><tr><td align='center'><font color='#FF0000' size='+1'>REGISTRO PENDIENTE DE AUTORIZACI&Oacute;N</font></td></tr></table>");
			}

?>

<br /><br /><br /><br /><br />
<table border="0" align="center" cellpadding="2" width="90%">
<tr>
<td align="center">----------------------------------------</td>
<td align="center">----------------------------------------</td>
<td align="center">----------------------------------------</td>
<td align="center">----------------------------------------</td>
</tr><tr>
<td align="center">Elaborado por: <?php echo $usuario_reg; ?></td>
<td align="center"><?php echo $firma_contabilidad; ?></td>
<td align="center"><?php echo $firma_gerencia; ?></td>
<td align="center"><?php echo $firma_interesado; ?></td>
</tr><tr>
<td align="left">Nombre:__________________________</td>
<td align="left">Nombre:__________________________</td>
<td align="left">Nombre:__________________________</td>
<td align="left">Nombre:__________________________</td>
</tr><tr>
<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C.I.:__________________________</td>
<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C.I.:__________________________</td>
<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C.I.:__________________________</td>
<td align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C.I.:__________________________</td>
</tr>
</table>

<?php


?>
</body>
</html>
