<style>
    .myresult
    {
        -webkit-print-color-adjust: exact;
    }
</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[64]->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="productlimitreportController.php?do=show" method="post">









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




                    <div class="form-group">
                        <label class="sr-only">الترتيب</label>
                        <select class="select2 wdt300"  name="order" id="order" >
                            <option value="asc">تصاعدى</option>
                            <option value="desc">تنازلى</option>
                        </select>
                    </div>

                    <div style="clear: both"></div>
                    <br />

                    <div class="form-group col-lg-3">
                        <label class="sr-only">تصنيف المنتج</label>
                        <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 id="manyParents">

                    </div>
                    <div class="form-group col-lg-3">
                        <div><label class="sr-only">نوع البحث</label></div>
                        <div class="radio-inline">
                            <label>
                                <input value="0" name="searchtype"  type="radio" checked="checked"  />
                                منتج نهائى   </label>
                        </div>
                        <div class="radio-inline">
                            <label>
                                <input value="1" name="searchtype"   type="radio"    />
                                اخر تصنيف   </label>
                        </div>

                    </div>
                    <div class="form-group">
                        <label class="sr-only">استخدام الحد الادنى من </label>
                        <div  class="input-group">
                            <label>  <input value="product" name="searchStoreLimitType" id="searchStoreLimitProduct" type="radio" checked onclick='localStorage.setItem("searchStoreLimitType", "product");
                                    window.location.reload();'>
                                المنتجات</label>
                            <label>
                                <input value="productstore" name="searchStoreLimitType" id="searchStoreLimitProductStore" type="radio" onclick='localStorage.setItem("searchStoreLimitType", "productstore");
                                        window.location.reload();'>
                                الحد الادنى للمنتجات فى المخزن</label>
                        </div>
                    </div>
                    <div style="clear: both"></div>
                    <br />
                    <button type="submit" class="btn btn-primary">بحث</button>
                </form>



            </div>


            {if {count($storedetailData)} > 0}

            <div class="panel panel-default panel-m">
                <!-- Default panel contents -->
                <div class="panel-heading">{$message}</div>
                <div class="panel-body">

                    <hr/>


                    {if $searchtype == 0}
                    <table class="table table-black dataTableClass">
                        <thead>
                            <tr>

                                <th>الرقم </th>
                                <th>اسم المخزن</th>
                                <th>اسم المنتج</th>
                                <th>الحد الادنى</th>
                                <th>الكمية</th>


                            </tr>
                        </thead>
                        <tbody>


                            {assign var=total value=0}
                            {assign var=x value=1}
                            {foreach $storedetailData as $storedetail}
                            <tr>
                                <td>{$x}</td>
                                <td>{$storedetail->storeName}</td>
                                <td>{$storedetail->productName}
                                    {if $hidecat eq 1}
                                    /{$storedetail->productCatName}
                                    {/if}
                                </td>
                                <td>{$storedetail->limitamount}</td>
                                <td>{$storedetail->productquantity}</td>

                            </tr>
                            {capture assign=x}{$x+1}{/capture}
                            {capture assign=total}{$total+{$storedetail->productquantity}}{/capture}
                            {/foreach}


                        </tbody>
                    </table>
                    {else}
                    <table class="table table-black">
                        <thead>
                            <tr>

                                <th>الرقم </th>
                                <th>اسم المنتج</th>
                                <th>الكمية</th>


                            </tr>
                        </thead>
                        <tbody>


                            {assign var=total value=0}
                            {assign var=x value=1}
                            {foreach $storedetailData as $storedetail}
                            <tr>
                                <td>{$x}</td>
                                <td>{$storedetail->productName}</td>
                                <td>{$storedetail->productquantity}</td>

                            </tr>
                            {capture assign=x}{$x+1}{/capture}
                            {capture assign=total}{$total+{$storedetail->productquantity}}{/capture}
                            {/foreach}


                        </tbody>
                    </table>
                    {/if}
                    <div class="col-lg-offset-8 col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">اجمالى عدد الوحدات {$total}</h4>
                        </div>
                    </div>

                    {/if}



                    <div class="clearfix"></div>


                    <hr />



                    {if {count($storedetailData)} > 0}
                    <div  class="hidden-print">
                        <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>
        {literal}
        <script>

            var search = localStorage.getItem("searchStoreLimitType");
            if (!search || search == "product") {
                $('#searchStoreLimitProduct').attr('checked', 'checked');
                $('#searchStoreLimitProductStore').removeAttr('checked');
            } else {
                $('#searchStoreLimitProductStore').attr('checked', 'checked');
                $('#searchStoreLimitProduct').removeAttr('checked');
            }
        </script>
        {/literal}