<script>

function printPage(id) {

    var html="<html>";

    html+= document.getElementById(id).innerHTML;

    html+="</html>";

    var printWin = window.open('','','left=100,top=100,width=1200,height=600,toolbar=0,scrollbars=0,status =0');

    printWin.document.write(html);

    printWin.document.close();

    printWin.focus();

    printWin.print();

    printWin.close();

}
</script>
<table width="900px" id="printsec">
        <tr><td width="20px"></td><td width="900px">
          <img style="height:60px;" alt="logo" src="<?php echo base_url();?>assets/logo.png" />
                      <h5 class="font-semibold">INVOICE</h5>
                      <table class="table table-bordered" width="900px">
                      <tr><th colspan="2" align="center"><h2>Y1 Electronics Order Invoice</h2></th></tr>
                        <tr  style="border-bottom:1px solid #999;">
                          <th width="300px" align="left">Invoice No. Y1INVO00-<?php echo $order->oid;?></th>
                          <th width="300px" align="right">Invoice Date <?php echo date("d M Y",strtotime($order->odate));?></th>
                        </tr>
                      </table>
                   
                   
                   
                   <table class="table table-bordered" width="900px" style="border:0px solid #CCC;">
                        <tr style="background:#CCC; solid #999;padding:10px;">
                          <th width="300px" align="left">Company Address</th><th width="300px" align="right">Delivery Address</th>
                        </tr>
                        <tr>
                        <td width="300px" align="left">
                        	<address>

					<?php $add=$this->db->get("admin")->row();
					echo '<b>'.$add->comp_name.'</b><br/>';

                    echo $add->address.'<br/>';
                    echo $add->city.' '.$add->pincode.'<br/>';?>

                    <abbr title="Phone">Ph :</abbr> <?php echo $add->mobile;?>



                    <br />



                     <?php echo $add->email;?>



                    </address>
                        </td>
                        <td width="300px" align="right">
                        	<p><?php echo $order->bname;?><br>
                          <?php echo $order->baddress;?><br>
                          <?php echo $order->blandmark.' '.$order->bcity.' '.$order->bstate.' '.$order->bpin;?><br>
                          <i class="fa fa-phone"></i> <?php echo $order->bphone;?></p>
                        </td>
                        </tr>
                      </table>
                   
                  
                    
                    <table class="table table-bordered table-striped" style="border:0px solid #333;" width="900px" >
                      <thead>
                        <tr style="padding:10px; background:#999; border:1px solid #000;">
                          <th>SKU</th>
                          <th>DESCRIPTION</th>
                          <th class="text-center" style="width:20px;">QTY</th>
                          <th class="text-right" style="width:120px;">UNIT PRICE</th>
                          <th class="text-right" style="width:120px;">TOTAL</th>
                        </tr>
                      </thead>
                      <tbody>
                      <?php $oi=1;foreach($items as $item){?>
                        <tr style="padding:10px;border:1px solid #000;">
                          <td align="center"><?php echo $oi;?></td>
                          <td align="center">
                          <?php echo $item->pname;?></td>
                          <td align="center"><?php echo $item->qty?></td>
                          <td align="center"> <?php echo $item->price.'/- ';?></td>
                          <td align="center"> <?php echo $item->subtotal;?>/-</td>
                          
                        </tr>
                        <?php $oi++;}?>
                      </tbody>
                      <tfoot style="border:2px solid #000;">
                        <tr>
                          <th colspan="3" rowspan="3" class="bdr"  style="border-top:0px solid #333; padding-top:20px;"></th>
                          <th class="text-right pd-10">Sub Total</th>
                          <th class="text-right pd-10"><?php echo $order->ototal+$order->odis;?>/-</th>
                        </tr>
                        <tr>
                          <th class="text-right  pd-10 no-bd">Shipping Cost</th>
                          <th class="text-right  pd-10 no-bd"><?php echo $order->shiptot;?></th>
                        </tr>
                        <tr>
                          <th class="text-right  pd-10 no-bd">Discount</th>
                          <th class="text-right  pd-10 vd_red no-bd">-<?php echo $order->odis;?>/-</th>
                        </tr>
                        <tr>
                          <th colspan="3" align="left">Thank you for your order.</th>
                          <th class="text-right  pd-10">Order Total</th>
                          <th class="text-right  pd-10 "><span class="vd_green font-sm font-normal">Rs <?php echo $order->ototal+$order->shiptot-$order->odis;//-$order->odis;?>/-</span></th>
                        </tr>
                        <tr><td colspan="5"></td></tr>
                          <tr style="border-top:1px solid #666;"><th colspan="3" style="border-top:1px solid #666;" align="left">Payment Method- <?php echo $order->pay_method;?></th><th colspan="2"></th></tr>
                          
                      </tfoot>
                    </table></td></tr></table>
                    <?php if($this->uri->segment(2)=='print_invoice'){?>
                    <hr/>
                     <button class="btn vd_btn vd_bg-grey" onclick="printPage('printsec');" type="button"><i class="fa fa-print append-icon"></i> Print Invoice</button><?php } ?>