
<html>
    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>GT4</title>
        <style type="text/css">
            @media print {
                @page {
                    size: 100mm 200mm landscape; /* landscape */
                    /* you can also specify margins here: */
                    margin: 5mm;
                    margin-right:5mm; /* for compatibility with both A4 and Letter */
                }
                #printdiv{
                    margin-top:{$billsettingsData[82]->billsettingsvalue}mm; /* user margin */
                }
            }

        </style>
    </head>
    <script src="../views/default/assets/js/jquery.js"></script>


    {literal}
    <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>

        span.copywrites1 {
            font-size: 13px;
            margin: 0;
        }
        .td td
        {
            border-right-widtd: 1px;
            border-bottom-widtd: 1px;
            border-left-widtd: 0px;
            border-top-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;
        }
        .data-border td{border:1px solid #444}
    </style>
    <style>
        .td td
        {
            border-right-widtd: 1px;
            border-bottom-widtd: 1px;

            font-size: 15px;
        }
        .NEE
        {
            font-size: 14px;
        }
        .newdesign
        {
            font-size: 14px;
        }
        .copywrites
        {
            font-size: 11px;
        }
        .style2 {
        }
        .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 #444;
            text-align: center;
        }
        .style1 {
            font-size: 14px;
            font-weight: bold;
        }
        .data-border td{border:1px solid #444;text-align: center}
    </style>
    {/literal}


    <body   onLoad="printDiv()">
        <div id="printdiv" >
            <table width='100%'>
                <tr {if $billsettingsData[70]->billsettingsvalue == 0}{else}  style="display:none"{/if}>

                    <td  colspan="6" align="center" style=" text-align:  center !important" class="style1">
                        <h2 style="margin: 0">{$billnameAddData->name}</h2>
                    </td>

                </tr>

            </table>
            <strong>
                {if {$billsettingsData[25]->billsettingsvalue} eq 0}

                <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-black" style="margin-bottom: 10px">
                    <tr>
                        <td colspan="2"><!--div {if {$billsettingsData[15]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} class="serial"> {$sellbillandruternData->sellbillid}</div--></td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td colspan="2" align="right" class="" {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>

                <table width='50%' style="float:right;direction: rtl" >
                    <tr>
                        <td  align="right" nowrap >
                            <span class="style1 style2">التاريخ :</span>
                            <span>{$sellbillandruternData->sellbilldate}</span>

                        </td>

                    </tr>
                    <tr>
                        <td colspan="2" align="right" {if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >
                            <span>السيد :</span>
                            <span>{$sellbillandruternData->tempclientName}</span>
                        </td>
                    </tr>
                </table>
                <table width='45%' style="float:left;direction: rtl">
                    <tr {if {$billsettingsData[3]->billsettingsvalue} eq 0} style="display:block" {else} style="display:none" {/if}>
                        <td  align="right" >
                            <span>{if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if} :</span>
                            <span> {$sellbillandruternData->employeename}</span>
                        </td>

                    </tr>
                    <tr>
                        <td align="right">

                            {if {$billsettingsData[27]->billsettingsvalue} eq 0} {$sellbillandruternData->storeName}{/if} </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <span> {if {$billsettingsData[18]->billsettingsvalue} eq 0} (ح/س):</span>
                            <span>{$sellbillandruternData->sellbilltotaldeptbefor} {/if}</span></td>
                    </tr>


                </table>
                <div style="clear:both"></div>

                <table width="100%" align="right">
                    <tr>
                        <td  colspan="6" align="center" style=" text-align:  center !important" class="style1">
                            <h3>المبيعات</h3>
                        </td>

                    </tr>
                </table>

                <div style="clear:both"></div>
                <table width="100%" class="data-border" style="border:1px solid #ddd" cellpadding="0" cellspacing="0">

                    <tr>
                        <td align="center" bgcolor="#B4B4B4" class="style4">الاجمالي</td>
                        <td align="center" bgcolor="#B4B4B4" class="style4"{if {$billsettingsData[23]->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">الكمية</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"{if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>الملاحظة</td>
                        <td align="center" bgcolor="#B4B4B4" class="style4" {if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>الباركود</td>
                        <td width="50%" align="center" bgcolor="#B4B4B4" class="style4">اسم المنتج</td>
                        <td align="right" bgcolor="#B4B4B4" class="style4">م </td>
                    </tr>
                    {foreach $sellbilldetailData as $mysellbilldetailData}
                    <tr>
                        <td align="center" class="style2 style1"> {$mysellbilldetailData->sellbilldetailtotalprice} </td>
                        <td align="center" class="style2 style1"{if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>


                            {if {$billsettingsData[34]->billsettingsvalue} eq 0}{$mysellbilldetailData->discountvalue} {else}  {$mysellbilldetailData->discounttype} {/if}
                        </td>
                        <td align="center" class="style2 style1">{$mysellbilldetailData->sellbilldetailprice} </td>
                        <td align="center" class="style2 style1" {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}>
                            {$mysellbilldetailData->otherdetailquantity}
                        </td>
                        <td align="center" class="style2 style1"> {$mysellbilldetailData->sellbilldetailquantity} </td>
                        <td align="center" class="style2 style1"{if {$billsettingsData[21]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$mysellbilldetailData->unitName}</td>
                        <td align="center" class="style2 style1"{if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$mysellbilldetailData->note}</td>
                        <td align="center" class="style2 style1"{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$mysellbilldetailData->parcode} </td>
                        <td align="right" class="style2 style1">{$mysellbilldetailData->productName}/{$mysellbilldetailData->productCatName}
                            {if {$billsettingsData[79]->billsettingsvalue} eq 0}
                            {if isset($mysellbilldetailData->sizeName) && $mysellbilldetailData->sizeName !=""}/{$mysellbilldetailData->sizeName}{/if}
                            {if isset($mysellbilldetailData->colorName) && $mysellbilldetailData->colorName !=""}/{$mysellbilldetailData->colorName}{/if}
                            {/if}
                        </td>
                        <td align="center" class="style2">{$mysellbilldetailData@index+1}</td>
                    </tr>
                    {/foreach}
                </table>
                <table width="100%">
                    <tr>
                        <td colspan="9" align="center"  style=" text-align:  center !important" class="style1">
                            <h2 style="margin: 0">المردودات</h2></td>
                    </tr>
                </table>
                <table width="100%" class="data-border" style="border:1px solid #ddd" cellpadding="0" cellspacing="0">
                    <tr>
                        <td align="center" bgcolor="#B4B4B4" class="style4">الاجمالي</td>
                        <td align="center" bgcolor="#B4B4B4" class="style4"{if {$billsettingsData[23]->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">الكمية</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"{if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>الملاحظة</td>
                        <td align="center" bgcolor="#B4B4B4" class="style4" {if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>الباركود</td>
                        <td width="50%" align="center" bgcolor="#B4B4B4" class="style4">اسم المنتج</td>
                        <td align="right" bgcolor="#B4B4B4" class="style4">م </td>
                    </tr>

                    {foreach $ruternbilldetailData as $myruternbilldetailData}
                    <tr>
                        <td align="center" class="style2 style1"> {$myruternbilldetailData->sellbilldetailtotalprice} </td>
                        <td align="center" class="style2 style1"{if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>



                            {if {$billsettingsData[34]->billsettingsvalue} eq 0}{$myruternbilldetailData->discountvalue} {else}  {$myruternbilldetailData->discounttype} {/if}

                        </td>
                        <td align="center" class="style2 style1">{$myruternbilldetailData->sellbilldetailprice}</td>
                        <td align="center" class="style2 style1" {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}>
                            {$myruternbilldetailData->otherdetailquantity}
                        </td>
                        <td align="center" class="style2 style1"> {$myruternbilldetailData->sellbilldetailquantity} </td>
                        <td align="center" class="style2 style1"{if {$billsettingsData[21]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>&nbsp;{$myruternbilldetailData->unitName} </td>
                        <td align="center" class="style2 style1"{if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>&nbsp;{$myruternbilldetailData->note}</td>
                        <td align="center" class="style2 style1"{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>

                            {$myruternbilldetailData->parcode} </td>
                        <td align="right" class="style2 style1"> {$myruternbilldetailData->productName}/{$myruternbilldetailData->productCatName}
                            {if {$billsettingsData[79]->billsettingsvalue} eq 0}
                            {if isset($myruternbilldetailData->sizeName) && $myruternbilldetailData->sizeName !=""}/{$myruternbilldetailData->sizeName}{/if}
                            {if isset($myruternbilldetailData->colorName) && $myruternbilldetailData->colorName !=""}/{$myruternbilldetailData->colorName}{/if}
                            {/if}
                        </td>
                        <td align="center" class="style2">{$myruternbilldetailData@index+1}</td>
                    </tr>
                    {/foreach}

                </table>
                </tr>
                </table>
                <hr style="margin-bottom: 0">
                <table>
                    <tr>
                        <td colspan="3"><table class="data-border" width="100%" border="0" cellpadding="0" cellspacing="0">
                                <tr>


                                    <!-----------الدين بعد ------------------->

                                    {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                                    <td width="14%" align="center" bgcolor="#B4B4B4" class="style1">الدين بعد</td>
                                    {/if}


                                    <!---------------------الباقي----------------->
                                    {if {$billsettingsData[30]->billsettingsvalue} eq 0}
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">الباقي</td>
                                    {/if}


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


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

                                    {if $billnameAddData->taxOfDiscountPrint eq 0}
                                    <td width="9%" align="center" bgcolor="#B4B4B4">ضريبه خصم </td>

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

                                    {/if}


                                    {if  $sellbillandruternData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 0}
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">خصم اضافى</td>
                                    {/if}
                                    {if  {$sellbillandruternData->sellbilldiscount} > 0}
                                    <td width="8%" align="center" bgcolor="#B4B4B4" {if {$billsettingsData[47]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>قيمة الخصم</td>
                                    <!--<td width="5%" align="center" bgcolor="#B4B4B4">نوع الخصم</td>-->
                                    {/if}
                                    {if  $sellbillandruternData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 1}
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">خصم اضافى</td>
                                    {/if}
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">عدد المرتجع</td>
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">عدد البيع</td>
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">الاجمالي</td>
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">اجمالي مردود</td>
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">اجمالي بيع</td>
                                </tr>
                                <tr>


                                    <!----------   الدين بعد--------------------->
                                    {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                                    <td align="center" class="style1"   >{$sellbillandruternData->sellbilltotaldeptafter}</td>
                                    {/if}

                                    <!---------------------الباقي----------------->
                                    {if {$billsettingsData[30]->billsettingsvalue} eq 0}
                                    <td align="center" class="style1">{$sellbillandruternData->sellbillfinalbill}</td>
                                    {/if}

                                    <!-----------المدفوع ------------------->
                                    {if {$billsettingsData[29]->billsettingsvalue} eq 0}
                                    <td align="center" class="style1">{$sellbillandruternData->sellbilltotalpayed}</td>
                                    {/if}


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

                                    {/if}

                                    {if $billnameAddData->taxOfDiscountPrint eq 0}
                                    <td align="center" class="style1">{$sellbillandruternData->taxOfDiscountVal}</td>
                                    {/if}
                                    {if {$billsettingsData[31]->billsettingsvalue} eq 0}
                                    <td align="center" class="style1">{$totaltax} ({$sellbillandruternData->tax}%)</td>
                                    {/if}

                                    {if  $sellbillandruternData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 0}
                                    <td align="center" class="style1">{$sellbillandruternData->extraDiscountVal}</td>
                                    {/if}
                                    {if  {$sellbillandruternData->sellbilldiscount} > 0}
                                    <td align="center" class="style1" {if {$billsettingsData[47]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                        {$discountvalue} {if $sellbillandruternData->sellbilldiscounttype eq 2}(%{$sellbillandruternData->sellbilldiscount}){/if}

                                    </td>
                                    <!--                                    <td align="center" class="style1"> {if {$sellbillandruternData->sellbilldiscounttype} eq 1}
                                                                            مباشر
                                                                            {else}
                                                                            بنسبة
                                                                            {/if} </td>-->
                                    {/if}
                                    {if  $sellbillandruternData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 1}
                                    <td align="center" class="style1">{$sellbillandruternData->extraDiscountVal}</td>
                                    {/if}
                                    <td align="center" class="style1"> {if {$sellbillandruternData->returnsellQuantity} <= 0}
                                        {$returnQuantity}
                                        {else}
                                        {$sellbillandruternData->returnsellQuantity}
                                        {/if} </td>
                                    <td align="center" class="style1"> {if {$sellbillandruternData->sellQuantity} <= 0}
                                        {$sellQuantity}
                                        {else}
                                        {$sellbillandruternData->sellQuantity}
                                        {/if} </td>
                                    <td align="center" class="style1">{$sellbillandruternData->sellbilltotalbill}</td>

                                    <td align="center" class="style1">{$sellbillandruternData->returnsellbillprice}</td>
                                    <td align="center" class="style1">{$sellbillandruternData->sellbillprice}</td>
                                </tr>
                            </table></td>
                    </tr>
                </table>
                <table>
                    {if {$billsettingsData[43]->billsettingsvalue} eq 0}

                    <tr>

                        <td >توقيع العميل </td> <td></td><td></td><td></td><td></td><td >توقيع ال{if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if} </td><td></td><td>{$billnameAddData->goodsReceiptApproval}</td>
                    </tr>

                    {/if}
                </table>
                <br><br>
                <div style="text-align: center;{if $billsettingsData[72]->billsettingsvalue == 2}display:none;{/if}"><span class="" style="direction:rtl"><strong>
                            {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                            {$Programsettingdata->address}
                            {else}
                            {$branchData->branchAddress}
                            {/if}
                        </strong></span></div>
                <div  style="text-align:center !important;{if $billsettingsData[81]->billsettingsvalue == 1}display:none{/if}" ><span class="copywrites1">تصميم شركة جي تي فور 01110070882</span></div>
                {else}



                <table  width="97%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-black">
                    <tr>
                        <!-- <td width="851"  align="left" valign="middle">&nbsp;</td> -->
                        <td width="1614" 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="65"><br>
                                    {$Programsettingdata->phone}<br>
                                    {else}
                                    <img src="../views/default/images/branch_image/{$branchData->logo}" alt="" width="122" height="65"><br>
                                    {$branchData->mobile}<br>
                                    {/if}
                                    </td>
                                    </tr>

                                    </table>
                                    <table width="50%;float:right" align="right" style="direction: rtl">
                                        {if $Programsettingdata->clientserial eq 1}

                                        <tr >
                                            <td  align="right">
                                                <span> رقم  تسلسل الفاتورة:</span>
                                                <span> {$sellbillandruternData->sellbillid}</span>
                                            </td>
                                        </tr>
                                        {/if}


                                        <tr {if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                            <td  align="right">
                                                <span> اسم العميل:</span>
                                                <span>{$sellbillandruternData->tempclientName}</span>
                                            </td>
                                        </tr>

                                        <tr>
                                            <td  align="right" >
                                                <span> تاريخ البيان:</span>
                                                <span>{$sellbillandruternData->sellbilldate}</span>
                                            </td>
                                        </tr>

                                    </table>
                                    <table width="45%;float:left" align="right">


                                        {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                                        <tr  >
                                            <td  align="right">
                                                <span> الدين قبل:</span>
                                                <span>{$sellbillandruternData->sellbilltotaldeptbefor} {$currency}</span>
                                            </td>
                                        </tr>
                                        {/if}

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


                                    </table>
                                    <div style="clear:both"></div>

                                    <table style="width:100%;text-align:center">
                                        <tr >  <td  align="center" colspan="8" style="background:#CCCCCC"> المبيعات </td></tr>
                                    </table>
                                    <table width="100%" border="0" cellpadding="0" cellspacing="0" dir="rtl" class="table-black data-border">

                                        <tr>
                                            <td align="center">م</td>
                                            <!-- <td align="center"{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/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">السعر</td>
                                            <td align="center" {if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >الخصم</td>
                                            <td align="center"> الاجمالى</td>


                                        </tr>



                                        {foreach $sellbilldetailData as $mysellbilldetailData}
                                        <tr>
                                            <td >{$mysellbilldetailData@index+1}</td>
                                            <!-- <td {if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>

                                                {$mysellbilldetailData->parcode}

                                            </td> -->


                                            <td>

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

                                            </td>


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

                                                {$mysellbilldetailData->note}

                                            </td>


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

                                                {$mysellbilldetailData->unitName}

                                            </td>



                                            <td>

                                                {$mysellbilldetailData->sellbilldetailquantity}

                                            </td>

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

                                            <td>

                                                {$mysellbilldetailData->sellbilldetailprice}
                                                <!-- {$currency} -->

                                            </td>

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

                                                {$mysellbilldetailData->discountvalue}

                                            </td>


                                            <td>

                                                {$mysellbilldetailData->sellbilldetailtotalprice}

                                            </td>

                                        </tr>

                                        {/foreach}
                                        <tfoot>

                                        </tfoot>

                                    </table>


                                    <!------------------------------------------------------------------------------->
                                    <table style="width:100%;text-align:center">
                                        <tr >  <td  align="center" colspan="8" style="background:#CCCCCC"> المردودات </td></tr>
                                    </table>

                                    <table width="100%" border="0" cellpadding="0" cellspacing="0" dir="rtl" class="table-black data-border">

                                        <tr >
                                            <td align="center">م</td>
                                            <td align="center"{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/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[10]->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">السعر</td>
                                            <td align="center" {if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >الخصم</td>
                                            <td align="center"> الاجمالى</td>


                                        </tr>



                                        {foreach $ruternbilldetailData as $myruternbilldetailData}
                                        <tr>
                                            <td >{$myruternbilldetailData@index+1}</td>
                                            <td {if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>

                                                {$myruternbilldetailData->parcode}

                                            </td>


                                            <td>

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

                                            </td>


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

                                                {$myruternbilldetailData->note}

                                            </td>


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

                                                {$myruternbilldetailData->unitName}

                                            </td>

                                            <td>

                                                {$myruternbilldetailData->sellbilldetailquantity}

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


                                            <td>

                                                {$myruternbilldetailData->sellbilldetailprice} 
                                                <!-- {$currency} -->

                                            </td>

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

                                                {$myruternbilldetailData->discountvalue}

                                            </td>


                                            <td>

                                                {$myruternbilldetailData->sellbilldetailtotalprice}

                                            </td>

                                        </tr>

                                        {/foreach}
                                        <!--                                        <tfoot>
                                                                                    <tr>
                                                                                        <td colspan="3">الاجمالى</td>
                                                                                        <td></td>
                                                                                        <td {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}></td>
                                                                                          <td></td>
                                                                                        <td {if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}></td>
                                                                                        <td>{$sellbillandruternData->returnsellbillprice}</td>
                                                                                    </tr>
                                                                                </tfoot>-->

                                    </table>

                                    <!--------------------------------------------------------------------------------->

                                    <table width="50%" style="margin-top:5px" border="0" align="left" cellpadding="0" cellspacing="0"  dir="rtl" class="td data-border">
                                        <tr {if {$billsettingsData[46]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                            <td>عدد القطع المباعه</td>
                                            <td>
                                                {if {$sellbillandruternData->sellQuantity} <= 0}
                                                {$sellQuantity}
                                                {else}
                                                {$sellbillandruternData->sellQuantity}
                                                {/if}
                                            </td>
                                        </tr>

                                        <tr {if {$billsettingsData[46]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                            <td>عدد القطع المرتجع</td>
                                            <td>
                                                {if {$sellbillandruternData->returnsellQuantity} <= 0}
                                                {$returnQuantity}
                                                {else}
                                                {$sellbillandruternData->returnsellQuantity}
                                                {/if}

                                            </td>
                                        </tr>

                                        <tr>
                                            <td>اجمالي فاتورة البيع</td>
                                            <td>{$sellbillandruternData->sellbillprice}</td>
                                        </tr>
                                        <!--                            <tr>
                                                                        <td>اجمالي المرتجع</td>
                                                                        <td>{$sellbillandruternData->returnsellbillprice}</td>
                                                                    </tr>-->
                                        <tr>
                                        <tr>
                                            <td>اجمالي الفاتوره</td>
                                            <td>{$sellbillandruternData->sellbilltotalbill}</td>
                                        </tr>

                                        {if  $sellbillandruternData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 1}
                                        <tr>
                                            <td>خصم اضافى</td>
                                            <td>{$sellbillandruternData->extraDiscountVal}</td>
                                        </tr>
                                        {/if}
                                        {if  {$sellbillandruternData->sellbilldiscount} > 0}
                                        <!--                                        <tr {if {$billsettingsData[47]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                                                                    <td>نوع الخصم</td>
                                                                                    <td>
                                                                                        {if {$sellbillandruternData->sellbilldiscounttype} eq 1}
                                                                                        مباشر
                                                                                        {else}
                                                                                        بنسبة
                                                                                        {/if}
                                                                                    </td>
                                                                                </tr>-->




                                        <tr {if {$billsettingsData[47]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                            <td>قيمه الخصم</td>
                                            <td>  {$discountvalue} {if $sellbillandruternData->sellbilldiscounttype eq 2}(%{$sellbillandruternData->sellbilldiscount}){/if}</td>
                                        </tr>

                                        {/if}

                                        {if  $sellbillandruternData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 0}
                                        <tr>
                                            <td>خصم اضافى</td>
                                            <td>{$sellbillandruternData->extraDiscountVal}</td>
                                        </tr>
                                        {/if}

                                        {if {$billsettingsData[31]->billsettingsvalue} eq 0}
                                        <tr>
                                            <td> ضريبه القيمة المضافة</td>
                                            <td>{$totaltax}{$Programsettingdata->currancy} ({$sellbillandruternData->tax}%)</td>
                                        </tr>
                                        {/if}
                                        {if $billnameAddData->taxOfDiscountPrint eq 0}
                                        <tr>
                                            <td> ضريبه الخصم </td>
                                            <td>{$sellbillandruternData->taxOfDiscountVal}</td>
                                        </tr>
                                        {/if}


                                        <tr>
                                            <td>المبلغ بعد الخصم</td>
                                            <td>{$sellbillandruternData->sellbillaftertotalbill} {$currency}</td>
                                        </tr>
                                        <!-----------الصافى   ------------------->
                                        {if {$billsettingsData[52]->billsettingsvalue} eq 0}
                                        <tr>
                                            <td>الصافى</td>
                                            <td> {$sellbillandruternData->sellbillaftertotalbill} {$currency}</td>
                                        </tr>
                                        {/if}

                                        <!-----------المدفوع ------------------->
                                        {if {$billsettingsData[29]->billsettingsvalue} eq 0}
                                        <tr>
                                            <td>المدفوع</td>
                                            <td> {$sellbillandruternData->sellbilltotalpayed} {$currency}</td>
                                        </tr>
                                        {/if}


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

                                        {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                                        <tr >
                                            <td>إجمالى المديونيه</td>
                                            <td>{$sellbillandruternData->sellbilltotaldeptafter} {$currency}</td>
                                        </tr>
                                        {/if}


                                    </table>
                                    <div style="clear:both"></div>
                                    {if {$billsettingsData[43]->billsettingsvalue} eq 0}
                                    <table>
                                        <tr>

                                            <td >توقيع العميل </td> <td></td><td >توقيع ال{if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if} </td><td></td><td>{$billnameAddData->goodsReceiptApproval}</td>
                                        </tr>

                                        {/if}
                                        </td>
                                        </tr>
                                    </table>
                                    <div style="clear:both"></div>

                                    <div style="text-align: right;{if $billsettingsData[72]->billsettingsvalue == 2}display:none;"{/if}" 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>

                                        <div  style="text-align:center !important;{if $billsettingsData[81]->billsettingsvalue == 1}display:none{/if}">
                                            <p><span class="copywrites"><span class="copywrites">تصميم شركة جي تي فور 01110070882...</span></span></p></td>

                                            {/if}
                                            </strong>
                                        </div>
                                        </body>