<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,
        .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
        }

        .dataTables_info,
        .dataTables_paginate,
        .dataTables_length,
        .dataTables_filter {
            display: none;
        }
    }
</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">تقرير الأصناف شراء

                <br />
                {if $message != ""}
                {$message} / {$mess}
                {/if}
                <a href="{$youtubes[66]->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="productReportsController.php?do=reportWithBuyPrice"
                    method="post">
                    <div class="form-group">
                        <label class="sr-only">تصنيفات المنتج</label>
                        <select class="select2 wdt100" name="productCatId" id="productCatId"
                            onChange="this.form.submit();">
                            <option value="-1">اختر تصنيف</option>
                            <option value="all">كل الأصناف</option>
                            {foreach $alldata as $cat}
                            <option value="{$cat->productCatId}">{$cat->productCatName}{if $cat->catParentName
                                !=""}/{$cat->catParentName}{/if}</option>
                            {/foreach}

                            {*for $j=0 to $itr*}
                            <!--<option value="{$parentId{$j}}">{$names{$j}} </option>-->
                            {*/for*}

                        </select>
                    </div>
                </form>
                {if count($productsData) >0}
            </div>
            <div class="col-lg-offset-8 col-lg-4">
                <div class="well well-sm well-print">
                    <h4 class="text-center">اجمالى الوحدات {$totalQuantity} وحدة</h4>
                </div>
            </div>
            <div class="col-lg-offset-8 col-lg-4">
                <div class="well well-sm well-print">
                    <h4 class="text-center">اجمالى السعر {$totalPrice} {$currency}</h4>
                </div>
            </div>
            <div class="clearfix"></div>
            <hr />
            <table class="table table-black dataTableClass22">
                <thead>
                    <tr>
                        <th>إسم الصنف</th>
                        <th>الكمية بالمخزن</th>
                        {if $userGroup->showstoredetailprice neq 1}
                        <th>سعر الشراء</th>
                        {/if}
                    </tr>
                </thead>
                <tbody>

                    {foreach from=$productsData item=data name=loop}
                    <tr>
                        <td>{$data->productName}

                            {if $hidecat eq 1}
                            /{$data->productCatName}
                            {/if}</td>
                        <!-- <td>{$data->productquantity}</td>-->
                        <td>{$data->sumProductQuantity}</td>
                        {if $userGroup->showstoredetailprice neq 1}
                        <td>{$data->productBuyPrice}</td>
                        {/if}
                    </tr>
                    {/foreach}

                </tbody>

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

            {if $userGroup->showstoredetailprice neq 1}
            <div class="col-lg-offset-8 col-lg-4">
                <div class="well well-sm well-print">
                    <h4 class="text-center">اجمالى السعر {$totalPrice} {$currency}</h4>
                </div>
            </div>
            {/if}
            <div class="clearfix"></div>
            <hr />
            <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">طباعة</button>
                        </div>
                    </div>
                </div>
                <div class="clearfix"></div>
            </div>
            <div class="clearfix"></div>
        </div>
    </div>
</div>

{/if}

{literal}
<script>
    $('.dataTableClass22').dataTable({
        "order"
            : [
                [4, "desc"]       // order by drug cat
            ]
    });

</script>
{/literal}