<meta charset="UTF-8">
<style>
    table{
        border-collapse: collapse;
        margin-bottom:10px;
    }
    table td {
        border:1px solid #111;
        text-align: center;
        font-size: 16px;
        font-family:arial;
    }
    .font24{
        font-size: 15px;
    }
    strong{
        font-weight: 600;
    }

    .ltable td
    {
        width: 2cm;
    }
    .noborder ,.noborder * {
        border:0px !important;
    }
    .makeborder{
        border:1px solid #000000 !important;
    }
    .fixborder {
        //margin: 1px !important;
        padding: 1px !important;
    }
    .xheight{
        height: 30px !important;
    }
    .nah{
        background: black !important;
    }
</style>
<center>
    <img src="{$path}/images/upload/{$Programsettingdata->logo}" width="150px" height="100px" />
    <table width="90%">
        <tr>
            <td colspan="3" style=" border: 0; ">&nbsp;</td>
        </tr>
        <tr>
            <td width="10%"><strong>Day</strong></td>
            <td width="17%">{$dayName}</td>
            <td width="48%" rowspan="2">SALES INVOICE BY INSURANCE</td>
            <td width="25%" colspan="2" rowspan="2">shop no ({$Branch->branchId}), phone ({$Branch->phone})</td>

        </tr>
        <tr>
            <td height="30"><strong>Date</strong></td>
            <td> {$billDate}  </td>
        </tr>
    </table>
        <table width="90%" class=" table-black">

            <tr>
                <td width="19%"><strong>invoice no</strong></td>
                <td width="41%"><div class="makeborder fixborder"> {$bill->billno}</div></td>
                <td colspan="2">&nbsp;</td>
            </tr>
            <tr>
                <td height="80"><strong>customer name</strong></td>
                <td><div class="makeborder fixborder xheight">{$bill->clientname}</div></td>
                <td width="20%"><strong>approval number</strong></td>
                <td width="29%"><div class="makeborder fixborder">{$bill->approvalno} </div></td>
            </tr>
            <tr>
                <td><strong>phone no</strong></td>
                <td> <div class="makeborder fixborder"> &nbsp; </div></td>
                <td><strong>mobile no</strong></td>
                <td><div class="makeborder fixborder"> &nbsp; </div></td>
            </tr>
            <tr>
                <td><strong>delivery date</strong></td>
                <td><div class="makeborder fixborder">{$date}</div></td>
                <td><strong>time</strong></td>
                <td><div class="makeborder fixborder">{$time}</div></td>
            </tr>

            <tr>
                <td><strong>Insurance </strong></td>
                <td><div class=" fixborder">{$bill->companyname}</div></td>
                <td><strong> Approval No </strong></td>

                <td><div class=" fixborder">{$bill->approvalno}</div></td>
            </tr>
            
            <tr>
                <td><strong>Customer name</strong></td>
                <td><div class=" fixborder">{$bill->clientname}</div></td>
                <td><strong>Customer Phone </strong></td>
                <td><div class=" fixborder">{$bill->username}</div></td>
            </tr>
            
            <tr>
                <td><strong>ID Number </strong></td>
                <td><div class=" fixborder">{$bill->clientid}</div></td>
                <td><strong> Bill number</strong></td>
                <td><div class=" fixborder">{$bill->billno}</div></td>
            </tr>
            
            <tr>
                <td><strong>Comment</strong></td>
                <td><div class=" fixborder">{$bill->comment}</div></td>
                <td><strong>Customer address</strong></td>
                <td><div class=" fixborder"> {$bill->approveFile}</div></td>
            </tr>

            
            
            <tr>
                <td><strong>Date Invoice</strong></td>
                <td><div class=" fixborder"> {$bill->billdate}</div></td>
                <td><strong>Type of detection</strong></td>
                <td><div class=" fixborder"> {if $bill->kashftype == 1} خارجى {elseif $bill->kashftype == -1} بدون كشف  {else} داخلى  {/if}</div></td>
            </tr>
            
            <tr>
                <td><strong> Received date</strong></td>
                <td><div class=" fixborder">{$bill->receivedate}</div></td>
                <td><strong>Maximum payment</strong></td>
                <td><div class=" fixborder"> {$bill->alloweddays}</div></td>
            </tr>
            
            <tr>
                <td><strong>Price type</strong></td>
                <td><div class=" fixborder">{if $bill->pricetype == 1} تجزئة {else if $bill->pricetype == 2} نصف جملة  {else if $bill->kashftype == 0} جملة  {/if}</div></td>
                <td><strong> Doctor's name</strong></td>
                <td><div class=" fixborder"> {$doctor_name}</div></td>
            </tr>
            
            <tr>
                <td><strong>  Branch number</strong></td>
                <td><div class=" fixborder"> {$Branch->branchNo}</div></td>
                <td><strong> Branch telephone</strong></td>
                <td><div class=" fixborder"> {$Branch->mobile}</div></td>
            </tr>
            
            
            
            
        </table>
    {if $lens == 1}
    <div style="width:50%;margin-left: 4; float: left;">
        <table class="ltable " width="90%" style="margin-right: -73px;">
            <tr>
                <td colspan="7"><strong>left</strong></td>
            </tr>
            <tr>
                <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
                <td>Sphere</td>
                <td>Cylinder</td>
                <td>Axis</td>
                <td>Prism</td>
                <td>V/A</td>
            </tr>
            <tr>
                <td><strong>distance</strong></td>
                <td>{$kashf->ldsphere}</td>
                <td>{$kashf->ldcylinder}</td>
                <td>{$kashf->ldaxis}</td>
                <td>{$kashf->ldprism}</td>
                <td>{$kashf->ldva}</td>
            </tr>
            <tr>
                <td><strong>near</strong></td>
                <td>{$kashf->lnsphere}</td>
                <td>{$kashf->lncylinder}</td>
                <td>{$kashf->lnaxis}</td>
                <td>{$kashf->lnprism}</td>
                <td>{$kashf->lnva}</td>
            </tr>
        </table>
    </div>

    
  

    <div style="width: 45%;margin-left: 2px;float: left;">
        <table class="ltable" width="100%">
            <tr>
                <td colspan="5"><strong>right</strong></td>
            </tr>
            <tr>
                <td>Sphere</td>
                <td>Cylinder</td>
                <td>Axis</td>
                <td>Prism</td>
                <td>V/A</td>
            </tr>
            <tr>
                <td>{$kashf->rdsphere}1</td>
                <td>{$kashf->rdcylinder}2</td>
                <td>{$kashf->rdaxis}3</td>
                <td>{$kashf->rdprism}4</td>
                <td>{$kashf->rdva}5</td>
            </tr>
            <tr>
                <td>{$kashf->rnsphere}1</td>
                <td>{$kashf->rncylinder}2</td>
                <td>{$kashf->rnaxis}3</td>
                <td>{$kashf->rnprism}4</td>
                <td>{$kashf->rnva}5</td>
            </tr>
        </table>
    </div>
    
    <div style="width: 10%;">
        <table >
            <tr>
                <td width="149" height="28"><strong>PD</strong></td>
                <td width="160">&nbsp; {$kashf->pd}</td>
            </tr>
            <tr>
                <td height="41"><strong>BVD</strong></td>
                <td>&nbsp; {$kashf->bvd}</td>
            </tr>
        </table>
    </div>
    {/if}

    <table width="90%">
        <tr>
            <td width="11%"><strong>note</strong></td>
            <td width="89%">    {$bill->customerpercent} % O/P UP TO SR {$bill->customercarry}</td>
        </tr>
    </table>
    <table width="90%">
        <tr>
            <td width="11%"><strong>Code</strong></td>
            <td width="27%"><strong>Service Description</strong></td>
            <td width="11%"><strong>Quantity</strong></td>
            <td width="11%"><strong>Unit Price</strong></td>
            <td width="11%"><strong>Total Price</strong></td>
            <td width="15%"><strong>Price paid by customer</strong></td>
            <td width="14%"><strong>price insurance coverage</strong></td>
        </tr>
        {foreach $billProducts as $product}
        <tr>
            <td>{$product->productcode}</td>
            <td>{$product->service}</td>
            <td>{$product->productno}</td>
            <td>{$product->productprice}</td>
            <td>{$product->producttotalprice}</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
        </tr>
        {/foreach}
        <tr>
            <td colspan="2"><center><b class="font24">Total</b></center></td>
        <td>&nbsp;</td>
        <td class="nah">&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        <td>&nbsp;</td>
        </tr>
    </table>

     


    
    <!-- start -->
    <div style="width:5%;margin-right:2%;float:left"><table width="100%"></table></div>
    <div style="width:30%;margin-right:2%;float:left">
        <table width="100%">
            <tr>
                <td><strong>the total amount of invoice</strong></td>
            </tr>
        </table>
    </div>
    <div style="width:55%;float:left">
        <table width="100%">
            <tr>
                <td><strong>{$bill->finalnetbillvalue}</strong></td>
            </tr>
        </table>
    </div>
    <div style="width:5%;"><table width="100%"></table></div>
    <!-- end -->

    
    
    <!-- start -->
    <div style="width:5%;margin-right:2%;float:left"><table width="100%"></table></div>
    <div style="width:30%;margin-right:2%;float:left">
        <table width="100%">
            <tr>
                <td><strong>insurance coverage</strong></td>
            </tr>
        </table>
    </div>
    <div style="width:55%;float:left">
        <table width="100%">
            <tr>
                <td><strong>paid by customer</strong></td>
            </tr>
        </table>
    </div>
    <div style="width:5%;"><table width="100%"></table></div>
    <!-- end -->

    <!-- start -->
    <div style="width:5%;margin-right:2%;float:left"><table width="100%"></table></div>
    <div style="width:30%;margin-right:2%;float:left">
        <table width="100%">
            <tr>
                <td height="44"> {$bill->companycarry} </td>
            </tr>
        </table>
    </div>
    <div style="width:55%;float:left">
        <table width="100%">
            <tr>
                {if $bill->card == 1}<td><strong>network</strong></td>{/if}
                {if $bill->cash == 1}<td><strong>in cash</strong></td>{/if}
                {if $bill->waitvalue != 0}<td><strong>in wait</strong></td>{/if}
            </tr>
            <tr>
                {if $bill->card == 1}<td>{$bill->cardvalue} </td>{/if}
                {if $bill->cash == 1}<td>{$bill->cashvalue}</td>{/if}
                {if $bill->waitvalue != 0}<td>{$bill->waitvalue}</td>{/if}
            </tr>
        </table>
    </div>
    <div style="width:5%;"><table width="100%"></table></div>
    <!-- end -->
    
    
    <table width="90%">
        <tr>
            <td width="166"><strong>note</strong></td>
            <td width="922">&nbsp;</td>
        </tr>
    </table>
   <div style="width:30%;margin-right:40%;float:left">
        <table >
            <tr>
                <td width="149" height="28"><strong>sales name</strong></td>
                <td width="160">&nbsp;</td>
            </tr>
            <tr>
                <td height="41"><strong>Signs</strong></td>
                <td>&nbsp;</td>
            </tr>
        </table>
    </div>
    <div style="width:25%;float:left">
        <table width="100%">
            <tr>
                <td width="150"><strong>customer name</strong></td>
                <td width="160">&nbsp;</td>
            </tr>
            <tr>
                <td height="45"><strong>Signs</strong></td>
                <td>&nbsp;</td>
            </tr>
        </table>

    </div>

    {literal}
    <script>
        print_Custom('mycustomheader');
    </script>
    {/literal}

</center>
{if $go && $go == "no" }
{else}
<meta http-equiv="refresh" content="0;URL=bills.php?do=show" />

{/if}


