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

<?php $__env->startPush('css'); ?>
    <style type="text/css">
        .cus>t{
            border-bottom: 2px dotted;
        }
    </style>
<?php $__env->stopPush(); ?>
<!-- page content -->
<?php $__env->startSection('content'); ?>
    <div class="right_col" role="main">
        <div class="">
            <div class="clearfix"></div>
            <div class="row">
                <div class="col-md-12 col-sm-12 col-xs-12">
                    <div class="x_panel">
                        <div class="x_title">
                            <a href="<?php echo e(route('production.list')); ?>" calss="btn" ><h2><i class="fa fa-mail-reply"></i></h2></a>
                            <h2>Purchase List</h2>
                            <ul class="nav navbar-right panel_toolbox">
                                <li><a class="collapse-" onclick="printDiv('printableArea')" ><i class="fa fa-print fa-2x green"></i></a>
                                <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a>
                                </li>
                                <li class="dropdown">
                                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-expanded="false"><i class="fa fa-wrench"></i></a>
                                    <ul class="dropdown-menu" role="menu">
                                        <li><a href="#">Settings 1</a>
                                        </li>
                                        <li><a href="#">Settings 2</a>
                                        </li>
                                    </ul>
                                </li>
                                <li><a class="close-link"><i class="fa fa-close"></i></a>
                                </li>
                            </ul>
                            <div class="clearfix"></div>
                        </div>
                        <div class="x_content">
                            <div class="" id="printableArea">
                                <div class="row">
                                    <div class="col-xs-12 col-sm-12">
                                        <div class="row">
                                            <div class="col-xs-1"></div>
                                            <div class="col-xs-1">
                                                <img src="<?php echo e(asset('storage/about/'.about()->logo)); ?>" class="img-responsive img-thumbnail" alt="logo" width="85px" height="75px" >
                                            </div>
                                            <div class="col-xs-8">
                                                <div class="text-center">
                                                    <h4><?php echo e(about()->english_name); ?></h4>
                                                    <p>Phone:  <?php echo e(about()->phone); ?>, Email: <?php echo e(about()->email); ?></p>
                                                    <p>Address: <?php echo e(about()->address); ?> </p>
                                                    <h4>Purchase Details Report</h4>
                                                </div>
                                            </div>
                                            <div class="col-xs-2"></div>
                                        </div>
                                        <hr/>
                                        <div class="ro">
                                            <div class="customer">
                                                <table class="table table-bordered">
                                                    <tr class="cus">
                                                        <td>
                                                            <b>Name:  <?php echo e($production->worker->name); ?></b>
                                                        </td>
                                                        <td>
                                                            <b>Phone: <?php echo e($production->worker->phone); ?></b>
                                                        </td>
                                                    </tr>
                                                    <tr class="cus">
                                                        <td>
                                                            <b>Address :  <?php echo e($production->worker->address); ?></b>
                                                        </td>
                                                        <td>
                                                            <b>Date :<?php echo e(date('d-M-Y', strtotime($production->production_date))); ?></b>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </div>
                                        </div>
                                        <table class="table table-condensed table-bordered">
                                            <thead>
                                                <tr>
                                                    <th class="center">SL</th>
                                                    <th>Product</th>
                                                    <th>Code No</th>
                                                    <th>Unit</th>
                                                    <th>Quantity</th>
                                                    <th>Rate</th>
                                                    <th>Pro.Cost</th>
                                                    <th>Unit Wage</th>
                                                    <th>Wage Total</th>
                                                </tr>
                                            </thead>
                                            <tbody>
                                            <?php 
                                                $total = 0;
                                                $tsqf = 0;
                                             ?>
                                            <?php $__currentLoopData = $production->pd; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key=>$detail): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                                <?php 
                                                    $total = $total + ( $detail->quantity * $detail->rate);
                                                    $tsqf = $detail->product->square_foot * $detail->quantity;
                                                 ?>
                                                <tr>
                                                    <td class="center"><?php echo e($key + 1); ?></td>
                                                    <td><?php echo e($detail->product->product_name); ?></td>
                                                    <td><?php echo e($detail->product->code); ?></td>
                                                    <td><?php echo e($detail->unit->name); ?></td>
                                                    <td><?php echo e($detail->quantity); ?></td>
                                                    <td><?php echo e($detail->rate); ?></td>
                                                    <td><?php echo e($detail->quantity * $detail->rate); ?></td>
                                                    <td><?php echo e($detail->wage); ?></td>
                                                    <td><?php echo e($detail->quantity * $detail->wage); ?></td>
                                                </tr>
                                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                            </tbody>
                                        </table>
                                    </div>
                                    <div class="hr hr8 hr-double hr-dotted"></div>
                                    <div class="ro">
                                        <div class="col-sm-5 pull-right">
                                            <h4 class="pull-right">
                                                Total amount :
                                                <span class="red"><?php echo e($production->grand_total); ?></span>
                                            </h4>
                                        </div>
                                        <div class="col-sm-7 pull-left"> 
                                            Previous Due: <b class="red"><?php echo e($production->worker->production->sum('due_amount') -  $production->due_amount); ?> </b>
                                            <br/>
                                            Total Due: <b class="red"><?php echo e($production->worker->production->sum('due_amount')); ?> </b>
                                        </div>
                                    </div>
                                    <div class="space-6"></div>
                                    <div class="">
                                        
                                    </div>
                                    <div class="ro">
                                        <div class="col-sm-12">Note: <?php echo e($production->note); ?></div>
                                    </div>
                                    <hr/>
                                    <div class="text-center">
                                        <small>
                                            Thank you for choosing our Company products.We believe you will be satisfied by our services.
                                        </small>
                                    </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- /page content -->
<?php $__env->stopSection(); ?>
<?php $__env->startPush('js'); ?>
    <script type="text/javascript">
        function printDiv(divName) {
         var printContents = document.getElementById(divName).innerHTML;
         var originalContents = document.body.innerHTML;

         document.body.innerHTML = printContents;

         window.print();

         document.body.innerHTML = originalContents;
        }
    </script>
    
<?php $__env->stopPush(); ?>
<?php echo $__env->make('backend.layouts.master', array_except(get_defined_vars(), array('__data', '__path')))->render(); ?>