<!DOCTYPE html>
<html >

    <head>
        <meta http-equiv='Content-Type' content='text/html; charset=UTF-8' />
        <title>GT4</title>
        <!--<title >طباعة الفاتوره</title>-->

        <style>


            @media print {
                @page {
                    size: 100mm 200mm landscape; /* landscape */
                    /* you can also specify margins here: */
                    margin: 0mm;
                    margin-right:0mm; /* for compatibility with both A4 and Letter */
                }
                #printdiv{
                    margin-top:{$billsettingsData[82]->billsettingsvalue}mm; /* user margin */
                }
            }
            html {
                -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            }

            body {
                font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
                font-size: 14px;
                line-height: 1.42857143;
                color: #000;
                background-color: #fff;
                margin: 20px
            }



            @media print {
                #items th {
                    background: #fff!important;
                }
            }

            * { margin: 0; padding: 0; }
            #page-wrap { width:100%; margin: 0 auto; }

            table { border-collapse: collapse; }
            table td, table th {
                padding: 3px 11px 3px;
                vertical-align: middle;
                text-align: center;
                padding:2px}

            .info-table{ width:30%;float: left;margin-top:2px}
            .info-table{ clear:both;margin-top: 0!important}
            .info-table .foot{ background-color:#fff}
            .info-table {
                border:1px solid #008bd2;
                -webkit-print-color-adjust: exact;
                -moz-print-color-adjust: exact;
                print-color-adjust: exact;
                margin-top: 10px
            }
            .info-table .head{ border-bottom:1px solid #008bd2}
            .info-table .head h3{
                display: inline-block;
                border-left:1px solid #008bd2;
                width:30%;
                background-color: #fff;
                padding-right: 5px}

            .info-table .head h3{
                background-color: transparent;
                width:40%
            }

            .border{ border:1px solid #008bd2}
            table{ width:100%}
            #items { clear: both; width: 100%; margin:0; border:1px solid #9c9999;
                     -webkit-print-color-adjust: exact;
                     -moz-print-color-adjust: exact;
                     print-color-adjust: exact;
            }

            .red{
                background-color:#fff!important;
                color:#000!important;
                -webkit-print-color-adjust: exact;
                -moz-print-color-adjust: exact;
                print-color-adjust: exact;
            }

            .red th{ font-size: 13px}
            /*@media print,(max-width: 991px){
                table.info{ width:100%!important;margin-bottom: 10px}
            }*/
            table td, table th {
                border:1px solid #9c9999;
                font-weight: bold;
                -webkit-print-color-adjust: exact;
                -moz-print-color-adjust: exact;
                print-color-adjust: exact;
            }

            .bill-head{
                background-color: #fff!important;
                border:1px solid #fff!important;
                -webkit-print-color-adjust: exact;
                -moz-print-color-adjust: exact;
                print-color-adjust: exact;
            }

            .bg-grey{
                background-color:#e0e0e0!important;
                -webkit-print-color-adjust: exact;
                -moz-print-color-adjust: exact;
                print-color-adjust: exact;
            }

            .foot-color{
                color: #008ed3;
                font-weight: bold;
                -webkit-print-color-adjust: exact;
                -moz-print-color-adjust: exact;
                print-color-adjust: exact;
            }

            table span{
                color:#444;
                font-weight:700;
                -webkit-print-color-adjust: exact;
                -moz-print-color-adjust: exact;
                print-color-adjust: exact;

            }
            .hidden{
                display: none;
            }

        </style>
        <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>
        {/literal}
    </head>

    <body  dir='rtl' onLoad="printDiv()">
        <div id="printdiv">
            <input type="hidden" id="billprintId" value="{$billprintId}" />
            <b>
                <div id="page-wrap">

                    {if $printWithoutPrice != 1}
                    <div {if $billsettingsData[69]->billsettingsvalue == 0}{else}  style="display:none"{/if} id="header" class="bill-head" style="height: 10px;width: 100%;border: 1px solid #008bd2;text-align: center;color: white;font: bold 15px ;text-decoration: uppercase;padding:5px 0px 10px; margin-bottom: 5px"> {$billnameAddData->name} </div>


                    <!--                    <div style="{if {$billsettingsData[15]->billsettingsvalue} eq 0}  {else};display:none !important; {/if}border:1px solid #ddd;border-radius:30px;padding:5px;background-color:#f5f5f5;text-align:center;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;">
                                            <div style="width:50%;text-align:center;display:inline-block;font-weight:bold">
                                                رقم الفاتورة:<span style="font-weight:bold">{$sellbillData->sellbillid}</span>
                                            </div>

                                        </div>-->
                    <div class="head" style="margin-top: 5px">
                        <h3 style=" display: inline-block;text-align: center;">التاريخ:</h3>
                        <span>{$sellbillData->sellbilldate}</span>
                    </div>

                    <div class="info info-bill" style="width:50%;float:right;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;margin-bottom:10px">
                        <!--div class="head" >
                            <h3 style="width:20%; display: inline-block;text-align: center;">رقم الفاتورة:</h3>
                            <span>{$sellbillData->sellbillid}</span>
                        </div-->

                        <!--div class="head" >
                            <h3 style="width:20%; display: inline-block;text-align: center;">كاشير:</h3>
                            <span> صهيب</span>
                        </div-->


                        <!--div class="head" style="float:right">
                            <h3 style=" display: inline-block;text-align: center;"> ت2 </h3>
                            <span> 2032698</span>
                        </div-->
                        <div class="head" {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                            <h3 style=" display: inline-block;text-align: center;">اسم الشركة:</h3>
                            <span> {$Programsettingdata->companyname}</span>
                        </div>
                        <div class="head" {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                            <h3 style=" display: inline-block;text-align: center;">العنوان:</h3>
                            <span>
                                {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                                {$Programsettingdata->address}
                                {else}
                                {$branchData->branchAddress}
                                {/if}
                            </span>
                        </div>
                        <div class="head" style="float:right{if $billsettingsData[72]->billsettingsvalue == 2};display:none;{/if}">
                            <h3 style=" display: inline-block;text-align: center;">تليفون:</h3>
                            <span>
                                {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                                {$Programsettingdata->phone}
                                {else}
                                {$branchData->mobile}
                                {/if}
                            </span>
                        </div>

                    </div>
                    <div class="info info-bill" style="{if {$billsettingsData[15]->billsettingsvalue} eq 0 && $Programsettingdata->clientserial == 1 }  {else};display:none !important; {/if}width:45%;float:left;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;margin-top: 10px;margin-bottom:10px">
                        <div class="head">
                            <h3 style=" display: inline-block;text-align: right;">رقم الفاتورة:</h3>
                            <span>{if $sellbillData->taxBillNumber > 0}{$sellbillData->taxBillNumber}{else}{$sellbillData->sellbillid}{/if}</span>
                        </div>

                        <!--div class="head" >
                            <h3 style="width:20%; display: inline-block;text-align: center;">كاشير:</h3>
                            <span> صهيب</span>
                        </div-->
                        <div class="head" {if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                            <h3 style=" display: inline-block;text-align: center;">العميل:</h3>
                            <span>{$sellbillData->tempclientName}</span>
                        </div>
                        <div class="head" {if {$billsettingsData[101]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                            <h3 style=" display: inline-block;text-align: center;">عملية الفاتورة:</h3>
                            <span>{$sellbillData->billoperationName}</span>
                        </div>

                        <div class="head" {if {$billsettingsData[3]->billsettingsvalue} eq 0}{else}style="display:none"{/if}>
                            <h3 style=" display: inline-block;text-align: center;">  ال{if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if}:</h3>
                            <span>{$sellbillData->employeename}</span>
                        </div>
                        <div class="head">
                            <h3 style=" display: inline-block;text-align: center;"> اسم المستخدم:</h3>
                            <span>{$billUserData->employeename}</span>
                        </div>

                        <div class="head" {if {$billsettingsData[22]->billsettingsvalue} eq 0}{else}style="display:none"{/if}>
                            <h3 style=" display: inline-block;text-align: center;">التعليق:</h3>
                            <span>{$sellbillData->comment}</span>
                        </div>
                    </div>
                    {else}
                    <div class="head" style="margin-top: 5px">
                        <h3 style=" display: inline-block;text-align: center;">التاريخ:</h3>
                        <span>{$sellbillData->sellbilldate}</span>
                    </div>
                    <div class="info info-bill" style="{if {$billsettingsData[15]->billsettingsvalue} eq 0 && $Programsettingdata->clientserial == 1 }  {else};display:none !important; {/if}width:45%;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;margin-top: 10px;margin-bottom:10px">
                        <div class="head">
                            <h3 style=" display: inline-block;text-align: right;">رقم الفاتورة:</h3>
                            <span>{if $sellbillData->taxBillNumber > 0}{$sellbillData->taxBillNumber}{else}{$sellbillData->sellbillid}{/if}</span>
                        </div>

                        <!--div class="head" >
                            <h3 style="width:20%; display: inline-block;text-align: center;">كاشير:</h3>
                            <span> صهيب</span>
                        </div-->
                        <div class="head" {if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                            <h3 style=" display: inline-block;text-align: center;">العميل:</h3>
                            <span>{$sellbillData->tempclientName}</span>
                        </div>
                    </div>
                    {/if}
                    <div style="clear:both"></div>

                    <div class="">
                        <strong>
                            <h3 style='text-align:center'>المبيعات</h3>
                            <table id="items" style="">

                                <thead class="">
                                    <tr>
                                        <th {if {$billsettingsData[20]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>الباركود</th>
                                        <th>اسم الصنف </th>
                                        <th {if {$billsettingsData[21]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>الوحدة</th>
                                        <th {if {$billsettingsData[22]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>التعليق</th>
                                        <th {if {$billsettingsData[46]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>العدد</th>
                                        {if $printWithoutPrice != 1}
                                        <th class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">السعر</th>
                                        <th class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>خصم</th>
                                        <th class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">الاجمالى</th>
                                        {/if}
                                    <tr>
                                </thead>
                                <tbody>
                                    {foreach $sellbilldetailData as $sellbilldetail}
                                    <tr class="item-row" dir="ltr">
                                        <td {if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>{$sellbilldetail->parcode}</td>
                                        <td><span>{$sellbilldetail->productName}{if {$billsettingsData[60]->billsettingsvalue} eq 0}/ {$sellbilldetail->productCatName}{/if}
                                                {if {$billsettingsData[79]->billsettingsvalue} eq 0}
                                                {if isset($sellbilldetail->sizeName) && $sellbilldetail->sizeName !=""}/{$sellbilldetail->sizeName}{/if}
                                                {if isset($sellbilldetail->colorName) && $sellbilldetail->colorName !=""}/{$sellbilldetail->colorName}{/if}
                                                {/if}

                                                {if $sellbilldetail->soldSerialsInDetails != ""} (sn: {$sellbilldetail->soldSerialsInDetails}) {/if}
                                            </span></td>
                                        <td {if {$billsettingsData[21]->billsettingsvalue} eq 0} {else} style="display:none" {/if}><span>{$sellbilldetail->unitName}</span></td>
                                        <td {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}><span>{$sellbilldetail->note}</span></td>
                                        <td {if {$billsettingsData[46]->billsettingsvalue} eq 0} {else} style="display:none" {/if}><span>{$sellbilldetail->sellbilldetailquantity}</span></td>
                                        {if $printWithoutPrice != 1}
                                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}"><span>{$sellbilldetail->sellbilldetailprice}</span></td>
                                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}><span>{$sellbilldetail->discountvalue}</span></td>
                                        <td class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}"><span >{$sellbilldetail->sellbilldetailtotalprice}</span></td>
                                        {/if}
                                    </tr>
                                    {/foreach}
                                </tbody>
                                
                                {if $printWithoutPrice != 1}
                                <tfoot class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}">
                                    <tr class="item-row">
                                        <td style="{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} display:none !important; {/if} border-left: 1px solid transparent!important;border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="border-left:1px solid transparent;border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="{if {$billsettingsData[21]->billsettingsvalue} eq 0}  border-left: 1px solid transparent!important; {else} ;display:none !important; {/if}border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="{if {$billsettingsData[22]->billsettingsvalue} eq 0}  border-left: 1px solid transparent!important; {else} ;display:none !important; {/if}border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="border-right:1px solid #9c9999!important;{if {$billsettingsData[46]->billsettingsvalue} eq 0} {else} ;display:none; {/if}"><span>
                                                {if {$sellbillData->sellQuantity} <= 0}
                                                {$quantity}
                                                {else}
                                                {$sellbillData->sellQuantity}
                                                {/if}
                                            </span></td>
                                        <th {if {$billsettingsData[23]->billsettingsvalue} eq 0} colspan="2" {else}  {/if}><span>الاجمالى</span></th>
                                        <td><span >{$sellbillData->sellbilltotalbill} {$currency}</span></td>
                                    </tr>
                                    <tr class="item-row" {if {$billsettingsData[28]->billsettingsvalue} eq 0 && $sellbillData->sellbillaftertotalbill != $sellbillData->sellbilltotalbill}  {else} style="display:none !important" {/if}>
                                        <td style="{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} display:none !important; {/if} border-left: 1px solid transparent!important;border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="border-left:1px solid transparent!important;border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="{if {$billsettingsData[21]->billsettingsvalue} eq 0}  border-left: 1px solid transparent!important; {else} ;display:none !important; {/if}border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="{if {$billsettingsData[22]->billsettingsvalue} eq 0}  border-left: 1px solid transparent!important; {else} ;display:none !important; {/if}border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="border-right:1px solid transparent!important;border-bottom:1px solid transparent!important;{if {$billsettingsData[46]->billsettingsvalue} eq 0} {else} display:none; {/if}"></td>
                                        <th {if {$billsettingsData[23]->billsettingsvalue} eq 0} colspan="2" {else}  {/if}><span>الصافى</span></th>
                                        <td><span >{$sellbillData->sellbillaftertotalbill} {$currency}</span></td>
                                    </tr>
                                    <tr class="item-row" {if {$billsettingsData[29]->billsettingsvalue} eq 0 && $sellbillData->sellbilltotalpayed != $sellbillData->sellbilltotalbill} {else} style="display:none" {/if}>
                                        <td style="{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} display:none !important; {/if} border-left: 1px solid transparent!important;border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="border-left:1px solid transparent!important;border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="{if {$billsettingsData[21]->billsettingsvalue} eq 0}  border-left: 1px solid transparent!important; {else} ;display:none !important; {/if}border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="{if {$billsettingsData[22]->billsettingsvalue} eq 0}  border-left: 1px solid transparent!important; {else} ;display:none !important; {/if}border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="border-right:1px solid transparent!important;border-bottom:1px solid transparent!important;{if {$billsettingsData[46]->billsettingsvalue} eq 0} {else} display:none; {/if}"></td>
                                        <th {if {$billsettingsData[23]->billsettingsvalue} eq 0} colspan="2" {else}  {/if}><span>المدفوع</span></th>
                                        <td><span >{$sellbillData->sellbilltotaldeptafter} {$currency}</span></td>
                                    </tr>
                                    <tr class="item-row" {if {$billsettingsData[30]->billsettingsvalue} eq 0 && $sellbillData->sellbillfinalbill > 0} {else} style="display:none" {/if}>
                                        <td style="{if {$billsettingsData[20]->billsettingsvalue} eq 0}  {else} display:none !important; {/if} border-left: 1px solid transparent!important;border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="border-left:1px solid transparent!important;border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="{if {$billsettingsData[21]->billsettingsvalue} eq 0}  border-left: 1px solid transparent!important; {else} ;display:none !important; {/if}border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="{if {$billsettingsData[22]->billsettingsvalue} eq 0}  border-left: 1px solid transparent!important; {else} ;display:none !important; {/if}border-right:1px solid transparent!important;border-bottom:1px solid transparent!important"></td>
                                        <td style="border-right:1px solid transparent!important;border-bottom:1px solid transparent!important;{if {$billsettingsData[46]->billsettingsvalue} eq 0} {else} display:none; {/if}"></td>
                                        <th {if {$billsettingsData[23]->billsettingsvalue} eq 0} colspan="2" {else}  {/if}><span>المتبقى</span></th>
                                        <td><span >{$sellbillData->sellbillfinalbill} {$currency}</span></td>
                                    </tr>
                                </tfoot>
                                {/if}
                            </table>
                            
                        {if $printWithoutPrice != 1}
                            <table id="items" class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" style="border-top:1px solid #444;margin-top:20px;margin-bottom:10px">

                                <tbody>
                                    <tr class="item-row">
                                        {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                                        {if $sellbillData->sellbilltotalpayed neq 0 || $sellbillData->sellbilltotaldeptbefor neq 0}
                                        <td style="border:1px solid transparent!important"><span>الرصيد قبل :{$sellbillData->sellbilltotaldeptbefor} {$currency}</span></td>
                                        <td style="border:1px solid transparent!important"><span> </span></td>
                                        {/if}
                                        {/if}
                                        {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                                        <td style="border:1px solid transparent!important"><span>الرصيد بعد :{$sellbillData->sellbilltotaldeptafter} {$currency}</span></td>
                                        <td style="border:1px solid transparent!important"><span ></span></td>
                                        {/if}
                                    </tr>


                                </tbody>

                            </table>


                            {if count($billPayments)>0}
                            <!--<h4 style="text-align: center;margin: 0">دفعات على الفاتورة</h4>-->
                            <table class="{if $Usergroupdata->hideBillPrices == 1}hidden{/if}" id="items" style="border-top:1px solid #444">
                                <tr>
                                    <td>    م</td>
                                    <td>  قيمة الفاتورة</td>
                                    <!--<td>  قيمة الدين قبل</td>-->
                                    <td> القيمة المدفوعة </td>
                                    <!--<td>  قيمة الدين بعد</td>-->
                                    <td>   تاريخ الدفع</td>
                                    <td>    طريقة الدفع</td>
                                </tr>
                                {foreach $billPayments as $data}
                                <tr class="gradeA ">
                                    <td> {$data.itra}</td>
                                    <td> {$data.finalnetbillvalue}  </td>
                                    <!--<td> {$data.wait_before}</td>-->
                                    <td> {$data.clientdebtchangeamount} </td>
                                    <!--<td> {$data.wait_after}</td>-->
                                    <td> {$data.date} </td>
                                    <td> {$data.paytype} </td>
                                </tr>
                                {/foreach}
                            </table>
                            {/if}
                        {/if}
                        </strong>


                    </div>

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

                </div>
            </b>
        </div>
    </body>

</html>