<style>
    .myresult {
        -webkit-print-color-adjust: exact;
    }
    .nodata{
        background-color: #72B4EC;
        color: white;
        border-radius: 13px;
        margin: 14px;
        font-size: 24px;
        text-align: center;
        padding: 5px;
    }
</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[168]->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="salesreport.php?do=consumption" method="post">
                    <div class="form-group">
                        <label class="sr-only">بحث بـ</label>
                        <div  class="input-group">
                            <label>  <input value="dateOnly" name="search" id="searchdateOnly" type="radio" checked onclick='localStorage.setItem("search", "dateOnly");
                                    window.location.reload();'>
                                تاريخ</label>
                            <label>
                                <input value="dateTime" name="search" id="searchdateTime" type="radio" onclick='localStorage.setItem("search", "dateTime");
                                        window.location.reload();'>
                                تاريخ ووقت</label>
                        </div>
                    </div>
                    <div id="dateTimeDiv">
                        <div class="form-group">
                            <label class="sr-only">من التاريخ</label>
                            <div  class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                                <input class="form-control" size="16" type="text" value="" name="datefrom" id="datefrom" readonly="" >
                                <span class="input-group-addon " style="width: 0%;"><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                                <span class="input-group-addon"  style="width: 0%;"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="sr-only">إلى التاريخ</label>
                            <div  class="input-group date form_datetime col-md-5" data-date="" data-date-format="yyyy-mm-dd  h:i:s" data-link-field="dtp_input1">
                                <input class="form-control" size="16" type="text" value="" name="dateto" id="dateto" readonly="" >
                                <span class="input-group-addon " style="width: 0%;"><span class=" glyphicon glyphicon-remove col-lg-4"></span></span>
                                <span class="input-group-addon" style="width: 0%;"><span class="glyphicon glyphicon-th col-lg-4"></span></span>
                            </div>
                        </div>
                    </div>

                    <div id="dateOnlyDiv">
                        <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="datefrom" >
                        </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="dateto" >
                        </div>
                    </div>

                    <div style="clear: both"></div>
                    {if $user->userstoreid == 0}
                    <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>
                            <option value="0">كل المخازن</option>
                            {foreach $storeData as $store}
                            <option value="{$store->storeId}">{$store->storeName}</option>
                            {/foreach}
                        </select>
                    </div>
                    {/if}
                    <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>
                    <br />
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>

            </div>
            <div class="panel panel-default panel-m">
                <!-- Default panel contents -->
                <div class="panel-heading">{$message}</div>
                <div class="panel-body">
                    {if $resultsCount > 0}
                    <hr/>
                    {if $loadData->netprofit neq 1}
                    <!--                    <div class="col-lg-offset-8 col-lg-4">
                                            <div class="well well-sm">
                                                <h4 class="text-center">صافى الربح {$totalsObj->netProfit} {$currency}</h4>
                                            </div>
                                        </div>-->
                    {/if}
                    <!--<div class=" col-lg-offset-8 col-lg-4 ">-->
                    <!--<div class="well well-sm">-->
                    <!--<h4 class="text-center">اجمالى المبيعات بدون خصومات  {$total_sell_without_discount}</h4>-->
                    <!--</div>-->


                </div>

                <style>
                    @media print {
                        @page {
                            size: landscape;
                            margin: 0;
                        }
                        .willprint ,.willprint td,.willprint th {
                            /* font-family: arial;
                            font-size: 14px;
                            border-collapse: collapse; */
                            padding: 0;
                            border: 1px solid #333 !important;
                        }
                        /* .willprint th{
                            background: #aaa !important;
                        } */
                        /* .willprint tr:even-child td{
                            background: #333 !important;
                            color: #fff !important;
                        } */
                    }
                </style>
                <table class="dataTableClass willprint " style="width: 100%">
                    <thead>
                        <tr>
                            <th rowspan="2">#</th>
                            <th rowspan="2">اسم المنتج</th>
                            <th colspan="2">المبيعات </th>
                            <th colspan="2">المرتجعات</th>
                            <th colspan="2">صافى المبيعات</th>
                            <th rowspan="2">الكمية الحالية</th>
                            <th rowspan="2">الكمية المتوقع طلبها</th>
                            <th rowspan="2">الحد الادنى للطلب</th>
                        </tr>
                        <tr>
                            <th>عدد </th>
                            <th>قيمة </th>
                            <th>عدد </th>
                            <th>قيمة </th>
                            <th>عدد </th>
                            <th>قيمة </th>
                        </tr>
                    </thead>
                    <tbody>
                        {assign var=i value=1}
                        {foreach $allDataArr as $data}
                        <tr>
                            <td>{$i}</td>
                            <td>{$data->productName}/ {$data->productCatName}</td>
                            <td>{$data->soldNo}</td>
                            <td>{$data->soldVal}</td>
                            <td>{$data->returnNo}</td>
                            <td>{$data->returnVal}</td>
                            <td>{$data->netNo}</td>
                            <td>{$data->netVal}</td>
                            <td>{$data->currentQuantity}</td>
                            <td>{$data->netNo - $data->currentQuantity}</td>
                            <td>{$data->limitamount}</td>
                        </tr>
                        {assign var=i value=$i+1}
                        {/foreach}
                    </tbody>
                    <tfoot>
                        <tr style="background-color: #c8c6c6 !important">
                            <td><span style="display: none">z</span></td>
                            <th style="text-align: center;">الاجمالى</th>
                            <td style="text-align: center;">{$totalsObj->soldNo}</td>
                            <td style="text-align: center;">{$totalsObj->soldVal}</td>
                            <td style="text-align: center;">{$totalsObj->returnNo}</td>
                            <td style="text-align: center;">{$totalsObj->returnVal}</td>
                            <td style="text-align: center;">{$totalsObj->netNo}</td>
                            <td style="text-align: center;">{$totalsObj->netVal}</td>
                            <td></td>
                            <td style="text-align: center;">{$totalsObj->sellbilltotalprice}</td>
                            <td></td>
                        </tr>
                    </tfoot>
                </table>
                {if $loadData->netprofit neq 1}
                <!--                <div class="col-lg-offset-8 col-lg-4">
                                    <div class="well well-sm">
                                        <h4 class="text-center">صافى الربح {$totalsObj->netProfit} {$currency}</h4>
                                    </div>
                                </div>-->
                {/if}

                <div class="clearfix"></div>
                <hr />
                <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>
                {else}
                <div class="nodata">عفوا لا توجد نتائج</div>
                {/if}

                <div class="clearfix"></div>
            </div>
        </div>
    </div>
    {literal}
    <script>
        var search = localStorage.getItem("search");
        if (search == "dateTime") {
            $('#searchdateTime').attr('checked', 'checked');
            $('#searchdateOnly').removeAttr('checked');
            //
            $('#dateTimeDiv').show();
            $('#dateOnlyDiv').remove();
        } else {
            $('#searchdateOnly').attr('checked', 'checked');
            $('#searchdateTime').removeAttr('checked');
            //
            $('#dateOnlyDiv').show();
            $('#dateTimeDiv').remove();
        }
    </script>
    {/literal}