<html dir="ltr">
    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>GT4</title>
        <style type="text/css">
        </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-bottom-color: #999;
            font-size: 15px;
            border-right-color: #999;
            text-align: center
        }
        .NEE
        {
            font-size: 14px;
        }
        .newdesign
        {
            font-size: 14px;
        }
        .copywrites
        {
            font-size: 11px;
        }
        .hidden{
            display: none;
        }
    </style>
    {/literal}
    <body onLoad="printDiv()">
        <div id="printdiv"  >

            <table class="table-black" width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
                <tr>
                    <td width="148" height="115" align="left" valign="middle">&nbsp;</td>
                    <td width="142" colspan="2" align="right" valign="top"><p><strong><img src="../views/default/images/upload/{$Programsettingdata->logo}" alt="" width="122" height="75"><br>

                                {$Programsettingdata->phone}<br>
                                </td>
                                </tr>
                                </table>

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

                                    <tr {if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                        <td dir="rtl">
                                            <span>اسم المورد:</span>
                                            <span>{$buyBillData->suppliername}</span>
                                        </td>
                                    </tr>
                                    <tr class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$billsettingsData[18]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                        <td dir="rtl">
                                            <span>الدين قبل  :</span>
                                            <span>{$buyBillData->buybilltotaldeptbefor}</span>
                                        </td>
                                    </tr>
                                    <tr  {if {$billsettingsData[15]->billsettingsvalue} eq 0&& $Programsettingdata->clientserial == 1}  {else} style="display:none !important" {/if}>
                                        <td dir="rtl">
                                            <span>رقم تسلسل الفاتورة : </span>
                                            <span>{$buyBillData->buybillid}</span>
                                        </td>

                                    </tr>
                                    <tr  {if {$billsettingsData[61]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                        <td dir="rtl">
                                            <span>رقم الفاتورة : </span>
                                            <span>{$buyBillData->buybillSerial}</span>
                                        </td>

                                    </tr>
                                </table>
                                <table align="left" width="60%">
                                    <tr>
                                        <td dir="rtl">
                                            <span>تاريخ البيان :</span>
                                            <span>{$buyBillData->buybilldate}</span>
                                        </td>
                                    </tr>

                                    {if {$Programsettingdata->saveprinting} eq 1}
                                    <tr>
                                        <td dir="rtl">
                                            <span>اسم المخزن :</span>
                                            <span>{$buyBillData->storeName}</span>
                                        </td>

                                    </tr>
                                    {/if}
                                    {if {$billsettingsData[22]->billsettingsvalue} eq 0}
                                    <tr>
                                        <td dir="rtl">
                                            <span>التعليق:</span>
                                            <span> {$buyBillData->comment}</span> </td>
                                    </tr>
                                    {/if}

                                    <tr>
                                </table>
                                <div style="clear:both"></div>
                                <!--start title -->
                                <div >
                                    <h4  style="  text-align:center;margin:5px 0 10px">{$billnameAddData->name}</h4>
                                </div>
                                <!-- end title -->


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

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


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

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

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


                                        <td align="center" {if {$billsettingsData[64]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>العدد</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[57]->billsettingsvalue} eq 0} {else}  style="display:none"    {/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[59]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>

                                            {$detail->parcode}

                                        </td>

                                        <td>

                                            {$detail->productName}{if {$billsettingsData[60]->billsettingsvalue} eq 0}/{$detail->productCatName}{/if}
                                            {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 1}  style="display:none !important"  {/if}>

                                            {$detail->note}

                                        </td>


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

                                            {$detail->unitName}

                                        </td>

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

                                            {$detail->buybilldetailquantity}

                                        </td>
                                        <td   {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                            {$detail->otherdetailquantity}
                                        </td>
                                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                            {$detail->buybilldetailprice} {$currency}
                                        </td>
                                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$billsettingsData[57]->billsettingsvalue} eq 0} {else}  style="display:none"    {/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[7]->billsettingsvalue} eq 1}  style="display:none !important"  {/if}>

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

                                                {$countBillDetails}

                                            </td>
                                            <td   {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}">
                                            </td>
                                            <td>
                                            </td>
                                            <td {if {$billsettingsData[57]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                            </td>
                                            <td>{$buyBillData->buybilltotalbill}</td>
                                        </tr>
                                    </tfoot>

                                </table>
                                <table width="50%" border="" align="left" cellpadding="0" cellspacing="0"  dir="rtl" class="td {if $Usergroupdata->hideBillPrices == 1}hidden{/if}">

                                    <!--
                                                                                <tr {if {$billsettingsData[58]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                                                                    <td>اجمالي  القطع</td>
                                                                                    <td>{$countBillDetails}</td>
                                                                                </tr> -->

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

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


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

                                    <tr {if {$billsettingsData[52]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                        <td>المبلغ بعد الخصم</td>
                                        <td>{$buyBillData->buybillaftertotalbill} {$currency}</td>
                                    </tr>


                                    <tr {if {$billsettingsData[54]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                        <td>المدفوع</td>
                                        <td> {$buyBillData->buybilltotalpayed}{$currency}</td>
                                    </tr>
                                    <tr {if {$billsettingsData[55]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                        <td>المتبقى</td>
                                        <td>{$buyBillData->buybillfinalbill} {$currency}</td>
                                    </tr>
                                    {if {$buyBillData->buybilltotaldeptafter} <> 0}
                                    <tr {if {$billsettingsData[56]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                        <td>إجمالى المديونيه</td>
                                        <td>{$buyBillData->buybilltotaldeptafter}{$currency}</td>
                                    </tr>
                                    {/if}
                                    <tr style="display:none;">
                                        <td colspan="2" valign="bottom">&nbsp;</td>
                                    </tr>

                                </table>
                                <div style="clear:both"></div>
                                <div style="text-align:center">
                                    <p class="NEE" style="margin:2px;font-size:14px"><strong>{$Programsettingdata->address}</strong></p>
                                    <p style="margin:0;font-size:14px">

                                        <span>01110070882...</span>
                                        <span style="display:inline-block">GT4 تصميم شركه </span></p>

                                </div>


                                </div>
                                </body>