<?php 
    $controller = 'POS';
    $action = 'print';
    include $_SERVER["DOCUMENT_ROOT"].'/app/include/bootstrap.php';?>
<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no">
    <link href="<?php echo ROOT_HOST?>/public/bootstrap/css/bootstrap.min.css" rel="stylesheet">     
</head><?php
/* INFORMACION EMPRESA */
#Cuando envio impresion desde boton en listado AperturaCierreCaja.php utilizando javascript printOpening();
$empresa = new EmpresaEntity();
$empresa->setOptions($empresa->getById(1)); 

$nombreEmpresa  = $empresa->getNombre();
$direccion      = $empresa->getDireccion();
$ciudadEstadoZC = $empresa->getCiudad().', '.$empresa->getEstado().' '.$empresa->getCodigoPostal();
$telefono       = $empresa->getTelefono();  

/* INFORMACION APERTURA DE CAJA */
$operacionesTarjeta = new OperacionesTarjetasRepository();
$dataCharge = $operacionesTarjeta->getDataPayment($_GET['reference']);

$charge = $dataCharge['data'];
?>
<div id="printArea">
    <div style="margin:auto;text-align: center;font-size: 10px;font-family: Arial,Helvetica Neue,Helvetica,sans-serif">
        <div style="margin: 30px;margin-bottom: 10px">
            <img src="../../public/img/logo_login.png" width="50%">
        </div>
        <div style="text-align: center">
            <h4><?php echo $nombreEmpresa;?></h4>
            <p class="m-a-0"><?php echo $direccion; ?></p>
            <p class="m-a-0"><?php echo $ciudadEstadoZC; ?></p>
            <p class="m-a-0"><?php echo $telefono;?></p>
        </div> 
        <div class="m-t-1">    
            <h4 class="m-a-0 text-center w-100">* * * * <?php echo $_translator->_getTranslation('Recibo')?> * * * *</h4>           
        </div>   
        <style>.table > tbody > tr > td, .table > tbody > tr > th, .table > tfoot > tr > td, .table > tfoot > tr > th, .table > thead > tr > td, .table > thead > tr > th{padding:2px; font-size: 12px}</style>
        <table class="m-t-1 table table-condensed tableTicket">
        <thead>
            <tr>
                <th style="width:20%;text-align: center"><?php echo $_translator->_getTranslation('Monto pagado')?></th>
                <th style="width:40%;text-align: center"><?php echo $_translator->_getTranslation('Fecha')?></th>
                <th style="width:40%;text-align: center"><?php echo $_translator->_getTranslation('Metodo de pago')?></th>
            </tr>
            <tr>
                <td style="widtd:20%;text-align: center">$<?php echo number_format($charge['amount'],2)?></td>
                <td style="widtd:40%;text-align: center"><?php echo $charge['date_formated'];?></td>
                <td style="widtd:40%;text-align: center"><?php echo $charge['brand'].' - '.$charge['last_4']?></td>
            </tr>
        </thead>
        <tbody>
            <tr>
                <td colspan='3' style="text-align:left;height:50px;vertical-align: middle"><?php echo $_translator->_getTranslation('Resumen'); ?></td>
            </tr>
            <tr>
                <td style="text-align: left" colspan="2"><?php echo $_translator->_getTranslation('Monto pagado')?></td>
                <td style="text-align: right">$<?php echo number_format($charge['amount'],2)?></td>
            </tr>
            <tr>
                <td colspan='3' style="text-align:left;height:60px;vertical-align: middle">You're receiving this receipt because you made a purchase at <?php echo $nombreEmpresa ?>, which partners with Stripe to provide invoicing and payments processing.</td>
            </tr>
        </tbody>
        </table>
    </div>
</div>
    <script type="text/javascript">
        self.print();
    </script>
</body>
</html>
