<!doctype html>
<?php Fun::lang()?>
<html>
<head>
    <meta charset="utf-8">
    <title>NSO POS</title>
    <link rel="stylesheet" type="text/css" href="<?php echo e(asset('assets/css/pos-invoice.css')); ?>">
    <?php
    $hr = '<div style="width: 100%;border-top: 1px dashed rgba(1,1,1,0.5);margin: 10px 0;"></div>';
    ?>
    <style>
        @media  print {
            * {
                font-size: 12px !important;
            }
        }

        * {
            font-size: 12px !important;
        }
    </style>
</head>
<body>
<div class="invoice-box print_this_form">
    <table class="tb-header">
        <tr>
            <td>
                <?php

                $br = getBranch();
                ?>
                <?php if($br->logo): ?>
                    <img src="<?php echo e(asset($br->logo??LogoImage())); ?> " style="height: 50px;margin: 5px">
                <?php else: ?>
                    <h4><?php echo e($br->name); ?></h4>
                <?php endif; ?>
            </td>
        </tr>
        <tr>
            <td>
                <span>
                     <b class="name_logo"><?php echo e($br->name); ?></b><br>
                    <i style="font-size: 11px"><?php echo e($br->address); ?><br><?php echo e($br->phone); ?></i>
                </span>
            </td>
        </tr>
    </table>
    <?php echo $hr; ?>

    <table class="tb-inv-info text-left">
        <tr>
            <td><?php echo e(__('administrator.invoice')); ?></td>
            <td>&nbsp;:&nbsp;<?php echo e($master->invoice_number); ?></td>
        </tr>
        <tr>
            <td><?php echo e(__('administrator.date')); ?></td>
            <td>&nbsp;:&nbsp; <b
                        style=""><?php echo e(date('d-m-Y H:i',strtotime($master->sale_date))); ?> <?php echo e($master->daily_order_number?'('.$master->daily_order_number.')':''); ?></b>
            </td>
        </tr>
        <?php if($master->customer_id): ?>
            <?php
                $customer = findCustomer($master->customer_id);
                $customer_name = $customer?$customer->name:'';
            ?>
            <tr>
                <td>
                    <?php echo e(__('administrator.customer')); ?>

                </td>
                <td style="">
                    &nbsp;:&nbsp;<?php echo e($customer_name); ?>

                </td>
            </tr>
        <?php endif; ?>
        <?php if($master->user_id): ?>
            <tr>
                <td><?php echo e(__('administrator.cashier')); ?></td>
                <td>&nbsp;:&nbsp;<?php echo e(findUser($master->user_id)->name); ?></td>
            </tr>
        <?php endif; ?>
        <?php if($master->member_type_id): ?>
            <tr>
                <td class=""><?php echo e(__('administrator.member_type')); ?></td>
                <td>&nbsp;:&nbsp;<?php echo e((getMemberType()[$master->member_type_id])); ?></td>
            </tr>
        <?php endif; ?>
    </table>
    <?php echo $hr; ?>

    <?php
        $hide=0;
            foreach($detail as $key => $row){
                if($row->dis==0){
                    $hide ++;
                }
            }
    ?>
    <table class="tb-list-item small-font">
        <thead>
        <tr>
            <th><?php echo e(__('administrator.products')); ?></th>
            <th><?php echo e(__('administrator.price')); ?></th>
            <th class="<?php echo e($hide>0?'display-none':''); ?>"><?php echo e(__('administrator.discount')); ?>($)</th>
            <th><?php echo e(__('administrator.total')); ?></th>
        </tr>
        </thead>
        <tbody>
        <?php
            $total_qty = 0;
            $total = 0;
            $currency = findCurrency($master->currency_id)->symbol;

        ?>

        <?php $__currentLoopData = $master->detail; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $row): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
            <?php
                $total_qty+=$row->qty;
                $stotal =$row->qty*$row->sale_price;
                $total+=$stotal;
                $product = getProductById($row->product_id);

                $size = findSize($row->size_code);
                $color = findColor($row->color_code);
                $size = $size?$size->size:'';
                $color = $color?$color->name:'';
            ?>
            <tr>
                <td><?php echo e($product?$product->product_name:''); ?> (<?php echo e($size.','.$color); ?>)</td>
                <td><?php echo e($row->qty.findUnit($row->unit_id)->unit); ?>

                    <small> x&nbsp;</small><?php echo e($currency.number_format($row->sale_price,2)); ?></td>
                <td class="<?php echo e($hide>0?'display-none':''); ?>"><?php echo e($row->dis); ?>$</td>
                <td><?php echo e($currency.number_format(generateTotal($row),2)); ?></td>
            </tr>
        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
        </tbody>
    </table>
    <?php echo $hr; ?>

    <?php
    $sub_total = generateSubTotal($master);

    ?>
    <table class="tb-list-foot">
        <tr>
            <td colspan="3" style="white-space: nowrap"><?php echo e(__('administrator.total_item')); ?></td>
            <td class="text-left"><?php echo e($total_qty); ?></td>
        </tr>
        <tr>
            <td colspan="3"><?php echo e(__('administrator.total')); ?></td>
            <td class="text-left"><?php echo e($currency); ?><?php echo e(number_format(($sub_total),2)); ?></td>
        </tr>
        <?php if($master->discount): ?>
            <tr>
                <td colspan="3"><?php echo e(__('administrator.discount')); ?></td>
                <td class="text-left"><?php echo e($master->discount); ?>

                    (<?php echo e($currency); ?><?php echo e(($sub_total - $master->discount)); ?>)
                </td>
            </tr>
        <?php endif; ?>
        <?php if($master->additional_charge): ?>
            <tr>
                <td colspan="3"><?php echo e(__('administrator.refund_amount')); ?></td>
                <td class="text-left">
                    <?php echo e($currency); ?><?php echo e((number_format($master->additional_charge,2))); ?>

                </td>
            </tr>
        <?php endif; ?>
        <?php if($master->refund_amount): ?>
            <tr>
                <td colspan="3"><?php echo e(__('administrator.refund_amount')); ?></td>
                <td class="text-left">
                    <?php echo e($currency); ?><?php echo e((number_format($master->refund_amount,2))); ?>

                </td>
            </tr>
        <?php endif; ?>
        <?php $fee = 0; ?>
        <?php if($master->delivery_fee>0): ?>
            <tr>
                <td colspan="3"><?php echo e(__('administrator.delivery_fee')); ?></td>
                <td class="text-left"><?php echo e($currency); ?><?php echo e($master->delivery_fee); ?></td>
            </tr>
        <?php endif; ?>
        <?php if($master->delivery_fee || $master->discount || $master->refund_amount): ?>
            <tr>
                <td colspan="3" style="white-space: nowrap"><?php echo e(__('administrator.grand_total')); ?></td>
                <td class="text-left"><?php echo e($currency.number_format(($master->grand_total),2)); ?></td>
            </tr>
        <?php endif; ?>
        <?php if($master->paid_amount): ?>
            <tr>
                <td colspan="3"><?php echo e(__('administrator.paid')); ?></td>
                <td class="text-left"><?php echo e($currency.number_format(($master->paid_amount),2)); ?></td>
            </tr>
        <?php endif; ?>
        <?php if($master->additional_charge): ?>
            <tr>
                <td colspan="3"><?php echo e(__('administrator.additional_charge')); ?></td>
                <td class="text-left"><?php echo e($currency.number_format(($master->additional_charge),2)); ?></td>
            </tr>
        <?php endif; ?>
        <?php
            $owed = ($master->grand_total?$master->grand_total:$sub_total)-($master->paid_amount+$master->additional_charge);
        ?>
        <?php if($owed): ?>
            <tr>
                <td colspan="3"><?php echo e(__('administrator.'.($owed>0?'owed':'change_amount'))); ?></td>
                <td class="text-left"><?php echo e($currency); ?><?php echo e(number_format(abs($owed),2)); ?> </td>
            </tr>
        <?php endif; ?>
    </table>
    <?php echo $hr; ?>

    <?php if($master->delivery_status): ?>
        <h5 class="text-left"><u><?php echo e(__('administrator.delivery_info')); ?></u></h5>
    <?php endif; ?>
    <table class="text-left " style="font-size: 11px;margin-top: 10px">
        <?php if($master->delivery_status): ?>
            <tr>
                <td>
                    <?php echo e(__('administrator.invoice_number')); ?>

                </td>
                <td style="">: <?php echo e($master->invoice_number); ?></td>
            </tr>
            <tr>
                <td><?php echo e(__('administrator.date')); ?></td>
                <td>&nbsp;:&nbsp;<?php echo e(date('d-m-Y H:i',strtotime($master->sale_date))); ?></td>
            </tr>
            <?php if($master->driver_id): ?>
                <?php $driver = findDriver($master->driver_id); ?>
                <tr>
                    <td><?php echo e(__('administrator.driver_name')); ?></td>
                    <td>: <?php echo e($driver->name); ?></td>
                </tr>
                <?php if($driver->phone): ?>
                    <tr>
                        <td><?php echo e(__('administrator.driver_number')); ?></td>
                        <td>: <?php echo e($driver->phone); ?></td>
                    </tr>
                <?php endif; ?>
            <?php endif; ?>
        <?php endif; ?>
        <?php if($master->note): ?>
            <tr>
                <td class="text-left" width="32%"><?php echo e(__('administrator.note')); ?></td>
                <td>: <?php echo e($master->note); ?></td>
            </tr>
        <?php endif; ?>
        <?php if($master->refund_reason): ?>
            <tr>
                <td class="text-left"><?php echo e(__('administrator.refund_reason')); ?></td>
                <td>: <?php echo e($master->refund_reason); ?></td>
            </tr>
        <?php endif; ?>
    </table>
    <?php if($master->delivery_status || $master->note || $master->refund_reason): ?>
        <?php echo $hr; ?>

    <?php endif; ?>
    <table>
        <tr>
            <td class="text-center" style="font-size: 11px"><b><?php echo $br->invoice_footer; ?></b></td>
        </tr>
    </table>
</div>
<script>

</script>
</body>
</html>
<?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/pos/invoice/pos-invoice.blade.php ENDPATH**/ ?>