{literal}
<script type="text/javascript" charset="utf-8">
//
//
//			$(document).ready( function () {
//    $('#example').dataTable( {
//		 "bPaginate": false,
//		 "bStateSave": true,
//        "sDom": 'TCR<"clear">lfrtip',
//        "oTableTools": {
//            "aButtons": [
//                "copy",
//                "print",
//                {
//                    "sExtends":    "collection",
//                    "sButtonText": "حفظ",
//                    "aButtons":    [ "csv", "xls"]
//                }
//            ]
//        }
//    } ).columnFilter();
//} );
//
//	
$(document).ready( function () {
    $('.dataTableClassNS').dataTable({
        dom: 'Bfrtip',
        buttons: [//'csv', 'pdf'
            {
                extend: "print",
                className: "btn dark btn-outline",
                text: "طباعه<i class='fa fa-print'></i>",
                exportOptions: {
                    //columns: '.show-print'
                    // columnzs: ':visible'//columns: ':visible(:not(.hidden-print))'
                },
                customize: function (win) {
                    $(win.document.body).find('table')
                            .css('direction', 'rtl');
                }
            }, {
                extend: "copy",
                className: "btn red btn-outline",
                text: "نسخ",
                exportOptions: {
                    // columns: ':visible'
                }
            }, {
                extend: "excel",
                className: "btn yellow btn-outline ",
                text: "اكسل",
                exportOptions: {
                    // columns: ':visible'
                }
            }, {
                extend: "colvis",
                className: "btn dark btn-outline",
                text: "المكونات"
            }, {
            }
        ],
        "bStateSave": true,
        "language": {
            "aria": {
                "sortAscending": ": Used to order Ascending",
                "sortDescending": ": Used to order Descending"
            },
            "emptyTable": "لا يوجد بيانات",
            "info": "عرض _START_ من _END_ الى _TOTAL_ عناصر",
            "infoEmpty": "لا يوجد بيانات",
            "infoFiltered": "(تنقيه _MAX_ من الاجمالى)",
            "lengthMenu": " _MENU_ عنصر",
            "search": "البحث:",
            "zeroRecords": "لا يوجد بيانات تشابه البحث"
        },
        responsive: !0,
        "columnDefs": [
            {targets: '_all', "className": 'show-print'}],
        order: [
            [0, "asc"]
        ],
//        "paging": false,
        lengthMenu: [
            [5, 10, 15, 20, -1],
            [5, 10, 15, 20, "All"]
        ],
        pageLength: 10,
        dom: "<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>"
    });
    $('.dataTableClassNS td').css("height", "30px");
});
	</script>
{/literal}

<style>
    .myresult {
        -webkit-print-color-adjust: exact;
    }
    @media print {
        p,h4,h3,h2,h1,span,label,td,th,div.dataTables_info,a,.dataTables_wrapper .dataTables_paginate .paginate_button.disabled,
        div.dataTables_wrapper div.dataTables_info,.panel-heading, tr.odd td.sorting_1,
        .table thead>tr>th, .table tbody>tr>th, .table tfoot>tr>th, .table thead>tr>td, .table tbody>tr>td, .table tfoot>tr>td{
            color:#000!important
        }
        .table thead>tr>th, .table tbody>tr>th, .table tfoot>tr>th, .table thead>tr>td, .table tbody>tr>td, .table tfoot>tr>td{
            text-align: center
        }
    }
</style>

