<html dir="rtl">

<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 200mm landscape;
                /* landscape */
                /* you can also specify margins here: */
                margin: 0mm;
                margin-right: 0mm;
                /* for compatibility with both A4 and Letter */
                /* size: 139mm 215mm;
  height: 215mm;
  width: 139mm; */
            }

            #printdiv {
                margin-top: {
                    $billsettingsData[82]->billsettingsvalue
                }

                mm;
                /* user margin */
            }

            td {
                font-weight: bolder !important;
            }
        }

        table.info tr {
            width: 100%;
        }



        .body {
            direction: rtl
        }

        td {
            margin: 0
        }

        .table-black1 tbody>tr>td {

            vertical-align: middle;
            text-align: center;
            border: 1px solid #000;
        }

        .result,
        .result tr,
        .result tr td {
            border: 1px solid #000
        }

        .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: 17px;
            border-right-color: #999;
        }

        .NEE {
            font-size: 14px;
        }

        .newdesign {
            font-size: 14px;
        }

        .copywrites {
            font-size: 11px;
        }

        td {
            margin: 0 !important
        }

        .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: 15px;
        font-weight: 200;
        padding: 0 2px
    }

    .td td {
        border-right-width: 1px;
        border-bottom-width: 1px;
        border-left-width: 0px;
        border-top-style: none;
        border-right-style: dotted;
        border-bottom-style: solid;
        border-left-style: none;
        border-bottom-color: #999;
        font-size: 17px;
        border-right-color: #999;
        padding: 0 2px
    }

    .NEE {
        font-size: 14px;
    }

    .newdesign {
        font-size: 14px;
    }

    .copywrites {
        font-size: 11px;
    }
</style>
<style>
    .td td {
        border-right-width: 1px;
        border-bottom-width: 1px;
        border-left-width: 0px;
        border-top-style: none;
        border-right-style: dotted;
        border-bottom-style: solid;
        border-left-style: none;
        border-bottom-color: #999;
        font-size: 18px;
        border-right-color: #999;
        padding: 0 2px
    }

    .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: 15px
    }

    .style-num {
        font-size: 12px
    }

    table.data td {
        border: 1px solid #000;
        text-align: center
    }

    td {
        font-size: 13px;
        padding: 0 2px
    }

    .table-last td {
        border: 1px solid #444;
        text-align: center
    }
</style>
{/literal}

