
<html>
    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>GT4</title>
        <style type="text/css">
            @media print {
                @page {
                    size: 100mm 200mm landscape; /* landscape */
                    /* you can also specify margins here: */
                    margin: 5mm;
                    margin-right:5mm; /* for compatibility with both A4 and Letter */
                }
                #printdiv{
                    margin-top:{$billsettingsData[82]->billsettingsvalue}mm; /* user margin */
                }
            }
        </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-bottom-color: #999;
            font-size: 15px;
            border-right-color: #999;
        }
        .NEE
        {
            font-size: 14px;
        }
        .newdesign
        {
            font-size: 14px;
        }
        .copywrites
        {
            font-size: 11px;
        }
        table.border-data td{border:1px solid #000;text-align: center}
    </style>
    {/literal}

    <body   onLoad="printDiv()">
        <div id="printdiv" >
            <table width='100%'>
                <tr {if $billsettingsData[70]->billsettingsvalue == 0}{else}  style="display:none"{/if}>

                    <td  colspan="6" align="center" style=" text-align:  center !important;border:0" class="style1">
                        <h2 style="margin: 0;border:0">{$billnameAddData->name}</h2>
                    </td>

                </tr>

            </table>
            <!-- width="{if {$billsettingsData[25]->billsettingsvalue} eq 0}420  {else} 250{/if}"س -->
            <table  cellpadding="0" cellspacing="0" {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                <tr>
                    <td width="851" height="115" align="left" valign="middle">&nbsp;</td>
                    <td width="1614" colspan="2" align="right" valign="top">
                        <strong><img src="../views/default/images/upload/{$Programsettingdata->logo}" alt="" width="122" height="75"><br>

                            {$Programsettingdata->phone}<br>
                        </strong>
                    </td>
                </tr>
            </table>
            <table width="100%" dir="rtl">
                {if {$Programsettingdata->deptprinting} eq 0}
                <tr {if {$billsettingsData[18]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                    <td dir="rtl">
                        <span> الدين قبل :</span>
                        <span> {$sellbillandruternData->sellbilltotaldeptbefor} {$currency}</span>
                    </td>

                </tr>
                {/if}
                <tr {if {$billsettingsData[15]->billsettingsvalue} eq 0&&$Programsettingdata->clientserial == 1}  {else} style="display:none !important" {/if}>
                    <td dir="rtl">
                        <span>رقم  تسلسل الفاتورة :</span>
                        <span> {$sellbillandruternData->sellbillid} </span>
                    </td>
                </tr>

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

                </tr>

                <tr>
                    <td dir="rtl">
                        <span>تاريخ البيان :</span>
                        <span>{$sellbillandruternData->sellbillsysdate} </span>
                    </td>

                </tr>

            </table>
            <div  style="text-align: center" colspan="8" style="background:#CCCCCC"> المبيعات </div>

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

                <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[22]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >ملاحظات</td>

                    <td align="center" {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else}  style="display:none"    {/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">السعر</td>
                    <td align="center" {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if} >الخصم</td>
                    <td align="center"> الاجمالى</td>


                </tr>



                {foreach $sellbilldetailData as $mysellbilldetailData}
                <tr>
                    <td >{$mysellbilldetailData@index+1}</td>
                    <td {if {$billsettingsData[59]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        {$mysellbilldetailData->parcode}
                    </td>
                    <td>
                        {$mysellbilldetailData->productName}{if {$billsettingsData[60]->billsettingsvalue} eq 0}/{$mysellbilldetailData->productCatName}{/if}
                        {if {$billsettingsData[79]->billsettingsvalue} eq 0}
                        {if isset($mysellbilldetailData->sizeName) && $mysellbilldetailData->sizeName !=""}/{$mysellbilldetailData->sizeName}{/if}
                        {if isset($mysellbilldetailData->colorName) && $mysellbilldetailData->colorName !=""}/{$mysellbilldetailData->colorName}{/if}
                        {/if}
                    </td>
                    <td {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else}  style="display:none !important"  {/if}>
                        {$mysellbilldetailData->note}
                    </td>
                    <td {if {$billsettingsData[53]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                        {$mysellbilldetailData->unitName}
                    </td>
                    <td {if {$billsettingsData[64]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        {$mysellbilldetailData->sellbilldetailquantity}
                    </td>
                    <td  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}>
                        {$mysellbilldetailData->otherdetailquantity}
                    </td>
                    <td>
                        {$mysellbilldetailData->sellbilldetailprice} {$currency}
                    </td>
                    <td {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        {$mysellbilldetailData->discounttype}
                    </td>
                    <td>
                        {$mysellbilldetailData->sellbilldetailtotalprice}
                    </td>
                </tr>

                {/foreach}
                <tfoot>
                    <tr>
                        <td colspan="1">الاجمالى</td>
                        <td {if {$billsettingsData[59]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        </td>
                        <td></td>
                        <td {if {$billsettingsData[22]->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[64]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                            {if {$sellbillandruternData->sellQuantity} <= 0}
                            {$sellQuantity}
                            {else}
                            {$sellbillandruternData->sellQuantity}
                            {/if}
                        </td>
                        <td  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}></td>
                        <td></td>
                        <td {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}></td>
                        <td>{$sellbillandruternData->sellbillprice}</td>
                    </tr>
                </tfoot>

            </table>

            <div  style="text-align: center" colspan="8" style="background:#CCCCCC"> المردودات </div>
            <table width="100%"  cellpadding="0" cellspacing="0" dir="rtl" class="table-black  border-data">

                <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 0}  {else} style="display:none !important" {/if} >ملاحظات</td>

                    <td align="center" {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else}  style="display:none"    {/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">السعر</td>
                    <td align="center" {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if} >الخصم</td>
                    <td align="center"> الاجمالى</td>

                </tr>



                {foreach $ruternbilldetailData as $myruternbilldetailData}
                <tr>
                    <td >{$myruternbilldetailData@index+1}</td>
                    <td {if {$billsettingsData[59]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        {$myruternbilldetailData->parcode}
                    </td>
                    <td>
                        {$myruternbilldetailData->productName}{if {$billsettingsData[60]->billsettingsvalue} eq 0}/{$myruternbilldetailData->productCatName}{/if}
                        {if {$billsettingsData[79]->billsettingsvalue} eq 0}
                        {if isset($myruternbilldetailData->sizeName) && $myruternbilldetailData->sizeName !=""}/{$myruternbilldetailData->sizeName}{/if}
                        {if isset($myruternbilldetailData->colorName) && $myruternbilldetailData->colorName !=""}/{$myruternbilldetailData->colorName}{/if}
                        {/if}

                    </td>
                    <td {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else}  style="display:none !important"  {/if}>
                        {$myruternbilldetailData->note}
                    </td>
                    <td {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        {$myruternbilldetailData->unitName}
                    </td>
                    <td {if {$billsettingsData[64]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        {$myruternbilldetailData->sellbilldetailquantity}
                    </td>
                    <td align="center"  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}>
                        {$myruternbilldetailData->otherdetailquantity}
                    </td>
                    <td>
                        {$myruternbilldetailData->sellbilldetailprice}
                    </td>
                    <td {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        {$myruternbilldetailData->discounttype}
                    </td>
                    <td>
                        {$myruternbilldetailData->sellbilldetailtotalprice}
                    </td>
                </tr>
                {/foreach}

                <tfoot>
                    <tr>
                        <td colspan="1">الاجمالى</td>
                        <td> </td>
                        <td {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else}  style="display:none !important"  {/if}>
                        </td>
                        <td {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        </td>
                        <!-- العدد-->
                        <td {if {$billsettingsData[64]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                            {if {$sellbillandruternData->returnsellQuantity} <= 0}
                            {$returnQuantity}
                            {else}
                            {$sellbillandruternData->returnsellQuantity}
                            {/if}
                        </td>
                        <td align="center"  {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}>
                        </td>
                        <td></td>
                        <td {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                        </td>
                        <td>{$sellbillandruternData->returnsellbillprice}</td>
                    </tr>
                </tfoot>

            </table>


            <table width="50%" border="0" style="margin-top: 10px" align="left" cellpadding="0" cellspacing="0"  dir="rtl" class="td border-data">
                <!--                                <tr>
                                                    <td>اجمالي فاتورة البيع</td>
                                                    <td>{$sellbillandruternData->sellbillprice}</td>
                                                </tr>-->
                <!--                                <tr>
                                                    <td>اجمالي المرتجع</td>
                                                    <td>{$sellbillandruternData->returnsellbillprice}</td>
                                                </tr>-->
                <tr>
                <tr>
                    <td>اجمالي الفاتوره</td>
                    <td>{$sellbillandruternData->sellbilltotalbill}</td>
                </tr>
                <!--                                <tr {if {$billsettingsData[58]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                                    <td>عدد القطع المباعه</td>
                                                    <td>
                                                        {if {$sellbillandruternData->sellQuantity} <= 0}
                                                        {$sellQuantity}
                                                        {else}
                                                        {$sellbillandruternData->sellQuantity}
                                                        {/if}
                                                    </td>
                                                </tr>-->

                <!--                                <tr>
                                                    <td>عدد القطع المرتجع</td>
                                                    <td>
                                                        {if {$sellbillandruternData->returnsellQuantity} <= 0}
                                                        {$returnQuantity}
                                                        {else}
                                                        {$sellbillandruternData->returnsellQuantity}
                                                        {/if}

                                                    </td>
                                                </tr>-->

                <!--{*if  {$sellbillandruternData->sellbilldiscount} > 0*}-->
                <!--                <tr {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                    <td>نوع الخصم</td>
                                    <td>
                                        {if {$sellbillandruternData->sellbilldiscounttype} eq 1}
                                        مباشر
                                        {else}
                                        بنسبة
                                        {/if}
                                    </td>
                                </tr>-->

                {if  $sellbillandruternData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 1}
                <tr>
                    <td>خصم اضافى</td>
                    <td>{$sellbillandruternData->extraDiscountVal}</td>
                </tr>
                {/if}
                <tr {if {$billsettingsData[47]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                    <td>قيمه الخصم</td>
                    <td>   {$discountvalue} {if $sellbillandruternData->sellbilldiscounttype eq 2}(%{$sellbillandruternData->sellbilldiscount}){/if}</td>
                </tr>
                {if  $sellbillandruternData->extraDiscountVal > 0 && $billsettingsData[90]->billsettingsvalue == 1 && $billnameAddData->extraDiscountPlace == 0}
                <tr>
                    <td>خصم اضافى</td>
                    <td>{$sellbillandruternData->extraDiscountVal}</td>
                </tr>
                {/if}
                <tr>
                    <td>ضريبه القيمة المضافة</td>
                    <td> {$totaltax}{$Programsettingdata->currancy} ({$sellbillandruternData->tax}%) </td>
                </tr>
                {if $billnameAddData->taxOfDiscountPrint eq 0}
                <tr>
                    <td> ضريبه الخصم </td>
                    <td>{$sellbillandruternData->taxOfDiscountVal}</td>
                </tr>
                {/if}

                <tr {if {$billsettingsData[52]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>
                    <td>الصافى</td>
                    <td>{$sellbillandruternData->sellbillaftertotalbill} {$currency}</td>
                </tr>
                <!--{*/if*}-->
                <tr {if {$billsettingsData[54]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                    <td>المدفوع</td>
                    <td> {$sellbillandruternData->sellbilltotalpayed} {$currency}</td>
                </tr>
                <tr {if {$billsettingsData[55]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                    <td>المتبقى</td>
                    <td>{$sellbillandruternData->sellbillfinalbill} </td>
                </tr>
                {if {$sellbillandruternData->sellbilltotaldeptafter} <> 0}
                <tr {if {$billsettingsData[56]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                    <td>إجمالى المديونيه</td>
                    <td>{$sellbillandruternData->sellbilltotaldeptafter} {$currency}</td>
                </tr>
                {/if}


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

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

            <table>
                <td >توقيع العميل </td> <td></td><td >توقيع ال{if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if} </td>
                </tr>

            </table>
            {/if}
            <div style="text-align: right;{if $billsettingsData[81]->billsettingsvalue == 1}display:none{/if}"><p class="NEE"><strong>{$Programsettingdata->address}</strong></p></td>
                <div style="text-align: center">
                    <p><span class="copywrites"><span class="copywrites">تصميم شركة جي تي فور 01110070882...</span></span></p>
                </div>
            </div>
    </body>