<style>
    .cust{
        background-color: #ffa4a4;
        padding: 7px;
        text-align: center;
        font-size: 15px;
        font-weight: bold;
    }
    @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,.panel-heading, 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
        }
    }
</style>

{if $countRetunSell neq '0' }
<div class="row">
    <div class="container">

        <div class="panel panel-default panel-m">

            <table class="table table-black">
                <tbody>

                    <tr >
                        <th  colspan="8">
                            <div class="cust">تقرير  مردودات المبيعات</div>
                        </th>

                    </tr>
                </tbody>
            </table>
            <br />

            <div class="col-lg-offset-16 col-lg-3 ">
                <div class="well well-sm">
                    <h4 class="text-center">عدد القطع المردوده:  {$returntotalQTY}</h4>
                </div>
            </div>

            <div class="col-lg-offset-16 col-lg-3 ">
                <div class="well well-sm">
                    <h4 class="text-center">إجمالي المردودات:  {$returntotalBills}</h4>
                </div>
            </div>

            <div class="col-lg-offset-16 col-lg-3 ">
                <div class="well well-sm">
                    <h4 class="text-center">إجمالي الخصومات:  {$returntotaldiscount}</h4>
                </div>
            </div>

            <div class="col-lg-offset-16 col-lg-3 ">
                <div class="well well-sm">
                    <!--h4 class="text-center">إجمالي ضرائب المبيعات:  {$returntotaltax}</h4-->
                    <h4 class="text-center"> اجمالى المدفوع : {$totalpayed}</h4>
                </div>
            </div>

            <table class="table table-black dataTableClass22">


                <thead>
                    <tr>
                        <th>رقم الفاتورة</th>
                        <th>تاريخ الفاتورة</th>

                        <th>العميل</th>
                        <th>المستخدم</th>
                        <th>{if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if}</th>
                        <th>اجمالى الفاتورة</th>

                        <th>الخصم</th>
                        <!--<th>ضريبه المبيعات</th>-->
                        <th>المدفوع</th>
                        <th>عدد القطع</th>

                        <th class="hidden-print">تفاصيل الفاتورة</th>
                    </tr>
                </thead>
                <tbody>
                    {foreach $returnsellbillData as $returnsellbill}

                    {if {$returnsellbill->conditions} <> 1}
                    {if {$returnsellbill->conditions} eq 1}
                    <tr class="danger"> {elseif {$returnsellbill->conditions} eq 0}

                    <tr> {/if}
                        <td>{$returnsellbill->returnsellbillid}</td>
                        <td>{$returnsellbill->returnsellbilldate}</td>
                        <td> {if {$returnsellbill->clientname} eq ""}
                            نقدى
                            {else}
                            {$returnsellbill->clientname}
                            {/if} </td>
                        <td>{$returnsellbill->username}</td>
                        <td>{$returnsellbill->employeename}</td>
                        <td>{$returnsellbill->returnsellbillaftertotalbill}</td>
                        <td>{$returnsellbill->sellbilldiscount}{$returnsellbill->returnsellbilldiscount}</td>
                        <!--<td>{$returnsellbill->tax} </td>-->
                        <td>{$returnsellbill->returnsellbilltotalpayed}{$returnsellbill->sellbilltotalpayed}</td>
                        <td>{$returnsellbill->returnsellQuantity}</td>

                        <td class="hidden-print">
                            {if $returnsellbill->type eq "returnSell"}
                            <a href="returnsellbillController.php?do=showDetail&returnsellbillid={$returnsellbill->returnsellbillid}" type="button" class="btn btn-default btn-lg editicon"></a> </td>
                        {else if $returnsellbill->type eq "sellAndReturn"}
                <a href="sellbillandruternController.php?do=showDetail&sellbillid={$returnsellbill->returnsellbillid}" type="button" class="btn btn-default btn-lg editicon"></a> </td>
                {/if}

                </tr>
                {/if}
                {/foreach}

                </tbody>

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

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