<?php $__env->startSection('title','Invoice'); ?>

<?php $__env->startSection('content'); ?>
<div class="page-bar">

</div>

<div class="row">
    <div class="col-12">
        <div class="white-box">
            <h3><b>INVOICE</b> <span class="pull-right">#<?php echo e($invoice->sale_no); ?></span></h3>
            <hr>
            <div class="row">
                <div class="col-md-12">
                    <div class="pull-left">
                        <address>
                            <img src="<?php echo e(asset(Config::get('app.company.logo'))); ?>" width="100px" height="auto" style="margin: 0">
                            <p class="text-muted m-l-5">
                                <?php echo e(Config::get('app.address.house')); ?> , <?php echo e(Config::get('app.address.road')); ?> , <?php echo e(Config::get('app.address.sector')); ?>

                                <br>
                                <?php echo e(Config::get('app.address.area')); ?> , <?php echo e(Config::get('app.address.city')); ?>

                                <br>
                                <?php echo e(Config::get('app.address.post')); ?>

                            </p>
                        </address>
                    </div>
                    <div class="pull-right text-right">
                        <address>
                            <p class="addr-font-h3">To,</p>
                            <p class="font-bold addr-font-h4"><?php if( $invoice->customer ): ?> $invoice->customer->phone <?php else: ?> $invoice->farmer->phone <?php endif; ?></p>
                            <?php if(!empty($invoice->address)): ?>
                            <p class="text-muted m-l-30">
                                <?php echo e($invoice->address ?? 'N/A'); ?>

                            </p>
                            <?php endif; ?>
                            <p class="m-t-30">
                                <b>Invoice Date :</b> <i class="fa fa-calendar"></i> <?php echo e(\Carbon\Carbon::parse($invoice->sale_date)->format('D-M-Y')); ?>

                            </p>
                            <p>
                                <b>Phone :</b> <?php if( $invoice->customer ): ?> <?php echo e($invoice->customer->phone); ?> <?php else: ?> <?php echo e($invoice->farmer->phone); ?> <?php endif; ?>
                            </p>
                        </address>
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="table-responsive m-t-40">
                        <table class="table table-hover">
                            <thead>
                                <tr>
                                    <th class="text-center">#</th>
                                    <th class="text-right">Product Name</th>
                                    <th class="text-right">Price</th>
                                    <th class="text-right">Quantity</th>
                                    <th class="text-right">Discount</th>
                                    <th class="text-right">Amount</th>
                                </tr>
                            </thead>
                            <?php
                                $i = 1;
                            ?>
                            <tbody>
                                <?php $__currentLoopData = $invoice->saleitems; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $item): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                    <tr>
                                        <td class="text-center"><?php echo e($i++); ?></td>
                                        <td class="text-right"><?php echo e($item->product->product_name); ?></td>
                                        <td class="text-right"><?php echo e($item->selling_price); ?></td>
                                        <td class="text-right"><?php echo e($item->quantity); ?></td>
                                        <td class="text-right"><?php echo e($item->discount); ?></td>
                                        <td class="text-right"><?php echo e($item->total_selling); ?></td>
                                    </tr>
                                <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            </tbody>
                        </table>
                    </div>
                </div>
                <div class="col-md-12">
                    <div class="pull-right m-t-30 text-right">
                        <p>Subtotal : <?php echo e($invoice->sub_total); ?> BDT</p>
                        <p>Discount : <?php echo e($invoice->discount); ?> BDT </p>
                        <h3>Total : <?php echo e($invoice->grand_total); ?> BDT</h3>
                        <p>Paid : <?php echo e($invoice->grand_total - $invoice->due); ?> BDT </p>
                        <p><strong>Due : <?php echo e($invoice->due); ?> BDT </strong></p>
                        <hr>
                    </div>
                    <div class="clearfix"></div>
                    <hr>
                    <div class="text-right">
                        <?php if( $invoice->due > 0 ): ?>
                            <a href="<?php echo e(route('admin.sale.partial.payment',[$invoice->id,$invoice->payment_type])); ?>" class="btn btn-primary">Proceed To Pay</a>
                        <?php endif; ?>
                        <button onclick="javascript:window.print();" class="btn btn-default btn-outline" type="button">
                            <span><i class="fa fa-print"></i> Print</span> 
                        </button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('template.app', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH E:\farm\resources\views/admin/saleinvoice/show.blade.php ENDPATH**/ ?>