
<?php $__env->startSection('title','Stock Transaction report'); ?>
<?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: 13px;
            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>Stock Transaction</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">Stock Transaction</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'=>'stock.transaction','method'=>'get'])); ?>


                        <div class="form-row">
                        <div class="form-group col-md-3" >
                                <label>Select Group</label>
                                <select name="group_id" class="form-control select2">
                                        <option value="">Select Group</option>
                                      
                                        <?php $__currentLoopData = $prodects_groups; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $key => $group): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                            <?php
                                                $count_items = 0;
                                                $products = count(App\Product::where('group_id',$key)->get(['id']));
                                               
                                            ?>
                                            <?php if($products > 0): ?>
                                                <option value="<?php echo e($key); ?>"><?php echo e($group); ?></option>
                                            <?php endif; ?>
                                        <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                                    </select>   
                                
                                </div>
                            <div class="form-group col-md-3" >
                                <label>From</label>
                                <input type="" name="from" class="form-control" value="<?php echo e(date('d-m-Y',strtotime($from))); ?>">
                            </div>
                            <div class="form-group col-md-3" >
                                <label>To</label>
                                <input type="" name="to" class="form-control" value="<?php echo e(date('d-m-Y',strtotime($to))); ?>">
                            </div>
                           
                            <div class="form-group col-md-1" 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-1" 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(!empty($groups)): ?>
    <?php
        $total = count($stockTransaction);
        $total_opening_qty = 0;
        $total_opening_price = 0;
        $total_goods_received_qty = 0;
        $total_goods_received_price = 0;
        $total_goods_issue_qty = 0;
        $total_goods_issue_price = 0;
        $total_available_qty = 0;
        $total_closing_qty = 0;
        $total_closing_price = 0;
        
        $pageNo= 1;
        $i=1;
    ?>
    <?php $__currentLoopData = collect($stockTransaction)->chunk(19); $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $chunkStocks): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
        <?php
            $total -=count($chunkStocks);
        ?>
        <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-right" style="margin:2px 30px 0 0">
                                <h6>Page No: <?php echo e($pageNo++); ?></h6>
                            </div>
                            <div class="col-md-12 text-center">
                                <h3><b>  <?php echo e(is_numeric(Auth::user()->active_unit) ? \App\Unit::query()->findOrFail(Auth::user()->active_unit)->name : 'NULL'); ?></b></h3>
                                <h5><b>Inventory Transaction</b></h5>
                                
                                <h6>Report From <?php echo e(dateFormat($from)); ?> To <?php echo e(dateFormat($to)); ?></h6>
                            </div>
                        </div>
                        
                        <table class="table table-hover table-bordered table-condensed text-right" width="100%">
                            <thead>
                            <tr class="text-center">
                                <th width="5%" class="text-center">#SL</th>
                                <th width="10%">Group</th>
                                <th width="10%">Opening Qty</th>
                                <th width="10%">Opening Value</th>
                                <th width="10%">Goods Rcvd</th>
                                <th width="10%">Goods Rcvd Value</th>
                                <th width="10%">Goods Issue</th>
                                <th width="10%">Goods Issue Value</th>
                                
                                <th width="7%">Closing Qty</th>
                                <th width="10%">Closing Value</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php

                            ?>
                            <?php $__currentLoopData = $chunkStocks; $__env->addLoop($__currentLoopData); foreach($__currentLoopData as $stock): $__env->incrementLoopIndices(); $loop = $__env->getLastLoop(); ?>
                                <tr>
                                    <td class="text-center"><?php echo e($i++); ?></td>
                                   <td class="text-left">
                                       <?php if(Auth::id()==35): ?>
                                       <?php echo e(Auth::id()); ?> <a style="text-decoration: none; color: black;" href="<?php echo e(route('indevisual.stock',[$stock['group_id'],$from,$to])); ?>"><?php echo e($stock['group_name']); ?></a>
                                       
                                       <?php else: ?>
                                        <?php echo e($stock['group_name']); ?>

                                       <?php endif; ?>
                                       
                                       </td>
                                    <td><?php echo e(round($stock['opening_qty'],2)); ?></td>
                                    <td><?php echo e(round($stock['opening_value'],2)); ?></td>
                                    <td><?php echo e(round($stock['goods_received_qty'],2)); ?></td>
                                    <td><?php echo e(round($stock['goods_received_value'],2)); ?></td>
                                    <td><?php echo e(round($stock['goods_issue_qty'],2)); ?></td>
                                    <td><?php echo e(round($stock['goods_issue_value'],2)); ?></td>

                                    <td><?php echo e(round($stock['closing_qty'],2)); ?></td>
                                    <td><?php echo e($stock['closing_qty']!=0 ? round($stock['closing_value'],2): 0); ?></td>
                                </tr>
                                <?php
                                    // $total_opening_qty += $stockTransaction[$stock->id]['opening_qty'];
                                    $total_opening_qty += $stock['opening_qty'];
                                    $total_opening_price += $stock['opening_value'];
                                    $total_goods_received_qty += $stock['goods_received_qty'];
                                    $total_goods_received_price += $stock['goods_received_value'];
                                    $total_goods_issue_qty += $stock['goods_issue_qty'];
                                    $total_goods_issue_price += $stock['goods_issue_value'];
                                    $total_available_qty += $stock['available_qty'];
                                    $total_closing_qty += $stock['closing_qty'];
                                    $total_closing_price +=  $stock['closing_value'];
                                ?>
                            <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>
                            <?php if($total  == 0): ?>
                            <tr>
                                <td colspan="2" class="text-right"><strong>Total</strong></td>
                                <td><strong><?php echo e(round($total_opening_qty,2)); ?></strong></td>
                                <td><strong><?php echo e(round($total_opening_price,2)); ?></strong></td>
                                <td><strong><?php echo e(round($total_goods_received_qty,2)); ?></strong></td>
                                <td><strong><?php echo e(round($total_goods_received_price,2)); ?></strong></td>
                                <td><strong><?php echo e(round($total_goods_issue_qty,2)); ?></strong></td>
                                <td><strong><?php echo e(round($total_goods_issue_price,2)); ?></strong></td>

                                <td><strong><?php echo e(round($total_closing_qty,2)); ?></strong></td>
                                <td><strong><?php echo e($total_closing_qty != 0 ? round($total_closing_price,2) : 0); ?></strong></td>
                            </tr>
                            <?php endif; ?>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </section>
        <div class="page_break"></div>
    <?php endforeach; $__env->popLoop(); $loop = $__env->getLastLoop(); ?>

<?php else: ?>
    <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 box-profile">
                        <h4 class="text-center">No Data Found</h4>
                    </div>
                </div>
                <!-- /.card -->
            </div>
        </div>
    </section>

<?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/stock-transaction-new.blade.php ENDPATH**/ ?>