<!-- Page Content -->
<div class="page-content">

    <!-- Page Header -->
    <div class="page-header position-relative">
        <div class="header-title">
            <h1>
                Receipt Details
            </h1>
        </div>
        <!--Header Buttons-->
        <div class="header-buttons">
            <a class="sidebar-toggler" href="#">
                <i class="fa fa-arrows-h"></i>
            </a>
            <a class="refresh" id="refresh-toggler" href="">
                <i class="glyphicon glyphicon-refresh"></i>
            </a>
            <a class="fullscreen" id="fullscreen-toggler" href="#">
                <i class="glyphicon glyphicon-fullscreen"></i>
            </a>
        </div>
        <!--Header Buttons End-->
    </div>
    <!-- /Page Header -->
    <!-- Page Body -->
    <div class="page-body">
        <div class="row">
            <div class="col-xs-12 col-md-5">
                <div class="widget">           
                    <div class="widget-body">
                        <table border="0" width="30%" cellpadding="0" cellspacing="0" style="margin:0 auto;">
                            <tr valign="top">
                                <td align="center">
            <!--    <img src="<?= base_url() ?>assets/img/shared/printlogo.jpg" alt="Logo"/>-->
                                    <?php
                                    if($company_det->DISPLAYLOGO) {
                                    ?>
                                    <img src="<?php echo $company_det->DISPLAYLOGO; ?>" alt="Logo" style="width: 200px;"/>
                                    <?php
                                    } else {
                                    ?>
                                        <h1 style="font-weight: bold !important;"><?php echo $company_det->COMPANYNAME; ?></h1>
                                    <?php
                                    }
                                    ?>
                                    <?php
                                    echo "<table id='receipt' style='width: 100%;'>";
                                    echo "<tbody>";
                                    
                                    if(isset($receipt)){
                                        if($receipt) {
                                            if ($receipt[0]->TICKETTYPE == 0) {
                                                echo "<tr><td align='left' colspan='8'>Receipt: ", $receipt[0]->TICKETID, "</td></tr>";
                                            } else {
                                                echo "<tr><td >Refund: ", $receipt[0]->TICKETID, "</td></tr>";
                                            }
                                            echo "<tr><td >Date: ", $receipt[0]->DATENEW, "</td></tr>";
                                            $customer = $receipt[0]->CUSTOMER;
                                            if ($customer != '') {
                                                echo "<tr><td >Customer: ", $receipt[0]->CUSTOMER, "</td></tr><tr>";
                                            }
                                            $xml = simplexml_load_string($receipt[0]->ATTRIBUTES);
                                            if($xml!=null)
                                            {
                                            foreach ($xml as $key0 => $value) {
                                                foreach ($value->attributes() as $attributeskey0 => $attributesvalue1) {
                                                    if ($attributesvalue1 !=null) {
                                                    if ($attributesvalue1 == "Place") {
                                                        echo "
        <tr>
        <br><br/>
        <td >Table: ", $value, "</td>
        </tr>";
                                                    } else if ($attributesvalue1 == "TariffArea") {
                                                        echo "
        <tr>
        <td >Tariff: ", $value, "</td>
        </tr>";
                                                    } else if ($attributesvalue1 == "Host") {
                                                        $station = $value;
                                                    }
                                                }
                                                }
                                            }
                                            }
                                        }
                                    }
    echo "</tbody>";
    echo "</table><br/>";
    echo "<table id='receipt'>";
    echo "<thead><tr><th scope='col' width='100'>Item</th>"
    . "<th scope='col' width='50'></th><th scope='col' align='right' width='50'>Price</th>"
            . "<th scope='col' align='right' style='width: 40px;text-align: right;'>Qty</th>"
            . "<th scope='col'  align='right' style='width: 80px;text-align: right;'>Value</th>"
            . "</tr>"
            . "</thead>";
    echo "<tbody>";
    echo "<tr><td colspan='5'><hr/></td></tr>";
    if(isset($ticketlines)) {
        foreach ($ticketlines as &$value) {
            echo "<tr><td height='20' style='padding: 5px;'>";
            $xml = simplexml_load_string($value->ATTRIBUTES);
            if($xml) {
                foreach($xml->entry as $entryxml) {
                    if($entryxml->attributes()->key=='product.name') {
                        echo $entryxml;
                    }
                }
            }
            echo " </td><td></td>
                <td height='20' align='right'>", $this->formatslist->formatCurrency($value->PRICE), "</td>
                <td height='20' align='right'>x $value->UNITS</td>
                <td height='20' align='right'>", $this->formatslist->formatCurrencywithHash($value->UNITTOTAL), "</td>
                </tr>";
        }
    }
    echo "<tr><td colspan='5'><hr/></td></tr>";
    echo "</tbody>";
    echo "</table>";
    echo "<div style='text-align: right;float: right;clear: both;margin-bottom: 20px;'><table id='receipt' style='width:100%;'>";
    echo "<thead>";
    if(isset($receipt)){
        if($receipt) {
            echo "<tr colspan='3'>
            <th style='text-align:right;'><font size='2'>Tax : </font></th>
            <th align='right' style='text-align:right;'><font size='2'>", $this->formatslist->formatCurrencywithHash($receipt[0]->TAX), "</font></th>
            </tr><tr colspan='3'>
            <th style='text-align:right;'><font size='4'>Total : </font></th>
            <th align='right' style='text-align:right;'><font size='4'>", $this->formatslist->formatCurrencywithHash($receipt[0]->TOTAL), "</font></th>
            </tr>";
        }
    }
    echo "</thead>";
    echo "</table>";
    echo "<table id='receipt' style='width:100%;'>";
        echo "<tbody>";
        if(isset($paymentlines)){
            foreach ($paymentlines as &$value1) {
                echo "<tr colspan='3'><td style='text-align:right;'>", $value1->PAYMENT, "</td>"
                        . "<td align='right' style='text-align:right;'>", $this->formatslist->formatCurrencywithHash($value1->PAYMENTTOTAL), "</td></tr>";
            }
        }
        echo "</tbody>";
    echo "</table>";
    if(isset($receipt)){
        echo "<table id='receipt' style='width:100%;'>";
            echo "<tbody>";
            if(isset($receipt[0]->CASHIER)) {
                echo "<tr colspan='3'><td align='left' style='text-align:right;'>Cashier: &nbsp;</td><td align='right' style='text-align:right;'>", $receipt[0]->CASHIER, "</td></tr>";
            }
            if(isset($station)) {
                echo "<tr colspan='3'><td align='left' style='text-align:right;'>Station: &nbsp;</td><td align='right' style='text-align:right;'>", $station, "</td></tr>";
            }
            echo "</tbody>";
        echo "</table></div>";
    }
    echo "<table id='receipt' style='width:100%;margin-top:20px;'>";
    echo "<tbody>";
    echo "
<tr colspan='3'>
<td align='center'>Thank you for your visit.</td>
</tr>
<tr colspan='3'>
<td><br/> </td>
</tr>
<tr colspan='3'>
<td align='center'>Copyright (C) POSICS. www.posics.com</td>
</tr>";
    echo "</tbody>";
    echo "</table>";
    ?>
                                
                            </tr>
                            <tr>
                                <td><img src="<?= base_url() ?>assets/img/shared/blank.gif" width="350" height="1" alt="blank" /></td>
                                <td></td>
                            </tr>
                            <tr>
                                <th></th>
                                <td id="tbl-border-bottom">&nbsp;&nbsp;&nbsp;&nbsp;</td>
                                <th> </th>
                            </tr>
                        </table>   
                    </div>
                </div>
            </div>
        </div>
        <!-- /Page Body -->
    </div>
    <!-- /Page Content -->
</div>
<!-- /Page Container -->
<!-- Main Container -->
</div>