Advertisement
Guest User

Untitled

a guest
Aug 29th, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 28.62 KB | None | 0 0
  1. <?php
  2. include "QRCodeGenerator.class.php";
  3. require 'app/core/Url.php';
  4. require 'app/core/Redirect.php';
  5. require realpath(__DIR__) . '/../../../../vendor/autoload.php';
  6.  
  7. function product_name($name) {
  8.     return character_limiter($name, (isset($Settings->char_per_line) ? ($Settings->char_per_line - 8) : 35));
  9. }
  10.  
  11. $fetchProduct = Func::array_table("tec_sales", array("id" => $this->data['sid']));
  12. $fetchPurchase = Func::array_table("tec_reports_nfe", array("purchase" => $this->data['sid']));
  13. if (is_array($fetchPurchase)) {
  14.     $path = $fetchPurchase["tpAmb"] > 1 ? "homologacao" : "producao";
  15.     $base = BASE_URL . "/vendor/nfephp-org/nfephp/schemes/NFe/{$path}/pdf/{$fetchPurchase["pdf"]}";
  16.     echo <<<EOF
  17. <object id="exPDF" type="application/pdf" data="{$base}" width="100%" height="100%"/>
  18. <script src="{$assets}plugins/jQuery/jQuery-2.1.4.min.js" type="text/javascript"></script>
  19. <script type="text/javascript">
  20.     $(document).ready(function () {
  21.         $(window).load(function () {
  22.             window.print();
  23.         });
  24.      });
  25. </script>                    
  26. EOF;
  27.     die();
  28. }
  29. if (!is_array($fetchProduct)) {
  30.     Redirect::home();
  31. }
  32. if ($modal) {
  33.     echo '<div class="modal-dialog no-modal-header"><div class="modal-content"><div class="modal-body"><button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-2x">&times;</i></button>';
  34. } else {
  35.     ?>
  36.     <!doctype html>
  37.     <html>
  38.         <head>
  39.             <meta charset="utf-8">
  40.             <title><?= $page_title . " " . lang("no") . " " . $inv->id; ?></title>
  41.             <base href="<?= base_url() ?>"/>
  42.             <meta http-equiv="cache-control" content="max-age=0"/>
  43.             <meta http-equiv="cache-control" content="no-cache"/>
  44.             <meta http-equiv="expires" content="0"/>
  45.             <meta http-equiv="pragma" content="no-cache"/>
  46.             <link rel="shortcut icon" href="<?= $assets ?>images/icon.png"/>
  47.             <link href="<?= $assets ?>bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
  48.             <style type="text/css" media="all">
  49.                 body { color: #000; }
  50.                 #wrapper { max-width: 480px; margin: 0 auto; padding-top: 20px; }
  51.                 .btn { border-radius: 0; margin-bottom: 5px; }
  52.                 .table { border-radius: 3px; }
  53.                 .table th { background: #f5f5f5; }
  54.                 .table th, .table td { vertical-align: middle !important; }
  55.                 h3 { margin: 5px 0; }
  56.  
  57.                 @media print {
  58.                     .no-print { display: none; }
  59.                     #wrapper { max-width: 480px; width: 100%; min-width: 250px; margin: 0 auto; }
  60.                 }
  61.             </style>
  62.         </head>
  63.  
  64.         <body>
  65.  
  66.         <?php } ?>
  67.         <div id="wrapper">
  68.             <div id="receiptData">
  69.                 <div class="no-print">
  70.                     <?php if ($message) { ?>
  71.                         <div class="alert alert-success">
  72.                             <button data-dismiss="alert" class="close" type="button">×</button>
  73.                             <?= is_array($message) ? print_r($message, true) : $message; ?>
  74.                         </div>
  75.                     <?php } ?>
  76.                 </div>
  77.                 <div id="receipt-data">
  78.                     <div class="text-center">
  79.                         <?= $Settings->header; ?>
  80.                         <p>
  81.                             <?= lang('sale') . ' ' . lang('no') . ': ' . $inv->id; ?><br>
  82.                             <?= lang("customer") . ': ' . $inv->customer_name; ?> <br>
  83.                             <?= lang("date") . ': ' . $this->tec->hrld($inv->date); ?> <br>
  84.                         </p>
  85.                         <div style="clear:both;"></div>
  86.                         <table class="table table-striped table-condensed">
  87.                             <thead>
  88.                                 <tr>
  89.                                     <th class="text-center col-xs-6"><?= lang('description'); ?></th>
  90.                                     <th class="text-center col-xs-1"><?= lang('quantity'); ?></th>
  91.                                     <th class="text-center col-xs-2"><?= lang('price'); ?></th>
  92.                                     <th class="text-center col-xs-3"><?= lang('subtotal'); ?></th>
  93.                                 </tr>
  94.                             </thead>
  95.                             <tbody>
  96.                                 <?php
  97.                                 $tax_summary = array();
  98.                                 foreach ($rows as $row) {
  99.                                     echo '<tr><td class="text-left">' . product_name($row->product_name) . '</td>';
  100.                                     echo '<td class="text-center">' . $this->tec->formatNumber($row->quantity) . '</td>';
  101.                                     echo '<td class="text-right">';
  102.  
  103.                                     if ($inv->total_discount != 0) {
  104.                                         $price_with_discount = $this->tec->formatMoney($row->net_unit_price + $this->tec->formatDecimal($row->item_discount / $row->quantity));
  105.                                         $pr_tax = $row->tax_method ?
  106.                                                 $this->tec->formatDecimal((($price_with_discount) * $row->tax) / 100) :
  107.                                                 $this->tec->formatDecimal((($price_with_discount) * $row->tax) / (100 + $row->tax));
  108.                                         echo '<del>' . $this->tec->formatMoney($price_with_discount + $pr_tax) . '</del> ';
  109.                                     }
  110.  
  111.                                     echo $this->tec->formatMoney($row->net_unit_price + ($row->item_tax / $row->quantity)) . '</td><td class="text-right">' . $this->tec->formatMoney($row->subtotal) . '</td></tr>';
  112.                                 }
  113.                                 ?>
  114.                             </tbody>
  115.                             <tfoot>
  116.                                 <tr>
  117.                                     <th colspan="2"><?= lang("total"); ?></th>
  118.                                     <th colspan="2" class="text-right"><?= $this->tec->formatMoney($inv->total + $inv->product_tax); ?></th>
  119.                                 </tr>
  120.                                 <?php
  121.                                 if ($inv->order_tax != 0) {
  122.                                     echo '<tr><th colspan="2">' . lang("order_tax") . '</th><th colspan="2" class="text-right">' . $this->tec->formatMoney($inv->order_tax) . '</th></tr>';
  123.                                 }
  124.                                 if ($inv->total_discount != 0) {
  125.                                     echo '<tr><th colspan="2">' . lang("order_discount") . '</th><th colspan="2" class="text-right">' . $this->tec->formatMoney($inv->total_discount) . '</th></tr>';
  126.                                 }
  127.  
  128.                                 if ($Settings->rounding) {
  129.                                     $round_total = $this->tec->roundNumber($inv->grand_total, $Settings->rounding);
  130.                                     $rounding = $this->tec->formatMoney($round_total - $inv->grand_total);
  131.                                     ?>
  132.                                     <tr>
  133.                                         <th colspan="2"><?= lang("rounding"); ?></th>
  134.                                         <th colspan="2" class="text-right"><?= $rounding; ?></th>
  135.                                     </tr>
  136.                                     <tr>
  137.                                         <th colspan="2"><?= lang("grand_total"); ?></th>
  138.                                         <th colspan="2" class="text-right"><?= $this->tec->formatMoney($inv->grand_total + $rounding); ?></th>
  139.                                     </tr>
  140.                                     <?php
  141.                                 } else {
  142.                                     $round_total = $inv->grand_total;
  143.                                     ?>
  144.                                     <tr>
  145.                                         <th colspan="2"><?= lang("grand_total"); ?></th>
  146.                                         <th colspan="2" class="text-right"><?= $this->tec->formatMoney($inv->grand_total); ?></th>
  147.                                     </tr>
  148.                                     <?php
  149.                                 }
  150.                                 if ($inv->paid < $round_total) {
  151.                                     ?>
  152.                                     <tr>
  153.                                         <th colspan="2"><?= lang("paid_amount"); ?></th>
  154.                                         <th colspan="2" class="text-right"><?= $this->tec->formatMoney($inv->paid); ?></th>
  155.                                     </tr>
  156.                                     <tr>
  157.                                         <th colspan="2"><?= lang("due_amount"); ?></th>
  158.                                         <th colspan="2" class="text-right"><?= $this->tec->formatMoney($inv->grand_total - $inv->paid); ?></th>
  159.                                     </tr>
  160.                                 <?php } ?>
  161.                             </tfoot>
  162.                         </table>
  163.                         <?php
  164.                         #if ($payments) {
  165.                        echo '<table class="table table-striped table-condensed"><tbody>';
  166.                         $paid_by = lang("paid_by");
  167.                         $languageAmount = lang('amount');
  168.                         $languageChannge = lang('change');
  169.                         # $TotalAmount = Func::FloatToReal($payment->pos_paid);
  170.                        #foreach ($payments as $payment) {
  171.                        $xchange = Func::FloatToReal($fetchProduct["change"]);
  172.                         $value = Func::FloatToReal($fetchProduct["paid"] + $fetchProduct["change"]);
  173.                         echo '<tr>';
  174.                         switch ($fetchProduct["paid_by"]) {
  175.                             case 'CC':
  176.                                 echo <<<EOF
  177. Cartão de Crédito - {$inv->pcc_type}
  178. Cartão de Crédito No : {$inv->cc_no}
  179. Títular : {$inv->cc_holder}</td>
  180. <td>{$languageAmount} : R$ {$value}</td>
  181. <td>{$languageChannge} : R$ {$xchange} </td>
  182. EOF;
  183.                                 break;
  184.                             case 'Cheque':
  185.                                 echo <<<EOF
  186. <td>{$paid_by} : Cheque </td>
  187. <td>Cheque No : {$inv->cheque_no}</td>
  188. <td>{$languageAmount} : R$ {$value}</td>
  189. <td>{$languageChannge} : R$ {$xchange} </td>
  190. EOF;
  191.                                 break;
  192.                             case'gift_card':
  193.                                 echo <<<EOF
  194. <td>{$paid_by} : Cartão da Loja</td>
  195. <td>Cartão da Loja No : {$inv->gift_card}</td>
  196. <td>{$languageAmount} : R$ {$value}</td>
  197. <td>{$languageChannge} : R$ {$xchange} </td>
  198. EOF;
  199.                                 break;
  200.                             case 'stripe':
  201.                                 echo <<<EOF
  202. <td>Cartão de Débito - {$inv->pcc_type} </td>
  203. <td>Cartão de Débido No : {$inv->cc_no} </td>
  204. <td>Títular : {$inv->cc_holder} </td>
  205. <td>{$languageAmount} : R$ {$value}</td>
  206. <td>{$languageChannge} : R$ {$xchange} </td>
  207. EOF;
  208.                                 break;
  209.                             default:
  210.                                 echo <<<EOF
  211. <td>{$paid_by} : Dinheiro</td>
  212. <td>{$languageAmount} : R$ {$value}</td>
  213. <td>{$languageChannge} : R$ {$xchange} </td>
  214. EOF;
  215.                                 break;
  216.                                 #}
  217.                                echo '</tr>';
  218.                         }
  219.                         $mesa = Func::array_table("tec_mesas", array("id" => $inv->mesa), "name");
  220.                         echo '</tbody></table>';
  221.                         echo!empty($inv->senha) ? "<p><h3>Senha : <strong><h3>{$inv->senha}</strong> </p></h3>" : "";
  222.                         echo!empty($inv->mesa) ? "<p><h3>Mesa : <strong>{$mesa}</strong> </p></h3>" : "";
  223.                         $ex1 = new QRCodeGenerator('http://www.nfe.fazenda.gov.br/portal/consulta.aspx?tipoConsulta=completa&tipoConteudo=XbSeqxE8pl8=MobLanche_PDVPARATODOS.COM.BR');
  224.                         echo "<img src=" . $ex1->generate() . ">";
  225.                         # }
  226.                        ?>
  227.  
  228.  
  229.                         <?= $inv->note ? '<p class="text-center">' . $this->tec->decode_html($inv->note) . '</p>' : ''; ?>
  230.                         <div class="well well-sm">
  231.                             <?= $Settings->footer; ?>
  232.                         </div>
  233.                     </div>
  234.                     <div style="clear:both;"></div>
  235.                 </div>
  236.                 <?php
  237.                 if ($modal) {
  238.                     echo '</div></div></div></div>';
  239.                 } else {
  240.                     ?>
  241.                     <div id="buttons" style="padding-top:10px; text-transform:uppercase;" class="no-print">
  242.                         <hr>
  243.                         <?php if ($message) { ?>
  244.                             <div class="alert alert-success">
  245.                                 <button data-dismiss="alert" class="close" type="button">×</button>
  246.                                 <?= is_array($message) ? print_r($message, true) : $message; ?>
  247.                             </div>
  248.                         <?php } ?>
  249.  
  250.                         <?php if ($Settings->java_applet) { ?>
  251.                             <span class="col-xs-12"><a class="btn btn-block btn-primary" onClick="printReceipt()"><?= lang("print"); ?></a></span>
  252.                             <span class="col-xs-12"><a class="btn btn-block btn-info" type="button" onClick="openCashDrawer()"><?= lang('open_cash_drawer'); ?></a></span>
  253.                             <div style="clear:both;"></div>
  254.                         <?php } else { ?>
  255.                             <span class="pull-right col-xs-12">
  256.                                 <a href="javascript:window.print()" id="web_print" class="btn btn-block btn-primary"
  257.                                    onClick="window.print();return false;"><?= lang("web_print"); ?></a>
  258.                             </span>
  259.                         <?php } ?>
  260.                         <!---->
  261.  
  262.                         <span class="pull-left col-xs-12"><a class="btn btn-block btn-success" href="#" id="email"><?= lang("email"); ?></a></span>
  263.                         <?php if (is_array($fetchPurchase)): ?>
  264.                             <span class="pull-left col-xs-12"><a class="btn btn-block btn-primary" href="<?php echo BASE_URL . "/vendor/nfephp-org/nfephp/schemes/NFe/homologacao/pdf/{$fetchPurchase["pdf"]}" ?>" target="_blank">PDF Nfe</a></span>
  265.                         <?php endif; ?>
  266.                         <span class="col-xs-12">
  267.                             <a class="btn btn-block btn-warning" href="<?= site_url('pos'); ?>"><?= lang("back_to_pos"); ?></a>
  268.                         </span>
  269.                         <?php if (!$Settings->java_applet) { ?>
  270.                             <div style="clear:both;"></div>
  271.                             <div class="col-xs-12" style="background:#F5F5F5; padding:10px;">
  272.                                 <font size="-2">
  273.                                 <p style="font-weight:bold;">Favor alterar as configurações de impressão de seu browser</p>
  274.                                 <p style="text-transform: capitalize;"><strong>FireFox:</strong> Arquivo &gt; Configurar impressora &gt; Margem &amp;Cabeçalho/Rodapé --Nenhum--</p>
  275.                                 <p style="text-transform: capitalize;"><strong>Chrome:</strong> Menu &gt; Impressora &gt; Disabilitar Cabeçalho/Rodapé Opções &amp; Setar margem em branco</p></div>
  276.                             <font>
  277.                         <?php } ?>
  278.                         <div style="clear:both;"></div>
  279.  
  280.                     </div>
  281.  
  282.                 </div>
  283.                 <canvas id="hidden_screenshot" style="display:none;">
  284.  
  285.                 </canvas>
  286.                 <div class="canvas_con" style="display:none;"></div>
  287.                 <script src="<?= $assets ?>plugins/jQuery/jQuery-2.1.4.min.js" type="text/javascript"></script>
  288.                 <?php
  289.                 if ($Settings->java_applet) {
  290.  
  291.                     function drawLine($Settings) {
  292.                         $size = $Settings->char_per_line;
  293.                         $new = '';
  294.                         for ($i = 1; $i < $size; $i++) {
  295.                             $new .= '-';
  296.                         }
  297.                         $new .= ' ';
  298.                         return $new;
  299.                     }
  300.  
  301.                     function printLine($str, $Settings, $sep = ":", $space = NULL) {
  302.                         $size = $space ? $space : $Settings->char_per_line;
  303.                         $lenght = strlen($str);
  304.                         list($first, $second) = explode(":", $str, 2);
  305.                         $new = $first . ($sep == ":" ? $sep : '');
  306.                         for ($i = 1; $i < ($size - $lenght); $i++) {
  307.                             $new .= ' ';
  308.                         }
  309.                         $new .= ($sep != ":" ? $sep : '') . $second;
  310.                         return $new;
  311.                     }
  312.  
  313.                     function printText($text, $Settings) {
  314.                         $size = $Settings->char_per_line;
  315.                         $new = wordwrap($text, $size, "\\n");
  316.                         return $new;
  317.                     }
  318.  
  319.                     function taxLine($name, $code, $qty, $amt, $tax) {
  320.                         return printLine(printLine(printLine(printLine($name . ':' . $code, '', 18) . ':' . $qty, '', 25) . ':' . $amt, '', 35) . ':' . $tax, ' ');
  321.                     }
  322.                     ?>
  323.  
  324.                     <script type="text/javascript" src="<?= $assets ?>plugins/qz/js/deployJava.js"></script>
  325.                     <script type="text/javascript" src="<?= $assets ?>plugins/qz/qz-functions.js"></script>
  326.                     <script type="text/javascript">
  327.                                        deployQZ('themes/<?= $Settings->theme ?>/assets/plugins/qz/qz-print.jar', '<?= $assets ?>plugins/qz/qz-print_jnlp.jnlp');
  328.                                        usePrinter("<?= $Settings->receipt_printer; ?>");
  329.         <?php /* $image = $this->tec->save_barcode($inv->reference_no); */ ?>
  330.                                        function printReceipt() {
  331.                                            //var barcode = 'data:image/png;base64,<?php /* echo $image; */ ?>';
  332.                                            receipt = "";
  333.                                            receipt += chr(27) + chr(69) + "\r" + chr(27) + "\x61" + "\x31\r";
  334.                                            receipt += "<?= printText(strip_tags(preg_replace('/\s+/', ' ', $Settings->header)), $Settings); ?>" + "\n";
  335.                                            receipt += " \x1B\x45\x0A\r ";
  336.                                            receipt += "<?= drawLine($Settings); ?>\r\n";
  337.                                            //receipt += "<?php // if($Settings->invoice_view == 1) { echo lang('tax_invoice'); }                                          ?>\r\n";
  338.                                            //receipt += "<?php // if($Settings->invoice_view == 1) { echo drawLine(); }                                          ?>\r\n";
  339.                                            receipt += "\x1B\x61\x30";
  340.                                            receipt += "<?= printLine(lang("sale_no") . ": " . $inv->id, $Settings) ?>" + "\n";
  341.                                            receipt += "<?= printLine(lang("sales_person") . ": " . $created_by->first_name . " " . $created_by->last_name, $Settings); ?>" + "\n";
  342.                                            receipt += "<?= printLine(lang("customer") . ": " . $inv->customer_name, $Settings); ?>" + "\n";
  343.                                            receipt += "<?= printLine(lang("date") . ": " . $this->tec->hrld($inv->date), $Settings); ?>" + "\n\n";
  344.                                            receipt += "<?php
  345.         $r = 1;
  346.         foreach ($rows as $row):
  347.             ?>";
  348.                                                receipt += "<?= "#" . $r . " "; ?>";
  349.                                                receipt += "<?= product_name(addslashes($row->product_name)); ?>" + "\n";
  350.                                                receipt += "<?= printLine($this->tec->formatNumber($row->quantity) . "x" . $this->tec->formatMoney($row->net_unit_price + ($row->item_tax / $row->quantity)) . ":  " . $this->tec->formatMoney($row->subtotal), $Settings, ' ') . ""; ?>" + "\n";
  351.                                                receipt += "<?php
  352.             $r++;
  353.         endforeach;
  354.         ?>";
  355.                                            receipt += "\x1B\x61\x31";
  356.                                            receipt += "<?= drawLine($Settings); ?>\r\n";
  357.                                            receipt += "\x1B\x61\x30";
  358.                                            receipt += "<?= printLine(lang("total") . ": " . $this->tec->formatMoney($inv->total + $inv->product_tax), $Settings); ?>" + "\n";
  359.         <?php if ($inv->order_tax != 0) { ?>
  360.                                                receipt += "<?= printLine(lang("tax") . ": " . $this->tec->formatMoney($inv->order_tax), $Settings); ?>" + "\n";
  361.         <?php } ?>
  362.         <?php if ($inv->total_discount != 0) { ?>
  363.                                                receipt += "<?= printLine(lang("discount") . ": " . $this->tec->formatMoney($inv->total_discount), $Settings); ?>" + "\n";
  364.         <?php } ?>
  365.         <?php if ($Settings->rounding) { ?>
  366.                                                receipt += "<?= printLine(lang("rounding") . ": " . $rounding, $Settings); ?>" + "\n";
  367.                                                receipt += "<?= printLine(lang("grand_total") . ": " . $this->tec->formatMoney($inv->grand_total + $rounding), $Settings); ?>" + "\n";
  368.         <?php } else { ?>
  369.                                                receipt += "<?= printLine(lang("grand_total") . ": " . $this->tec->formatMoney($inv->grand_total), $Settings); ?>" + "\n";
  370.         <?php } ?>
  371.         <?php if ($inv->paid < $inv->grand_total) { ?>
  372.                                                receipt += "<?= printLine(lang("paid_amount") . ": " . $this->tec->formatMoney($inv->paid), $Settings); ?>" + "\n";
  373.                                                receipt += "<?= printLine(lang("due_amount") . ": " . $this->tec->formatMoney($inv->grand_total - $inv->paid), $Settings); ?>" + "\n\n";
  374.         <?php } ?>
  375.         <?php
  376.         if ($payments) {
  377.             foreach ($payments as $payment) {
  378.                 if ($payment->paid_by == 'cash' && $payment->pos_paid) {
  379.                     ?>
  380.                                                        receipt += "<?= printLine(lang("paid_by") . ": " . lang($payment->paid_by), $Settings); ?>" + "\n";
  381.                                                        receipt += "<?= printLine(lang("amount") . ": " . $this->tec->formatMoney($payment->pos_paid), $Settings); ?>" + "\n";
  382.                                                        receipt += "<?= printLine(lang("change") . ": " . ($payment->pos_balance > 0 ? $this->tec->formatMoney($payment->pos_balance) : 0), $Settings); ?>" + "\n";
  383.                 <?php } if (($payment->paid_by == 'CC' || $payment->paid_by == 'ppp' || $payment->paid_by == 'stripe') && $payment->cc_no) { ?>
  384.                                                        receipt += "<?= printLine(lang("paid_by") . ": " . lang($payment->paid_by), $Settings); ?>" + "\n";
  385.                                                        receipt += "<?= printLine(lang("amount") . ": " . $this->tec->formatMoney($payment->pos_paid), $Settings); ?>" + "\n";
  386.                                                        receipt += "<?= printLine(lang("card_no") . ": xxxx xxxx xxxx " . substr($payment->cc_no, -4), $Settings); ?>" + "\n";
  387.                 <?php } if ($payment->paid_by == 'gift_card') { ?>
  388.                                                        receipt += "<?= printLine(lang("paid_by") . ": " . lang($payment->paid_by), $Settings); ?>" + "\n";
  389.                                                        receipt += "<?= printLine(lang("amount") . ": " . $this->tec->formatMoney($payment->pos_paid), $Settings); ?>" + "\n";
  390.                                                        receipt += "<?= printLine(lang("card_no") . ": " . $payment->gc_no, $Settings); ?>" + "\n";
  391.                 <?php } if ($payment->paid_by == 'Cheque' && $payment->cheque_no) { ?>
  392.                                                        receipt += "<?= printLine(lang("paid_by") . ": " . lang($payment->paid_by), $Settings); ?>" + "\n";
  393.                                                        receipt += "<?= printLine(lang("amount") . ": " . $this->tec->formatMoney($payment->pos_paid), $Settings); ?>" + "\n";
  394.                                                        receipt += "<?= printLine(lang("cheque_no") . ": " . $payment->cheque_no, $Settings); ?>" + "\n";
  395.                     <?php if ($payment->paid_by == 'other' && $payment->amount) { ?>
  396.                                                            receipt += "<?= printLine(lang("paid_by") . ": " . lang($payment->paid_by), $Settings); ?>" + "\n";
  397.                                                            receipt += "<?= printLine(lang("amount") . ": " . $this->tec->formatMoney($payment->amount), $Settings); ?>" + "\n";
  398.                                                            receipt += "<?= printText(lang("payment_note") . ": " . $payment->note, $Settings); ?>" + "\n";
  399.                         <?php
  400.                     }
  401.                 }
  402.             }
  403.         }
  404.  
  405.         /* if($Settings->invoice_view == 1) {
  406.           if(!empty($tax_summary)) {
  407.           ?>
  408.           receipt += "\n" + "<?= lang('tax_summary'); ?>" + "\n";
  409.           receipt += "<?= taxLine(lang('name'),lang('code'),lang('qty'),lang('tax_excl'),lang('tax_amt')); ?>" + "\n";
  410.           receipt += "<?php foreach ($tax_summary as $summary): ?>";
  411.           receipt += "<?= taxLine($summary['name'],$summary['code'],$this->tec->formatNumber($summary['items']),$this->tec->formatMoney($summary['amt']),$this->tec->formatMoney($summary['tax'])); ?>" + "\n";
  412.           receipt += "<?php endforeach; ?>";
  413.           receipt += "<?= printLine(lang("total_tax_amount") . ":" . $this->tec->formatMoney($inv->product_tax)); ?>" + "\n";
  414.           <?php
  415.           }
  416.           } */
  417.         ?>
  418.                                            receipt += "\x1B\x61\x31";
  419.         <?php if ($inv->note) { ?>
  420.                                                receipt += "<?= printText(strip_tags(preg_replace('/\s+/', ' ', $this->tec->decode_html($inv->note))), $Settings); ?>" + "\n";
  421.         <?php } ?>
  422.                                            receipt += "<?= printText(strip_tags(preg_replace('/\s+/', ' ', $Settings->footer)), $Settings); ?>" + "\n";
  423.                                            receipt += "\x1B\x61\x30";
  424.         <?php if (isset($Settings->cash_drawer_cose)) { ?>
  425.                                                print(receipt, '', '<?= $Settings->cash_drawer_cose; ?>');
  426.         <?php } else { ?>
  427.                                                print(receipt, '', '');
  428.         <?php } ?>
  429.  
  430.                                        }
  431.  
  432.                     </script>
  433.                 <?php } ?>
  434.                 <script type="text/javascript">
  435.                     $(document).ready(function () {
  436.                         $('#email').click(function () {
  437.                             var email = prompt("<?= lang("email_address"); ?>", "<?= $customer->email; ?>");
  438.                             if (email != null) {
  439.                                 $.ajax({
  440.                                     type: "post",
  441.                                     url: "<?= site_url('pos/email_receipt') ?>",
  442.                                     data: {<?= $this->security->get_csrf_token_name(); ?>: "<?= $this->security->get_csrf_hash(); ?>", email: email, id: <?= $inv->id; ?>},
  443.                                     dataType: "json",
  444.                                     success: function (data) {
  445.                                         alert(data.msg);
  446.                                     },
  447.                                     error: function () {
  448.                                         alert('<?= lang('ajax_request_failed'); ?>');
  449.                                         return false;
  450.                                     }
  451.                                 });
  452.                             }
  453.                             return false;
  454.                         });
  455.                     });
  456.     <?php if (!$Settings->java_applet && !$noprint) { ?>
  457.                         $(window).load(function () {
  458.                             window.print();
  459.                         });
  460.     <?php } ?>
  461.                 </script>
  462.         </body>
  463.     </html>
  464. <?php } ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement