
<html>
    <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-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;
        }
    </style>
    <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; }
        .serial {
            background-color: #C8C8C8;
            height: 20px;
            width: 150px;
            padding: 5px;
            margin: 5px;
            border: medium double #000000;
            text-align: center;
        }
        .style1 {
            font-size: 12px
        }
    </style>
    {/literal}
    <body onLoad="printDiv()">
        <div id="printdiv"  >
            {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">{$returnsellbillData->returnsellbillid}</div--></td>
                    <td>&nbsp;</td>
                    <td>&nbsp;</td>
                    <td colspan="2" align="right" class="style1"><img src="../views/default/images/upload/{$Programsettingdata->logo}" alt="" width="134" height="49"><br>
                        {$Programsettingdata->phone}</td>
                </tr>


                <tr>


                    <td colspan="6" nowarp  align="center" class="style1">
                        <h1   text-align:center">{$billnameAddData->name}</h1>
                    </td>
                </tr>

                {if $Programsettingdata->clientserial eq 1}
                <td width="8%" align="right" ><span class="style1 style2">رقم  تسلسل الفاتورة   :{$returnsellbillData->returnsellbillid}</span></td>
                {/if}
                <tr {if {$billsettingsData[3]->billsettingsvalue} eq 0} style="display:block" {else} style="display:none" {/if}>
                    <td  align="right" dir="rtl" ><span class="style1 style2">{if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if}: {$returnsellbillData->employeename}</span></td>
                    <td width="23%" align="right">&nbsp;</td>

                    <td width="37%" align="right"></td>

                    <td colspan="2" nowrap  width="8%" align="right"><span class="style1 style2">التاريخ :{$returnsellbillData->returnsellbillsysdate}</span></td>
                </tr>
                <tr>
                    <td align="right"  dir="rtl"><span class="style1 style2">{if {$billsettingsData[18]->billsettingsvalue} eq 0} (ح/س){$returnsellbillData->returnsellbilltotaldeptbefor}{/if}</span></td>
                    <td align="right">&nbsp;</td>
                    <td align="right">  {if {$billsettingsData[27]->billsettingsvalue} eq 0}  {$returnsellbillData->storeName}{/if} </td>
                    <td align="right">&nbsp;</td>

                    <td colspan="2" align="right" {if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >السيد : {$returnsellbillData->tempclientName}</td>
                </tr>
                <tr>
                    <td colspan="6"><table width="100%" border="0" cellpadding="2" cellspacing="7">
                            <tr>
                                <td align="center" bgcolor="#B4B4B4" class="style4">الاجمالي</td>
                                <td align="center" bgcolor="#B4B4B4" class="style4"{if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if} >الخصم</td>
                                <td align="center" bgcolor="#B4B4B4" class="style4">السعر</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[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 !important" {/if}>الباركود</td>
                                <td width="50%" align="center" bgcolor="#B4B4B4" class="style4">اسم المنتج</td>
                                <td align="right" bgcolor="#B4B4B4" class="style4">م </td>
                            </tr>
                            {foreach $returnsellbilldetailData as $myreturnsellbilldetailData}
                            <tr>
                                <td align="center" class="style2 style1">{$myreturnsellbilldetailData->returnsellbilldetailtotalprice} </td>
                                <td align="center" class="style2 style1"{if {$billsettingsData[23]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>

                                    {if {$billsettingsData[34]->billsettingsvalue} eq 0}{$myreturnsellbilldetailData->discountvalue} {else}  {$myreturnsellbilldetailData->discounttype} {/if}

                                </td>
                                <td align="center" class="style2 style1"> {$myreturnsellbilldetailData->returnsellbilldetailprice} </td>
                                <td align="center" class="style2 style1" {if {$Programsettingdata->scunitname} eq '0'}  hidden {/if}>
                                    {$myreturnsellbilldetailData->otherdetailquantity}
                                </td>
                                <td align="center" class="style2 style1"> {$myreturnsellbilldetailData->returnsellbilldetailquantity} </td>
                                <td align="center" class="style2 style1"{if {$billsettingsData[21]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>

                                    {$myreturnsellbilldetailData->unitName} </td>
                                <td align="center" class="style2 style1"{if {$billsettingsData[22]->billsettingsvalue} eq 0}  {else}  style="display:none !important"  {/if}>

                                    {$myreturnsellbilldetailData->note} </td>
                                <td align="center" class="style2 style1"{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$myreturnsellbilldetailData->parcode} </td>
                                <td align="right" class="style2 style1"> {$myreturnsellbilldetailData->productName}/{$myreturnsellbilldetailData->productCatName} </td>
                                <td align="center" class="style2">{$myreturnsellbilldetailData@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">
                            <tr>



                                <!-----------الدين بعد ------------------->
                                {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}
                                <!---------------------إجمالى المديونية----------------->
                                <td width="9%" align="center" bgcolor="#B4B4B4">إجمالى المديونية</td>
                                <!---------------------الصافي----------------->
                                {if {$billsettingsData[28]->billsettingsvalue} eq 0}
                                <td width="9%" align="center" bgcolor="#B4B4B4">الصافي</td>
                                {/if}


                                {if {$billsettingsData[31]->billsettingsvalue} eq 0}
                                <td width="9%" 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}

                                {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                                <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">الدين السابق</td>
                                {/if}
                                <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">الاجمالي</td>
                                <td width="9%" align="center" bgcolor="#B4B4B4" class="style1">الكمية</td>
                            </tr>
                            <tr>


                                <!-----------الدين بعد ------------------->
                                {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                                <!--td align="center" class="style1" >{$returnsellbillData->returnsellbilltotaldeptafter}</td-->
                                {/if}
                                <!---------------------الباقي----------------->
                                {if {$billsettingsData[30]->billsettingsvalue} eq 0}
                                <!--td align="center" class="style1">{$returnsellbillData->returnsellbillfinalbill}</td-->
                                {/if}

                                <!-----------المدفوع ------------------->
                                {if {$billsettingsData[29]->billsettingsvalue} eq 0}
                                <!--td align="center" class="style1">{$returnsellbillData->returnsellbilltotalpayed}</td-->
                                {/if}
                                <!---------------------إجمالى المديونية-------->
                                <td align="center" class="style1">{$returnsellbillData->returnsellbilltotaldeptbefor+$returnsellbillData->returnsellbilltotalbill}</td>
                                <!---------------------الصافي----------------->
                                {if {$billsettingsData[28]->billsettingsvalue} eq 0}
                                <td align="center" class="style1">{$returnsellbillData->returnsellbillaftertotalbill} </td>
                                {/if}

                                {if {$billsettingsData[31]->billsettingsvalue} eq 0}
                                <td align="center" class="style1">{$returnsellbillData->tax} </td>
                                {/if}
                                {if  {$returnsellbillData->returnsellbilldiscount} > 0}
                                <td align="center" class="style1"> {$returnsellbillData->returnsellbilldiscount}</td>
                                <td align="center" class="style1"> {if {$returnsellbillData->returnsellbilldiscounttype} eq 1}
                                    مباشر
                                    {else}
                                    بنسبة
                                    {/if} </td>
                                {/if}
                                {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                                <td align="center" class="style1">{$returnsellbillData->returnsellbilltotaldeptbefor}</td>
                                {/if}
                                <td align="center" class="style1">{$returnsellbillData->returnsellbilltotalbill}</td>
                                <td align="center" class="style1"> {if {$returnsellbillData->returnsellQuantity} <= 0}
                                    {$quantity}
                                    {else}
                                    {$returnsellbillData->returnsellQuantity}
                                    {/if} </td>
                            </tr>
                        </table></td>
                </tr>
                <tr>
                    <td colspan="2"><table width="100%" border="0" cellpadding="2" cellspacing="7">
                            <tr>
                                <!-----------الدين بعد ------------------->
                                {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                                <td width="50%" align="center" bgcolor="#B4B4B4" >رصيد الدين</td>
                                {/if}
                                <!---------------------المدفوع----------------->
                                {if {$billsettingsData[29]->billsettingsvalue} eq 0}
                                <td width="50%" align="center" bgcolor="#B4B4B4">المدفوع</td>
                                {/if}
                            </tr>
                            <tr>
                                <!-----------الدين بعد ------------------->
                                {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                                <td align="center" class="style1" >{$returnsellbillData->returnsellbilltotaldeptafter}</td>
                                {/if}
                                <!-----------المدفوع ------------------->
                                {if {$billsettingsData[29]->billsettingsvalue} eq 0}
                                <td align="center" class="style1">{$returnsellbillData->returnsellbilltotalpayed}</td>
                                {/if}
                            </tr>
                        </table>
                    </td>
                </tr>
                {if {$billsettingsData[43]->billsettingsvalue} eq 0}
                <tr>
                    <td colspan="3" align="right">
                        <br/> <br/>
                    </td>
                </tr>
                <tr>

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

                <tr>
                    <td height="130" colspan="3"  nowrapalign="right" valign="bottom"><!--span class="style1" style="direction:rtl"><strong>{$returnsellbillData->useremployeename}</strong></span--></td>
                    <td height="130" colspan="3" align="right" valign="bottom"><span class="style1" style="direction:rtl"><strong>{$Programsettingdata->address}</strong></span></td>
                </tr>
                <tr>
                    <td colspan="6"  style="text-align:center !important"><p><span class="copywrites1">تصميم شركة جي تي فور 01110070882</span></p></td>
                </tr>
            </table>
            {else}
            <table  width="97%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-black">
                <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>

                                <tr><td></td><td>
                                        <table align="right">
                                            <tr>
                                                <td   colspan="3" align="right" class="style1" dir="rtl">
                                                    <h1  style="float:right; text-align:right">{$billnameAddData->name}</h1>    </td>
                                            </tr>

                                            {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                                            <tr >
                                                <td align="right">  {$returnsellbillData->returnsellbilltotaldeptbefor}  {$currency}</td>

                                                <td align="right"> : الدين قبل</td>
                                            </tr>
                                            {/if}
                                            {if {$billsettingsData[16]->billsettingsvalue} eq 0}
                                            <tr >
                                                <td align="right">  {$returnsellbillData->tempclientName}</td>

                                                <td align="right"> : اسم العميل </td>
                                            </tr>
                                            {/if}
                                            {if $Programsettingdata->clientserial eq 1}
                                            <tr >
                                                <td align="right">   {$returnsellbillData->returnsellbillid}</td>

                                                <td align="right"> :رقم  تسلسل الفاتورة</td>
                                            </tr>
                                            {/if}
                                            <tr>
                                                <td align="right">  {$returnsellbillData->returnsellbillsysdate}</td>

                                                <td align="right" > : تاريخ البيان</td>
                                            </tr>

                                            {if {$billsettingsData[27]->billsettingsvalue} eq 0}
                                            <tr>
                                                <td align="right">  {$returnsellbillData->storeName}</td>

                                                <td  align="right"> : اسم المخزن</td>
                                            </tr>
                                            {/if}
                                        </table>
                                    </td>
                                </tr>

                                <tr>


                                    <td colspan="3" class="td"align="right">
                                        <table width="100%" border="0" cellpadding="0" cellspacing="0" dir="rtl" class="table-black">

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

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


                                            </tr>



                                            {foreach $returnsellbilldetailData as $myreturnsellbilldetailData}

                                            <tr>

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

                                                    {$myreturnsellbilldetailData->parcode}

                                                </td>

                                                <td>

                                                    {$myreturnsellbilldetailData->productName}/{$myreturnsellbilldetailData->productCatName}

                                                </td>


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

                                                    {$myreturnsellbilldetailData->note}

                                                </td>


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

                                                    {$myreturnsellbilldetailData->unitName}

                                                </td>


                                                <td>

                                                    {$myreturnsellbilldetailData->returnsellbilldetailquantity}

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

                                                <td>

                                                    {$myreturnsellbilldetailData->returnsellbilldetailprice} {$currency}

                                                </td>



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



                                                    {if {$billsettingsData[34]->billsettingsvalue} eq 0}{$myreturnsellbilldetailData->discountvalue} {else}  {$myreturnsellbilldetailData->discounttype} {/if}
                                                </td>


                                                <td>

                                                    {$myreturnsellbilldetailData->returnsellbilldetailtotalprice}

                                                </td>





                                            </tr>

                                            {/foreach}

                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td height="54" colspan="3" align="right"><table width="50%" border="0" align="left" cellpadding="0" cellspacing="0"  dir="rtl" class="td">

                                            <tr>
                                                <td>اجمالي الفاتوره</td>
                                                <td>{$returnsellbillData->returnsellbilltotalbill}</td>
                                            </tr>
                                            <tr>
                                                <td {if {$billsettingsData[46]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>عدد القطع</td>
                                                <td>
                                                    {if {$returnsellbillData->returnsellQuantity} <= 0}
                                                    {$quantity}
                                                    {else}
                                                    {$returnsellbillData->returnsellQuantity}
                                                    {/if}
                                                </td>
                                            </tr>

                                            {if  {$returnsellbillData->returnsellbilldiscount} > 0}
                                            <tr {if {$billsettingsData[47]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                                                <td>نوع الخصم</td>
                                                <td>
                                                    {if {$returnsellbillData->returnsellbilldiscounttype} eq 1}
                                                    مباشر
                                                    {else}
                                                    بنسبة
                                                    {/if}
                                                </td>
                                            </tr>

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

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

                                            <tr>
                                                <td>ضريبه القيمة المضافة</td>
                                                <td>  % {$returnsellbillData->tax}</td>
                                            </tr>
                                            {/if}
                                            <tr>
                                                <td>المبلغ بعد الخصم</td>
                                                <td>{$returnsellbillData->returnsellbillaftertotalbill} {$currency}</td>
                                            </tr>
                                            {/if}

                                            <!-----------الصافى   ------------------->
                                            {if {$billsettingsData[28]->billsettingsvalue} eq 0}
                                            <tr>
                                                <td>الصافى</td>
                                                <td> {$returnsellbillData->returnsellbillaftertotalbill} {$currency}</td>
                                            </tr>
                                            {/if}

                                            <!-----------المدفوع ------------------->
                                            {if {$billsettingsData[29]->billsettingsvalue} eq 0}
                                            <tr>
                                                <td>المدفوع</td>
                                                <td> {$returnsellbillData->returnsellbilltotalpayed} {$currency}</td>
                                            </tr>
                                            {/if}


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


                                            {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                                            <tr >
                                                <td>إجمالى المديونيه</td>
                                                <td>{$returnsellbillData->returnsellbilltotaldeptafter}  {$currency}</td>
                                            </tr>
                                            {/if}
                                            <tr>
                                                <td colspan="2" valign="bottom">&nbsp;</td>
                                            </tr>

                                        </table>
                                    </td>
                                </tr>
                                {if {$billsettingsData[43]->billsettingsvalue} eq 0}
                                <tr>
                                    <td colspan="3" align="right">
                                        <br/> <br/>
                                    </td>
                                </tr>
                                <tr>

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

                                <tr>
                                    <td colspan="3" align="right"><p class="NEE"><strong>{$Programsettingdata->address}</strong></p></td>
                                </tr>
                                <tr>
                                    <td colspan="3" align="right"  style="text-align:center !important">

                                        <p><span class="copywrites"><span class="copywrites">تصميم شركة جي تي فور 01110070882...</span></span></p></td>
                                </tr>
            </table>
            {/if}
        </div>
    </body>