
<?php $__env->startSection('title', 'All Units Summary'); ?>
<?php $__env->startSection('css'); ?>
    <style>
        body {
            overflow-y: hidden;
            /*font-family: "Times New Roman";*/
            color: #000000;
        }

        .table-bordered td,
        .table-bordered th {
            border: 0.1rem solid rgba(8, 8, 8, 0.33) !important;
             !important;
        }

        h5.heading-title {
            text-transform: initial;
            font-weight: bold;
            letter-spacing: 1px;
        }

        tr th,
        tr td {
            line-height: 1.0;
            font-size: 15px;
            padding: 7px !important;

        }

        tr th,
        span strong,
        div span {
            text-transform: initial;
            font-weight: bold;
        }

        @media  print {
            @page  {
                size: A4 landscape;
                padding: 0 !important;
                margin: 0 !important;
            }

            .table-bordered td,
            .table-bordered th {
                border: 0.1rem solid rgba(8, 8, 8, 0.50) !important;
            }

            body {
                overflow: hidden !important;
                color: #000000;
            }

            div.card-body {
                margin: auto 20px;
            }

            div.card-body {
                padding-top: 0;
            }

            .table .thead-dark th {
                color: #000 !important;
                background-color: #dadada !important;
                /*border-color: #32383e !important;*/
            }

            /*body {*/
            /*-webkit-print-color-adjust: exact;*/
            /*}*/

        }

    </style>
<?php $__env->stopSection(); ?>
<?php $__env->startSection('content'); ?>

    <!-- Content Header (Page header) -->
    <section class="content-header">
        <div class="container-fluid">
            <div class="row mb-2">
                <div class="col-sm-6">
                    <h1>Product Summary</h1>
                </div>
                <div class="col-sm-6">
                    <ol class="breadcrumb float-sm-right">
                        <li class="breadcrumb-item"><a href="#">Report</a></li>
                        <li class="breadcrumb-item active">Product Summary</li>
                    </ol>
                </div>
            </div>
        </div><!-- /.container-fluid -->
    </section>

    <section class="content no-print">
        <div class="container-fluid">
            
            <div class="col-lg-12 col-sm-8 col-md-6 col-xs-12">
                <div class="card card-primary card-outline">
                    <div class="card-body " style="padding-bottom:0">
                        <?php echo e(Form::open(['route' => 'all-units-item-summary', 'method' => 'get'])); ?>

                        <div class="form-row">
                            <div class="form-group col-md-3">
                                <label>Select Product</label>
                                <select name="product_id" class="from-control select2">
                                    <option value="">Select Product</option>
                                    <?php $__currentLoopData = $products; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $product): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <option value="<?php echo e($product->id); ?>"><?php echo e($product->name); ?></option>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                </select>
                                
                            </div>

                            <div class="form-group col-md-2" style="margin-top: 30px">
                                <button type="submit" class="btn btn-info btn-md btn-block"><i
                                        class="fa fa-search"></i>&nbsp;Search</button>

                            </div>
                            <div class="form-group col-md-2" style="margin-top: 30px">
                                <button class="btn btn-success btn-md btn-block" onclick="window.print(); return false;"><i
                                        class="fa fa-print"></i>&nbsp;Print</button>
                            </div>

                        </div>
                        <?php echo e(Form::close()); ?>

                    </div>
                </div>
                <!-- /.card -->
            </div>
        </div>
    </section>
    <?php if($item != null): ?>
        <section class="content">
            <div class="col-lg-12">
                <div class="card"><br>
                    <div class="card-body">

                        <div class="row">
                            <div class="col-md-12 text-center">
                                <h3><b>Consolidated Product Summary</b></h3>
                                <h5>Product Name: <?php echo e($item->name); ?></h5>
                            </div>
                        </div>
                        
                        <table class="table table-hover table-bordered table-condensed text-center" width="100% ">
                            <thead>
                                <tr>
                                    <th width="10%" class="text-center">#SL</th>
                                    <th width="40%">Unit Name</th>
                                    <th width="15%">Avalable Qty</th>
                                    <th width="20%">Avarage Price</th>
                                    <th width="20%">Value</th>
                                </tr>
                            </thead>
                            <tbody>

                                <?php if($units != null): ?>
                                    <?php $__currentLoopData = $units; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $unit): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                        <tr>
                                            <td><?php echo e($key + 1); ?></td>
                                            <td><?php echo e($unit->name); ?></td>
                                            <?php
                                                $abalavailqty =
                                                    App\GoodsinProduct::where('unit_id', $unit->id)
                                                        ->where('product_id', $item->id)
                                                        ->sum('qty') -
                                                    App\GoodsIssueProduct::where('unit_id', $unit->id)
                                                        ->where('product_id', $item->id)
                                                        ->sum('qty');
                                                $count = App\GoodsinProduct::where('unit_id', $unit->id)
                                                    ->where('product_id', $item->id)
                                                    ->count('qty');
                                                if ($count != 0) {
                                                    $price =
                                                        App\GoodsinProduct::where('unit_id', $unit->id)
                                                            ->where('product_id', $item->id)
                                                            ->sum('price') / $count;
                                                    if ($abalavailqty != 0) {
                                                        $averageprice = $price;
                                                    } else {
                                                        $averageprice = 0;
                                                    }
                                                } else {
                                                    $averageprice = 0;
                                                }
                                                $totalprice = $averageprice * $abalavailqty;
                                            ?>
                                            <td class="text-right"><?php echo e($abalavailqty); ?></td>
                                            <td class="text-right"><?php echo e(round($averageprice, 2)); ?></td>
                                            <td class="text-right"><?php echo e(round($totalprice, 2)); ?></td>
                                        </tr>
                                    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                <?php endif; ?>
                            </tbody>
                            
                        </table>
                    </div>
                </div>
            </div>
        </section>
        <div class="page_break"></div>
    <?php endif; ?>

<?php $__env->stopSection(); ?>

<?php $__env->startSection('style'); ?>

<?php $__env->stopSection(); ?>


<?php $__env->startSection('plugin'); ?>
    <!-- DataTables -->
    <script src="<?php echo e(asset('plugins/datatables/jquery.dataTables.js')); ?>"></script>
    <script src="<?php echo e(asset('plugins/datatables/dataTables.bootstrap4.js')); ?>"></script>
    <script src='https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.3/js/select2.min.js'></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-confirm/3.3.4/jquery-confirm.min.js"></script>
<?php $__env->stopSection(); ?>

<?php $__env->startSection('script'); ?>
    <!-- page script -->
    <script type="text/javascript">
        $('.select2').select2()
    </script>
<?php $__env->stopSection(); ?>

<?php echo $__env->make('layouts.fixed', \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/welluugs/purchase.wellgrouperp.com/resources/views/inventory/goodsin/itemwise_all_unit_summery.blade.php ENDPATH**/ ?>