<style>
    .select2-container{
        width: 150px !important;
    }
</style>
<div class="row">
    <div class="container">
        <ol class="breadcrumb">
            <li><a href="#">المخازن </a></li>
            <li><a href="#"> اهلاك خامات </a></li>
            <li class="active">عرض اهلاك خامات </li>
        </ol>
        <div class="panel panel-default panel-m">
            <!-- Default panel contents -->
            <div class="panel-heading" style="padding:5px 15px 15px">
                <h3 class="panel-title" style="display: inline-block;"> عرض اهلاك خامات</h3>
                <a href="{$youtubes[110]->url}" target="_blank" class="hidden-print"><img src="../views/default/assets/img/youtube.png" class="pull-left" alt="Youtube" style="width: 2%;"></a>
                <a href="restaurantRawDestruction.php" class="hidden-print"><input type="button" style="margin-left: 12px" id="submit"  class="btn btn-primary pull-left " value="إضافة جديد"/></a>
            </div>
            <div class="panel-body">

                <!---------- start outputString alert ----------->
                <div id="outputString" class="alert alert-block alert-success fade in" style="display:none">
                    <button type="button" class="close pull-left" data-dismiss="alert" aria-hidden="true">&times;</button>
                    <p id="outputStringValue">{$outputString}</p>
                    <div class="clearfix"></div>
                </div>
                <!---------  end outputString alert ------------>

                <form class="form-inline hidden-print" method="post" action="restaurantRawDestruction.php?do=show">

                {if $searchinonestore neq 0}
                 <div class="form-group" style="    width: 250px;">
                    <label for="storesData" class="col-lg-2 control-label">المخزن</label>
                    <div class="col-lg-4">
                      <input type="hidden" name="storeId" id="storeId"  value="{$storeid}"  >
                        <input type="hidden"  id="searchstoreName" value="{$storedef->storeName}">
                        <input type="hidden"  id="searchstorid" value="{$storeid}">
                        {$storedef->storeName}
                        <input type="hidden" name="storeId_hidden" id="storeId_hidden" value="{$storeid}"/>
                    </div>
                </div>
                {else}
                 <div class="form-group" style="    width: 250px;">
                    <label for="storesData" class="col-lg-2 control-label">المخزن</label>
                    <div class="col-lg-4">
                        <select class="select2 wdt100" name="storeId" id="storeId">
                            <option value="-1">اختر مخزن</option>
                            {foreach $stores as $store}
                            <option value="{$store->storeId}">{$store->storeName}</option>
                            {/foreach}
                        </select>
                        <input type="hidden" name="storeId_hidden" id="storeId_hidden" value=""/>
                    </div>
                </div>
                {/if}



                   
                    <div class="form-group">
                        <label class="sr-only">عرض مجمع
                            <input type="checkbox" name="showopnum" id="showopnum" value="1"></label>
                    </div>

                    <br />
                    <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 hidden-print">بحث</button>
                </form>


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

                        <!-- Table -->
                        {if $showopnum == 1}
                        <table class="table table-black">
                            <thead>
                                <tr>
                                    <th>م </th>
                                    <th>رقم العملية </th>
                                    {if $Usergroupdata->hideBillPrices != 1}<th>الاجمالى </th>{/if}
                                    <th>التاريخ </th>
                                    <th>المستخدم </th>

                                    <th class="hidden-print">طباعة</th>
                                </tr>
                            </thead>
                            <tbody>
                                {assign var=total value=0}
                                {foreach $arrContainer as $data}

                                <tr>

                                    <td> {$data.itra} </td>
                                    <td>{$data.operationNum}</td>
                                    {if $Usergroupdata->hideBillPrices != 1}<td> {$data.price} </td>{/if}
                                    <td>{$data.date}</td>
                                    <td>{$data.employeename}</td>
                                    <td class="hidden-print"> <a href="restaurantRawDestruction.php?do=printoperation&num={$data.operationNum}" type="button" target="_blank" class="btn btn-default btn-lg printicon"> </a> </td>
                                </tr>
                                {assign var=total value=$total+$data.price}
                                {/foreach}

                            </tbody>
                            {if $Usergroupdata->hideBillPrices != 1}
                            <tfoot style="background-color: #ddd;">
                                <tr>

                                    <td colspan="2" style="text-align: center">الاجمالى</td>
                                    <td> {$total} </td>
                                    <td></td>
                                    <td></td>
                                    <td class="hidden-print"></td>
                                </tr>

                            </tfoot>
                            {/if}

                        </table>
                        {else}
                        <table class="table table-black">
                            <thead>
                                <tr>
                                    <th>م </th>
                                    <th>إسم المخزن </th>
                                    <th>إسم المنتج </th>
                                    <th>كمية الاهلاك</th>
                                    {if $Usergroupdata->hideBillPrices != 1}<th>سعر الوحدة</th>{/if}
                                    {if $Usergroupdata->hideBillPrices != 1}<th>الاجمالى</th>{/if}
                                    <th>التاريخ</th>
                                    <th>التعليق</th>

                                    <!--<th class="hidden-print">حذف</th>-->
                                </tr>
                            </thead>
                            <tbody>

                                {assign var=quantity value=0}
                                {assign var=total value=0}
                                {foreach $arrContainer as $data}

                                <tr>

                                    <td> {$data.itra} </td>
                                    <td>{$data.storeName}</td>
                                    <td>{$data.productName}</td>
                                    <td>{$data.distroyQuantity}</td>
                                    <td> {$data.price} </td>
                                    <td> {$data.distroyQuantity*$data.price} </td>
                                    <td> {$data.date} </td>
                                    <td> {$data.note} </td>

                                    <!--                                            <a href="incomeController.php?do=delete&id={$data->incomeId}&action={$data->dailyentryid}" name="dd"  type="button" class="btn btn-default btn-lg deleteicon"
                                                                                   onclick="getValue({$data->incomeId});"> </a> </td>-->
                                </tr>
                                {assign var=quantity value=$quantity+$data.distroyQuantity}
                                {assign var=total value=$total+{$data.distroyQuantity*$data.price}}
                                {/foreach}

                            </tbody>

                            {if $Usergroupdata->hideBillPrices != 1}
                            <tfoot style="background-color: #ddd;">
                                <tr>

                                    <td colspan="3" style="text-align: center">الاجمالى</td>
                                    <td> {$quantity} </td>
                                    <td>-</td>
                                    <td>{$total}</td>
                                    <td colspan="2"></td>
                                </tr>

                            </tfoot>
                            {/if}

                        </table>
                        {/if}
                    </div>
                </div>
            </div>
        </div>