<body onLoad="printDiv()">
    <div id="printdiv">

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

            <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-black">
                <tr>
                    <!-- <td colspan="2"><div {if {$billsettingsData[15]->billsettingsvalue && $Programsettingdata->clientserial == 1} eq 0}  {else} style="display:none !important" {/if} class="serial">{$sellbillData->sellbillid}</div></td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td>
                        <td>&nbsp;</td> -->
                    <td colspan="2" align="center" class="style1" {if $billsettingsData[72]->billsettingsvalue ==
                        2}style="display:none;"{/if}>
                        {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 ||
                        $userData->branchId == -1}
                        <img src="../views/default/images/upload/{$Programsettingdata->logo}" alt="" width="134"
                            height="49"><br>
                        {$Programsettingdata->phone}
                        {else}
                        <img src="../views/default/images/branch_image/{$branchData->logo}" alt="" width="134"
                            height="49"><br>
                        {$branchData->mobile}
                        {/if}
                    </td>
                </tr>
            </table>
            <div style="clear:both"></div>
            <!--start title -->
            <div {if $billsettingsData[70]->billsettingsvalue == 0}{else} style="display:none"{/if}>
                <h2 style="  text-align:center" class="style1">{$billnameAddData->name}</h2>
            </div>
            <!-- end title -->
            <div style="clear:both"></div>

            <table width="45%" align="right" cellpadding="0" cellspacing="0" class="table-black"
                style="margin-bottom: 10px;font-size:10px">
                <tr>
                    <!--  <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} :{$sellbillData->employeename}</span--><!--</td>-->

                    {if $Programsettingdata->clientserial eq 1}
                    <td style="padding: 2px" align="right">
                        <span class="">رقم تسلسل الفاتورة :</span>
                        <span>{if $sellbillData->taxBillNumber >
                            0}{$sellbillData->taxBillNumber}{else}{$sellbillData->sellbillid}{/if}</span>
                    </td>
                    {/if}

                </tr>
                <tr>
                    <td style="padding: 2px" align="right" nowrap width="">
                        <span class="">التاريخ :</span>
                        <span>{$sellbillData->sellbilldate}</span>
                    </td>
                </tr>
                <tr>
                    <td style="padding: 2px" align="right" nowrap width="">
                        <span class="">اسم المستخدم :</span>
                        <span>{$billUserData->employeename}</span>
                    </td>
                </tr>
                <tr>
                    <td style="padding: 2px;{if $billsettingsData[72]-> billsettingsvalue == 2};display:none;{/if}"
                        align="right" nowrap>
                        <span class="" style="direction:rtl"> العنوان :</span>
                        <span>
                            {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 ||
                            $userData->branchId == -1}
                            {$Programsettingdata->address}
                            {else}
                            {$branchData->branchAddress}
                            {/if}
                        </span>
                    </td>
                </tr>

            </table>
            <table width="50%" align="right" cellpadding="0" cellspacing="0" class="table-black"
                style="margin-bottom: 10px">
                <!--الدين بعد -->
                <tr>
                    <!--td align="right"  dir="rtl" >{if {$billsettingsData[18]->billsettingsvalue} eq 0} <span class="style1 style2"> (حساب / سابق) :{$sellbillData->sellbilltotaldeptbefor}</span> {/if}</td-->
                    <td align="right" style="padding: 3px"> {if {$billsettingsData[27]->billsettingsvalue} eq 0}
                        {$sellbillData->storeName}{/if} </td>
                </tr>
                <tr>
                    <td colspan="2" align="right"
                        style="padding: 3px;{if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} display:none !important; {/if}"
                        nowrap>
                        <span>السيد :</span>
                        <span> {$sellbillData->tempclientName}</span>

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

                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="right"
                        style="padding: 3px;{if {$billsettingsData[22]->billsettingsvalue} eq 0}  {else} display:none !important; {/if}"
                        nowrap>
                        <span>التعليق :</span>
                        <span> {$sellbillData->comment}</span>

                    </td>
                </tr>
            </table>
            <div style="clear:both"></div>
            <h4 style="text-align: center;margin: 0">فاتورة مبيعات</h4>
            <table width="100%" border="0" cellpadding="" cellspacing="" class="table-black1" style="direction: ltr">
                <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" class="style4" {if {$Programsettingdata->scunitname} eq
                        '0'||$billsettingsData[67]->billsettingsvalue} 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" {/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" {/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 style-num"> {$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 style1" {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">{$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 style-num">{$sellbilldetail@index+1}</td>
                </tr>
                {/foreach}

            </table>
            <hr style="background-color: #000">
            {if {$billsettingsData[80]->billsettingsvalue} eq 0}

            <table width="20%" border="" cellpadding="0" cellspacing="" class="result class=" {if $Usergroupdata->
                hideBillPrices == 1}hidden{/if}" style="float:right">
                <tr>
                    {if {$billsettingsData[80]->billsettingsvalue} eq 0}
                    <td align="center" bgcolor="#B4B4B4">{if {$Programsettingdata->delivery} eq 0}شحن{else} توصيل {/if}
                    </td>
                    <td align="center" bgcolor="#B4B4B4">الاجمالي </td>
                    {/if}
                </tr>
                <tr>
                    {if {$billsettingsData[80]->billsettingsvalue} eq 0}

                    <td align="center" class="style1">{$sellbillData->delivery}</td>
                    <td align="center" class="style1">{$sellbillData->totalafterdelivery}</td>
                    {/if}

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


            <table width="40%" border="" cellpadding="0" cellspacing=""
                class="result {if $Usergroupdata->hideBillPrices == 1}hidden{/if}" style="float:left" dir="ltr">

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

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



                    {/if}

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


                    {if {$billsettingsData[30]->billsettingsvalue} eq 0 && $sellbillData->sellbillfinalbill > 0}
                    <td align="center" bgcolor="#B4B4B4">الباقي</td>
                    {/if}

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

                    <!--الدين قبل-->
                    {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                    {if $sellbillData->sellbilltotalpayed neq 0 || $sellbillData->sellbilltotaldeptbefor neq 0}
                    <td align="center" bgcolor="#B4B4B4">الدين قبل</td>
                    {/if}
                    {/if}


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

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

                    <!--ضريبه المبيعات -->

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

                    <!--الخصم -->
                    {if $sellbillData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 &&
                    $billnameAddData->extraDiscountPlace == 0}
                    <td align="center" bgcolor="#B4B4B4">خصم اضافى </td>
                    <!--<td  align="center" bgcolor="#B4B4B4">نوع الخصم</td>-->
                    {/if}

                    <!--الخصم -->
                    {if {$sellbillData->sellbilldiscount} > 0 && {$billsettingsData[47]->billsettingsvalue} eq 0}
                    <td align="center" bgcolor="#B4B4B4">قيمة الخصم</td>
                    <!--<td  align="center" bgcolor="#B4B4B4">نوع الخصم</td>-->
                    {/if}

                    <!--الخصم -->
                    {if $sellbillData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 &&
                    $billnameAddData->extraDiscountPlace == 1}
                    <td align="center" bgcolor="#B4B4B4">خصم اضافى </td>
                    <!--<td  align="center" bgcolor="#B4B4B4">نوع الخصم</td>-->
                    {/if}

                    <td align="center" bgcolor="#B4B4B4" class="style1">الاجمالي</td>
                    <td {if {$billsettingsData[21]->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 {{$sellbillData->sellbilltotaldeptafter}} <> 0} {else}
                            style="display:none !important" {/if}>{$sellbillData->sellbilltotaldeptafter}</td>
                    {/if}

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

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

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


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

                    {if $billnameAddData->taxOfDiscountPrint eq 0 && $sellbillData->taxOfDiscountVal > 0}
                    <td align="center" class="style1">{$sellbillData->taxOfDiscountVal}</td>
                    {/if}


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

                    {if $sellbillData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 &&
                    $billnameAddData->extraDiscountPlace == 0}
                    <td align="center" class="style1">{$sellbillData->extraDiscountVal}</td>
                    {/if}

                    {if {$sellbillData->sellbilldiscount} > 0 && {$billsettingsData[47]->billsettingsvalue} eq 0}
                    <td align="center" class="style1">
                        {$discountvalue}{if $sellbillData->sellbilldiscounttype eq
                        2}(%{$sellbillData->sellbilldiscount}){/if}
                    </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">{$sellbillData->extraDiscountVal}</td>
                    {/if}

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

                </tr>
            </table>
            {if count($billPayments)>0}
            <!--<h4 style="text-align: center;margin: 0">دفعات على الفاتورة</h4>-->
            <table class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="50%" border="" cellpadding="0"
                cellspacing="" class="result" style="float:right" 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}
            <div style="clear:both"></div>
            <table>
                {if {$billsettingsData[43]->billsettingsvalue} eq 0}

                <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}
                <tr>

                    <td nowrapalign="right" valign="bottom"><span class="style1"
                            style="direction:rtl"><!--strong>{$sellbillData->useremployeename}</strong--></span></td>
            </table>
            <!-- footer -->
            <div style="text-align: center;{if $billsettingsData[81]->billsettingsvalue == 1}display:none{/if}">
                <p><span class="copywrites">تصميم شركة جي تي فور 01110070882</span></p>
            </div>


            {else}

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

                    <td width="142" align="center" 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="50"><br>
                                <span style="font-size:14px">{$Programsettingdata->phone}</span>
                                {else}
                                <img src="../views/default/images/branch_image/{$branchData->logo}" alt="" width="122"
                                    height="50"><br>
                                <span style="font-size:14px"> {$branchData->mobile}</span>
                                {/if}

                    </td>
                </tr>
            </table>
            <!--start title -->
            <div {if $billsettingsData[70]->billsettingsvalue == 0}{else} style="display:none"{/if}>
                <h2 style="  text-align:center" class="style1">{$billnameAddData->name}</h2>
            </div>
            <!-- end title -->
            <div style="clear:both"></div>
            <table style="width:55%;float:right;margin-top: 7px">
                <!--                    <tr {if $billsettingsData[70]->billsettingsvalue == 0}{else}  style="display:none"{/if}>
                                            <td align="right" class="style1" dir="rtl">
                                                <h1  style="float:right; text-align:right">{$billnameAddData->name}</h1>    </td>
                                        </tr>-->
                {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                {if $sellbillData->sellbilltotalpayed neq 0 || $sellbillData->sellbilltotaldeptbefor neq 0}
                <tr>
                    <td align="right">
                        {if $Usergroupdata->hideBillPrices != 1}
                        <span> الدين قبل:</span>
                        <span>{$sellbillData->sellbilltotaldeptbefor} </span>
                        {/if}
                    </td>

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

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

                </tr>

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

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

                </tr>
                <tr {if {$billsettingsData[3]->billsettingsvalue} eq 0} {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>{$sellbillData->employeename}</span>
                    </td>

                </tr>
                <tr>
                    <td align="right">
                        <span> تاريخ البيان:</span>
                        <span>{$sellbillData->sellbilldate}</span>
                    </td>
                </tr>
                <tr {if {$billsettingsData[112]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>
                    <td align="right">
                        <span> تاريخ التسليم:</span>
                        <span>{$sellbillData->datestarting}</span>
                    </td>
                </tr>
            </table>
            <table style="width:45%;float:left">

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

                    <td dir="rtl">
                        <span>تليفون العميل:</span>
                        <span>{$clientdata->clientphone} {if $clientdata->clientmobile != ''} - {$clientdata->clientmobile}{/if}</span>
                    </td>

                </tr>

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

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

                </tr>

                {if $Programsettingdata->clientserial eq 1}
                <tr>

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




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

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

                <tr>
                    <td align="right">
                        <span> اسم المخزن:</span>
                        <span> {$sellbillData->storeName}</span>
                    </td>
                </tr>
                {/if}

                <tr>
                    <td align="right">
                        <span>اسم المستخدم:</span>
                        <span> {$billUserData->employeename}</span>
                    </td>
                </tr>

                {if {$billsettingsData[101]->billsettingsvalue} eq 0}
                <tr>
                    <td align="right">
                        <span> عملية الفاتورة:</span>
                        <span> {$sellbillData->billoperationName}</span>
                    </td>
                </tr>
                {/if}
                {if {$billsettingsData[22]->billsettingsvalue} eq 0}
                <tr>
                    <td align="right">
                        <span> التعليق:</span>
                        <span> {$sellbillData->comment}</span>
                    </td>
                </tr>
                {/if}

            </table>
            <div style="clear:both"></div>
            <table style="width:100%">
                {if $sellorder lt 1}
                <h4 style="text-align: center;margin: 0">فاتورة المبيعات</h4>
                {else}
                <h3 style="text-align: center;margin: 0"> أمر بيع </h3>
                {/if}
            </table>
            <div style="clear:both"></div>

            <table class="data" width="100%" 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>

                    {if {$billsettingsData[26]->billsettingsvalue} eq 0 && $billsettingsData[108]->billsettingsvalue eq
                    0}
                    <td align="center" bgcolor="#E8E8E8">المخزن</td>
                    {/if}

                    <td align="center" bgcolor="#E8E8E8" {if {$billsettingsData[7]->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'} hidden {/if}
                        >{$Programsettingdata->scunitname}</th>

                    <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" dir="ltr">

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


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


                    </td>

                    {if {$billsettingsData[26]->billsettingsvalue} eq 0 && $billsettingsData[108]->billsettingsvalue eq
                    0}
                    {if {$sellbilldetail->storeName} <> ""}
                        <td align="center" dir="ltr">
                            <div id="productparcode1">
                                <p class="form-control-static"> {$sellbilldetail->storeName} </p>
                            </div>
                        </td>
                        {else}
                        <td align="center" dir="ltr">
                            <div id="productparcode1">
                                <p class="form-control-static">

                                    {$sellbillData->storeName}
                                </p>
                            </div>
                        </td>
                        {/if}
                        {/if}


                        <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>
            {if {$billsettingsData[80]->billsettingsvalue} eq 0}
            <table align="right" cellpadding="0" cellspacing="0" style="margin-top: 5px" dir="rtl" class="table-last">
                <tr {if {$billsettingsData[80]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>
                    <td>{if {$Programsettingdata->delivery} eq 0} : شحن{else} : توصيل {/if}</td>
                    <td>{$sellbillData->delivery}</td>
                </tr>
                <tr {if {$billsettingsData[80]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>
                    <td>الاجمالي :</td>
                    <td>{$sellbillData->totalafterdelivery}</td>
                </tr>
            </table>
            {/if}
            <table align="left" cellpadding="0" cellspacing="0" style="margin-top: 5px" dir="rtl"
                class="table-last {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                <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>
                <tr>
                    <td>اجمالي الفاتوره</td>
                    <td>{$sellbillData->sellbilltotalbill}</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 == 1}
                <tr>
                    <td>خصم اضافى</td>
                    <td>{$sellbillData->extraDiscountVal}</td>
                </tr>
                {/if}

                <tr {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 == 0}
                <tr>
                    <td>خصم اضافى</td>
                    <td>{$sellbillData->extraDiscountVal}</td>
                </tr>
                {/if}

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

                {if $billnameAddData->taxOfDiscountPrint eq 0 && $sellbillData->taxOfDiscountVal > 0}
                <tr>
                    <td>ضريبه خصم</td>
                    <td> {$sellbillData->taxOfDiscountVal}</td>
                </tr>
                {/if}

                <tr>
                    <td>المبلغ </td>
                    <td>{$sellbillData->sellbillaftertotalbill} {$currency}</td>
                </tr>

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


                <tr>
                    <td>الصافى</td>
                    <td> {$sellbillData->sellbillaftertotalbill} {$currency}</td>
                </tr>
                {/if}

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


                <tr{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>
                        <td>المتبقى</td>
                        <td>{$sellbillData->sellbillfinalbill} {$currency}</td>
                    </tr>
                    {/if}

                    {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                    {if $sellbillData->sellbilltotalpayed neq 0 || $sellbillData->sellbilltotaldeptbefor neq 0}
                    <tr>
                        <td>المديونيه السابقة</td>
                        <td>{$sellbillData->sellbilltotaldeptbefor} {$currency}</td>
                    </tr>
                    {/if}
                    {/if}

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


                    <tr {if {$sellbillData->sellbilltotaldeptafter} <> 0} {else} style="display:none !important" {/if}>
                            <td>إجمالى المديونيه</td>
                            <td>{$sellbillData->sellbilltotaldeptafter} {$currency}</td>
                    </tr>
                    {/if}
            </table>
            {if count($billPayments)>0}
            <!--<h4 style="text-align: center;margin: 0">دفعات على الفاتورة</h4>-->
            <table width="50%" cellpadding="0" cellspacing="0" style="margin-top: 5px;float:right"
                class="table-last {if $Usergroupdata->hideBillPrices == 1}hidden{/if}" dir="rtl"
                class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                <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}
            <div style="clear:both"></div>
            <table>

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

                <tr>

                    <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></td>
                    <td></td>
                    <td>{$billnameAddData->goodsReceiptApproval}</td>
                </tr>

                {/if}
            </table>
            <div style="clear:both"></div>
            <div nowrap {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}><p
                    style="
                                                                                                             text-align: right"><strong>
                        {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 ||
                        $userData->branchId == -1}
                        {$Programsettingdata->address}
                        {else}
                        {$branchData->branchAddress}
                        {/if}
                    </strong></p>
            </div>

            <!-- footer -->

            {if $qrerp > 1}
            <div style="text-align: center;">
                {if $qrerp == 3 || $qrerp == 4}
                <img src="data:image/jpeg;base64,{$base64qr}" style="width:120px;height: 120px;" />
                {/if}
                {if $qrerp == 2 || $qrerp == 4}
                <img src="data:image/jpeg;base64,{$base64qrs}" style="width:120px;height: 120px;" />
                {/if}
            </div>
            {/if}

            <div style="
                     text-align: center;
                     {if $billsettingsData[81]->billsettingsvalue == 1}display:none{/if}">

                <p><span class="copywrites">تصميم شركة جي تي فور 01110070882</span></p>
            </div>

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