<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 200mm 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 */
            }
        }

        .td td {
            border: 1px solid #000;
            font-size: 16px;
            text-align: center
        }

        .NEE {
            font-size: 14px;
        }

        .newdesign {
            font-size: 14px;
        }

        .copywrites {
            font-size: 11px;
        }

        @media print {
            .form-control-static {
                font-size: 17px;
            }
            
            .footer {
                position: static !important;
                width: 100%;
                bottom: 0;
                left: 0;
            }
        }

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

        .hidden {
            display: none;
        }
        .footer {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
        }
    </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 td {
        border: 1px solid #000;
        font-size: 16px;
    }

    .NEE {
        font-size: 14px;
    }

    .newdesign {
        font-size: 14px;
    }

    .copywrites {
        font-size: 11px;
    }
</style>
<style>
    .td td {
        border: 1px solid #000;
        font-size: 16px;
    }

    .NEE {
        font-size: 14px;
    }

    .newdesign {
        font-size: 14px;
    }

    .copywrites {
        font-size: 11px;
    }

    .style2 {
        font-family: tahoma
    }

    .style4 {
        font-family: tahoma;
        font-size: 12px;
        font-weight: bold;
    }

    .serial {
        background-color: #C8C8C8;
        height: 20px;
        width: 150px;
        padding: 5px;
        margin: 5px;
        border: medium double #000000;
        text-align: center;
    }

    .style1 {
        font-size: 14px
    }

    table td {
        font-size: 16px;
        direction: rtl;
    }

    .form-control-static {
        font-size: 17px
    }

    table.bill td {
        border: 1px solid #000;
        direction: rtl;
    }
