<html>
    <head>

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



            }

            .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: 22px;
                border-right-color: #999;
            }
            .NEE
            {
                font-size: 14px;
            }
            .newdesign
            {
                font-size: 14px;
            }
            .copywrites
            {
                font-size: 11px;
            }
            .hidden{
                display: none;
            }
        </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>
        td{font-size:17px;
           font-weight: 200;


        }
        .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: 20px;
            border-right-color: #999;
        }
        .NEE
        {
            font-size: 14px;
        }
        .newdesign
        {
            font-size: 14px;
        }
        .copywrites
        {
            font-size: 11px;
        }
    </style>
    <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: 20px;
            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: 14px; font-weight: bold;
                 border: 1px solid  #999  !important;
        }
        .serial {
            background-color: #C8C8C8;
            height: 20px;
            width: 150px;
            padding: 5px;
            margin: 5px;
            border: medium double #000000;
            text-align: center;
        }
        .style1 {
            font-size: 14px
        }


    </style>
    {/literal}
    <body onLoad="printDiv()">
        <div align="center" id="printdiv" >
            <b>

                <h4 style="margin:0;text-align: center">فاتورة المبيعات</h4>


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

                <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-black">
                    <tr>
                        <td colspan="2"><div {if {$billsettingsData[15]->billsettingsvalue} eq 0 &&$Programsettingdata->clientserial == 1}  {else} style="display:none !important" {/if} class="serial">{if $sellbillData->taxBillNumber > 0}{$sellbillData->taxBillNumber}{else}{$sellbillData->sellbillid}{/if}</div></td>

                        <td colspan="2" 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>
                <table>

                    <tr {if $billsettingsData[69]->billsettingsvalue == 0}{else}  style="display:none"{/if}>


                        <td align="center" class="mymargin style1" nowrap>
                            <h2  style="  text-align:center">{$billnameAddData->name}</h2>
                        </td>

                    </tr>


                </table>
                <table style="width:60%;float: right;direction: rtl">
                    <!--  <td  align="right"  dir="rtl"><!--span class="style1 style2">{if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if}</span--><!--</td>-->
                    <!--                    <tr {if $Programsettingdata->clientserial eq 1}>

                                            <td  align="right">
                                                <span> رقم  الفاتورة   :</span>
                                                <span>{if $sellbillData->taxBillNumber > 0}{$sellbillData->taxBillNumber}{else}{$sellbillData->sellbillid}{/if}</span></td>
                                            {/if}
                                        </tr>-->
                    <tr>
                        <td  align="right">
                            <span class="style1 style2">التاريخ :</span>
                            <span>{$sellbillData->sellbilldate|date_format:"%Y-%m-%d"}</span></td>
                    </tr>

                </table>
                <table style="width:40%;float: left;direction: rtl">

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

                    <tr>
                        <!--td align="right"  dir="rtl" >{if {$billsettingsData[18]->billsettingsvalue} eq 0} <span class="style1 style2"> (حساب / سابق) :{$sellbillData->sellbilltotaldeptbefor}</span> {/if}</td-->
                    <tr>
                        <td align="right">  {if {$billsettingsData[27]->billsettingsvalue} eq 0}  {$sellbillData->storeName}{/if} </td>

                    </tr>

                    <tr>

                        <td  align="right"  nowrap{if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >السيد : {$sellbillData->tempclientName}</td>
                    </tr>
                    <tr {if {$billsettingsData[101]->billsettingsvalue} eq 0}{else} style="display:none;" {/if}>
                        <td align="right">  عملية الفاتورة : {$sellbillData->billoperationName} </td>

                    </tr>
                    <tr>
                        <td align="right">  اسم المستخدم : {$billUserData->employeename} </td>
                    </tr>
                    <tr {if {$billsettingsData[22]->billsettingsvalue} eq 0}{else} style="display:none;" {/if}>
                        <td align="right">  التعليق : {$sellbillData->comment} </td>
                    </tr>
                </table>
                <table width="100%" border="1" cellpadding="" cellspacing="" class="table-black1">
                    <tr>
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" align="center" bgcolor="#B4B4B4" class="style4">اجمالى</td>
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" align="center" bgcolor="#B4B4B4" class="style4"{if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if} >الخصم</td>
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" align="center" bgcolor="#B4B4B4" class="style4">سعر</td>
                        <td align="center" bgcolor="#B4B4B4"  {if $Programsettingdata->scunitname eq '0'||$billsettingsData[67]->billsettingsvalue eq 1}  hidden {/if} >{$Programsettingdata->scunitname}</td>
                        <td align="center" bgcolor="#B4B4B4" class="style4" {if {$billsettingsData[46]->billsettingsvalue} eq 0} {else} style="display:none" {/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"
                            {if {$billsettingsData[21]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>الوحدة</td>
                        <td align="center" bgcolor="#B4B4B4" class="style4"{if {$billsettingsData[22]->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"    {/if}>الباركود</td>
                        <td width="50%" align="center" bgcolor="#B4B4B4" class="style4">اسم المنتج</td>
                        <td align="right" bgcolor="#B4B4B4" class="style4">م </td>
                    </tr>
                    {foreach $sellbilldetailData as $sellbilldetail}
                    <tr>
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" align="center" class="style2 style1"> {$sellbilldetail->sellbilldetailtotalprice} </td>
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" align="center" class="style2 style1"{if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>


                            {if {$billsettingsData[34]->billsettingsvalue} eq 0}{$sellbilldetail->discountvalue} {else}  {$sellbilldetail->discounttype} {/if}
                        </td>
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" align="center" class="style2 style1">{$sellbilldetail->sellbilldetailprice} </td>

                        <td align="center" class="style2" {if {$Programsettingdata->scunitname} eq '0'||$billsettingsData[67]->billsettingsvalue}  hidden {/if}>{$sellbilldetail->otherdetailquantity}</td>

                        <td align="center" class="style2 style1" {if {$billsettingsData[46]->billsettingsvalue} eq 0} {else} style="display:none" {/if}> {$sellbilldetail->sellbilldetailquantity} </td>
                        <td align="center" class="style2 style1"  {if {$billsettingsData[21]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>{$sellbilldetail->unitName} </td>
                        <td align="center" class="style2 style1"{if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$sellbilldetail->note} </td>
                        <td align="center" class="style2 style1"{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$sellbilldetail->parcode}</td>
                        <td align="right" class="style2 style1" style="font-size: 12px">{$sellbilldetail->productName}{if {$billsettingsData[60]->billsettingsvalue} eq 0}/{$sellbilldetail->productCatName}{/if}
                            {if {$billsettingsData[79]->billsettingsvalue} eq 0}
                            {if isset($sellbilldetail->sizeName) && $sellbilldetail->sizeName !=""}/{$sellbilldetail->sizeName}{/if}
                            {if isset($sellbilldetail->colorName) && $sellbilldetail->colorName !=""}/{$sellbilldetail->colorName}{/if}
                            {/if}

                            {if $sellbilldetail->soldSerialsInDetails != ""} (sn: {$sellbilldetail->soldSerialsInDetails}) {/if}
                        </td>
                        <td align="center" class="style2">{$sellbilldetail@index+1}</td>
                    </tr>
                    {/foreach}
                </table>
                <table width="100%" border="1" cellpadding="" cellspacing="">

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

                        {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                        <td width="10%" align="center" bgcolor="#B4B4B4" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {{$sellbillData->sellbilltotaldeptafter}} <> 0}  {else} style="display:none !important" {/if}} >اجمالى المديونيه</td>



                        {/if}

                        <!-----------الباقى ------------------->


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

                        <!-----------المدفوع ------------------->
                        {if {$billsettingsData[29]->billsettingsvalue} eq 0 && $sellbillData->sellbilltotalpayed != $sellbillData->sellbilltotalbill}
                        <!--td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="8%" align="center" bgcolor="#B4B4B4">المدفوع</td-->
                        {/if}

                        <!-----------الدين قبل ------------------->
                        {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                        <!--td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="8%" align="center" bgcolor="#B4B4B4">الدين قبل</td-->
                        {/if}


                        <!-----------الصافي ------------------->
                        {if {$billsettingsData[28]->billsettingsvalue} eq 0 && $sellbillData->sellbillaftertotalbill != $sellbillData->sellbilltotalbill}
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="9%" align="center" bgcolor="#B4B4B4">الصافى</td>
                        {/if}

                        <!-----------ضريبه المبيعات ------------------->
                        {if $billnameAddData->taxOfDiscountPrint eq 0 && $sellbillData->taxOfDiscountVal > 0}
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="9%" align="center" bgcolor="#B4B4B4">ضريبه خصم</td>
                        {/if}
                        {if {$billsettingsData[31]->billsettingsvalue} eq 0 && $taxvalue > 0}
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="9%" align="center" bgcolor="#B4B4B4">ضريبه القيمة المضافة</td>
                        {/if}


                        <!-----------الخصم ------------------->
                        {if  $sellbillData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 0}
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="8%" align="center" bgcolor="#B4B4B4">خصم اضافى </td>
                        {/if}
                        {if  {$sellbillData->sellbilldiscount} > 0 && {$billsettingsData[47]->billsettingsvalue} eq 0}
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="8%" align="center" bgcolor="#B4B4B4">قيمة الخصم</td>
                        <!--<td width="8%" align="center" bgcolor="#B4B4B4">نوع الخصم</td>-->
                        {/if}
                        {if  $sellbillData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 1}
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="8%" align="center" bgcolor="#B4B4B4">خصم اضافى </td>
                        {/if}
                        <!-----------الدين السابق ------------------->
                        {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                        {if $sellbillData->sellbilltotalpayed neq 0 || $sellbillData->sellbilltotaldeptbefor neq 0}
                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="10%" align="center" bgcolor="#B4B4B4">الدين السابق</td>
                        {/if}
                        {/if}
                        <td width="10%" align="center" bgcolor="#B4B4B4" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">اجمالى</td>
                        <td  {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else} style="display:none" {/if} width="9%" align="center" bgcolor="#B4B4B4" class="style1">عدد</td>

                    </tr>
                    <tr>

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



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

                        <td align="center" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {{$sellbillData->sellbilltotaldeptafter}} <> 0}  {else} style="display:none !important" {/if}>{$sellbillData->sellbilltotaldeptbefor+$sellbillData->sellbilltotalbill}</td>
                        {/if}

                        <!-----------الباقى ------------------->
                        {if {$billsettingsData[30]->billsettingsvalue} eq 0 && $sellbillData->sellbillfinalbill > 0}
                        <!--td align="center" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$sellbillData->sellbillfinalbill}</td-->
                        {/if}

                        <!-----------المدفوع ------------------->
                        {if {$billsettingsData[29]->billsettingsvalue} eq 0 && $sellbillData->sellbilltotalpayed != $sellbillData->sellbilltotalbill}
                        <!--td align="center" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$sellbillData->sellbilltotalpayed}</td-->
                        {/if}

                        <!-----------الدين قبل ------------------->
                        {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                        <!--td align="center" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$sellbillData->sellbilltotaldeptbefor}</td-->
                        {/if}


                        <!-----------الصافي ------------------->
                        {if {$billsettingsData[28]->billsettingsvalue} eq 0 && $sellbillData->sellbillaftertotalbill != $sellbillData->sellbilltotalbill}
                        <td align="center" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$sellbillData->sellbillaftertotalbill}</td>
                        {/if}

                        {if $billnameAddData->taxOfDiscountPrint eq 0 && $sellbillData->taxOfDiscountVal > 0}
                        <!-----------ضريبة المبيعات ------------------->
                        <td align="center"  class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$sellbillData->taxOfDiscountVal}</td>
                        {/if}
                        {if {$billsettingsData[31]->billsettingsvalue} eq 0 && $taxvalue > 0}
                        <!-----------ضريبة المبيعات ------------------->
                        <td align="center"  class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$taxvalue} ({$sellbillData->tax}%)</td>
                        {/if}


                        {if  $sellbillData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 0}
                        <!-----------ضريبة المبيعات ------------------->
                        <td align="center"  class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$sellbillData->extraDiscountVal}</td>
                        {/if}

                        {if  {$sellbillData->sellbilldiscount} > 0 && {$billsettingsData[47]->billsettingsvalue} eq 0}
                        <td align="center" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}"> {if $sellbillData->sellbilldiscounttype eq 2}(%{$sellbillData->sellbilldiscount}){/if} {$discountvalue}</td>
                        <!--                        <td align="center" class="style1">
                                                    {if {$sellbillData->sellbilldiscounttype} eq 1}
                                                    مباشر
                                                    {else}
                                                    بنسبة
                                                    {/if}
                                                </td>-->
                        {/if}
                        {if  $sellbillData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 1}
                        <!-----------ضريبة المبيعات ------------------->
                        <td align="center"  class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$sellbillData->extraDiscountVal}</td>
                        {/if}
                        <!-----------الدين السابق ------------------->
                        {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                        {if $sellbillData->sellbilltotalpayed neq 0 || $sellbillData->sellbilltotaldeptbefor neq 0}
                        <td align="center" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$sellbillData->sellbilltotaldeptbefor}</td>
                        {/if}
                        {/if}

                        <td align="center" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$sellbillData->sellbilltotalbill}</td>
                        <td  {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else} style="display:none" {/if} align="center" class="style1">
                            {if {$sellbillData->sellQuantity} <= 0}
                            {$quantity}
                            {else}
                            {$sellbillData->sellQuantity}
                            {/if} </td>


                    </tr>
                </table></td>
                </tr>
                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                    <td colspan="3">{$totalWritten}</td>
                </tr>
                <tr>
                    <td colspan="2">
                        <table class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="100%" border="1" cellpadding="0" cellspacing="0"><!-- border="0" cellpadding="2" cellspacing="7"-->

                            <tr>
                                <!-----------رصيد الدين بعد ------------------->
                                {if {$billsettingsData[19]->billsettingsvalue} eq 0 && $sellbillData->sellbilltotaldeptafter <> 0}
                                <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">رصيد الدين بعد</td>
                                {/if}
                                <!-----------المدفوع ------------------->
                                {if {$billsettingsData[29]->billsettingsvalue} eq 0 && $sellbillData->sellbilltotalpayed != $sellbillData->sellbilltotalbill}
                                <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">المدفوع</td>
                                {/if}
                                <!-----------المتبقى ------------------->
                                {if {$billsettingsData[30]->billsettingsvalue} eq 0 && $sellbillData->sellbillfinalbill > 0}
                                <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">المتبقى</td>
                                {/if}
                            </tr>
                            <tr>
                                {if {$billsettingsData[19]->billsettingsvalue} eq 0 && $sellbillData->sellbilltotaldeptafter <> 0}
                                <td width="10%" align="center" class="style1" >{$sellbillData->sellbilltotaldeptafter}</td>
                                {/if}
                                <!-----------المدفوع ------------------->
                                {if {$billsettingsData[29]->billsettingsvalue} eq 0 && $sellbillData->sellbilltotalpayed != $sellbillData->sellbilltotalbill}
                                <td width="10%" align="center" class="style1" >{$sellbillData->sellbilltotalpayed}</td>
                                {/if}
                                <!-----------المتبقى ------------------->
                                {if {$billsettingsData[30]->billsettingsvalue} eq 0 && $sellbillData->sellbillfinalbill > 0}
                                <td width="10%" align="center" class="style1" >{$sellbillData->sellbillfinalbill}</td>
                                {/if}
                            </tr>
                        </table>

                        {if count($billPayments)>0}
                        <br/>
                        <!--<h4 style="text-align: center;margin: 0">دفعات على الفاتورة</h4>-->
                        <table class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="100%" border="1" cellpadding="0" cellspacing="0" dir="rtl">
                            <tr>
                                <td>    م</td>
                                <td>  قيمة الفاتورة</td>
                                <!--<td>  قيمة الدين قبل</td>-->
                                <td> القيمة المدفوعة </td>
                                <!--<td>  قيمة الدين بعد</td>-->
                                <td>   تاريخ الدفع</td>
                                <td>    طريقة الدفع</td>
                            </tr>
                            {foreach $billPayments as $data}
                            <tr class="gradeA ">
                                <td> {$data.itra}</td>
                                <td> {$data.finalnetbillvalue}  </td>
                                <!--<td> {$data.wait_before}</td>-->
                                <td> {$data.clientdebtchangeamount} </td>
                                <!--<td> {$data.wait_after}</td>-->
                                <td> {$data.date} </td>
                                <td> {$data.paytype} </td>
                            </tr>
                            {/foreach}
                        </table>
                        {/if}
                    </td>
                </tr>

                {if {$billsettingsData[43]->billsettingsvalue} eq 0}
                <tr>
                    <td colspan="3" align="right">
                        <br/> <br/>
                    </td>
                </tr>
                <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>
                <tr>
                    <td colspan="3" align="right">
                        <br/> <br/> <br/>
                    </td>
                </tr>
                {/if}
                <tr>

                    <td height="130" colspan="3"  nowrapalign="right" valign="bottom">
                        <span class="style1" style="direction:rtl">
                            <!--strong>{$sellbillData->useremployeename}</strong-->
                        </span></td>

                    <td height="130" colspan="3"  nowrapalign="right" valign="bottom" nowrap>
                        <span class="style1" style="direction:rtl;{if $billsettingsData[72]->billsettingsvalue == 2}display:none;{/if}"><strong>
                                {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                                {$Programsettingdata->address}
                                {else}
                                <!--<img src="../views/default/images/branch_image/{$branchData->logo}" alt="" width="134" height="49"><br>-->
                                {$branchData->branchAddress}
                                {/if}

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




                {else}









                <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
                    <tr>
                        <td width="148" height="115" align="left" valign="middle">&nbsp;</td>
                        <td width="142" colspan="2" align="right" valign="top"><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}
                                    {else}
                                    <img src="../views/default/images/branch_image/{$branchData->logo}" alt="" width="122" height="75"><br>
                                    {$branchData->mobile}
                                    {/if}
                                    <br>
                                    </td>
                                    </tr>







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

                                                {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                                                {if $sellbillData->sellbilltotalpayed neq 0 || $sellbillData->sellbilltotaldeptbefor neq 0}
                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" >
                                                    <td align="right">   {$sellbillData->sellbilltotaldeptbefor}</td>
                                                    <td align="right"> : الدين قبل </td>

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

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

                                                </tr>

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

                                                    <td dir="rtl">{$clientdata->clientaddress}</td>
                                                    <td dir="rtl"> عنوان العميل </td>

                                                </tr>

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

                                                    <td dir="rtl">{$clientdata->clientphone}</td>
                                                    <td dir="rtl">تليفون العميل </td>

                                                </tr>

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

                                                    <td dir="rtl">{$clientdata->clientcode}</td>
                                                    <td dir="rtl"> كود العميل </td>

                                                </tr>

                                                <!--                                                {if $Programsettingdata->clientserial eq 1}
                                                                                                <tr >
                                                                                                    <td align="right">   {if $sellbillData->taxBillNumber > 0}{$sellbillData->taxBillNumber}{else}{$sellbillData->sellbillid}{/if}</td>

                                                                                                    <td align="right"> :    رقم  الفاتورة  </td>
                                                                                                    <td>  </td>

                                                                                                </tr>
                                                                                                {/if}-->
                                                <tr>
                                                    <td align="right">  {$sellbillData->sellbilldate|date_format:"%Y-%m-%d"}</td>
                                                    <td align="right"> : تاريخ البيان</td>
                                                    <td>  </td>

                                                </tr>
                                                <tr {if {$billsettingsData[3]->billsettingsvalue} eq 0}  {else} style="display:none" {/if}>
                                                    <td align="right">  {$sellbillData->employeename}</td>
                                                    <td align="right"> : ال{if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if}</td>
                                                    <td>  </td>

                                                </tr>


                                                {*if {$Programsettingdata->saveprinting} eq 1*}

                                                <!-----------المخزن ------------------->
                                                {if {$billsettingsData[27]->billsettingsvalue} eq 0}

                                                <tr>
                                                    <td align="right">  {$sellbillData->storeName}</td>
                                                    <td align="right" > : اسم المخزن</td>
                                                    <td>  </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">

                                                <tr>
                                                    <td align="center" bgcolor="#E8E8E8">م</td>

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

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

                                                    <td  align="center" bgcolor="#E8E8E8"{if {$billsettingsData[22]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >التعليق</td>

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

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


                                                </tr>



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

                                                        {$sellbilldetail->parcode}

                                                    </td>


                                                    <td align="center">

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


                                                        {if $sellbilldetail->soldSerialsInDetails != ""} (sn: {$sellbilldetail->soldSerialsInDetails}) {/if}
                                                    </td>


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

                                                        {$sellbilldetail->note}

                                                    </td>


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

                                                        {$sellbilldetail->unitName}

                                                    </td>

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

                                                        {$sellbilldetail->sellbilldetailquantity}

                                                    </td>

                                                    <td align="center"  {if {$Programsettingdata->scunitname} eq '0'||$billsettingsData[67]->billsettingsvalue}  hidden {/if}>
                                                        {$sellbilldetail->otherdetailquantity}
                                                    </td>

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

                                                        {$sellbilldetail->sellbilldetailprice} {$currency}

                                                    </td>




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


                                                        {$sellbilldetail->discountvalue}

                                                    </td>


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

                                                        {$sellbilldetail->sellbilldetailtotalprice}

                                                    </td>





                                                </tr>

                                                {/foreach}

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


                                    <tr>
                                        <td height="54" colspan="3" align="right">
                                            <table width="50%" border="0" align="left" cellpadding="0" cellspacing="0"  dir="rtl" class="td">

                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                                    <td>اجمالي الفاتوره</td>
                                                    <td>{$sellbillData->sellbilltotalbill}</td>
                                                </tr>
                                                <tr {if {$billsettingsData[58]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                                    <td>اجمالي  القطع</td>
                                                    <td>
                                                        {if {$sellbillData->sellQuantity} <= 0}
                                                        {$quantity}
                                                        {else}
                                                        {$sellbillData->sellQuantity}
                                                        {/if}
                                                    </td>
                                                </tr>

                                                {if  {$sellbillData->sellbilldiscount} > 0 && {$billsettingsData[57]->billsettingsvalue} eq 0}
                                                <!--tr>

                                               <td {if {$billsettingsData[47]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>نوع الخصم</td>
                                               <td>
                                                {if {$sellbillData->sellbilldiscounttype} eq 1}
                                                                 مباشر
                                                                 {else}
                                                                 بنسبة
                                                                 {/if}
                                               </td>
                                             </tr-->
                                                {if  $sellbillData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 0}
                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                                    <td>خصم اضافى </td>
                                                    <td> {$sellbillData->extraDiscountVal}</td>
                                                </tr>
                                                {/if}
                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$sellbillData->sellbilldiscount} > 0 && {$billsettingsData[47]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                                    <td>قيمه الخصم</td>
                                                    <td>  {$discountvalue}{if $sellbillData->sellbilldiscounttype eq 2}(%{$sellbillData->sellbilldiscount}){/if}</td>
                                                </tr>
                                                {if  $sellbillData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 1}
                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                                    <td>خصم اضافى </td>
                                                    <td> {$sellbillData->extraDiscountVal}</td>
                                                </tr>
                                                {/if}

                                                {if $billnameAddData->taxOfDiscountPrint eq 0 && $sellbillData->taxOfDiscountVal > 0}
                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                                    <td>ضريبه خصم</td>
                                                    <td> {$sellbillData->taxOfDiscountVal}</td>
                                                </tr>
                                                {/if}

                                                {if {$billsettingsData[31]->billsettingsvalue} eq 0 && $taxvalue > 0}
                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                                    <td>ضريبه القيمة المضافة</td>
                                                    <td> {$taxvalue}{$Programsettingdata->currancy} ({$sellbillData->tax}%)</td>
                                                </tr>
                                                {/if}


                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                                    <td>المبلغ </td>
                                                    <td>{$sellbillData->sellbillaftertotalbill} {$currency}</td>
                                                </tr>

                                                {/if}
                                                <!-----------الصافى  ------------------->
                                                {if {$billsettingsData[28]->billsettingsvalue} eq 0 && $sellbillData->sellbillaftertotalbill != $sellbillData->sellbilltotalbill}


                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                                    <td>الصافى</td>
                                                    <td> {$sellbillData->sellbillaftertotalbill} {$currency}</td>
                                                </tr>
                                                {/if}

                                                <!-----------المدفوع ------------------->


                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$billsettingsData[29]->billsettingsvalue} eq 0 && $sellbillData->sellbilltotalpayed != $sellbillData->sellbilltotalbill}  {else} style="display:none !important" {/if}>
                                                    <td>المدفوع</td>
                                                    <td> {$sellbillData->sellbilltotalpayed} {$currency}</td>
                                                </tr>

                                                {if {$billsettingsData[30]->billsettingsvalue} eq 0 && $sellbillData->sellbillfinalbill > 0}
                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                                    <td>المتبقى</td>
                                                    <td>{$sellbillData->sellbillfinalbill} {$currency}</td>
                                                </tr>
                                                {/if}



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


                                                <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$sellbillData->sellbilltotaldeptafter} <> 0}  {else} style="display:none !important" {/if}>
                                                    <td>إجمالى المديونيه</td>
                                                    <td>{$sellbillData->sellbilltotaldeptafter} {$currency}</td>
                                                </tr>
                                                {/if}
                                            </table>
                                        </td>
                                    </tr>
                                    {if {$billsettingsData[43]->billsettingsvalue} eq 0}
                                    <tr>
                                        <td colspan="3" align="right">
                                            <br/> <br/>
                                        </td>
                                    </tr>
                                    <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>
                                    <tr>
                                        <td colspan="3" align="right">
                                            <br/> <br/> <br/>
                                        </td>
                                    </tr>
                                    {/if}
                                    <!-- <tr>
                                        <td colspan="3" align="right" nowrap {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}><p class="NEE"><strong>
                                                    {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                                                    {$Programsettingdata->address}
                                                    {else}
                                                    <img src="../views/default/images/branch_image/{$branchData->logo}" alt="" width="134" height="49"><br>
                                                    {$branchData->branchAddress}
                                                    {/if}
                                                </strong></p></td>
                                    </tr> -->
                                    <tr>
                                        <td colspan="3" align="right"><p>&nbsp;</p>

                                            <p {if $billsettingsData[81]->billsettingsvalue == 1}style="display:none"{/if}><span class="copywrites"><span class="copywrites">تصميم شركة جي تي فور 01110070882...</span></span></p></td>
                                    </tr>
                </table></b>
        </div>
        {/if}
    </body>