<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[134]->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="freebuys.php" method="post">
                    <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>
                    <input type="hidden" name="olddatefrom" id="olddatefrom" value="{$olddatefrom}"/>
                    <input type="hidden" name="olddateto" id="olddateto" value="{$olddateto}"/>
                    <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 style="clear: both"></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/>
                    <div class="col-lg-offset-8 col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">صافى الربح {$totalsObj->netProfit} {$currency}</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;
                                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 table-black" style="width: 100%">
                        <thead>
                            <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}</td>
                                <td>{$data->soldNo}</td>
                                <td>{$data->returnNo}</td>
                                <td>{$data->netNo}</td>
                                <td><a class="showdetails" data-id="{$data->id}">تفاصيل</a></td>
                            </tr>
                            {assign var=i value=$i+1}
                            {/foreach}
                            <tr>
                                <td><span style="display: none">z</span></td>
                                <td style="text-align: center;">الاجمالى</td>
                                <td>{$totalsObj->soldNo}</td>
                                <td>{$totalsObj->returnNo}</td>
                                <td>{$totalsObj->netNo}</td>
                                <td></td>
                            </tr>
                        </tbody>

                    </table>

                    <div class="col-lg-offset-8 col-lg-4">
                        <div class="well well-sm">
                            <h4 class="text-center">صافى الربح {$totalsObj->netProfit} {$currency}</h4>
                        </div>
                    </div>

                    <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>
            $('.showdetails').live('click', function () {
                var proid = $(this).attr('data-id');
                var dfrom = $('#olddatefrom').val();
                var dto = $('#olddateto').val();
                window.location.href = "freebuys.php?do=detail&id=" + proid + "&datefrom=" + dfrom + "&dateto=" + dto;
            });
        </script>
        {/literal}