<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">التقارير</a></li>
            <li class="active">صافى تحويلات المخزن</li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">صافى تحويلات المخزن
                <a href="{$youtubes[114]->url}" target="_blank" class="hidden-print"><img src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube" style="width: 2%;"></a>
            </div>
            <div class="panel-body">
                <form class="form-inline hidden-print" action="netStoreTransfer.php?do=show" method="post">
                    <input type="hidden" name="searchvalue" id="searchvalue" value="{$Programsettingdata->searchvalue}"/>
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">تصنيف المنتج</label>
                        </div>
                        <select class="select2 wdt300 productCat" data-level="0"  name="productCatId0" id="productCatId0" >
                            <option value="-1">اختر تصنيف</option>
                            {foreach $catDataReport as $data}
                            <option value="{$data->productCatId}">{$data->productCatName}</option>
                            {/foreach}
                        </select>
                        <input type="hidden" id="level" name="level" value="0">
                    </div>

                    <div class="form-group">
                        <div id="manyParents">

                        </div>
                    </div>
                    <div class="row"></div>
                   <!--  <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">المخزن</label>
                        </div>
                        <select class="select2 wdt300"  name="storeId" id="storeId">
                            <option value="-1">اختر مخزن</option>
                            {foreach $storeData as $store}
                            <option value="{$store->storeId}">{$store->storeName}</option>
                            {/foreach}
                        </select>
                    </div> -->

                    {if $searchinonestore neq 0}
                     <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">المخزن</label>
                        </div>
                         <input type="hidden" name="storeId" id="storeId"  value="{$storeid}"  >
                        {$storedef->storeName}
                    </div>

                    {else}
                    <div class="form-group">
                        <div class="col-md-2">
                            <label class="sr-only">المخزن</label>
                        </div>
                        <select class="select2 wdt300"  name="storeId" id="storeId">
                            <option value="-1">اختر مخزن</option>
                            {foreach $stores as $store}
                            <option value="{$store->storeId}">{$store->storeName}</option>
                            {/foreach}
                        </select>
                    </div>
                    {/if}



                    <div class="row"></div>
                    <div class="form-group">
                        <label class="sr-only">من التاريخ</label>
                        <input type="text" class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" name="from" >
                    </div>
                    <div class="form-group">
                        <label class="sr-only">إلى التاريخ</label>
                        <input type="text" class="form-control awdatepicker" autocomplete="off"   data-date-format="yyyy-mm-dd" name="to" >
                    </div>
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>
            </div>
            {*if {count($storereportData)} > 0*}
            <div class="panel panel-default">
                <!-- Default panel contents -->
                <div class="panel-heading">{$message}</div>
                <div class="panel-body">
                    <hr/>
                    <!--div class="col-lg-offset-8 col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">اجمالى سعر المنتجات {$sumValue} {$currency}</h4>
                        </div>
                    </div-->
                    <table class="table table-black dataTableClassNS" id="example">
                        <thead>
                            <tr>
                                <!--th>الرقم</th-->
                                <th>المنتج</th>
                                <th>الرصيد الحالى للمخزن</th>
                                <th>رصيد اضافة</th>
                                <th>رصيد أول المدة</th>
                                <th>محول منه</th>
                                <th>محول إليه</th>
                                <th>الفرق</th>
                                <th>المشتريات</th>
                                <th>المرتجعات</th>
                                <th>صافى</th>
                                <th>المبيعات</th>
                                <th>المرتجعات</th>
                                <th>صافى</th>
                                <th>مبيعات المستخدمين</th>
                                <th>معالجة عجز</th>
                                <th>صافى الحركة</th>
                                <th>صافى الشراء </th>
                                <th>القديم </th>
                                <th>صافى الكمية </th>
                                <th>النوع </th>
                                <th>معدل البيع</th>
                                <th>الحالة </th>
                            </tr>
                        </thead>
                        <tbody>
                            {assign var=totalAll value=0}
                            {foreach $choosenStoreIds as $oneStore}
                            {foreach $allDataArr_{$oneStore} as $data}
                            <tr>
                                <td>{$data->productName}</td>
                                <td>{$data->productquantity}</td>
                                <td>{$data->productAddQuantity}</td>
                                <td>{$data->firstDurationQuantity}</td>
                                <td>{$data->transferFrom}</td>
                                <td>{$data->transferTo}</td>
                                <td>{$data->transferFrom-$data->transferTo}</td>
                                <td>{$data->buy}</td>
                                <td>{$data->retBuy}</td>
                                <td>{$data->buy-$data->retBuy}</td>
                                <td>{$data->sell}</td>
                                <td>{$data->retSell}</td>
                                <td>{$data->sell-$data->retSell}</td>
                                <td>{$data->sellsersName}</td>
                                <td>{$data->storeDeficit}</td>
                                {assign var=total value=$data->productAddQuantity+$data->firstDurationQuantity-$data->transferFrom+$data->transferTo+$data->buy-$data->retBuy-$data->sell+$data->retSell+$data->storeDeficit}
                                {assign var=netBuy value={{$data->buy-$data->retBuy} - {$data->transferFrom-$data->transferTo}}}
                                {assign var=netQuantity value={{$data->productquantity + {$data->sell-$data->retSell}}}}
                                {assign var=old value=$netQuantity-$netBuy}
                                {assign var=sellRate value={{$data->sell-$data->retSell}/$netQuantity*100}}
                                <td>{$total}</td>
                                <td>{$netBuy}</td>
                                <td>{$old}</td>
                                <td>{$netQuantity}</td>
                                <td>{if $old > 0} قديم {else}جديد{/if}</td>
                                <td>{$sellRate|number_format:2}</td>
                                <td>{if $sellRate >= 40}تمام{else}ضعيف{/if}</td>
                            </tr>
                            {/foreach}
                            {/foreach}

                        </tbody>

                    </table>
                    <!--div class="col-lg-offset-8 col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">اجمالى سعر المنتجات {$sumValue} {$currency}</h4>
                        </div>
                    </div-->
                    {*/if*}
                    <div class="clearfix"></div>
                    <hr />
                    {*if {count($storereportData)} > 0*}
                    <!--div  class="noprint">
                        <div class="col-lg-12">
                            <div class="form-group">
                                <div class="col-lg-4">
                                    <button type="button" onclick="print_Custom('mycustomheader');" class="btn btn-success pull-right hidden-print">طباعة</button>
                                </div>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div-->
                    {*/if*}
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
