<html dir='rtl'>
    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>GT4</title>
        <style type="text/css">
            .serial {
                background-color: #C8C8C8;
                height: 20px;
                width: 150px;
                padding: 5px;
                margin: 5px;
                border: medium double #000000;
                text-align: center;
            }
            .style1 {
                font-size: 12px
            }
            .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 td
        {
            border-right-widtd: 1px;
            border-bottom-widtd: 1px;
            border-left-widtd: 0px;
            border-top-style: none;
            border-right-style: dotted;
            border-bottom-style: solid;
            border-left-style: none;
            border-bottom-color: #999;
            font-size: 15px;
            border-right-color: #999;
        }
        .NEE
        {
            font-size: 14px;
        }
        .newdesign
        {
            font-size: 14px;
        }
        .copywrites
        {
            font-size: 11px;
        }
        .style2 {
            font-family: tahoma
        }
        .style4 {font-family: tahoma; font-size: 12px; font-weight: bold; }

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

            <!--start title -->
            <!-- <div {if $billsettingsData[69]->billsettingsvalue == 0}{else}  style="display:none"{/if}>
                <h2  style="  text-align:center">{$billnameAddData->name}</h2>
            </div> -->
            <!-- end title -->
            {if {$billsettingsData[25]->billsettingsvalue} eq 0}

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

                    <td colspan="2" align="right" class="style1" {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                        {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                        <img src="../views/default/images/upload/{$Programsettingdata->logo}" alt="" width="134" height="49"><br>
                        {$Programsettingdata->phone}
                        {else}
                        <img src="../views/default/images/branch_image/{$branchData->logo}" alt="" width="134" height="49"><br>
                        {$branchData->mobile}
                        {/if}
                    </td>
                </tr>

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

                    <td></td>
                    <td></td>
                    <td colspan="2" align="center" class="style1">
                        <h1  style="float:right; text-align:center">{$billnameAddData->name}</h1>
                    </td>
                </tr>
                <tr>
                    <td width="5%" height="26" align="right">&nbsp;</td>
                    <td width="4%" align="right">&nbsp;</td>
                    <td width="23%" align="right">&nbsp;</td>
                    <td width="23%" align="right">&nbsp;</td>
                    <td width="37%" align="right"><span class="style1 style2">{$buyBillData->buybilldate}</span></td>
                    <td width="8%" align="right"><span class="style1 style2">التاريخ</span></td>
                </tr>
                <tr>
                    <td align="right">&nbsp;</td>
                    <td align="right">

                        {if {$billsettingsData[27]->billsettingsvalue} eq 0}
                        <span class="style1 style2">
                            {$buyBillData->storeName} </span>
                        {/if}    </td>
                    <td align="right">&nbsp;</td>
                    <td align="right"><span class="style1 style2 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{if {$billsettingsData[18]->billsettingsvalue} eq 0} دين قبل :{$buyBillData->buybilltotaldeptbefor} {/if}</span></td>
                    <td colspan="2" align="right" {if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} ><span class="style1 style2">{$buyBillData->suppliername}</span> </td>
                </tr>
                <tr>
                    <td colspan="6"><table width="100%" border="0" cellpadding="2" cellspacing="7">
                            <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 !important" {/if}>الخصم</td>
                                <td align="center" bgcolor="#B4B4B4" class="style4 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">السعر</td>
                                <td align="center" bgcolor="#B4B4B4" class="style4" {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}" >{$Programsettingdata->scunitname}</td>

                                <td align="center" bgcolor="#B4B4B4" class="style4">الكمية</td>

                                <td align="center" bgcolor="#B4B4B4" class="style4"{if {$billsettingsData[21]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>الوحدة</td>
                                <td align="center" bgcolor="#B4B4B4" class="style4"{if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>الملاحظة</td>
                                <td align="center" bgcolor="#B4B4B4" class="style4" {if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>الباركود</td>
                                <td width="50%" align="center" bgcolor="#B4B4B4" class="style4">اسم المنتج</td>
                                <td align="right" bgcolor="#B4B4B4" class="style4">م </td>
                            </tr>
                            {foreach $buyBillDetails as $detail}
                            <tr>
                                <td align="center" class="style2 style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$detail->buybilldetailtotalprice}</td>
                                <td align="center" class="style2 style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}"{if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$detail->discountvalue} </td>
                                <td align="center" class="style2 style1 {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">{$detail->buybilldetailprice}</td>
                                <td  align="center" class="style2 style1" {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                    {$detail->otherdetailquantity}
                                </td>
                                <td align="center" class="style2 style1"> {$detail->buybilldetailquantity} </td>

                                <td align="center" class="style2 style1"{if {$billsettingsData[21]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$detail->unitName}</td>
                                <td align="center" class="style2 style1"{if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$detail->note}</td>
                                <td align="center" class="style2 style1"{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$detail->parcode}</td>
                                <td align="right" class="style2 style1">{$detail->productName}/{$detail->productCatName}
                                    {if {$billsettingsData[79]->billsettingsvalue} eq 0}
                                    {if isset($detail->sizeName) && $detail->sizeName !=""}/{$detail->sizeName}{/if}
                                    {if isset($detail->colorName) && $detail->colorName !=""}/{$detail->colorName}{/if}
                                    {/if}
                                </td>
                                <td align="center" class="style2">{$detail@index+1}</td>
                            </tr>
                            {/foreach}
                        </table></td>
                </tr>
                <tr>
                    <td colspan="6"><hr /></td>
                </tr>
                <tr>
                    <td colspan="2"><table width="100%" border="0" cellpadding="2" cellspacing="7" class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                            <tr>
                                <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">الاجمالي</td>
                                <td width="30%" align="center">&nbsp;</td>

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

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

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

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


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

                                {if  {$buyBillData->buybilldiscount} > 0}
                                <td width="8%" align="center" bgcolor="#B4B4B4">قيمة الخصم</td>
                                <td width="8%" align="center" bgcolor="#B4B4B4">نوع الخصم</td>
                                {/if}





                                <td width="9%" align="center" bgcolor="#B4B4B4" class="style1">عدد الوحدات</td>
                            </tr>
                            <tr>
                                <td align="center" class="style1">{$buyBillData->buybilltotalbill}</td>
                                <td align="center" class="style1">&nbsp;</td>
                                {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                                <td align="center" class="style1"  >{$buyBillData->buybilltotaldeptafter}</td>
                                {/if}
                                <!-----------الباقى ------------------->
                                {if {$billsettingsData[30]->billsettingsvalue} eq 0}
                                <td align="center" class="style1">{$buyBillData->buybillfinalbill}</td>
                                {/if}
                                <!-----------المدفوع ------------------->
                                {if {$billsettingsData[29]->billsettingsvalue} eq 0}
                                <td align="center" class="style1">{$buyBillData->buybilltotalpayed}</td>
                                {/if}

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


                                {if {$billsettingsData[36]->billsettingsvalue} eq "0"}
                                <td align="center" class="style1">{$taxvalue}{$currency} ({$buyBillData->payedtax}%) </td>
                                {/if}
                                {if  {$buyBillData->buybilldiscount} > 0}
                                <td align="center" class="style1">{$buyBillData->buybilldiscount} </td>
                                <td align="center" class="style1">
                                    {if $buyBillData->buybilldiscountrype eq 0}
                                    مباشر
                                    {else}
                                    بنسبة
                                    {/if}
                                </td>
                                {/if}


                                <td align="center" class="style1">{$countBillDetails}</td>
                            </tr>
                        </table></td>
                </tr>
                <tr {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                    <td height="130" colspan="6" align="right" valign="bottom"><span class="style1" style="direction:rtl"><strong>
                                {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                                {$Programsettingdata->address}
                                {else}
                                {$branchData->branchAddress}
                                {/if}
                            </strong></span></td>
                </tr>
                <tr>
                    <td colspan="6"><p><span class="copywrites"><span class="copywrites">تصميم شركة جي تي فور 01110070882</span></span></p></td>
                </tr>
            </table>

            {else}

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

                                </table>

                                <div {if $billsettingsData[69]->billsettingsvalue == 0}{else}  style="display:none"{/if}>
                                    <div class="style1" >
                                        <h1  style=" text-align:center">{$billnameAddData->name}</h1>    </div>
                                </div>
                                <div style="clear:both"></div>

                                <table align="right" width="60%">


                                    {if {$billsettingsData[15]->billsettingsvalue} eq 0}
                                    <tr >
                                        <td align="right">
                                            <span>اسم المورد :</span>
                                            <span> {$buyBillData->suppliername}</span>
                                        </td>
                                    </tr>
                                    {/if}

                                    {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                                    <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                        <td align="right"> {$buyBillData->buybilltotaldeptbefor}:  </td>
                                    </tr>
                                    {/if}
                                    <tr   {if {$billsettingsData[15]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                        <td align="right">
                                            <span>  رقم الفاتورة :</span>
                                            <span>{$buyBillData->buybillid}</span></td>
                                    </tr>
                                    <tr>
                                        <td align="right" >
                                            <span>  التاريخ:</span>
                                            <span>{$buyBillData->buybilldate}</span>
                                        </td>
                                    </tr>
                                </table>
                                <table align="right" width="40%">

                                    <tr  {if {$billsettingsData[15]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                        <td align="right">
                                            <span> رقم عملية السداد :</span>
                                            <span>{$buyBillData->buybillSerial}</span> </td>
                                    </tr>

                                    {if {$billsettingsData[27]->billsettingsvalue} eq 0}
                                    <tr>
                                        <td  align="right">
                                            <span>اسم المخزن:</span>
                                            <span> {$buyBillData->storeName}</span> </td>
                                    </tr>
                                    {/if}
                                    {if {$billsettingsData[22]->billsettingsvalue} eq 0}
                                    <tr>
                                        <td  align="right">
                                            <span>التعليق:</span>
                                            <span> {$buyBillData->comment}</span> </td>
                                    </tr>
                                    {/if}
                                </table>

                                <table width="100%" border="1" cellpadding="0" cellspacing="0" dir="rtl" class="table-black" style="text-align: center">

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


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

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

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


                                        <td align="center">العدد</td>
                                        <td align="center"  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}" >{$Programsettingdata->scunitname}</td>

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



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

                                            {$detail->parcode}                  </td>

                                        <td > {$detail->productName}/{$detail->productCatName}
                                            {if {$billsettingsData[79]->billsettingsvalue} eq 0}
                                            {if isset($detail->sizeName) && $detail->sizeName !=""}/{$detail->sizeName}{/if}
                                            {if isset($detail->colorName) && $detail->colorName !=""}/{$detail->colorName}{/if}
                                            {/if}
                                        </td>
                                        <td {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>

                                            {$detail->note} </td>

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

                                            {$detail->unitName} </td>
                                        <td > {$detail->buybilldetailquantity} </td>


                                        <td  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                            <p class="form-control-static"> {$detail->otherdetailquantity}</p>
                                        </td>
                                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}"> {$detail->buybilldetailprice} {$currency} </td>
                                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >

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

                                    </tr>

                                    {/foreach}
                                    <tfoot class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                        <tr>
                                            <td colspan="2">الاجمالى</td>
                                            <td {if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}></td>
                                            <td {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}></td>
                                            <td {if {$billsettingsData[21]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}></td>

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

                                            <td></td>
                                            <td {if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}></td>
                                            <td>{$buyBillData->buybilltotalbill}</td>
                                        </tr>
                                    </tfoot>
                                </table>
                                <table style="margin-top: 5px;text-align: center" width="40%" border="1" align="left" cellpadding="0" cellspacing="0"  dir="rtl" class="td {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">

                                    <tr {if {$billsettingsData[46]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                        <td>نوع الخصم</td>
                                        <td>{$countBillDetails}</td>
                                    </tr>

                                    {if  {$buyBillData->buybilldiscount} > 0}
                                    <tr {if {$billsettingsData[47]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                        <td>نوع الخصم</td>
                                        <td>
                                            {if $buyBillData->buybilldiscountrype eq 0}
                                            مباشر
                                            {else}
                                            غير مباشر
                                            {/if}
                                        </td>
                                    </tr>

                                    <tr {if {$billsettingsData[47]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                        <td>قيمة الخصم</td>
                                        <td>  {$buyBillData->buybilldiscount} </td>
                                    </tr>

                                    {/if}
                                    <!---------------------???????-->
                                    {if {$billsettingsData[36]->billsettingsvalue} eq "0"}
                                    <tr>
                                        <td> ضريبه القيمة المضافة</td>
                                        <td> {$taxvalue}{$currency} ({$buyBillData->payedtax}%)</td>
                                    </tr>
                                    {/if}
                                    <tr>
                                        <td>المبلغ بعد الخصم</td>
                                        <td>{$buyBillData->buybillaftertotalbill} {$currency}</td>
                                    </tr>





                                    <!---------------------???????-->
                                    {if {$billsettingsData[29]->billsettingsvalue} eq 0}
                                    <tr>
                                        <td>المدفوع</td>
                                        <td> {$buyBillData->buybilltotalpayed}{$currency}</td>
                                    </tr>
                                    {/if}
                                    <!-----------?????? -->
                                    {if {$billsettingsData[28]->billsettingsvalue} eq 0}
                                    <tr>
                                        <td>الصافى</td>
                                        <td> {$buyBillData->buybillaftertotalbill}{$currency}</td>
                                    </tr>
                                    {/if}

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

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

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

                                <p style="text-align: center"><span class="copywrites"><span class="copywrites"> 01110070882 تصميم بواسطه شركه GT4</span></span></p></td>


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