</style>
{/literal}
<!-- onLoad="printDiv()" -->

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

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

            {literal}
            <style>
                .a4 .s1 {
                    background: #CCC;
                }

                .a4 .s2 {
                    background: #EEE;
                }

                .a4 table {
                    text-align: center;
                }

                .a4 td,
                .a4 th {}

                .a4 th {
                    font-size: 13px;
                }

                .a4 td,
                .a4 th {
                    border: 1px solid #333;
                }

                .a4 .footer {

                    margin-top: 7px;
                }

                .a4 .bbottom,
                .a5 .bbottom {
                    bottom: 7px;
                    right: 0;
                    left: 0;
                }
            </style>


            {/literal}
            <div class="a4 a5">

                <table width="100%" class="table-black">
                    <tr>
                        <th scope="row" colspan="3" class="s1"><strong> بطاقة ضريبية :
                                {$Programsettingdata->taxcard}</strong></th>
                        <td rowspan="2" colspan="2" align="center"><strong {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=""
                                    height="50px" width="90%">
                                {else}
                                <img src="../views/default/images/branch_image/{$branchData->logo}" alt="" height="50px"
                                    width="90%">
                                {/if}
                            </strong></td>
                        <td class="s1" colspan="3"><strong
                                style="font-size: 18px">{$Programsettingdata->companyname}</strong></td>
                    </tr>
                    <tr>
                        <th scope="row" colspan="3" class="s1"><strong>سجل تجارى :
                                {$Programsettingdata->commercialregistration}</strong></th>
                        <td class="s1" colspan="3"><strong>{$Programsettingdata->specializtion}</strong></td>
                    </tr>

                    <tr>
                        <th colspan="2" width="15%" class="s2" scope="row"><strong {if
                                {$billsettingsData[15]->billsettingsvalue} eq 0 && $Programsettingdata->clientserial ==
                                1} {else} style="display:none !important" {/if}>{if $sellbillData->taxBillNumber >
                                0}{$sellbillData->taxBillNumber}{else}{$sellbillData->sellbillid}{/if} </strong></th>
                        <td colspan="2" class="s1" width="35%"><strong {if {$billsettingsData[15]->billsettingsvalue} eq
                                0 && $Programsettingdata->clientserial == 1} {else} style="display:none !important"
                                {/if}>رقم الفاتورة </strong></td>

                        <td width="30%" colspan="2" class="s1"><strong>{$sellbillData->sellbilldate}</td>
                        <td width="20%" colspan="2" class="s2"><strong> التاريخ</strong></th>

                            <!--                            <td width="30%" colspan="2" class="s1"><strong>{$sellbillData->billoperationName}</td>
                                                            <td  width="20%" colspan="2" class="s2"><strong> عملية الفاتورة</strong></th>-->
                    </tr>
                    <tr>
                        <th colspan="2" width="15%" scope="row" class="s2"><strong>{$clientdata->clientphone}{if
                                $clientdata->clientmobile != ''} - {$clientdata->clientmobile}{/if}</strong></th>
                        <td colspan="2" class="s1" width="35%"><strong>تليفون العميل</strong></td>
                        <td width="30%" colspan="2" class="s2"><strong {if {$billsettingsData[16]->billsettingsvalue} eq
                                0} {else} style="display:none !important;"
                                {/if}>{$sellbillData->tempclientName}</strong></td>
                        <td width="20%" colspan="2" class="s1"><strong {if {$billsettingsData[16]->billsettingsvalue} eq
                                0} {else} style="display:none !important;" {/if}>اسم العميل</strong></td>

                        <!--                            <td width="30%" colspan="2" class="s1"><strong>{$sellbillData->comment}</td>
                                                        <td  width="20%" colspan="2" class="s2"><strong> التعليق</strong></th>-->
                    </tr>
                    <tr {if $billsettingsData[35]->billsettingsvalue == 1} style="display:none"{/if}>
                        <th width="12.5%" class="s2" scope="row"><strong>{$sellbillData->carmotor}</strong></th>
                        <td width="12.5%" class="s1"><strong>موتور</strong></td>
                        <td width="12.5%" class="s2"><strong>{$sellbillData->carchase}</strong></td>
                        <td width="12.5%" class="s1"><strong>شاسية</strong></td>
                        <td width="12.5%" class="s2"><strong>{$sellbillData->cartype}</strong></td>
                        <td width="12.5%" class="s1"><strong>نوعها</strong></td>
                        <td width="12.5%" class="s2"><strong>{$sellbillData->carnumber}</strong></td>
                        <td width="12.5%" class="s1"><strong>رقم السيارة </strong></td>
                    </tr>

                </table>

                <div>
                    <div class="sellData" style="margin-bottom: 50px;">
                    <!--الدين بعد -->
                        <table width="100%" border="1" cellpadding="" cellspacing="">
                            <tr>
                                <td colspan="9" align="center" bgcolor="#B4B4B4" class="style2 style1">
                                    <strong>المبيعات</strong>
                                </td>
                            </tr>
                            <tr>
                                <td align="center" bgcolor="#B4B4B4"
                                    class="style4 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">اجمالى</td>
                                <td align="center" bgcolor="#B4B4B4"
                                    class="style4 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if
                                    {$billsettingsData[23]->billsettingsvalue} eq 0} {else} style="display:none" {/if}
                                    >الخصم</td>
                                <td align="center" bgcolor="#B4B4B4"
                                    class="style4 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">سعر</td>
                                <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 align="center"
                                    class="style2 style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    {$sellbilldetail->sellbilldetailtotalprice} </td>
                                <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$billsettingsData[23]->
                                    billsettingsvalue} eq 0} {else} style="display:none" {/if}>
                                    {$sellbilldetail->discountvalue} </td>
                                <td align="center"
                                    class="style2 style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    {$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="center" class="style2 style1" dir="rtl">
                                    {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>
                                <td align="center" class="style2">{$sellbilldetail@index+1}</td>
                            </tr>
                            {/foreach}
                        </table>
                        <hr style="margin: 0">
                        <div class="bbottom">
                            <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[18]->billsettingsvalue} eq 0}
                                    <td width="10%" align="center" bgcolor="#B4B4B4"
                                        class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if
                                        {{$sellbillData->sellbilltotaldeptbefor}} <> 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[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 == 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="8%"
                                        align="center" bgcolor="#B4B4B4">
                                        <table style="width:10px; !important ">
                                            <tr>
                                                <td nowrap> قيمه الضريبه</td>
                                                <td nowrap> % الضريبه</td>


                                            </tr>


                                        </table>
                                    </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}


                                    <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" width="10%"
                                        align="center" bgcolor="#B4B4B4" class="">الاجمالي</td>
                                    <td {if {$billsettingsData[21]->billsettingsvalue} eq 0} {else} style="display:none
                                        !important" {/if} width="9%" align="center" bgcolor="#B4B4B4" class="">عدد الوحدات
                                    </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->sellbilltotaldeptafter}</td>
                                    {/if}

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


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

                                    <td align="center" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}"
                                        {if {{$sellbillData->sellbilltotaldeptbefor}} <> 0} {else} style="display:none
                                            !important" {/if}>{$sellbillData->sellbilltotaldeptbefor}</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[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 == 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}">

                                        <table style="width:100%; !important ;">

                                            <tr>
                                                <td style="text-align:center; width:50% "> {$taxvalue}</td>

                                                <td style="text-align:center; width:50% "> %{$sellbillData->tax}</td>

                                            </tr>

                                        </table>
                                    </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}">
                                        {$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 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                        {$sellbillData->extraDiscountVal}</td>
                                    {/if}


                                    <td align="center" class="style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                        {$sellbillData->sellbilltotalbill}</td>
                                    <td {if {$billsettingsData[21]->billsettingsvalue} eq 0} {else} style="display:none
                                        !important" {/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="100%" border="1"
                                cellpadding="" cellspacing="" style="direction: rtl!important">
                                <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>
                        <div style="clear:both"></div>
                    </div>
                        <div nowrapalign="right" valign="bottom">
                            <div class="footer">

                                <table width="100%" class="table-black">
                                    <tr {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                                        <th class="s2"><strong>
                                                {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId
                                                == 0 || $userData->branchId == -1}
                                                {$Programsettingdata->phone}
                                                {else}
                                                {$branchData->mobile}
                                                {/if}
                                            </strong></th>
                                        <td width="15%" class="s1"><strong>تليفون</strong></td>
                                        <td width="45%" class="s2"><strong>
                                                {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId
                                                == 0 || $userData->branchId == -1}
                                                {$Programsettingdata->address}
                                                {else}
                                                {$branchData->branchAddress}
                                                {/if}


                                            </strong></td>
                                        <td width="15%" class="s1"><strong>العنوان</strong></td>
                                    </tr>
                                    <!-- <tr {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                                            <th class="s2" ><strong>
                                                    {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                                                    {$Programsettingdata->phone2}
                                                    {else}
                                                    {$branchData->phone}
                                                    {/if}
                                                </strong></th>
                                        </tr> -->
                                    <tr {if $billsettingsData[81]->billsettingsvalue == 1}style="display:none"{/if}>
                                        <td colspan="5" style="text-align:center !important">
                                            <p><span class="copywrites1">تصميم شركة جي تي فور 01110070882</span></p>
                                        </td>
                                    </tr>
                                </table>

                            </div>
                        </div>
                    {else}
                    <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0" class=""
                        style="margin-bottom: 5px">
                        <tr {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                            <td width="142" colspan="2" align="center" valign="top">
                                {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 ||
                                $userData->branchId == -1}
                                <img src="../views/default/images/upload/{$Programsettingdata->logo}" alt="" width="90%"
                                    height="50">
                                <div style="clear:both"></div>
                                <span>{$Programsettingdata->phone}</span>
                                {else}
                                <img src="../views/default/images/branch_image/{$branchData->logo}" alt="" width="90%"
                                    height="50">
                                <br />
                                {$branchData->mobile}
                                {/if}
                            </td>
                        </tr>
                    </table>
                    <h4 style="margin: 0">فاتورة المبيعات</h4>

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

                        <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[15]->billsettingsvalue && $Programsettingdata->clientserial == 1} eq
                            0} {else} style="display:none !important" {/if}>
                            <td align="right">
                                <span> رقم عمليه السداد: </span>
                                <span> {if $sellbillData->taxBillNumber >
                                    0}{$sellbillData->taxBillNumber}{else}{$sellbillData->sellbillid}{/if}</span>
                            </td>
                        </tr>

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

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

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

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

                        {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                        <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                            <td align="right">
                                <span>الدين قبل: </span>
                                <span>{$sellbillData->sellbilltotaldeptbefor}</span>
                            </td>
                        </tr>
                        {/if}
                    </table>
                    <table style="width:100%">
                        <tr>
                            <td align="right">
                                <span>تاريخ البيان:</span>
                                <span> {$sellbillData->sellbilldate}</span>
                            </td>

                        </tr>
                    </table>

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

                        <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 !important" {/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="rtl">

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


                            <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">

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

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

                    <div class="bbottom">
                        <table width="35%" align="left" cellpadding="0" cellspacing="0" dir="rtl"
                            class="td table-black">

                            <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 {$billsettingsData[117]->billsettingsvalue} eq 1 && $sellbillData->totalprodiscount > 0}
                            <tr>
                                <td>إجمالي خصومات المنتج</td>
                                <td>
                                    {$sellbillData->totalprodiscount}</td>
                            </tr>
                            {/if}

                            {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 {$sellbillData->sellbilldiscount} > 0 && {$billsettingsData[57]->billsettingsvalue} eq
                            0}
                            <!--                            <tr {if {$billsettingsData[47]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>

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

                            {/if}
                            {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}

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

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

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


                            <!--الصافى -->
                            {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}

                            <!--المدفوع -->
                            {if {$billsettingsData[29]->billsettingsvalue} eq 0 && $sellbillData->sellbilltotalpayed !=
                            $sellbillData->sellbilltotalbill}


                            <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                <td>المدفوع</td>
                                <td> {$sellbillData->sellbilltotalpayed} {$currency}</td>
                            </tr>
                            {/if}

                            {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[18]->billsettingsvalue} eq 0}
                            <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {{$sellbillData->
                                sellbilltotaldeptbefor}} <> 0} {else} style="display:none !important" {/if}}>

                                    <td>المديونية السابقة</td>
                                    <td>{$sellbillData->sellbilltotaldeptbefor}</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>
                        {if count($billPayments)>0}
                        <!--<h4 style="text-align: center;margin: 0">دفعات على الفاتورة</h4>-->
                        <table width="60%" align="right" cellpadding="0" cellspacing="0" dir="rtl"
                            class="td table-black {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>
                        <div class="footer">

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

                            <div id="terms" style="
                                     text-align: center;
                                     {if $billsettingsData[81]->billsettingsvalue == 1}display:none{/if}">
                                <h5>تصميم شركة جى تى فور 01110070882 </h5>
                            </div>
                        </div>
        </b>
    </div>
    </div>
    </div>

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