
<?php $__env->startSection('content'); ?>
    <?php Fun::lang()?>
<?php
$from_date = @$_GET['from_date'];
$to_date = @$_GET['to_date'];
$user_id = @$_GET['user_id'];
$iloveucustomer = @$_GET['iloveucustomer'];
$product_id = @$_GET['product_id'];
$sale_type = @$_GET['sale_type'];
?>
    <div class="page">
        <div class=container-fluid>
            <div class="top-content">
                <div class="row">
                    <div class="col-sm-12 col-xs-12 form-group">
                        <div class="title-add">
                            <div class="pull-left">
                                <h3><?php echo e(__('administrator.report_sale_detail')); ?></h3>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="top-content">
                <div class="row">
                    <div class="col-sm-12 col-xs-12 form-group paddin-0">
                        <div>
                             <?php echo Form::open(array('route' => 'report-sale-detail','method'=>'get')); ?>

                            <div class="col-sm-3">
                                <div class="form-group">
                                    <?php echo Form::select('sale_type', ['wholesale'=> __('administrator.wholesale'),'retail'=> __('administrator.retail')],$sale_type, array('placeholder' => __('administrator.type'),'class' => 'form-control','autocomplete select2' => 'off','')); ?>

                                </div>
                            </div>
                            <div class="col-sm-3">
                                <div class="form-group">
                                    <?php echo Form::select('user_id', pluckAllUser(),$user_id, array('placeholder' => __('administrator.seller'),'class' => 'form-control','autocomplete select2' => 'off','')); ?>

                                </div>
                            </div>
                            <div class="col-sm-3">
                                <div class="form-group">
                                    <?php echo Form::select('iloveucustomer', pluckAllCustomer(),$iloveucustomer, array('placeholder' => __('administrator.customer'),'class' => 'form-control select2','autocomplete' => 'off','')); ?>

                                </div>
                            </div>
                            <div class="col-sm-3">
                                <div class="form-group">
                                    <?php echo Form::select('product_id', getAllProduct()->pluck('product_name','id'),$product_id, array('placeholder' => __('administrator.products'),'class' => 'form-control select2','autocomplete' => 'off','')); ?>

                                </div>
                            </div>
                            <div class="col-sm-3">
                                <div class="form-group">
                                    <?php echo Form::text('from_date', $from_date, array('placeholder' => __('administrator.from_date'),'class' => 'form-control date_picker','autocomplete' => 'off','')); ?>

                                </div>
                            </div>
                            <div class="col-sm-3">
                                <div class="form-group">
                                    <?php echo Form::text('to_date', $to_date, array('placeholder' => __('administrator.to_date'),'class' => 'form-control date_picker','autocomplete' => 'off','')); ?>

                                </div>
                            </div>
                            <div class=" col-sm-6">
                                <?php echo Form::open(array('route' => 'reportsales_print','method'=>'GET')); ?>

                                <button class=" button_success pull-right print_button" type="button" ><i class="fa fa-print "></i> <?php echo e(__('administrator.print')); ?></button>
                                <?php echo Form::close(); ?>

                                <button class=" button_primary pull-right"   type="submit"> <?php echo e(__('administrator.search')); ?></button>
                            </div>
                             <?php echo Form::close(); ?>

                        </div>
                    </div>
                </div>
            </div>
            <div class="wrapper-table">
                <table id="print_table" width="100%" class="table table-striped table-hover ">
                    <thead>
                    <tr>
                        <th>#</th>
                        <th><?php echo e(__('administrator.type')); ?></th>
                        <th><?php echo e(__('administrator.sale_date')); ?></th>
                        <th><?php echo e(__('administrator.invoice')); ?></th>
                        <th><?php echo e(__('administrator.seller')); ?></th>
                        <th><?php echo e(__('administrator.customer_name')); ?></th>
                        <th><?php echo e(__('administrator.products')); ?></th>
                        <th><?php echo e(__('administrator.sale_price')); ?></th>
                        <th><?php echo e(__('administrator.discount')); ?></th>
                        <th><?php echo e(__('administrator.sale_qty')); ?></th>
                        <th><?php echo e(__('administrator.total')); ?></th>
                    </tr>
                    </thead>
                    <tbody class="tbody">

                    </tbody>
                    <tfoot class="tfoot">
                    <tr>
                        <th colspan="9" class="text-right"></th>
                        <th class="text-right"></th>
                        <th class="green"></th>
                    </tr>
                    </tfoot>
                </table>
            </div>
        </div>
    </div>
        <?php $__env->stopSection(); ?>

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

            <script type="text/javascript">

                $(document).ready(function () {

                    $('#print_table').DataTable({
                        "oLanguage": {
                            "sSearch": "<?php echo e(__('administrator.search')); ?>:",
                            "sLengthMenu": "<?php echo e(__('administrator.display')); ?> _MENU_ <?php echo e(__('administrator.record_per_page')); ?>",
                            "sZeroRecords": "<?php echo e(__('administrator.Nothing_foundsorry')); ?>",
                            "sInfo": "<?php echo e(__('administrator.showing')); ?> _START_ <?php echo e(__('administrator.to')); ?> _END_ <?php echo e(__('administrator.of')); ?> _TOTAL_ <?php echo e(__('administrator.record')); ?>",
                            "sInfoEmpty": "<?php echo e(__('administrator.showing')); ?> 0 <?php echo e(__('administrator.to')); ?> 0 <?php echo e(__('administrator.of')); ?> 0 <?php echo e(__('administrator.record')); ?>",
                            "sInfoFiltered": "(<?php echo e(__('administrator.filter_form')); ?> _MAX_ <?php echo e(__('administrator.total_records')); ?>)",
                            "oPaginate": {
                                "sFirst": "<?php echo e(__('administrator.first')); ?>",
                                "sLast": "<?php echo e(__('administrator.last')); ?>",
                                "sNext": "<?php echo e(__('administrator.next')); ?>",
                                "sPrevious": "<?php echo e(__('administrator.previous')); ?>"
                            },
                        },

                        ordering: false,
                        serverSide: true,
                        lengthMenu: [[20, 30, 50, 100, 200, 500, 1000], [20, 30, 50, 100, 200, 500, 1000]],
                        ajax: "<?php echo e(route('report-sale-detail')); ?>?from_date=<?php echo e($from_date); ?>&to_date=<?php echo e($to_date); ?>&sale_type=<?php echo e($sale_type); ?>&user_id=<?php echo e($user_id); ?>&product_id=<?php echo e($product_id); ?>&iloveucustomer=<?php echo e($iloveucustomer); ?>",
                       data:{customer_name :'<?php echo e($iloveucustomer); ?>' },

                        columns:
                            [
                                {data: 'DT_RowIndex', 'searchable': false},
                                {data: 'sale_type', 'name': 'nso007_sales.sale_type'},
                                {data: 'sale_date', 'name': 'nso007_sales.sale_date'},
                                {data: 'invoice_number', 'name': 'nso007_sales.invoice_number'},
                                {data: 'user_id', 'searchable': false},
                                {data: 'customer_id', 'searchable': false},
                                {data: 'product_id', 'searchable': false},
                                {data: 'sale_price', 'searchable': false},
                                {data: 'dis', 'searchable': false},
                                {data: 'qty', 'searchable': false},
                                {data: 'amount', 'searchable': false},

                            ],
                        "footerCallback": function (row, data, start, end, display) {
                            var api = this.api(), data;
                            var intVal = function (i) {
                                return typeof i === 'string' ?
                                    i.replace(/[\$,]/g, '') * 1 :
                                    typeof i === 'number' ?
                                        i : 0;
                            };
                            var cost_Total = api
                                .column(6)
                                .data()
                                .reduce(function (a, b) {
                                    return intVal(a) + intVal(b);
                                }, 0);


                            var numFormat = $.fn.dataTable.render.number('\,', '.', 2, '$ ').display;
                            $(api.column(6).footer()).html(numFormat(cost_Total));
                        },
                    });

                    $.fn.dataTable.ext.errMode = 'throw';
                });
            </script>
<?php $__env->stopSection(); ?>

    



<?php echo $__env->make(branchMenu(), \Illuminate\Support\Arr::except(get_defined_vars(), ['__data', '__path']))->render(); ?><?php /**PATH /home/nsowos/public_html/shr-brand/resources/views/administrator/payment-report/report-sale-marketing/index.blade.php ENDPATH**/ ?>