<!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: 5mm;
                    margin-right:5mm; /* for compatibility with both A4 and Letter */
                }
                #printdiv{
                    margin-top:{$billsettingsData[82]->billsettingsvalue}mm; /* user margin */
                }
            }

            html {
                font-size: 10px;
                -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
            }

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



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

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

            table { border-collapse: collapse; }
            table td, table th {
                padding: 3px 11px 3px;
                vertical-align: middle;
                text-align: center;}
            .info-bill{
                width:40%;

            }
            .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 {

                -webkit-print-color-adjust: exact;
                -moz-print-color-adjust: exact;
                print-color-adjust: exact;
                margin-top: 10px
            }
            .info-table .head{ border-bottom:1px solid #444}
            .info-table .head h3{
                display: inline-block;
                border-left:1px solid #444;
                width:30%;
                background-color: #c8e3f5;
                padding-right: 5px}

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

            .border{ border:1px solid #444}
            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;
                -webkit-print-color-adjust: exact;
                -moz-print-color-adjust: exact;
                print-color-adjust: exact;
                padding: 0px
            }

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

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

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

            table span{
                color:#444;
                -webkit-print-color-adjust: exact;
                -moz-print-color-adjust: exact;
                print-color-adjust: exact;
            }


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

    <body  dir='rtl' onLoad="printDiv()">
        <div id="printdiv" >

            <strong>
                <div id="page-wrap">

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

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

                        </tr>

                    </table>

                    <div style="width:30%;float:right;{if $billsettingsData[72]->billsettingsvalue == 2}display:none;{/if}">
                        {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                        <img style="height:50px;text-align:center;padding:2px 5px;width:95%" src="../views/default/images/upload/{$Programsettingdata->logo}">
                        {else}
                        <img style="height:50px;text-align:center;padding:2px 5px;width:95%" src="../views/default/images/branch_image/{$branchData->logo}">
                        {/if}

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

                    <div class="" style="{if $billsettingsData[72]->billsettingsvalue == 2}display:none;{/if} width:45%;float: right;margin-top: 5px">
                        <div class="head" style="">

                            <div class="info info-bill" style="float:right;width:100%;border-left:1px solid #ddd;direction: rtl">

                                <div class="head" style="border-top:1px solid #ddd;border-bottom:1px solid #ddd">
                                    <h3 style="border-right:1px solid #ddd; display: inline-block;border-left:1px solid #ddd;width:30%;background-color: #fff;padding-right: 5px">اسم الشركة</h3>
                                    <span>{$Programsettingdata->companyname}</span>
                                </div>
                                <div class="head" style="border-bottom:1px solid #ddd" {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                                    <h3 style=" border-right:1px solid #ddd;display: inline-block;border-left:1px solid #ddd;width:30%;background-color: #fff;padding-right: 5px">العنوان</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="border-bottom:1px solid #ddd" {if $billsettingsData[72]->billsettingsvalue == 2}style="display:none;"{/if}>
                                    <h3 style="border-right:1px solid #ddd; display: inline-block;border-left:1px solid #ddd;width:30%;background-color: #fff;padding-right: 5px">الهاتف </h3>
                                    <span>
                                        {if $billsettingsData[72]->billsettingsvalue == 0 || $userData->branchId == 0 || $userData->branchId == -1}
                                        {$Programsettingdata->phone}
                                        {else}
                                        {$branchData->mobile}
                                        {/if}
                                    </span>
                                </div>


                            </div>
                        </div>
                    </div>

                    <div class="" style="width:50%;float:left;margin-bottom:5px; border:1px solid #ddd;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;margin-top: 5px;direction: rtl">
                        <div class="head" style="border-bottom:1px solid #ddd">
                            <h3 style=" display: inline-block;border-left:1px solid #ddd;width:30%;padding-right: 5px">التاريخ</h3>
                            <span>{$sellbillandruternData->sellbilldate} </span>
                        </div>
                        <div class="head" style="border-bottom:1px solid #ddd" {if {$billsettingsData[16]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>
                            <h3 style=" display: inline-block;border-left:1px solid #ddd;width:30%;padding-right: 5px">العميل</h3>
                            <span>{$sellbillandruternData->tempclientName}</span>
                        </div>
                        <div class="head" style="border-bottom:1px solid #000;{if $Programsettingdata->clientserial eq 1}display:none{/if}" >
                            <h3 style=" display: inline-block;border-left:1px solid #ddd;width:30%;padding-right: 5px">رقم الفاتورة</h3>
                            <span>{$sellbillData->sellbillid} </span>
                        </div>
                        <!--div class="head" style="border-bottom:1px solid #ddd">
                            <h3 style=" display: inline-block;border-left:1px solid #ddd;width:30%;background-color: #c8e3f5;padding-right: 5px"> إذن صرف</h3>
                            <span> 2032698</span>
                        </div-->

                        <div class="head" style="border-bottom:1px solid #ddd;{if {$billsettingsData[3]->billsettingsvalue} eq 0}{else}display:none{/if}">
                            <h3 style=" display: inline-block;border-left:1px solid #ddd;width:30%;padding-right: 5px"> ال{if $Programsettingdata->delegate_seller eq 0} بائع {elseif $Programsettingdata->delegate_seller == 1}مندوب {elseif $Programsettingdata->delegate_seller == 2}طبيب {/if}</h3>
                            <span>{$sellbillData->employeename}</span>
                        </div>



                    </div>

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

                    <div class="">
                        <h3>المبيعات</h3>
                        <table id="items" style="margin-bottom:5px">

                            <thead class="red">
                                <tr>
                                    {assign var=secUnitTotal value=0}
                                    <th style="width:40%">اسم الصنف</th>
                                    <th {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>الوحدة</th>
                                    <th {if {$Programsettingdata->scunitname} eq '0'||$billsettingsData[67]->billsettingsvalue}  hidden {/if}>{$Programsettingdata->scunitname}</th>
                                    <!--                                <th {if {$billsettingsData[22]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>التعليق</th>-->
                                    <th {if {$billsettingsData[64]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>الكمية</th>
                                    <th>السعر</th>
                                    <!--                                <th {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>خصم</th>-->
                                    <th>الاجمالى</th>
                                <tr>
                            </thead>
                            <tbody>
                                {foreach $sellbilldetailData as $sellbilldetail}
                                <tr class="item-row">
                                    <td class=""><span>{$sellbilldetail->productName}/ {$sellbilldetail->productCatName}
                                            {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}
                                        </span></td>
                                    <td {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else} style="display:none" {/if}><span>{$sellbilldetail->unitName}</span></td>
                                    <td {if {$Programsettingdata->scunitname} eq '0'||$billsettingsData[67]->billsettingsvalue}  hidden {/if}><span>{$sellbilldetail->otherdetailquantity}</span></td>
                                    <!--                                <td {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}><span>{$sellbilldetail->note}</span></td>-->
                                    <td {if {$billsettingsData[64]->billsettingsvalue} eq 0} {else} style="display:none" {/if}><span>{$sellbilldetail->sellbilldetailquantity}</span></td>
                                    <td><span>{$sellbilldetail->sellbilldetailprice}</span></td>
                                    <!--                                <td {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}><span>{$sellbilldetail->discountvalue}</span></td>-->
                                    <td><span >{$sellbilldetail->sellbilldetailtotalprice}</span></td>
                                    {assign var=secUnitTotal value=$secUnitTotal+$sellbilldetail->otherdetailquantity}
                                </tr>
                                {/foreach}
                                <!-- <tr class="item-row">
           <td colspan="5"><span>0</span></td>
                                        <td><span>الاجمالى</span></td>
            <td><span >1266356</span></td>
        </tr>-->
                            </tbody>

                        </table>
                        <h3>المردودات</h3>
                        <table id="items" style="margin-bottom:5px">

                            <thead class="red">
                                <tr>
                                    {assign var=secUnitTotal value=0}
                                    <th style="width:40%">اسم الصنف</th>
                                    <th {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>الوحدة</th>
                                    <th {if {$Programsettingdata->scunitname} eq '0'||$billsettingsData[67]->billsettingsvalue}  hidden {/if}>{$Programsettingdata->scunitname}</th>
                                    <!--                                <th {if {$billsettingsData[22]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}>التعليق</th>-->
                                    <th {if {$billsettingsData[64]->billsettingsvalue} eq 0} {else} style="display:none" {/if}>الكمية</th>
                                    <th>السعر</th>
                                    <!--                                <th {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>خصم</th>-->
                                    <th>الاجمالى</th>
                                <tr>
                            </thead>
                            <tbody>
                                {foreach $ruternbilldetailData as $sellbilldetail}
                                <tr class="item-row">
                                    <td class=""><span>{$sellbilldetail->productName}/ {$sellbilldetail->productCatName}
                                            {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}
                                        </span></td>
                                    <td {if {$billsettingsData[53]->billsettingsvalue} eq 0} {else} style="display:none" {/if}><span>{$sellbilldetail->unitName}</span></td>
                                    <td {if {$Programsettingdata->scunitname} eq '0'||$billsettingsData[67]->billsettingsvalue}  hidden {/if}><span>{$sellbilldetail->otherdetailquantity}</span></td>
                                    <!--                                <td {if {$billsettingsData[7]->billsettingsvalue} eq 0}  {else} style="display:none !important" {/if}><span>{$sellbilldetail->note}</span></td>-->
                                    <td {if {$billsettingsData[64]->billsettingsvalue} eq 0} {else} style="display:none" {/if}><span>{$sellbilldetail->sellbilldetailquantity}</span></td>
                                    <td><span>{$sellbilldetail->sellbilldetailprice}</span></td>
                                    <!--                                <td {if {$billsettingsData[23]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}><span>{$sellbilldetail->discountvalue}</span></td>-->
                                    <td><span >{$sellbilldetail->sellbilldetailtotalprice}</span></td>
                                    {assign var=secUnitTotal value=$secUnitTotal+$sellbilldetail->otherdetailquantity}
                                </tr>
                                {/foreach}
                                <!-- <tr class="item-row">
           <td colspan="5"><span>0</span></td>
                                        <td><span>الاجمالى</span></td>
            <td><span >1266356</span></td>
        </tr>-->
                            </tbody>

                        </table>
                        <div style="overflow:hidden">
                            {if $sellbillandruternData->sellbilltotaldeptbefor != 0&&$sellbillandruternData->sellbillfinalbill!=0&&$sellbillandruternData->sellbilltotaldeptafter!=0}
                            <div class="info info-table">


                                <table class="final" style="float:left;">

                                    <tbody>
                                        {if {$billsettingsData[18]->billsettingsvalue} eq 0}
                                        <tr class="item-row">
                                            <td style="background-color:#fff;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;"><span>رصيد سابق</span></td>
                                            <td class=""><span>{$sellbillandruternData->sellbilltotaldeptbefor} {$currency}</span></td>
                                        </tr>
                                        {/if}
                                        {if {$billsettingsData[55]->billsettingsvalue} eq 0}
                                        <tr class="item-row">
                                            <td style="background-color:#fff;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;"><span>متبقى</span></td>
                                            <td class=""><span>{$sellbillandruternData->sellbillfinalbill} {$currency}</span></td>
                                        </tr>
                                        {/if}
                                        {if {$billsettingsData[19]->billsettingsvalue} eq 0}
                                        <tr class="item-row">
                                            <td style="background-color:#fff;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;"><span>رصيد حالى</span></td>
                                            <td><span>{$sellbillandruternData->sellbilltotaldeptafter}</span></td>
                                        </tr>
                                        {/if}

                                    </tbody>

                                </table>

                            </div>
                            {/if}

                            <div class="" style="width:40%;float: left;margin-bottom:5px;">
                                <table class="final">

                                    <tbody>
                                        <tr class="item-row">
                                            <td colspan="3" style="background-color:#fff;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;"><span>العدد</span></td>
                                            <td class=""><span>
                                                    {$sellQuantity+$returnQuantity}
                                                </span></td>
                                            {if {$Programsettingdata->scunitname} eq '0'||$billsettingsData[67]->billsettingsvalue}  <!--hidden-->{else}
                                            <td  colspan="3" style="background-color:#fff;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;"><span>الكمية</span></td>
                                            <td><span>{$secUnitTotal}</span></td>
                                            {/if}
                                        </tr>
                                        <!--                                    <tr class="item-row">
                                                                      <td style="background-color:#fff;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;"><span>التعليق على الفاتورة</span></td>
                                                                      <td colspan="3">{$sellbillandruternData->comment}</td>

                                                                  </tr>-->

                                        <tr class="item-row">
                                            <td colspan="3" style="background-color:#fff;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;"><span>إجمالى</span></td>
                                            <td ><span>{$sellbillandruternData->sellbilltotalbill} {$currency}</span></td>
                                            {if $sellbillandruternData->sellbilldiscount !=0 }
                                            <td style="{if {$billsettingsData[47]->billsettingsvalue} eq 0} {else}  display:none;    {/if}background-color:#fff;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;"><span>خصم</span></td>
                                            <td {if {$billsettingsData[47]->billsettingsvalue} eq 0} {else}  style="display:none"    {/if}>
                                                <!--<span>{$sellbillandruternData->sellbilldiscount}{if {$sellbillandruternData->sellbilldiscounttype} eq 1} {$currency}مباشر{else}%{/if}</span>-->
                                                <span>{$discountvalue} {if $sellbillandruternData->sellbilldiscounttype eq 2}(%{$sellbillandruternData->sellbilldiscount}){/if}</span>
                                            </td>
                                            {/if}
                                        </tr>
                                        <tr class="item-row">
                                            <td colspan="3" style="background-color:#fff;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;"><span>مدفوع</span></td>
                                            <td><span>{$sellbillandruternData->sellbilltotalpayed} {$currency}</span></td>
                                            {if $sellbillandruternData->sellbilldiscount !=0 }
                                            <td style="background-color:#fff;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;"><span>صافى</span></td>
                                            <td><span>{$sellbillandruternData->sellbillaftertotalbill} {$currency}</span></td>
                                            {/if}
                                        </tr>

                                    </tbody>

                                </table>
                            </div>


                            <div style="clear:both"></div>
                            <p>{$totalWritten}</p>
                            <div style="margin-top:5px">
                                <p style="text-align:center;color:#000;-webkit-print-color-adjust: exact; -moz-print-color-adjust: exact; print-color-adjust: exact;">لا يسمح بقبول مرتجعات بعد مرور 21 يوما من تاريخ استلام البضاعة</p>
                            </div>
                            <!--                            <div style="text-align:center;margin-top:20px;float:left;margin-left:20px">
                                                            <p style="display:inline-block;text-align:center">استلمت البضاعة كامله واتعهد بسداد قيمتها فور طلبها  <h3 style="display:block;margin-right:50px">المستلم</h3></p>
                                                        </div>-->

                        </div>

                    </div>



                </div>



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

</html>