<html>
    <head>

        <meta http-equiv="content-type" content="text/html; charset=utf-8" />
        <title>GT4</title>
        <style type="text/css">
        </style>
        <style>

            .table-black1   th, td{



            }

            .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: 22px;
                border-right-color: #999;
            }
            .NEE
            {
                font-size: 14px;
            }
            .newdesign
            {
                font-size: 14px;
            }
            .copywrites
            {
                font-size: 11px;
            }
        </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{font-size:20px;
           font-weight: 200;
           text-align: center !important;


        }
        .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: 20px;
            border-right-color: #999;
            text-align: center !important;
        }
        .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: 20px;
            border-right-color: #999;
            text-align: center !important;
        }
        .NEE
        {
            font-size: 14px;
        }
        .newdesign
        {
            font-size: 14px;
        }
        .copywrites
        {
            font-size: 11px;
        }
        .style2 {
            font-family: tahoma
        }
        .style4 {font-family: tahoma; font-size: 16px; font-weight: bold;
                 border: 1px solid  #999  !important;
        }
        .serial {
            background-color: #C8C8C8;
            height: 20px;
            width: 150px;
            padding: 5px;
            margin: 5px;
            border: medium double #000000;
            text-align: center;
        }
        .style1 {
            font-size: 20px
        }
        .rtl{
            direction: rtl;
        }


    </style>
    {/literal}
    {if $Programsettingdata->rulers eq 0}
    <body onLoad="printDiv()">
        <div align="center" id="printdiv" >
            <b>

                <table width="95%" border="0" align="center" cellpadding="0" cellspacing="0" class="table-black">
                    <tr>

                        <td  colspan="6" style="text-align: center;"><center>
                        <img style="display: block" src="../views/default/images/upload/{$Programsettingdata->logo}" alt="" width="134" height="49"></center>
                    <span>{$Programsettingdata->phone}</span>
                    </td><!--height="50px" width="70%"-->
                    </tr>



                    {if $restaurantOrder->tableId > 0 }
                    <tr>


                        <td width="5%" align="right">&nbsp;</td>
                        <td  ><span class="style1 style2 rtl"></span></td>
                        <td width="10%" align="right">&nbsp;</td>

                        <td width="10%" align="right"></td>
                        <td class="rtl"   colspan="2" nowrap width="8%" align="right"><span class="style1 style2">طاولة :{$restaurantOrder->tableName}</span></td>
                    </tr>
                    {/if}

                    <tr>


                        <td width="5%" align="right">&nbsp;</td>

                        <td  >{if $showserial eq 1}<span class="style1 style2 rtl">سيريال :{$restaurantOrder->id}</span>{/if}</td>
                        <td width="10%" align="right">&nbsp;</td>

                        <td width="10%" align="right"></td>
                        <td class="rtl"   colspan="2" nowrap width="8%" align="right"><span class="style1 style2">رقم الطلب:{$restaurantOrder->daySreial}</span></td>
                    </tr>


                    <!-----------الدين بعد ------------------->

                    <tr>
                        <td width="5%" align="right">&nbsp;</td>
                        <td  ><span class="style1 style2 rtl">{$restaurantOrder->sysdate}</span></td>
                        <td width="10%" align="right">&nbsp;</td>

                        <td width="10%" align="right"></td>
                        <td class="rtl"   colspan="2" nowrap width="8%" align="right"><span class="style1 style2">المستخدم :{$userData->employeename}</span></td>
                    </tr>

                    {if $clientFlag == 1}
                    <tr>
                        <td width="5%" align="right">&nbsp; </td>
                        <td  ><span class="style1 style2 rtl">
                                رقم الهاتف:
                                {if $delivery->clientmobile == 1}
                                {$client->clientmobile}
                                {/if}
                                {if $delivery->clientphone == 1}
                                {if $delivery->clientmobile == 1}
                                <br/>
                                {/if}
                                {$client->clientphone}
                                {/if}
                            </span></td>
                        <td width="10%" align="right">&nbsp;</td>

                        <td width="10%" align="right"> </td>
                        <td class="rtl"   colspan="2" nowrap width="8%" align="right"><span class="style1 style2">

                                اسم العميل: {$client->clientname}

                            </span></td>
                    </tr>

                    <tr>

                        <td class="rtl" colspan="6" nowrap style="text-align: center;" width="220px">
                            {if $delivery->clientaddress == 1}
                            {$client->clientaddress}
                            {/if}
                            {if $delivery->clientdetails == 1}
                            {$client->clientdetails}
                            {/if}
                        </td>

                    </tr>
                    {/if}
                    <!-----------الدين بعد ------------------->
                    <tr>
                        <td colspan="6">
                            <table width="100%" border="0" cellpadding="2" cellspacing="7" class="table-black1">
                                <tr>
                                    <td width="15%" align="center" bgcolor="#B4B4B4" class="style4">اجمالى</td>
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style4">السعر</td>
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style4">الكميه</td>
                                    <td width="50%" align="center" bgcolor="#B4B4B4" class="style4">الصــــــــنف</td>
                                    <td width="5%" align="right" bgcolor="#B4B4B4" class="style4"># </td>
                                </tr>
                                {assign var=i value=1}
                                {assign var=total value=0}
                                {foreach $restaurantOrderDetails as $product}
                                <tr>
                                    {assign var=proTotal value=$product->quantity * $product->price}
                                    <td align="right" class="style2 style1">{$proTotal}</td>{*$product->total*}
                                    <td align="right" class="style2 style1">{$product->price}</td>
                                    <td align="right" class="style2 style1">{$product->quantity}</td>
                                    <td align="right" class="style2 style1">{$product->productName}</td>
                                    <td align="center" class="style2">{$i}</td>
                                </tr>
                                {assign var=total value=$total+$proTotal}
                                {assign var=i value=$i+1}
                                {/foreach}
                            </table></td>
                    </tr>
                    <tr>

                        <td colspan="6"><hr /></td>
                    </tr>
                    <tr>
                        <td colspan="6"><table width="100%" border="0" cellpadding="2" cellspacing="7">
                                  <tr>
                                   
                                    <td width="8%" align="center" bgcolor="#B4B4B4">الاجمالي    </td>
                                  
                                    {if $restaurantOrder->tax > 0 || $billTax > 0 }
                                    <td width="70%"  align="center" bgcolor="#B4B4B4">    {if $Programsettingdata->taxNameFlag == 1}خدمة{else}%  الضريبه    15 {/if} </td>
                                    {/if}
                                    {if $restaurantOrder->discount !=0}
                                    <td width="8%" align="center" bgcolor="#B4B4B4">الخصم</td>
                                    {/if}
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">الصافى</td>
                                </tr>
                                 {if $printResBillonly == 1}
                                 
                                   <tr>
                               
                                    <td align="center" class="style1">{$total + $billTax}</td>
                                 
                                    {if $billTax > 0}
                                    <td align="center" class="style1">{$billTax}</td>
                                    {/if}
                                    {if $restaurantOrder->discount !=0}
                                    <td align="center" class="style1">{$restaurantOrder->discount}</td>
                                    {/if}
                                    {if $restaurantOrder->discount !=0}

                                    {/if}
                                    <td align="center" class="style1">{$total}</td>
                                </tr>
                                
                                {else}
                                
                                  <tr>
                               
                                    <td align="center" class="style1">{$restaurantOrder->netBill}</td>
                                 
                                    {if $restaurantOrder->tax !=0}
                                    <td align="center" class="style1">{$restaurantOrder->tax}</td>
                                    {/if}
                                    {if $restaurantOrder->discount !=0}
                                    <td align="center" class="style1">{$restaurantOrder->discount}</td>
                                    {/if}
                                    {if $restaurantOrder->discount !=0}

                                    {/if}
                                    <td align="center" class="style1">{$total}</td>
                                </tr>
                                {/if}
                              

                                <tr {if $restaurantOrder->restaurantplaystationplayid > 0}{else} style="display:none"{/if}>

                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">
                                        حجز بلاى ستيشن رقم {$playstation->id} بمبلغ {$playstation->netPrice}
                                    </td>
                                </tr>
                                <tr {if $restaurantOrder->restaurantplaystationplayid > 0}{else} style="display:none"{/if}>

                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">
                                        الاجمالى العام :
                                        {$total+$restaurantOrder->tax-$restaurantOrder->discount + $playstation->netPrice - $playstation->cardPayed}{*$restaurantOrder->netBill*}
                                    </td>
                                </tr>
                                {if $restaurantOrder->billComment!=""}</td>
                    <tr>
                        <td  colspan="6"  style="text-align: center;">
                            <div> {$restaurantOrder->billComment}</div>
                        </td>
                    </tr>
                    {/if}
                </table></td>
                </tr>
                </table>
                <hr/>
            </b>
        </div>
    </body>
    {else}
    <body onLoad="printDiv()">
        <div align="center" id="printdiv" >
            <b>

                <table width="95%" border="1" align="center" cellpadding="0" cellspacing="0" class="table-black">
                    <tr>

                        <td  colspan="6" style="text-align: center;"><center>
                        <img style="display: block" src="../views/default/images/upload/{$Programsettingdata->logo}" alt="" width="134" height="49"></center>
                    <span>{$Programsettingdata->phone}</span>
                    </td><!--height="50px" width="70%"-->
                    </tr>



                    {if $restaurantOrder->tableId >0}
                    <tr>


                        <td width="5%" align="right">&nbsp;</td>
                        <td  ><span class="style1 style2 rtl"></span></td>
                        <td width="10%" align="right">&nbsp;</td>

                        <td width="10%" align="right"></td>
                        <td class="rtl"   colspan="2" nowrap width="8%" align="right"><span class="style1 style2">طاولة :{$restaurantOrder->tableName}</span></td>
                    </tr>
                    {/if}

                    <tr>


                        <td width="5%" align="right">&nbsp;</td>

                        <td  >{if $showserial eq 1}<span class="style1 style2 rtl"> {$restaurantOrder->id}</span>{/if}</td>
                        <td width="10%" align="right">&nbsp;</td>

                        <td width="10%" align="right"></td>
                        <td class="rtl"   colspan="2" nowrap width="8%" align="right"><span class="style1 style2">رقم الطلب:{$restaurantOrder->daySreial}</span></td>
                    </tr>


                    <!-----------الدين بعد ------------------->

                    <tr>
                        <td width="5%" align="right">&nbsp;</td>
                        <td  ><span class="style1 style2 rtl">{$restaurantOrder->sysdate}</span></td>
                        <td width="10%" align="right">&nbsp;</td>

                        <td width="10%" align="right"></td>
                        <td class="rtl"   colspan="2" nowrap width="8%" align="right"><span class="style1 style2">المستخدم :{$userData->employeename}</span></td>
                    </tr>

                    {if $clientFlag == 1}
                    <tr>
                        <td width="5%" align="right">&nbsp; </td>
                        <td  ><span class="style1 style2 rtl">

                                {if $delivery->clientmobile == 1}
                                {$client->clientmobile}
                                {/if}
                                {if $delivery->clientphone == 1}
                                {if $delivery->clientmobile == 1}
                                <br/>
                                {/if}
                                {$client->clientphone}
                                {/if}
                            </span></td>
                        <td width="10%" align="right">&nbsp;</td>

                        <td width="10%" align="right"> </td>
                        <td class="rtl"   colspan="2" nowrap width="8%" align="right"><span class="style1 style2" style="font-weight:bold !important">

                                {$client->clientname}

                            </span></td>
                    </tr>

                    <tr>

                        <td class="rtl" colspan="6" nowrap style="text-align: center;font-weight: bold !important;" width="220px">
                            {if $delivery->clientaddress == 1}
                            {$client->clientaddress}
                            {/if}
                            {if $delivery->clientdetails == 1}
                            {$client->clientdetails}
                            {/if}
                        </td>

                    </tr>
                    {/if}
                    <!-----------الدين بعد ------------------->
                    <tr>
                        <td colspan="6">
                            <table width="100%" border="1" cellpadding="2" cellspacing="7" class="table-black1">
                                <tr>
                                    <td width="15%" align="center" bgcolor="#B4B4B4" class="style4">اجمالى</td>
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style4">السعر</td>
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style4">الكميه</td>
                                    <td width="50%" align="center" bgcolor="#B4B4B4" class="style4">الصــــــــنف</td>
                                    <td width="5%" align="right" bgcolor="#B4B4B4" class="style4"># </td>
                                </tr>
                                {assign var=i value=1}
                                {assign var=total value=0}
                                {foreach $restaurantOrderDetails as $product}
                                <tr>
                                    {assign var=proTotal value=$product->quantity*$product->price}
                                    <td align="right" class="style2 style1">{$proTotal}</td>{*$product->total*}
                                    <td align="right" class="style2 style1">{$product->price}</td>
                                    <td align="right" class="style2 style1">{$product->quantity}</td>
                                    <td align="right" class="style2 style1">{$product->productName}</td>
                                    <td align="center" class="style2">{$i}</td>
                                </tr>
                                {assign var=total value=$total+$proTotal}
                                {assign var=i value=$i+1}
                                {/foreach}
                            </table></td>
                    </tr>
                    <tr>

                        <td colspan="6"><hr /></td>
                    </tr>
                    <tr>
                        <td colspan="6"><table width="100%" border="0" cellpadding="2" cellspacing="7">
                                <tr>
                                    {if $restaurantOrder->tax !=0||$restaurantOrder->discount !=0}
                                    <td width="8%" align="center" bgcolor="#B4B4B4">الصافى</td>
                                    {/if}
                                    {if $restaurantOrder->tax !=0}
                                    <td width="70%"  align="center" bgcolor="#B4B4B4">    {if $Programsettingdata->taxNameFlag == 1}خدمة{else}%  الضريبه    15 {/if} </td>
                                    {/if}
                                    {if $restaurantOrder->discount !=0}
                                    <td width="8%" align="center" bgcolor="#B4B4B4">الخصم</td>
                                    {/if}
                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">الاجمالي</td>
                                </tr>
                                <tr>
                                    {if $restaurantOrder->tax !=0||$restaurantOrder->discount !=0}
                                    <td align="center" class="style1">{$restaurantOrder->netBill}</td>
                                    {/if}
                                    {if $restaurantOrder->tax !=0}
                                    <td align="center" class="style1">{$restaurantOrder->tax}</td>
                                    {/if}
                                    {if $restaurantOrder->discount !=0}
                                    <td align="center" class="style1">{$restaurantOrder->discount}</td>
                                    {/if}
                                    {if $restaurantOrder->discount !=0}

                                    {/if}
                                    <td align="center" class="style1" style="font-weight:bold !important ;
                                        font-size: 22px">{$restaurantOrder->totalBill}</td>
                                </tr>

                                <tr {if $restaurantOrder->restaurantplaystationplayid > 0}{else} style="display:none"{/if}>

                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">
                                        حجز بلاى ستيشن رقم {$playstation->id} بمبلغ {$playstation->netPrice}
                                    </td>
                                </tr>
                                <tr {if $restaurantOrder->restaurantplaystationplayid > 0}{else} style="display:none"{/if}>

                                    <td width="10%" align="center" bgcolor="#B4B4B4" class="style1">
                                        الاجمالى العام :
                                        {$total+$restaurantOrder->tax-$restaurantOrder->discount + $playstation->netPrice - $playstation->cardPayed}{*$restaurantOrder->netBill*}
                                    </td>
                                </tr>
                                {if $restaurantOrder->billComment!=""}</td>
                    <tr>
                        <td  colspan="6"  style="text-align: center;">
                            <div> {$restaurantOrder->billComment}</div>
                        </td>
                    </tr>
                    {/if}
                </table></td>
                </tr>
                </table>
                <hr/>
            </b>
        </div>
    </body>
    {/if}
    {if $qrerp > 1}
    <div style="text-align: center;">
        {if $qrerp == 3 ||  $qrerp == 4}
        <img src="data:image/jpeg;base64,{$base64qr}" style="width:250px;height: 250px;"/>
        {/if}
        {if $qrerp == 2 ||  $qrerp == 4}
        <img src="data:image/jpeg;base64,{$base64qrs}" style="width:250px;height: 250px;"/>
        {/if}
    </div>
    {/if}

    <div id="terms" style="text-align: center;{if $billsettingsData[81]->billsettingsvalue == 1}display:none{/if}">
        <h5>{$Programsettingdata->printfoot}</h5>
    </div>



    <div {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}  style="text-align: center;">
        <h5 style="margin: 0;margin-top: -20px">
            العنوان : {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
            {$Programsettingdata->address}
            {else}
            {$branchData->branchAddress}
            {/if}
        </h5>
    </div>