<div class="clearfix"></div>
  <div class="content-wrapper">
    <div class="container-fluid">
      <!-- Breadcrumb-->
     <div class="row pt-2 pb-2">
        <div class="col-sm-9">
		    <h4 class="page-title">Orders Details</h4>
	   </div>
     
     </div>
    <!-- End Breadcrumb-->
      <div class="row">
            <div class="col-sm-9">

                <div class="card">

                  <div class="card-body" style="padding:40px;" id="printsec">

                    <div class="pull-right text-right">

                      <h3 class="font-semibold mgbt-xs-20">INVOICE</h3>

                      <table class="table table-bordered">

                        <tr>

                          <th>Invoice No.</th>

                          <th>Date</th>

                        </tr>

                        <tr>

                          <td>#<?php echo $order->oid;?></td>

                          <td><?php echo date("d M Y",strtotime($order->odate));?></td>

                        </tr>
                        <tr bgcolor="#FFFF33">

                        <td><?php echo $order->city_name.'</td><td>'.$order->store_person;?></td></tr><tr bgcolor="#FFFF66">
                        <td><?php echo date("d M Y",strtotime($order->delivery_date)).'</td><td>'.$order->dt_slot;?></td>

                        </tr>

                      </table>

                    </div>

                    <div class="mgbt-xs-20"><img style="height:60px;" alt="logo" src="<?php echo base_url();?>assets/images/logo.png" /></div>

                    <address>

                    ABC Test Address , <br>

                    123, ABC Test Store, ABC City State 123456<br/>shop no.1, ABC Country 123456<br>

                    <abbr title="Phone">Ph :</abbr> 1234567890, +91 1231231230<br />

                    <br />

                    info@subhoj.com

                    </address>

                    <hr/>

                    <br/>

                    <div class="pd-25">

                      <div class="row">

                        <div class="col-md-8">

                          <address>

                          <strong>Bill To:</strong><br>

                          <?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;?>

                          </address>

                        </div>

                       <!-- <div class="col-xs-4">

                          <address>

                          <strong>Ship To:</strong><br>

                          John Doe<br>

                          795 Folsom Ave, Suite 600<br/>

                          San Francisco, CA 94107<br>

                          </address>

                        </div>-->

                       <!-- <div class="col-xs-2">

                          <address>

                          <strong>Due Date:</strong><br>

                          24 July 2013

                          </address>

                        </div>-->

                        <div class="col-md-4">

                          <div class="text-right">

                          <strong>Total Amount:</strong><br>

                          <h4 class="text-warning"><?php echo $order->curr.' '.$order->ototal;?>/-</h4>

                          Pay Method - <strong> <?php echo $order->pay_method;?></strong>
