{literal}<html dir="rtl">
    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>GT4</title>
        <style type="text/css">
        </style>
    </head>
    <script src="../views/default/assets/js/jquery.js"></script>



    <script language="javascript" type="text/javascript">
        /*$(document).ready(function() {
         //window.print();
         printDiv();
         });*/
        function printDiv() {
            var divId = document.getElementById('printdiv');
            divId.setAttribute("className", "print_section print");
            divId.setAttribute("class", "print_section print");
            window.print();
            setTimeout(window.close, 0);
            // window.close();
        }
    </script>
    <style>
        .td td
        {
            border-right-widtd: 1px;
            border-bottom-widtd: 1px;
            border-left-widtd: 0px;
            border-top-style: none;
            border-right-style: dotted;
            border-bottom-style: solid;
            border-left-style: none;
            border-bottom-color: #999;
            font-size: 15px;
            border-right-color: #999;
        }
        .NEE
        {
            font-size: 14px;
        }
        .newdesign
        {
            font-size: 14px;
        }
        .copywrites
        {
            font-size: 11px;
        }
        .hidden{
            display: none;
        }
    </style>
    <style>
        .td td
        {
            border:1px solid #444;
            font-size: 15px;
            border-right-color: #999;
        }
        .NEE
        {
            font-size: 14px;
        }
        .newdesign
        {
            font-size: 14px;
        }
        .copywrites
        {
            font-size: 11px;
        }
        .style2 {
            font-family: tahoma
        }
        .style4 {font-family: tahoma; font-size: 12px; font-weight: bold; }
        .serial {
            background-color: #C8C8C8;
            height: 20px;
            width: 150px;
            padding: 5px;
            margin: 5px;
            border: medium double #000000;
            text-align: center;
        }
        .style1 {
            font-size: 12px
        }
        .table-data td{
            border:1px solid #444;
            text-align: center
        }
    </style>
    {/literal}
    <body  onLoad="printDiv()">


        <div id="printdiv" >
            {if {$billsettingsData[25]->billsettingsvalue} eq 0}





            <table width="100%" border="0"  cellpadding="0" cellspacing="0" class="table-black">
                <tr>
                    <!-- <td colspan="2"><div {if {$billsettingsData[15]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} class="serial">{$returnbuybillData->returnbuybillid}</div></td> -->

                    <td colspan="" align="right" class="style1" {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                        {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                        <img src="../views/default/images/upload/{$Programsettingdata->logo}" alt="" width="134" height="49"><br>
                        {$Programsettingdata->phone}
                        {else}
                        <img src="../views/default/images/branch_image/{$branchData->logo}" alt="" width="134" height="49"><br>
                        {$branchData->mobile}
                        {/if}
                    </td>
                </tr>
            </table>
            <div {if $billsettingsData[70]->billsettingsvalue == 0}{else}  style="display:none"{/if}>
                <h3  style="text-align:center">{$billnameAddData->name}</h3>
            </div>
            <table style="width:100%">
                <tr>
                    <td align="right" >
                        <span>  التاريخ:</span>
                        <span>{$returnbuybillData->returnbuybilldate}</span>
                    </td>
                </tr>
                <tr align="right">
                    <td>
                        <span>  المخزن:</span>
                        <span>{if {$billsettingsData[27]->billsettingsvalue} eq 0} {$returnbuybillData->storeName}{/if}</span>
                    </td>
                    <td>
                        <span class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{if {$billsettingsData[18]->billsettingsvalue} eq 0} دين قبل :{$returnbuybillData->returnbuybilltotaldeptbefor} {/if}</span>
                    </td>
                <tr align="right">
                    <td {if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >
                        <span>  المورد:</span>
                        <span>{$returnbuybillData->suppliername}</span>
                    </td>
                    <td {if {$billsettingsData[22]->billsettingsvalue} eq 0}{else} style="display:none !important" {/if}>
                        <span>  التعليق:</span>
                        <span> {$returnbuybillData->comment}</span>
                    </td>
                </tr>
            </table>

            <table width="100%"  cellpadding="0" cellspacing="0" class="table-data">
                <tr>
                    <td align="right" bgcolor="#B4B4B4" class="style4">م </td>
                    <td width="50%" align="center" bgcolor="#B4B4B4" class="style4">اسم المنتج</td>
                    <td align="center" bgcolor="#B4B4B4" class="style4" {if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>الباركود</td>
                    <td align="center" bgcolor="#B4B4B4" class="style4"{if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>الملاحظة</td>
                    <td align="center" bgcolor="#B4B4B4" class="style4"{if {$billsettingsData[21]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>الوحدة</td>
                    <td align="center" bgcolor="#B4B4B4" class="style4">الكمية</td>
                    <td align="center" bgcolor="#B4B4B4" class="style4"  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if} >{$Programsettingdata->scunitname}</td>
                    <td align="center" bgcolor="#B4B4B4" class="style4 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">السعر</td>
                    <td align="center" bgcolor="#B4B4B4" class="style4 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}"{if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>الخصم</td>
                    <td align="center" bgcolor="#B4B4B4" class="style4 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">الاجمالي</td>
                </tr>
                {foreach $returnbuybilldetailData as $detail}
                <tr>
                    <td align="center" class="style2">{$detail@index+1}</td>
                    <td align="right" class="style2 style1">{$detail->productName}/{$detail->productCatName}
                        {if {$billsettingsData[79]->billsettingsvalue} eq 0}
                        {if isset($detail->sizeName) && $detail->sizeName !=""}/{$detail->sizeName}{/if}
                        {if isset($detail->colorName) && $detail->colorName !=""}/{$detail->colorName}{/if}
                        {/if}
                    </td>
                    <td align="center" class="style2 style1"{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$detail->parcode}</td>
                    <td align="center" class="style2 style1"{if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$detail->note}</td>
                    <td align="center" class="style2 style1"{if {$billsettingsData[21]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$detail->unitName}</td>
                    <td align="center" class="style2 style1">{$detail->returnbuybilldetailquantity}</td>
                    <td align="center" class="style2 style1" {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}>
                        {$detail->otherdetailquantity} </td>
                    <td align="center" class="style2 style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$detail->returnbuybilldetailprice} </td>
                    <td align="center" class="style2 style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}"{if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$detail->discountvalue} </td>
                    <td align="center" class="style2 style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$detail->returnbuybilldetailtotalprice} </td>
                </tr>
                {/foreach}
            </table>
            <table width="100%" cellpadding="0" cellspacing="0" class="table-data {if $Usergroupdata->hideBillPrices == 1}hidden{/if}" style="margin-top: 5px;direction: ltr">
                <tr>
                    {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                    <td width="14%" align="center" bgcolor="#B4B4B4"  >الدين بعد</td>
                    {/if}
                    <!-----------الباقى ------------------->
                    {if {$billsettingsData[30]->billsettingsvalue} eq 0}
                    <td width="10%" align="center" bgcolor="#B4B4B4">الباقي</td>
                    {/if}


                    <!-----------المدفوع ------------------->
                    {if {$billsettingsData[29]->billsettingsvalue} eq 0}
                    <td width="8%" align="center" bgcolor="#B4B4B4">المدفوع</td>
                    {/if}

                    <!---------------------الصافي----------------->
                    {if {$billsettingsData[28]->billsettingsvalue} eq 0}
                    <td width="9%" align="center" bgcolor="#B4B4B4">الصافي</td>
                    {/if}


                    <!---------------------ضريبه المبيعات----------------->
                    {if {$billsettingsData[36]->billsettingsvalue} eq 0}
                    <td width="9%" align="center" bgcolor="#B4B4B4">ضريبه القيمة المضافة</td>
                    {/if}



                    {if  {$returnbuybillData->returnbuybilldiscount} > 0}
                    <td width="8%" align="center" bgcolor="#B4B4B4">قيمة الخصم</td>
                    <td width="8%" align="center" bgcolor="#B4B4B4">نوع الخصم</td>
                    {/if}
                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">الاجمالي</td>
                    <td width="9%" align="center" bgcolor="#B4B4B4" class="style1">عدد الوحدات</td>

                </tr>
                <tr>
                    {if {$returnbuybillData->returnbuybilltotaldeptafter} <> 0}
                    <td align="center" class="style1" {if {$billsettingsData[19]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$returnbuybillData->returnbuybilltotaldeptafter}</td>
                    {/if}
                    <!-----------الباقى -->
                    {if {$billsettingsData[30]->billsettingsvalue} eq 0}
                    <td align="center" class="style1">{$returnbuybillData->returnbuybillfinalbill}</td>
                    {/if}
                    <!-----------المدفوع-->
                    {if {$billsettingsData[29]->billsettingsvalue} eq 0}
                    <td align="center" class="style1">{$returnbuybillData->returnbuybilltotalpayed}</td>
                    {/if}

                    <!---------------------الصافي-->
                    {if {$billsettingsData[28]->billsettingsvalue} eq 0}
                    <td align="center" class="style1">{$returnbuybillData->returnbuybillaftertotalbill}</td>
                    {/if}

                    {if {$billsettingsData[36]->billsettingsvalue} eq 0}
                    <td align="center" class="style1">{$returnbuybillData->payedtax}</td>
                    {/if}
                    {if  {$returnbuybillData->returnbuybilldiscount} > 0}
                    <td align="center" class="style1">{$returnbuybillData->returnbuybilldiscount} </td>
                    <td align="center" class="style1">{if $returnbuybillData->returnbuybilldiscountrype eq 0}
                        مباشر
                        {else}
                        بنسبة
                        {/if} </td>
                    {/if}
                    <td align="center" class="style1">{$returnbuybillData->returnbuybilltotalbill}</td>
                    <td align="center" class="style1">{$countBillDetails}</td>
                </tr>
            </table>
            <div {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if} style="text-align:center;margin-top:5px">
                <strong style="margin-top: 5px">
                    {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                    {$Programsettingdata->address}
                    {else}
                    {$branchData->branchAddress}
                    {/if}
                </strong>
                <p style="margin: 2px"><span style="text-align:center">تصميم شركة جي تي فور 01110070882</span></p>
            </div>
        </table>

        {else}

        <table  width="97%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-black">
            <tr>
                <td width="148" height="115" align="left" valign="middle">&nbsp;</td>
                <td width="142" colspan="2" align="right" valign="top" {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}><p><strong>
                            {if $billsettingsData[72]->billsettingsvalue == 0||$userData->branchId == 0 || $userData->branchId == -1}
                            <img src="../views/default/images/upload/{$Programsettingdata->logo}" alt="" width="122" height="75"><br>
                            {$Programsettingdata->phone}<br>
                            {else}
                            <img src="../views/default/images/branch_image/{$branchData->logo}" alt="" width="122" height="75"><br>
                            {$branchData->mobile}<br>
                            {/if}
                            </td>
                            </tr>

                            <tr><td></td><td>
                                    <table align="right" width="90%">
                                        <tr {if $billsettingsData[69]->billsettingsvalue == 0}{else}  style="display:none"{/if}>
                                            <td   align="right" class="style1" dir="rtl">
                                                <h1  style="float:right; text-align:right">{$billnameAddData->name}</h1>
                                            </td>
                                            <td>  </td>
                                        </tr>


                                        <tr {if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                            <td></td>
                                            <td  align="right">{$returnbuybillData->suppliername}</td>
                                            <td  align="right"> : اسم المورد </td>
                                        </tr>
                                        <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$billsettingsData[18]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                            <td></td>
                                            <td  align="right">{$returnbuybillData->returnbuybilltotaldeptbefor}</td>
                                            <td  align="right"> : الدين قبل </td>
                                        </tr>
                                        <tr  {if {$billsettingsData[15]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                            <td></td>
                                            <td  align="right"> {$returnbuybillData->returnbuybillid}</td>
                                            <td  align="right"> : رقم الفاتورة</td>
                                        </tr>
                                        <tr  >
                                            <td></td>
                                            <td  align="right"> {$returnbuybillData->returnbuybillSerial}</td>
                                            <td  align="right"> : رقم عمليه السداد</td>
                                        </tr>
                                        <tr>
                                            <td></td>
                                            <td  align="right">{$returnbuybillData->returnbuybilldate}</td>
                                            <td  align="right" > : تاريخ البيان</td>
                                        </tr>


                                        {if {$billsettingsData[27]->billsettingsvalue} eq 0}

                                        <tr>
                                            <td></td>
                                            <td  align="right">{$returnbuybillData->storeName}</td>
                                            <td  align="right" > : اسم المخزن</td>
                                        </tr>
                                        {/if}
                                        {if {$billsettingsData[22]->billsettingsvalue} eq 0}

                                        <tr>
                                            <td></td>
                                            <td  align="right">{$returnbuybillData->comment}</td>
                                            <td  align="right" > : التعليق</td>
                                        </tr>
                                        {/if}

                                    </table>
                                </td>
                            </tr>
                            <tr>


                                <td colspan="3" class="td"align="right">
                                    <table width="100%" border="0" cellpadding="0" cellspacing="0" dir="rtl" class="table-black">

                                        <tr>
                                            <td align="center"{if {$billsettingsData[59]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if} class="wdt120">الباركود</td>

                                            <td align="center" c>اسم المنتج</td>

                                            <td  align="center"{if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >ملاحظات</td>

                                            <td align="center" {if {$billsettingsData[21]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >الوحدة</td>
                                            <td align="center">العدد</td>
                                            <td align="center"   {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if} >{$Programsettingdata->scunitname}</td>

                                            <td align="center" class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">السعر</td>

                                            <td align="center" class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >الخصم</td>
                                            <td align="center" class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}"> الاجمالى</td>


                                        </tr>



                                        {foreach $returnbuybilldetailData as $detail}
                                        <tr>

                                            <td {if {$billSettingsData[59]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>

                                                {$detail->parcode}

                                            </td>

                                            <td>

                                                {$detail->productName} / {$detail->productCatName}
                                                {if {$billsettingsData[79]->billsettingsvalue} eq 0}
                                                {if isset($detail->sizeName) && $detail->sizeName !=""}/{$detail->sizeName}{/if}
                                                {if isset($detail->colorName) && $detail->colorName !=""}/{$detail->colorName}{/if}
                                                {/if}

                                            </td>


                                            <td {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else}  style="display:none !important"  {/if}>

                                                {$detail->note}

                                            </td>


                                            <td {if {$billsettingsData[21]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>

                                                {$detail->unitName}

                                            </td>




                                            <td>

                                                {$detail->returnbuybilldetailquantity}

                                            </td>
                                            <td  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}>
                                                {$detail->otherdetailquantity}
                                            </td>

                                            <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">

                                                {$detail->returnbuybilldetailprice} {$currency}

                                            </td>



                                            <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>

                                                {$detail->discountvalue}

                                            </td>


                                            <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">

                                                {$detail->returnbuybilldetailtotalprice}

                                            </td>





                                        </tr>

                                        {/foreach}

                                    </table>
                                </td>
                            </tr>
                            <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                <td height="54" colspan="3" align="right"><table width="50%" border="0" align="left" cellpadding="0" cellspacing="0"  dir="rtl" class="td">

                                        <tr>
                                            <td>اجمالي الفاتوره</td>
                                            <td>{$returnbuybillData->returnbuybilltotalbill}</td>
                                        </tr>
                                        <tr {if {$billsettingsData[58]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                            <td>اجمالي  القطع</td>
                                            <td>{$countBillDetails}</td>
                                        </tr>

                                        {if  {$returnbuybillData->returnbuybilldiscount} > 0}
                                        <tr {if {$billsettingsData[57]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                            <td>نوع الخصم</td>
                                            <td>
                                                {if $returnbuybillData->returnbuybilldiscountrype eq 0}
                                                مباشر
                                                {else}
                                                بنسبة
                                                {/if}
                                            </td>
                                        </tr>

                                        <tr {if {$billsettingsData[57]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                            <td>قيمه الخصم</td>
                                            <td>  {$returnbuybillData->returnbuybilldiscount} </td>
                                        </tr>
                                        <tr>
                                            <td>المبلغ بعد الخصم</td>
                                            <td>{$returnbuybillData->returnbuybillaftertotalbill} {$currency}</td>
                                        </tr>
                                        {/if}

                                        <!---------------------ضريبه المبيعات----------------->
                                        {if {$billsettingsData[36]->billsettingsvalue} eq 0}
                                        <tr>
                                            <td>  ضريبه القيمة المضافة</td>
                                            <td>{$returnbuybillData->payedtax} %</td>
                                        </tr>
                                        {/if}

                                        <!---------------------الصافي----------------->
                                        {if {$billsettingsData[28]->billsettingsvalue} eq 0}
                                        <tr>
                                            <td>  الصافي</td>
                                            <td>{$returnbuybillData->returnbuybillaftertotalbill} {$currency}</td>
                                        </tr>
                                        {/if}
                                        <!-----------المدفوع ------------------->
                                        {if {$billsettingsData[29]->billsettingsvalue} eq 0}
                                        <tr>

                                            <td>المدفوع</td>
                                            <td> {$returnbuybillData->returnbuybilltotalpayed}{$currency}</td>
                                        </tr>
                                        {/if}

                                        <!-----------الباقى ------------------->
                                        {if {$billsettingsData[30]->billsettingsvalue} eq 0}
                                        <tr>
                                            <td>المتبقى</td>
                                            <td>{$returnbuybillData->returnbuybillfinalbill} {$currency}</td>
                                        </tr>
                                        {/if}

                                        {if {$returnbuybillData->returnbuybilltotaldeptafter} <> 0}
                                        <tr {if {$billsettingsData[19]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                            <td>إجمالى المديونيه</td>
                                            <td>{$returnbuybillData->returnbuybilltotaldeptafter}{$currency}</td>
                                        </tr>
                                        {/if}
                                        <tr>
                                            <td colspan="2" valign="bottom">&nbsp;</td>
                                        </tr>

                                    </table>
                                </td>
                            </tr>
                            <tr {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                                <td colspan="3" align="right"><p class="NEE"><strong>
                                            {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                                            {$Programsettingdata->address}
                                            {else}
                                            {$branchData->branchAddress}
                                            {/if}
                                        </strong></p></td>
                            </tr>
                            <tr>
                                <td colspan="3" align="right">

                                    <p><span class="copywrites"><span class="copywrites">تصميم شركة جي تي فور 01110070882...</span></span></p></td>
                            </tr>
        </table>
        {/if}
    </div>
</body>
