<div class="inner-wrapper">
				<!-- start: sidebar -->
				
				<!-- end: sidebar -->

				<section role="main" class="content-body">
					<header class="page-header">
						<h2>Inventory</h2>
					</header>
                    <div class="row">
                    <div class="col-md-12 col-lg-12 col-xl-4">
								<div class="row">
									
									<div class="col-md-3 col-xl-12">
										<section class="panel">
											<div class="panel-body bg-secondary">
												<div class="widget-summary">
													<div class="widget-summary-col widget-summary-col-icon">
														<div class="summary-icon">
															<i class="fa fa-plus-square"></i>
														</div>
													</div>
													<div class="widget-summary-col">
														<div class="summary">
															<h4 class="title">Types Of Medicines</h4>
															<div class="info">
																<strong class="amount"><?php echo $this->db->get("medicines")->num_rows();?></strong>
															</div>
														</div>
													</div>
												</div>
											</div>
										</section>
									</div>
									<div class="col-md-3 col-xl-12">
										<section class="panel">
											<div class="panel-body bg-tertiary">
												<div class="widget-summary">
													<div class="widget-summary-col widget-summary-col-icon">
														<div class="summary-icon">
															<i class="fa fa-medkit"></i>
														</div>
													</div>
													<div class="widget-summary-col">
														<div class="summary">
															<h4 class="title">Treatment Packages</h4>
															<div class="info">
										<strong class="amount"><strong class="amount"><?php echo $this->db->get("packages")->num_rows();?></strong></strong>
															</div>
														</div>
													</div>
												</div>
											</div>
										</section>
									</div>
									<div class="col-md-3 col-xl-12">
										<section class="panel">
											<div class="panel-body bg-quaternary">
												<div class="widget-summary">
													<div class="widget-summary-col widget-summary-col-icon">
														<div class="summary-icon">
															<i class="fa fa-life-ring"></i>
														</div>
													</div>
													<div class="widget-summary-col">
														<div class="summary">
															<h4 class="title">Listed Lab Tests</h4>
															<div class="info">
					<strong class="amount"><strong class="amount"><?php echo $this->db->get("lab_tests")->num_rows();?></strong></strong>
															</div>
														</div>
													</div>
												</div>
											</div>
										</section>
									</div>
								</div>
							</div>
                        <?php if($this->session->flashdata("msg")){?>
                       <div class="alert alert-info"><?php echo $this->session->flashdata("msg");?></div> 
                        <?php }?>
                        <div class="col-md-8">
                        
                        	<section class="panel">
                            
							<header class="panel-heading">
                            	<h2 class="panel-title">Listing All Medicines</h2>
                            </header>
							
                            <div class="panel-body">
	<table class="table table-bordered mb-none" id="example">
									<thead>
										<tr>
											<th>S.No.</th>
											<th>Medicine/Variant</th>
                                            <th>Type</th>
											<th>Avail.Qty.</th>
                                            <th>Add Qty</th>
										</tr>
									</thead>
									<tbody>
                                    <?php $i=1;foreach($medicines as $med){?>
                                    	<tr><td><?php echo $i;?></td>
                                        	<td><?php echo $med->medicine;?><br/><?php echo $med->variant;?></td>
                                            <td><?php echo $med->mtype;?></td>
                                            <td id="medq<?php echo $med->mid;?>"><?php echo $med->qty;?></td>
                                            <td>
                                            <form id="<?php echo $med->mid;?>" action="" method="post" class="updatemeds">
                                            <input type="hidden" name="preqty" value="<?php echo $med->qty;?>" />
                                            <input type="number" style="width:100px;" name="qty" class="form-control" value="" />
                                            <input type="submit" class="btn btn-warning btn-sm" value="update" /></form></td>
                                            </tr>
                                    <?php }?>
                                    </tbody>
								</table>
                                
							</div>
						</section>	
                        </div>
                        <div class="col-md-4">
                        	<section class="panel">
                            
							<header class="panel-heading">
                            	<h2 class="panel-title">Listing All Packages</h2>
                            </header>
							
                            <div class="panel-body">
	<table class="table table-bordered table-striped mb-none">
									<thead>
										<tr>
                                            <th>Package & Medicine</th>
                                            <th>Qty/Add Qty</th>
										</tr>
									</thead>
									<tbody>
                                    <?php $i=1;foreach($packs as $p){$med=explode(",",$p->p_meds);?>
                                    	<tr>
                                        	<td><?php echo $p->p_name;?><br/>
                                            <?php 
											foreach($med as $m){
											$m=$this->db->get_where("medicines",array("mid"=>$m))->row();
											echo '<label class="label label-success" style="font-size:12px;">'.$m->medicine.'</label><br/>';}?>
                                           </td>
                                           <td id="packq<?php echo $p->packid;?>"><?php echo $p->pqty;?><br/><form id="<?php echo $p->packid;?>" action="" method="post" class="updatepacks">
                                            <input type="hidden" name="pqty" value="<?php echo $p->pqty;?>" />
                                            <input type="number" style="width:100px;" name="qty" class="form-control" value="" />
                                            <input type="submit" class="btn btn-warning btn-sm" value="update" /></form></td>
                                            </tr>
                                    <?php }?>
                                    </tbody>
								</table>
                                
							</div>
						</section>	
                        </div>
                    </div>    					
				</section>
			</div>
		</section>
	<script src="<?php echo base_url();?>adminassets/assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
    <script>
		$(document).ready(function(){
			$('form.updatemeds').submit(function(e){e.preventDefault();
				var id=$(this).attr("id");
				var formdata=$(this).serialize();
				$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>admin/ajax_med_qty',
				 data: {formdata:formdata,id:id},
				 success: function(res){//alert(res);
					 if(res==0){
					 
					 }else{
						 $("#medq"+id).html(res);
					 }
					}
				 }); 
			});
			$('form.updatepacks').submit(function(e){e.preventDefault();
				var id=$(this).attr("id");
				var formdata=$(this).serialize();
				$.ajax({
				 type: "POST",
				 url: '<?php echo base_url();?>admin/ajax_pack_qty',
				 data: {formdata:formdata,id:id},
				 success: function(res){//alert(res);
					 if(res==0){
					 
					 }else{
						 $("#packq"+id).html(res);
					 }
					}
				 }); 
			});
		});
	</script>
	<script src="<?php echo base_url();?>adminassets/assets/vendor/jquery-cookie/jquery-cookie.js"></script>		
	<script src="<?php echo base_url();?>adminassets/assets/vendor/bootstrap/js/bootstrap.js"></script>		
	<script src="<?php echo base_url();?>adminassets/assets/vendor/nanoscroller/nanoscroller.js"></script>		
	<script src="<?php echo base_url();?>adminassets/assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>		
	<script src="<?php echo base_url();?>adminassets/assets/vendor/magnific-popup/jquery.magnific-popup.js"></script>		
	<script src="<?php echo base_url();?>adminassets/assets/vendor/jquery-placeholder/jquery-placeholder.js"></script>
		
		<!-- Specific Page Vendor -->		
		<script src="<?php echo base_url();?>adminassets/assets/vendor/select2/js/select2.js"></script>	
		
		<!-- Theme Base, Components and Settings -->
		<script src="<?php echo base_url();?>adminassets/assets/javascripts/theme.js"></script>
		
		<!-- Theme Custom -->
		<script src="<?php echo base_url();?>adminassets/assets/javascripts/theme.custom.js"></script>
		
		<!-- Theme Initialization Files -->
		<script src="<?php echo base_url();?>adminassets/assets/javascripts/theme.init.js"></script>
		<!-- Analytics to Track Preview Website -->		
		<!-- Examples -->
        <script src="<?php echo base_url();?>adminassets/assets/javascripts/ui-elements/examples.lightbox.js"></script>
        <script src="https://cdn.datatables.net/1.10.16/js/jquery.dataTables.min.js"></script>
        <script src="https://cdn.datatables.net/1.10.16/js/dataTables.bootstrap.min.js"></script>
        <script src="https://cdn.datatables.net/buttons/1.4.2/js/dataTables.buttons.min.js"></script>
        <script src="https://cdn.datatables.net/buttons/1.4.2/js/buttons.bootstrap.min.js"></script>
        <script src="//cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js"></script>
        <script src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/pdfmake.min.js"></script>
        <script src="//cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.32/vfs_fonts.js"></script>
        <script src="//cdn.datatables.net/buttons/1.4.2/js/buttons.html5.min.js"></script>
        <script src="//cdn.datatables.net/buttons/1.4.2/js/buttons.print.min.js"></script>
        <script src="//cdn.datatables.net/buttons/1.4.2/js/buttons.colVis.min.js"></script>

        <script>
		$(document).ready(function() {
    var table = $('#example').DataTable( {
        lengthChange: false,  "order": [],"scrollX": true,
        buttons: [ 'copy', 'excel', 'pdf', 'colvis' ]
    } );
 
    table.buttons().container()
        .appendTo( '#example_wrapper .col-sm-6:eq(0)' );
} );
			
		</script>
	</body>
</html>