<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, tr.odd td.sorting_1{
            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!important
        }
        body{
            direction: rtl;
        }
    }

    td.details-control {
        background: url('../views/default/images/details_open.png') no-repeat center center;
        cursor: pointer;
    }
    tr.details td.details-control {
        background: url('../views/default/images/details_close.png') no-repeat center center;
    }

</style>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">{$smarty.const.STORE_REPORTS}</a></li>
            <li class="active">{$smarty.const.STORE_WAREHOUSE_BALANCE} </li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading">{$smarty.const.STORE_WAREHOUSE_BALANCE}
                <a href="{$youtubes[111]->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="storedetailController.php?do=show" method="post">
                    <input type="hidden" name="searchvalue" id="searchvalue" value="{$Programsettingdata->searchvalue}"/>
                    <input type="hidden" name="childitr" id="childitr" value="1"/>

                    <!--                    <div class="form-group">
                                            <label class="sr-only">تصنيف المنتج</label>
                                            <select class="select2 wdt300 productCatId" data-id="55"  name="productCatId" id="productCatId" >
                                                <option value="-1">اختر تصنيف</option>
                                                {foreach $productCatData as $cat}
                                                <option value="{$cat->productCatId}">{$cat->productCatName}</option>
                                                {/foreach}
                                                {*for $j=0 to $itr*}
                                                          <option value="{$parentId{$j}}">{$names{$j}}</option>
                                                {*/for*}
                                            </select>
                                        </div>-->

                    <div class="form-group">
                        <div class="col-md-2">

                            <label class="sr-only">{$smarty.const.STORE_PRODUCT_RATING}</label>
                        </div>
                        <select class="select2 wdt300 productCat" data-level="0"  name="productCatId0" id="productCatId0" >
                            <option value="-1">{$smarty.const.STORE_CHOOSE_RATING}</option>
                            {foreach $productCatData as $data}
                            <option value="{$data->productCatId}">{$data->productCatName}</option>
                            {/foreach}
                        </select>
                        <input type="hidden" id="level" name="level" value="0">
                    </div>
                    <!--                    <div id="hereischilds">
                                        </div>-->

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

                        </div>
                    </div>
                    <br />

                    {if $searchinonestore neq 0}
                    <div class="form-group">
                        <label class="sr-only">{$smarty.const.STORE_STORE}</label>
                        <input type="hidden" name="storeId" id="storeId"  value="{$storeid}"  >
                        {$storedef->storeName}
                        <input type="hidden" name="storeId_hidden" id="storeId_hidden" value="{$storeid}"/>
                    </div>

                    {else}
                    <div class="form-group">
                        <label class="sr-only">{$smarty.const.STORE_STORE}</label>
                        <select class="select2 wdt300"  name="storeId" id="storeId" >
                            <option value="-1">{$smarty.const.STORE_CHOOSE_STORE}</option>
                            {foreach $stores 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">{$smarty.const.STORE_STORE}</label>
                          </div>

                          <select class="select2 wdt300"  name="storeId" id="storeId" >
                              <option value="-1">{$smarty.const.STORE_CHOOSE_STORE}</option>



                              {foreach $storeData as $store}




                              <option value="{$store->storeId}">{$store->storeName}</option>


                              {/foreach}



                          </select>
                      </div> -->
                    <div class="form-group" style="padding: 0 10px;">
                        <div class="col-md-2">

                            <label class="sr-only">اظهار الكميات فى المخازن الوسيطة</label>
                        </div>

                        <input type="checkbox" name="showStoreBetweenQuantity" id="showStoreBetweenQuantity" value="1">
                    </div>


                    <div class="form-group">
                        <div class="col-md-2">

                            <label class="sr-only">{$smarty.const.STORE_ORDER}</label>
                        </div>

                        <select class="select2 wdt300"  name="order" id="order" >



                            <option value="desc">{$smarty.const.STORE_ORDER_ASCENDING}</option>
                            <option value="asc">{$smarty.const.STORE_ORDER_DESCENDING}</option>






                        </select>
                    </div>
                    <input type="radio" name="search" value="0" checked="checked"/><label>{$smarty.const.STORE_FINAL_PRODUCT}</label>
                    <input type="radio" name="search" value="1"/><label>{$smarty.const.STORE_RATING}</label>

                    <br />
                    <button type="submit" class="btn btn-primary">{$smarty.const.STORE_SEARCH}</button>
                </form>
            </div>
            <div class="panel panel-default">
                <!-- Default panel contents -->
                <div class="panel-heading">{$message}</div>
                <div class="panel-body">
                    <hr/>
                    {if {count($storedetailData)} > 0}
                    <div class="col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">{$smarty.const.STORE_TOTAL_NUMBER_NEGATIVE_PRODUCTS}{$minusQuantity}</h4>
                        </div>
                    </div>
                    <div class="col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">{$smarty.const.STORE_TOTAL_NUMBER_POSITIVE_PRODUCTS}{$plusQuantity}</h4>
                        </div>
                    </div>
                    <div class="col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">{$smarty.const.STORE_TOTAL_NET_NUMBER_PRODUCTS} {$productquantity}</h4>
                        </div>
                    </div>
                    {if $showstoredetailprice != 1}
                    <div class=" col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">{$smarty.const.STORE_TOTAL_NEGATIVE_PRODUCTS_PRICE}{$minusPrice} {$currency}</h4>
                        </div>
                    </div>
                    <div class=" col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">{$smarty.const.STORE_TOTAL_PRICE_POSITIVE_PRODUCTS} {$plusPrice} {$currency}</h4>
                        </div>
                    </div>
                    <div class=" col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">{$smarty.const.STORE_TOTAL_NET_PRICE_PRODUCTS} {$sumValue} {$currency}</h4>
                        </div>
                    </div>
                    {/if}
                    {/if}
                    <a href="javascript:;" id="toggleAll" data-status="closed" class="btn btn-default bg-black hidden-print"> {$smarty.const.STORE_OPEN_CLOSEALL}</a>
                    <input type="hidden" name="showstoredetailprice" id="showstoredetailprice" value="{$showstoredetailprice}"/>
                    <table class="table datatable table-bordered table-black " id="productQuantityTable"><!-- dataTableClass22 -->
                        <thead>
                            <tr>
                                <th></th>
                                <th></th>
                                <th>{$smarty.const.STORE_NUMBER}</th>
                                <th>{$smarty.const.STORE_STORE_NAME}</th>
                                <th>{$smarty.const.STORE_CATEGORY_NAME}</th>
                                <th>{$smarty.const.STORE_PRODUCT_NAME}</th>
                                <th> {$smarty.const.STORE_BARCODE}</th>
                                <th>{$smarty.const.STORE_QUANTITY}</th>
                                {if {$Programsettingdata->scunitname} <> '0'}
                                <th>{$Programsettingdata->scunitname}</th>
                                {/if}
                                {if $showstoredetailprice != 1}
                                <!-- <th>{$smarty.const.STORE_UNIT_PRICE}</th> -->
                                 <th>سعر الشراء</th>
                                <th>نسبة الخصم</th>
                                <th>{$smarty.const.STORE_TOTAL}</th>
                                <th>الاجمالى شامل ق.م</th>
                                <th>سعر البيع</th>
                                <th>إجمالي البيع</th>
                                {/if}
                                <th>{$smarty.const.STORE_DATE_LAST_OPERATION}</th>

                            </tr>
                        </thead>
                        <tbody>
                            <!--{assign var=x value=1}-->
                            {foreach $storedetailData as $storedetail}
                            {if $storedetail.productquantity neq '0'}
                            <tr data-pro="{$storedetail.productid}{if $storedetail.productDataSOC != ''}_SOC{/if}{if $storedetail.productDataSAC != '[]'}_SAC{/if}{if $storedetail.productDataING != '[]'}_ING{/if}{$storedetail.storeid}" data-store="{$storedetail.storeid}">
                                <td></td>
                                <td></td>
                                <td>
                                    {$storedetail.itra}
                                    {if $storedetail.productDataSAC != "[]"}
                                    <input type='hidden' name='sizecolordetails{$storedetail.productid}_SAC' id='sizecolordetails{$storedetail.productid}_SAC{$storedetail.storeid}' value='{$storedetail.productDataSAC}'/>
                                    {/if}
                                    {if $storedetail.productDataSOC != ""}
                                    <input type='hidden' name='sizecolordetails{$storedetail.productid}_SOC' id='sizecolordetails{$storedetail.productid}_SOC{$storedetail.storeid}' value='{$storedetail.productDataSOC}'/>
                                    {/if}
                                    {if $storedetail.productDataING != ""}
                                    <input type='hidden' name='sizecolordetails{$storedetail.productid}_ING' id='sizecolordetails{$storedetail.productid}_ING{$storedetail.storeid}' value='{$storedetail.productDataING}'/>
                                    {/if}
                                </td>

                                <td>{$storedetail.storeName}</td>
                                <td>{$storedetail.productCatName}</td>
                                <td>{$storedetail.productName}</td>
                                <td>{$storedetail.parcode}</td>
                                <td>{$storedetail.productquantity}</td>
                                {if {$Programsettingdata->scunitname} <> '0'}

                                <td>{$storedetail.unittype}</td>
                                {/if}
                                {if $showstoredetailprice != 1}
                                <td>{$storedetail.productBuyPrice}</td>
                                <td>{$storedetail.buydiscountpercent}</td>
                                <td>{$storedetail.productquantity * $storedetail.productBuyPriceWithbuydiscountPrice}</td>
                                <td>{$storedetail.productquantity * $storedetail.taxPriceWithbuydiscountPrice}</td>
                                <td>{$storedetail.productSellUnitPrice}</td>
                                <td>{$storedetail.productSellUnitPrice * $storedetail.productquantity}</td>
                                {/if}
                                <td>{$storedetail.storedetaildate}</td>
                            </tr>
                            {/if}
                            <!--{capture assign=x}{$x+1}{/capture}-->
                            {/foreach}

                        </tbody>

                    </table>
                    <div class="col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">{$smarty.const.STORE_TOTAL_NUMBER_PRODUCTS} {$productquantity}</h4>
                        </div>
                    </div>
                    {if $showstoredetailprice != 1}
                    <div class=" col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">{$smarty.const.STORE_TOTAL_PRICE_PRODUCTS} {$sumValue} {$currency}</h4>
                        </div>
                    </div>
                    {/if}
                    <div class="clearfix"></div>
                    <hr />
                    {if {count($storedetailData)} > 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">{$smarty.const.STORE_PRINT}</button>
                                </div>
                            </div>
                        </div>
                        <div class="clearfix"></div>
                    </div>



                    {/if}
                    <div class="clearfix"></div>
                </div>
            </div>
        </div>
