<div style="display: none;">
    <div id="guestBill_<?php echo $billOrder[0]->id ?>" style="width: 80mm; margin: 0 auto;">
        <table style="width: 80mm; margin: 0 auto;padding: 0" >
            <tr>
                <td colspan="2" style="width: 80mm; text-align: center;"><img src="<?php echo UPLOAD_PATH ?>gkpos/logo/<?php echo $this->config->item('gk_logo'); ?>"></td>
            </tr>
            <tr>
                <td colspan="2" style="width: 80mm;text-align: center;font-weight: bold;text-transform: uppercase; font-size: 1.5em"><?php echo $this->config->item('gk_name') ?></td>
            </tr>
            <tr>
                <td colspan="2" style="width: 80mm; text-align: left; font-size: 1em"><?php echo $this->config->item('gk_address') ?></td>
            </tr>
            <tr>
                <td colspan="2" style="width: 80mm;font-size: 1em;text-align: center;">Phone: <?php echo $this->config->item('gk_phone') ?></td>
            </tr>
            <tr>
                <td colspan="2" style="width: 80mm;font-size: 1em; text-align: center;">VAT NO: <?php echo $this->config->item('gk_vat_reg') ?></td>
            </tr>
            <tr>
                <td style="width: 30mm; font-size: 1em;text-align: left;">#<?php echo strtoupper($billOrder[0]->id) ?></td>
                <td style="width: 50mm; font-size: 1em;text-align: right; padding-right: 5mm">By:-<?php echo get_user_name($this->session->userdata('gkpos_userid')) ?></td>
            </tr>
            <tr>
                <td colspan="2" style="width: 80mm; border-bottom: 2px dotted #000;padding: 0;margin: 0"></td>
            </tr>    
        </table>
        <table style="width: 80mm; margin: 0 auto;padding: 0" >
            <tr>
                <td style="width:65mm;font-weight: bold;"><?php echo $this->lang->line('gkpos_item') ?></td>
                <td style="width:15mm;font-weight: bold;"><?php echo $this->lang->line('gkpos_price') ?></td>
            </tr>
            <?php if (!empty($billItems)): ?>
                <?php $billItems = array_reverse($billItems, true) ?>
                <?php foreach ($billItems as $key => $obj): ?>
                    <tr>
                        <td style="text-transform: capitalize;"><?php echo $obj->quantity ?>&nbsp;&nbsp;
                            <?php
                            $itemString = isset($obj->selection_title) && $obj->selection_title != null ? $obj->selection_title . '-' . $obj->menu_title : $obj->menu_title;
                            $itemString.=$obj->set_items != null ? '<br/> <i style="font-size:14px;"> <strong>Items : </strong>' . $obj->set_items.'</i>' : '';
                            $itemString.=$obj->toppings != null ? '<br/> <i style="font-size:13px;"> <strong class="text-transform: uppercase;">T/S : </strong>' . $obj->toppings.'</i>' : '';
                            echo $itemString;
                            ?>
                        </td>
                        <td><?php echo to_currency($obj->quantity * $obj->price) ?></td>
                    </tr>
                <?php endforeach; ?>
            <?php endif; ?>
            <tr>
                <td colspan="2" style="width: 80mm; border-bottom: 2px dotted #000;padding: 0;margin: 0"></td>
            </tr>           
        </table>
        <table style="width: 80mm; margin: 0 auto;padding: 0" >
            <tr>
                <td style="width: 50mm;text-align: right;padding-right: 3mm"><?php echo $this->lang->line('gkpos_subtotal') ?>:</td>
                <td style='width: 30mm;text-align: right; padding-right: 3mm'><?php echo to_currency($billOrder[0]->order_total) ?></td>
            </tr>
            <?php if (!empty($billVat[0])): ?>
                <tr>
                    <td style="width: 50mm;text-align: right;padding-right: 3mm;"><?php echo $this->lang->line('gkpos_vat') ?>:</td>
                    <td style='width: 30mm;text-align: right; padding-right: 3mm'><?php $billVat[0]->is_included == 1 ? print'<span class="alert-info">' . $billVat[0]->number . '&percnt;' . $this->lang->line('gkpos_vat_included') . '</span>' : print to_currency($billVat[0]->amount) ?></td>
                </tr>
            <?php endif; ?>

            <?php if ($billOrder[0]->delivery_charge != null && $billOrder[0]->delivery_charge > 0): ?>
                <tr>
                    <td style="width: 50mm; text-align: right;padding-right: 3mm;"><?php echo $this->lang->line('gkpos_delivery_fee') ?>:</td>
                    <td style='width: 30mm;text-align: right;padding-right: 3mm; '><?php to_currency($billOrder[0]->delivery_charge) ?></td>
                </tr>
            <?php endif; ?>

            <?php if (!empty($billDiscount[0])): ?>   
                <tr>
                    <td style="width: 50mm;text-align: right;padding-right: 3mm;"><?php echo $this->lang->line('gkpos_discount') ?>:</td>
                    <td style='width: 30mm;text-align: right;padding-right: 3mm; '><?php echo to_currency($billDiscount[0]->amount) ?></td>
                </tr>
            <?php endif; ?>
            <tr>
                <td colspan="2" style="width: 80mm; border-bottom: 2px dotted #000;padding: 0;margin: 0"></td>
            </tr>    
            <tr>
                <td style="width: 50mm; text-align: right;padding-right: 3mm;"><?php echo $this->lang->line('gkpos_total') ?>:</td>
                <td style='width: 30mm;text-align: right;padding-right: 3mm;'><?php echo to_currency($billOrder[0]->grand_total) ?></td>
            </tr>
            <?php if (!empty($payments)): ?>
                <tr>
                    <td colspan="2" style="width: 80mm; border-bottom: 2px dotted #000;padding: 0;margin: 0; display: none;" class="payment-line" ></td>
                </tr>      
                <?php foreach ($payments as $payment): ?>
                    <tr>
                        <td style="width: 50mm; text-align: right; padding-right: 3mm;" class="Cash"><?php echo $payment->method ?></td>
                        <td style='width: 30mm;text-align: right;padding-right: 3mm;' class="CashAmount"><?php echo to_currency($payment->amount) ?></td>
                    </tr>
                <?php endforeach; ?>
            <?php endif; ?>
            <tr>
                <td colspan="2" style="width: 80mm; border-bottom: 2px dotted #000;padding: 0;margin: 0; display: none;" class="payment-line" ></td>
            </tr>  
            <?php
            $changeDueString = null;
            $changeAmount = null;
            if ($billOrder[0]->change_due != null && $billOrder[0]->change_due < 0) {

                if ($billOrder[0]->pay_tip == 'yes') {
                    $changeDueString = 'Tips:';
                } else {
                    $changeDueString = 'Paid Back:';
                }
                $changeAmount = abs($billOrder[0]->change_due);
            }
            ?>
            <?php if ($changeAmount > 0): ?>
                <tr>
                    <td style="width: 60mm; text-align: right;padding-right: 3mm;" id="billChangeOption"><?php ($billOrder[0]->change_due != null && $billOrder[0]->change_due < 0) ? print $changeDueString : '' ?></td>
                    <td style='width: 20mm;text-align: right;padding-right: 3mm;' id="billChangeAmount"><?php ($billOrder[0]->change_due != null && $billOrder[0]->change_due < 0) ? print to_currency($changeAmount) : '' ?></td>
                </tr>
            <?php endif; ?>
            <tr>
                <td colspan="2">
                    <table style="width: 80mm; margin: 0 auto;padding: 0" >
                        <tr>
                            <td style="width: 20mm; font-size: 1em;text-align: left;"><?php echo date($this->config->item('dateformat')) ?></td>
                            <td colspan="2" style="font-size: 1.2em; width: 40mm; text-transform: uppercase;font-weight: bold; text-align: center;"><?php echo $billOrder[0]->order_type . '-' . $billOrder[0]->online_type ?></td>
                            <td style="width: 20mm; font-size: 1em;text-align: right; padding-right: 5mm;"><?php echo date($this->config->item('timeformat')) ?></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table style="width: 80mm; margin: 0 auto;padding: 0" >
                        <?php if ($billOrder[0]->name != null): ?>
                            <tr>
                                <td colspan="2" style="width: 80mm; font-size: 1em;text-align: center; text-transform: capitalize;"><?php echo $this->lang->line('gkpos_name') ?>:<?php echo $billOrder[0]->name ?></td>
                            </tr>
                        <?php endif; ?>

                        <?php if ($billOrder[0]->online_type == 'delivery' && $billOrder[0]->postcode != null): ?>
                            <?php if ($billOrder[0]->phone != null): ?>
                                <tr>
                                    <td colspan="2" style="width: 80mm; font-size: 1em;text-align: center;"><?php echo $this->lang->line('gkpos_phone') ?>:<?php echo $billOrder[0]->phone ?></td>
                                </tr>
                            <?php endif; ?>
                            <?php
                            $billAddressString = '';
                            $billAddressString.= $billOrder[0]->floor_or_apt != null ? $this->lang->line('gkpos_floor_or_apt_no') . '&nbsp;:&nbsp;' . $billOrder[0]->floor_or_apt . ', ' : '';
                            $billAddressString.= $billOrder[0]->building != null ? $this->lang->line('gkpos_building') . '&nbsp;:&nbsp;' . $billOrder[0]->building . '<br/>' : '';
                            $billAddressString.= $billOrder[0]->house != null ? $billOrder[0]->house . '&nbsp;' : '';
                            $billAddressString.=$billOrder[0]->street != null ? $billOrder[0]->street . ', ' : '';
                            $billAddressString.=$billOrder[0]->city != null ? $billOrder[0]->city . ', ' : '';
                            $billAddressString.=$billOrder[0]->postcode;
                            ?>
                            <tr>
                                <td colspan="2" style="width: 80mm; font-size: 1em;text-align: center; padding-right: 5mm;"><?php echo $billAddressString ?></td>
                            </tr>
                            <tr>
                                <td colspan="2" style="width: 80mm; font-size: 1em;text-align: center;"><?php echo $this->lang->line('gkpos_delivery_time') ?>:<?php echo date('F j, Y H:i:a', strtotime($billOrder[0]->delivery_time)) ?></td>
                            </tr>
                        <?php endif; ?>
                    </table>
                </td>
            </tr>
        </table>
    </div>
</div>