<?php if($order->pay_method!='COD'){?>
                           <br/>Transaction ID- <strong> <?php echo $order->trans_id;?></strong>

                           <br/>Transaction Ref- <strong> <?php echo $order->txn_ref;?></strong>
<?php }?>
                          </div>

                        </div>

                      </div>

                    </div>

                    <table class="table table-condensed table-striped">

                      <thead>

                        <tr>

                          <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;">Shipping</th>

                          <th class="text-right" style="width:120px;">TOTAL</th>

                        </tr>

                      </thead>

                      <tbody>

                      <?php foreach($items as $item){?>

                        <tr>

                          <td class="text-center"><?php echo $item->pid;?></td>

                          <td class="text-center">

                          <img  width="100px" class="img img-responsive pull-left" src="<?php echo $item->pimg;?>"> <?php echo $item->pname;if($item->claim_pro=="yes"){?><br/><label class="label label-warning">Claimed</label><?php }?></td>

                          <td><?php echo $item->qty?></td>

                          <td class="text-right"> <?php echo $item->price.'/- ';?></td>

                          <td class="text-right"> <?php echo $item->s_pro_ship.'/- ';?></td>

                          <td class="text-right"> <?php echo $item->s_pro_ship+$item->subtotal;?>/-</td>

                          

                        </tr>

                        <?php }?>

                      </tbody>

                      <tfoot bgcolor="#FFFFCC">

                        <tr>

                          <th colspan="4" rowspan="3" class="bdr">

                            <!--<h4>Offer Code Used - 

                            <b class="text-danger"><?php if($order->offer!=""){

							  $of=$this->db->get_where("promos",array("promo_id"=>$order->offer))->row();

							  echo $of->promo_code;}?></b></h4>--></th>

                          <th class="text-left pd-10">Sub Total</th>

                          <th class="text-right pd-10"><?php echo $order->ototal;?>/-</th>

                        </tr>

                        <tr>

                          <th class="text-left  pd-10 no-bd">Shipping</th>

                          <th class="text-right  pd-10 no-bd"><?php echo $order->shiptot;?>/-</th>

                        </tr>

                        

                        <tr>

                          <th class="text-left  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="4">Thank you for your order. Please remit the total amount due within 30 days.</th>

                          <th class="text-left  pd-10">Order Total</th>

                          <th class="text-right  pd-10"><span class="vd_green font-sm font-normal"><?php echo $order->ototal-$order->odis;//-$order->odis;?>/-</span></th>

                        </tr>

                      </tfoot>

                    </table>

                  </div>

                  <!-- panel-body --> 

                  

                </div>

                <!-- Panel Widget --> 

              </div>
            <div class="col-sm-3">
            	<div class="card">
                <div class="card-body">
                <div class="mgbt-xs-5">
                  <a href="<?php echo base_url();?>admin/orders" class="btn btn-warning" type="button">
                  <i class="fa fa-arrow-left"></i> Back To All Orders</a>
                </div>
                <div class="mgbt-xs-5">
                  <button class="btn vd_btn vd_bg-grey" onclick="printPage('printsec');" type="button"><i class="fa fa-print append-icon"></i> Print Invoice</button>
                </div>
                <div class="mgbt-xs-5">
                  <a class="btn vd_btn vd_bg-green" href="<?php echo base_url();?>admin/invoice_pdf/<?php echo $this->uri->segment(3);?>"><i class="fa fa-download append-icon"></i> Get PDF</a>
                </div>
                
                <div class="mgbt-xs-5">
                <hr/>
                <h5>Update Status</h5>
                <p id="ostresponse" class="text-danger"></p>
                  <select id="changestatus" class="form-control">
                  		<option value="Pending" <?php if($order->ostatus=="Pending"){echo "selected";}?>>Pending</option>
                        <option value="Comfirmed" <?php if($order->ostatus=="Comfirmed"){echo "selected";}?>>Comfirmed</option>
                        <option value="Delivered" <?php if($order->ostatus=="Delivered"){echo "selected";}?>>Delivered</option>
                        <option value="Completed" <?php if($order->ostatus=="Completed"){echo "selected";}?>>Completed</option>
                  </select>
                </div>
                </div></div>
              </div>
        </div><!--End Row-->
	  
	  <!--End Row-->

    </div>
    <!-- End container-fluid-->
    
    </div><!--End content-wrapper-->
   <!--Start Back To Top Button-->
    <a href="javaScript:void();" class="back-to-top"><i class="fa fa-angle-double-up"></i> </a>
    <!--End Back To Top Button-->
	
	<!--Start footer-->
	<footer class="footer">
      <div class="container">
        <div class="text-center">
          Copyright © 2020 Grocery Store
        </div>
      </div>
    </footer>
	<!--End footer-->
   
  </div><!--End wrapper-->

  <script src="<?php echo base_url();?>adminassets/plugins/bootstrap-datatable/js/jquery.dataTables.min.js"></script>
  <script src="<?php echo base_url();?>adminassets/plugins/bootstrap-datatable/js/dataTables.bootstrap4.min.js"></script>
  <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();
}
	$(document).ready(function(){
		$("#changestatus").change(function(){
			//alert("AFsd");
			var st=$(this).val();
			$.ajax({
					type:'POST',
					data:{oid:'<?php echo $this->uri->segment(3);?>',st:st},
					url:'<?php echo base_url();?>store/ostatus_change',
					success:function(data){
					  // alert(data);
						$("#ostresponse").html(data); 
						//$('#sectionn').material_select();  
					}
			});
		});
	});
</script>
  <script src="<?php echo base_url();?>adminassets/js/sidebar-menu.js"></script>
  <!-- Custom scripts -->
  <script src="<?php echo base_url();?>adminassets/js/app-script.js"></script>
</body>
</html>
