 <?php
include("code.php");
//authorize();
$name=$_GET['name']; //$_SESSION['admin_name'];
$bcode=$_GET['bcode'];//$_SESSION['branchcode'];
$date=date('Y-m-d');
$rst ="";
$row_just="";
$num="";




$sql = "SELECT * FROM cart where BranchCode='$bcode' and date='$date' and officer='$name'";
	$rst = mysqli_query($link,$sql);
	$row_just = mysqli_fetch_assoc($rst);
	$num=mysqli_num_rows($rst);

//	$row_just=getcart($link,$date);



	function getReceipt($link,$bcode){
		$sq=mysqli_query($link,"select * from payment where BranchCode='$bcode'");
	$row_just = mysqli_fetch_assoc($sq);
	$nm=mysqli_num_rows($sq);
	$num=$nm + 1;
	return $num;
}
function getTotalCart($link,$bcode,$date,$name){
		$result=mysqli_query($link,"select * from cart where BranchCode='$bcode' and date='$date' and officer='$name'");
		$bal=0;
		while($reply = mysqli_fetch_array($result)){
			$amnt=$reply['total'];
			$bal+=$amnt;
		}
		return $bal;
}
	function getLimit($link,$bcode,$itname){
		$result=mysqli_query($link,"select * from items where BranchCode='$bcode' and name='$itname'");
		$reply = mysqli_fetch_array($result);
			$amnt=$reply['price'];
			$bal=$amnt;
		return $bal;
}

function getPAmount($link,$bcode,$itname,$price){
	if($price=="nprice"){
		$result=mysqli_query($link,"select * from items where BranchCode='$bcode' and name='$itname'");
		$reply = mysqli_fetch_array($result);
			$amnt=$reply['nprice'];
			$bal=$amnt;
		return $bal;
	}elseif($price=="lar"){
		$result=mysqli_query($link,"select * from items where BranchCode='$bcode' and name='$itname'");
		$reply = mysqli_fetch_array($result);
			$amnt=$reply['lar'];
			$bal=$amnt;
		return $bal;
	}elseif($price=="vsm"){
		$result=mysqli_query($link,"select * from items where BranchCode='$bcode' and name='$itname'");
		$reply = mysqli_fetch_array($result);
			$amnt=$reply['vsm'];
			$bal=$amnt;
		return $bal;
	}elseif($price=="psn"){
		$result=mysqli_query($link,"select * from items where BranchCode='$bcode' and name='$itname'");
		$reply = mysqli_fetch_array($result);
			$amnt=$reply['psn'];
			$bal=$amnt;
		return $bal;
	}else{
		return $bal=0;
	}
	
}

/*if (isset($_POST['pos'])){
	$date=date('Y-m-d');
	$item=$_POST['item'];
	$qnt=$_POST['quan'];
	$price=$_POST['price'];
	$amount=getPAmount($link,$bcode,$item,$price);
	//$itcode= getProductcode($link,$bcode,$item);
	$amnt=getAmount($link,$bcode,$item);
	$qnts= getItemBal($link,$bcode,$item);
	//$status=getstatus($link,$bcode,$item);
	$tot=$qnt*$amount;
	$officer=$name;
		if($qnt!=""){
			$ssqll =$link->query("select * from dailystockreport where date='$date'");
			$num=mysqli_num_rows($ssqll);
			if($num>0){
		
						 if($qnts >=$qnt){
							 
							 	if($amount >= $amnt){
							 
								$ssql3 =$link->query("insert into cart values(0,'$bcode', '$date','$item','$qnt','$amount','$tot','$price','$officer')");
					
								if($ssql3){
											echo "<script>location='pos.php'</script>";} else {$result = "<div class='error'>Savings not Succesfull. Try again</div>";};
											
									}else{
									echo "<script>alert('This Amount Is Too Low')</script>";
												echo "<script>location='pos.php'</script>";
										}
											
							}else{
								echo "<script>alert('Insufficient Quantity')</script>";
											echo "<script>location='pos.php'</script>";
							}
			}else{
				echo "<script>alert('Daily Stock Not Yet Done')</script>";
										echo "<script>location='pos.php'</script>";
			}
						
										
				}else{
					
					echo "<script>alert('Please Supply Quantity')</script>";
										echo "<script>location='pos.php'</script>";
				}
		
}*/
//==================================================================================
function getItemBal($link,$bcode,$name){
		$result=mysqli_query($link,"select * from items where BranchCode='$bcode' and name='$name'");
		$row=mysqli_fetch_array($result);
		$cpos=$row['quantity'];
		return $cpos;
	}
	
function getItemCost($link,$bcode,$itname){
		$result=mysqli_query($link,"select * from items where BranchCode='$bcode' and name='$itname'");
		$row=mysqli_fetch_array($result);
		$cpos=$row['cost'];
		return $cpos;
	}
	function getItemCate($link,$bcode,$itname,$date,$qnt){
		$result=mysqli_query($link,"select * from items where BranchCode='$bcode' and name='$itname'");
		$row=mysqli_fetch_array($result);
		$cate=$row['category'];
		if($cate=='BOTTLE'){
			$reslt=mysqli_query($link,"select * from dailyemptystock where BranchCode='$bcode' and name='$itname' and date='$date'");
			$rw=mysqli_fetch_array($reslt);
			$sin=$rw['StockIN'];
			$tqnt=$qnt + $sin;

		$rest=mysqli_query($link,"update dailyemptystock set StockIN='$tqnt' where BranchCode='$bcode' and name='$itname' and date='$date'");	
			return "1";

		}else{return "";}
	}
	function getDebtors($link,$bcode,$dbt,$date,$name,$officer){
		if($dbt>0){
		$sq =mysqli_query($link,"insert into debtors values(0,'$bcode','$date','$name','$dbt','$officer')");
		return "";	
		}else{
			return 0;		
		}
	}
function getQntSummary($link,$date,$bcode,$name,$status){
		$result=mysqli_query($link,"select * from summary where date='$date' and BranchCode='$bcode' and name='$name'");
		$row=mysqli_fetch_array($result);
		if($status=="nprice")
		{
			$qnt=$row['quantity'];
			return $qnt;
		}elseif($status=="lar"){
			$qnt=$row['lquan'];
			return $qnt;
		}elseif($status=="vsm"){
			$qnt=$row['vquan'];
			return $qnt;
		}elseif($status=="psn"){
			$qnt=$row['pquan'];
			return $qnt;
		}else{
			return 0;		}
	}		
	
	function UpdateSummary($link,$date,$bcode,$name,$qnt,$status){
	
		if($status=="nprice")
		{
			$sq =$link->query("update summary set quantity='$qnt' where BranchCode='$bcode' and name='$name' and date='$date'");
			return "";	
		}elseif($status=="lar"){
			$sq =$link->query("update summary set lquan='$qnt' where BranchCode='$bcode' and name='$name' and date='$date'");
			return "";	
		}elseif($status=="vsm"){
			$sq =$link->query("update summary set vquan='$qnt' where BranchCode='$bcode' and name='$name' and date='$date'");
			return "";	
		}elseif($status=="psn"){
			$sq =$link->query("update summary set pquan='$qnt' where BranchCode='$bcode' and name='$name' and date='$date'");
			return "";	
		}
	}		
//======================================================================================


if(isset($_POST['payment'])){
			$amnt1=$_POST['amnt1'];
			$pos=$_POST['pos'];
			$trans=$_POST['trans'];
			$charge=$_POST['charge'];
			$cash=$_POST['cash'];
			$cashs=$cash + $charge;
			$amt=$pos + $trans + $cash;
			$dbt=floatval($_POST['debit']);
			$amnt=$amt + $dbt;
			$customer=$_POST['cusname'];
			$imei=getReceipt($link,$bcode);
			$mode=$_POST['mode'];
			$date=date('Y-m-d');
			$mon=date('m');
			$yr=date('Y');
			$time=date("h:i a" );
			$tell="IN".$date.rand(0,7729); 
			$teller=$imei.$tell;
	if($amnt > $amnt1 || $amnt < $amnt1){
		echo "<script>alert('Amount Not Balance')</script>";
		echo "<script>location='pos.php?name=$name&bcode=$bcode'</script>";
	}else if($mode=='Null'){
		echo "<script>alert('Please Select The Correct Mode Of Payment')</script>";
		echo "<script>location='pos.php'</script>";
	}
	else if($amnt==''){
		echo "<script>alert('Please Enter An Actual Amount')</script>";
		echo "<script>location='pos.php'</script>";
	}
	else{
			$sql =$link->query("select * from cart where BranchCode='$bcode' and date='$date' and officer='$name'");
				while($reply = mysqli_fetch_array($sql)){
						$itname=$reply['name'];
						 $quan=floatval($reply['quantity']);
						$price=$reply['price'];
						$total=$reply['total'];
						$admin=$reply['officer'];
						$status=$reply['cate'];
						$qnt= getItemBal($link,$bcode,$itname);
						$sqnt=floatval(getQntSummary($link,$date,$bcode,$itname,$status));
						$cost=getItemCost($link,$bcode,$itname);
						$qbal=$qnt - $quan;
						$sqntbal=$sqnt + $quan;
						$tcost=$quan*$cost;
						$it=getItemCate($link,$bcode,$itname,$date,$quan);
						$profit=$total-$tcost;
						
							$sq =$link->query("update items set quantity='$qbal' where BranchCode='$bcode' and name='$itname'");	
							$sql2 =$link->query("insert into invoice values(0,'$bcode','$teller','$date','$time','$customer','$itname','$quan','$price','$total','$imei','$mode',$mon,$yr,'$name')");
							$sq2 =$link->query("insert into profit values(0,'$bcode','$date','$itname','$quan','$profit',$mon,$yr,'$name')");		
							$val=UpdateSummary($link,$date,$bcode,$itname,$sqntbal,$status);
					}
							if($charge>0){

										$sq =$link->query("insert into invoice values(0,'$bcode','$teller','$date','$time','$customer','Charges','0','$charge','$charge','$imei','$mode',$mon,$yr,'$name')");
										$sqs =$link->query("insert into payment values(0, '$bcode','$date','$teller','$customer','Cash','$charge',$mon,$yr,'$name')");
							}
			
				$sql3 =$link->query("insert into payment values(0, '$bcode','$date','$teller','$customer','Cash','$cash',$mon,$yr,'$name')");
				$sql4 =$link->query("insert into payment values(0, '$bcode','$date','$teller','$customer','POS','$pos',$mon,$yr,'$name')");
				$sql4 =$link->query("insert into payment values(0, '$bcode','$date','$teller','$customer','TRANSFER','$trans',$mon,$yr,'$name')");
				$dt=getDebtors($link,$bcode,$dbt,$date,$customer,$name);
								if($mode=="Cash"){
								$sql4 =$link->query("insert into cashbook values(0, '$bcode','$date','$teller','$time','$customer','$amnt','0','0','0',$mon,$yr,'$name')");
								$sql7 =$link->query("insert into journal values(0, '$bcode','$date','100','Cash Account','0','$amnt',$mon,$yr,'$name')");
								$sql8 =$link->query("insert into journal values(0, '$bcode','$date','101','Sales Account','$amnt','0',$mon,$yr,'$name')");
								header("location: receipt.php?teller=$teller&date=$date&time=$time&Cash=$cash&Transfer=$trans&Pos=$pos");
								}else{
									$sql5 =$link->query("insert into cashbook values(0, '$bcode','$date','$teller','$time','$customer','0','$amnt','0','0',$mon,$yr,'$admin')");
									$sql6 =$link->query("insert into bcashbook values(0, '$bcode','$date','$teller','$customer','$amnt','0','0',$mon,$yr,'$admin')");
									$sql9 =$link->query("insert into journal values(0, '$bcode','$date','100','Cash Account','0','$amnt',$mon,$yr,'$admin')");
									$sql10 =$link->query("insert into journal values(0, '$bcode','$date','101','Sales Account','$amnt','0',$mon,$yr,'$admin')");
									header("location: receipt.php?teller=$teller&date=$date&time=$time&Cash=$cash&Transfer=$trans&Pos=$pos");
									}
									
						$sql10 =$link->query("delete from cart where BranchCode='$bcode' and officer='$name'");			
						//echo "<script>alert('Payment Made Succefully
						echo "<script>location='receipt.php?teller=$teller&date=$date&time=$time&Cash=$cash&Transfer=$trans&Pos=$pos'</script>";
						//header("location: receipt.php?teller=$teller&date=$date&time=$time");
	}

}
?>

<!DOCTYPE html>
<!-- saved from url=(0035)https://my.mobilevtu.com.ng/profile -->
<html lang="en" class="js flexbox flexboxlegacy canvas canvastext webgl no-touch geolocation postmessage websqldatabase indexeddb hashchange history draganddrop websockets rgba hsla multiplebgs backgroundsize borderimage borderradius boxshadow textshadow opacity cssanimations csscolumns cssgradients cssreflections csstransforms csstransforms3d csstransitions fontface generatedcontent video audio localstorage sessionstorage webworkers no-applicationcache svg inlinesvg smil svgclippaths"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    
    
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <title><?php echo getStoreName($link); ?> | POS ::</title>

    <!-- Bootstrap -->
    <link href="./profile_files/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link href="./profile_files/font-awesome.min.css" rel="stylesheet">
    <link rel="stylesheet" href="./profile_files/font-awesome.min(1).css">
    <!-- NProgress -->
    <link href="./profile_files/nprogress.css" rel="stylesheet">
    <!-- iCheck -->
    <link href="./profile_files/green.css" rel="stylesheet">
	
    <!-- bootstrap-progressbar -->
    <link href="./profile_files/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
    <!-- JQVMap -->
    <link href="./profile_files/jqvmap.min.css" rel="stylesheet">
    
    <link href="./profile_files/featherlight.min.css" rel="stylesheet">
    <link href="./profile_files/select2.min.css" rel="stylesheet">

    <!-- bootstrap-daterangepicker -->
    <link href="./profile_files/daterangepicker.css" rel="stylesheet">
	<link href="./profile_files/sweetalert.css" rel="stylesheet" type="text/css"> 
    
	<link rel="stylesheet" href="./profile_files/leaflet.css">
	<script type="text/javascript" async="" src="./profile_files/recaptcha__en.js.download" crossorigin="anonymous" integrity="sha384-XtymsJC8H3wYh57vnHxIWSTq9LJf2d3w3WVjR2gR+rDtBuWO8zdvO/s6O6Cli/Oe"></script><script src="./profile_files/leaflet.js.download"></script>
    <!-- Custom Theme Style -->
    <link href="./profile_files/custom.min.css" rel="stylesheet">
    <meta name="theme-color" content="#036">
    <meta name="msapplication-TileColor" content="#036">   
    <script type="text/javascript">

    	function getPrice(val) {
	$.ajax({
	type: "POST",
	url: "get_price.php",
	data:'name='+val,
	success: function(data){
		$("#name").html(data);
	}
	});
}

    </script>
    <link rel="shortcut icon" type="image/png" href="img/logo.jpg">
  <style>
.se-pre-con {
	position: fixed;
	left: 0px;
	top: 0px;
	width: 100%;
	height: 100%;
	z-index: 9999;
	background: url(files/Preloader_3.gif) center no-repeat #fff;
	background-size: 120px 120px !important;
}
</style><link id="load-css-button.min.css" rel="stylesheet" type="text/css" href="./profile_files/button.min.css"></head>

  <body class="nav-md">
  	<div class="se-pre-con" style="display: none;"></div>
    <div class="se-pre-con2"></div>
    <div class="noconnection"></div>
    <div class="container body">
      <div class="main_container">
        <div class="col-md-3 left_col">
          <div class="left_col scroll-view">
            <div class="navbar nav_title" style="border: 0;">
              <a href="#" class="site_title"><img src="img/Profile.png"></i> <span><?php echo getStoreName($link); ?></span></a>
            </div>

            <div class="clearfix"></div>



           <!-- sidebar menu -->
            <div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
              <div class="menu_section active">
                <ul class="nav side-menu" style="">
                    <li class="connect_check current-page"><a href="DashboardSales.php"><img src="img/Loading.png"></i> Dashboard </a> </li>
                  
                   <li class="connect_check"><a href="pos.php"><img src="img/images (1)~3.png"></i> Point of Sales</a> </li>
                   
                                   
                  <li><a class="connect_check" href="logout.php"><img src="img/Exit.png"></i> Sign Out</a></li>
     
                </ul>
              </div>

            </div>
            <!-- /sidebar menu -->

          </div>
        </div>

        <!-- top navigation -->
        <div class="top_nav">
          <div class="nav_menu">
            <nav>
              <div class="nav toggle">

                <a id="menu_toggle"><img src="img/download~2.png"></i></a>

              </div>



              <ul class="nav navbar-nav navbar-right">

                <li class="">

                  <a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown" aria-expanded="false">

                    <img src="./profile_files/user.png" alt=""><?php echo $name; ?>
                    <span class=" fa fa-angle-down"></span>

                  </a>

                  <ul class="dropdown-menu dropdown-usermenu pull-right">

                    <li>

                      <a class="connect_check" href="#"> 

                        <i class="fa fa-user pull-right"></i>

                        <span>My Profile</span>

                      </a>

                    </li>

                    <li class="connect_check"><a href="#"><i class="fa fa-sign-out pull-right"></i> Log Out</a></li>

                  </ul>

                </li>

              </ul>

            </nav>

          </div>

        </div>

        <!-- /top navigation -->

	 <!-- page content -->
        <div class="right_col" role="main" style="min-height: 1042px;">
          <div class="">
            <div class="page-title">
              <div class="title_left">
                <h3>Point of Sale</h3>
              </div>
			</div>
            
            <div class="clearfix"></div>
            <!-- main content -->

                <div class="x_panel">
                  <div class="x_title">
                  	<h2><img src="img/images (1)~3.png"></i> Selling Portal</h2>
                    <div class="clearfix"></div>
                  </div>
                  <div class="x_content">
					<form method="post" id="seller2" action="calculate_pos.php" class="form-horizontal form-label-left">


                        <div class="form-group">
                        	<label for="password1" class="control-label col-md-3 col-sm-3 col-xs-12">Select Product</label>
                        	<div class="col-md-8 col-sm-8 col-xs-12">
                        	  <select name="item" id="category_id" class="custom-select select2" onChange="getPrice(this.value);" style="width:100%;" placeholder="Select Branches">

															<option value="">Please select</option>
									<?php getAllProducts($link,$bcode); ?>
                                </select>
                        	</div>
                    	</div>    


                         <div class="form-group">
                        	<label for="password1" class="control-label col-md-3 col-sm-3 col-xs-12">Select Price</label>  
                                <div class="col-md-8 col-sm-8 col-xs-12">
                        	  <select name="price" id="name" class="form-control" placeholder="Select Branches">
                        	    <option value="nprice">RETAIL</option>
								<option value="lar">LAR</option>
                                <option value="vsm">VSM</option>
                                <option value="psn">PSN</option>
                                </select>
                        	</div>
                    	</div>              
                        <div class="form-group">
                        	<label for="quantity" class="control-label col-md-3 col-sm-3 col-xs-12">Enter Product Quantity</label>
                        	<div class="col-md-8 col-sm-8 col-xs-12">
                        	  <input placeholder="Enter Product Quantity" class="form-control col-md-7 col-xs-12" id="id" type="text" required name="quan" >
                        	</div>
                    	</div>  
                        
                        
                        <div class="form-group">
                       	  <p>
                         
                        </div>                                                                
				<div class="ln_solid"></div>
                                             
                      <div class="form-group">
                        <div class="col-md-9 col-sm-9 col-xs-12 col-md-offset-3">
                          <button type="submit" name="clear"  class="btn btn-default"><img src="img/Delete.png"></i> Cancel</button>
                          <button type="submit" name="pos" class="btn btn-success"><img src="img/Add.png"></i> Save</button>
                        </div>
                      </div>
                      <div class="ln_solid"></div>
                      <!-- Recent  -->

			<div class="col-md-12 col-sm-12 col-xs-12">

              <div class="x_panel tile fixed_height_32 ">

                <div class="x_title">

                  <h2 class="green"><strong>Customer Shopping Cart</strong></h2>

					<ul class="nav navbar-right panel_toolbox">

                    <li><a class="collapse-link"><i class="fa fa-chevron-up"></i></a></li>

                  </ul>

                  <div class="clearfix"></div>

                </div>               



				<div class="table-responsive">

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

                  		<thead>

                          <tr class="headings">

							 <th class="column-title">Date</th>
                           

                            <th class="column-title">Description</th>
                           

                            <th class="column-title">Quantity</th>

                            <th class="column-title">Price</th>
                            
                             <th class="column-title">Total</th>
                              <th class="column-title">Category</th>
                            
                            <th class="column-title">Officer</th>
                            
                            <th class="column-title">Remove</th>

                          </tr>

                        </thead>

                        <tbody> 

		 <?php $num = 1; do { ?>
                          <tr class="even pointer">

                            <td class=" "><?php echo $row_just['date']; ?></td>


                            <td class=" "><?php echo $row_just['name']; ?></td>
                            

                            <td class=" "><?php echo $row_just['quantity']; ?></td>

                            <td class=" "><?php echo $row_just['price']; ?></td>
                            
                             <td class=" "><?php echo $row_just['total']; ?></td>
                            <td class=" "><?php echo $row_just['cate']; ?></td>
                            <td class=" "><?php echo $row_just['officer']; ?></td>
                            
                             <td class=" "><a href="delete.php?pname=<?php echo $row_just['name']; ?>&bcode=<?php echo $row_just['BranchCode'];  ?>&del=delete" ><button type="button" name="open" class="btn btn-success pull-right"><img src="img/Delete.png"></i> Remove</button></a></td>

                          </tr>
<?php $num++; } while ($row_just = mysqli_fetch_assoc($rst)); ?>
                        </tbody>

                    </table>     
</form>


	<form method="post" action="<?php $_SERVER['PHP_SELF']; ?>" class="form-horizontal form-label-left">
                    <div class="form-group">
                        	<label for="quantity" class="control-label col-md-3 col-sm-3 col-xs-12">Total Cash</label>
                        	<div class="col-md-8 col-sm-8 col-xs-12">
                        	  <input placeholder="" class="form-control col-md-7 col-xs-12" style="width:20%; background-color:#CCC;" id="quan" type="text" name="amnt1" value="<?php echo getTotalCart($link,$bcode,$date,$name);  ?>">
                               <input placeholder="CASH" class="form-control col-md-7 col-xs-12" required style="width:20%;" id="quan" type="text" name="cash">     
                               <input placeholder="POS" class="form-control col-md-7 col-xs-12" required style="width:20%;" id="quan" type="text" name="pos">    
                               <input placeholder="TRANSFER" class="form-control col-md-7 col-xs-12" required style="width:20%;" id="quan" type="text" name="trans">                     
                                <input placeholder="Debors Amount" class="form-control col-md-7 col-xs-12" required style="width:15%;" id="quan" type="text" name="debit">  
                                <input placeholder="Charges Amount" class="form-control col-md-7 col-xs-12" required style="width:12%;" id="quan" type="text" name="charge">                   
                        	  <select name="mode" class="form-control col-md-7 col-xs-12" style="width:15%;" placeholder="Select Branches">
                        
                                 <option value="Cash">Cash</option>
                                  <option value="POS">POS</option>
                                  <option value="TRANSFER">TRANSFER</option>
                                </select>
                                
                                   <select name="bank" class="form-control col-md-7 col-xs-12" style="width:15%;" placeholder="Select Branches">
                                 <?php echo getAllAcc($link,'7',$bcode); ?>
                                  
                                </select>
                                 
                                
                               <input placeholder="Enter Customer Name" class="form-control col-md-7 col-xs-12" style="width:12%;" id="quan" type="text" name="cusname">
                        	</div>
                            
                    	</div>                                
                           

           			<button class="btn btn-success pull-right" type="submit" name="payment"><img src="img/Next.png"></i> Make Payment</button>

                  </div>       

              </div>

            </div>

          <!-- Recent Transactions --> 
                    </form>
                    
                  </div>
                </div>

               </div>
				
             
                
            </div>
            <!-- Main contents -->
          </div>
        <!-- /page content -->
        
<!-- Popup for view entry -->

   <div id="buy_airtime" style="display:none; overflow-x: hidden; width: 99.99%; height: 99.99%; z-index: 99999; position: fixed; top: 0; left: 0; background: rgba(0,0,0,0.5);">

    	 <div class="row"><br><br>

           <div class="col-lg-3 col-md-2 col-sm-1 col-xs-12"> </div>

           <div class="col-lg-6 col-md-8 col-sm-10 col-xs-12">

           	    <div class="popup_closer">

                  <button type="button" onclick="$(&#39;#buy_airtime&#39;).fadeOut(&#39;slow&#39;);" class="pull-right btn btn-danger"><i class="fa  fa-times"></i></button>

               </div>

               <div class="x_panel">

                 <div class="x_content">

                 	<h3>Buy Airtime</h3>

                     <div class="ln_solid"></div>

                        <form method="post" id="payform" action="https://my.mobilevtu.com.ng/profile" data-parsley-validate="" class="form-horizontal form-label-left">							

                       	<input type="hidden" id="hash" value="ba895bb38ae495515851321c00d5647f:ZWjIH8vUDVaJWinRjHwSMGIGf1XFMSWs">

                        <input type="hidden" id="email" value="faccomputers@yahoo.com">

                        <input type="hidden" id="amount" value="0.00">

                        <div class="form-group operator_logo" style="display:none">

                        	<center><img id="operator_logo" src="./profile_files/ajax-loader.gif" style="width:70px;border-radius:5px;"></center>

                        </div>

                        

                        <div class="form-group">

                            <label for="number" class="control-label col-md-3 col-sm-3 col-xs-12">Mobile Number</label>

                            <div class="col-md-8 col-sm-8 col-xs-12">

                                <input id="number" required="required" placeholder="E.g: 2348031234567" class="form-control col-md-7 col-xs-12" type="number" value="">

                            </div>

                        </div>

                        

	                    <div class="form-group show_operator" style="display:none">

                        	<label class="control-label col-md-3 col-sm-3 col-xs-12">Select Operator</label>

                            <div class="col-md-8 col-sm-8 col-xs-12">

                                <select id="operator" style="width:100%;" required="" class="select2a form-control col-md-7 col-xs-12">

								   <option disabled="" selected="" value="">Choose Network Operator</option>

                                   
										<option value="MTN">MTN Nigeria </option>

                                     
										<option value="Glo">Glo Mobile Nigeria </option>

                                     
										<option value="9mobile">9Mobile Nigeria </option>

                                     
										<option value="Airtel">Airtel Nigeria </option>

                                        

                               </select>

                            </div>

                        </div> 

                        

                        <div class="form-group">

                            <label for="value_amount" class="control-label col-md-3 col-sm-3 col-xs-12">Airtime Amount</label>

                            <div class="col-md-8 col-sm-8 col-xs-12">

                                <input id="value_amount" required="required" placeholder="Min of 200" class="form-control col-md-7 col-xs-12" type="number" value="0" min="200" max="20000">

                            </div>

                        </div>

                        

                        <div class="form-group">

                            <label for="amount2" class="control-label col-md-3 col-sm-3 col-xs-12">You Pay</label>

                            <div class="col-md-8 col-sm-8 col-xs-12">

                                <span id="amount2" class="form-control col-md-7 col-xs-12" style="border-color:#eee;">₦0.00</span>

                            </div>

                        </div>

                      

                    <div class="ln_solid"></div>

                    <div class="form-group">

                      <div class="col-md-9 col-sm-9 col-xs-12 col-md-offset-3">

                         <button type="button" id="paystack" onclick="payTopupPaystack()" class="acting btn btn-primary"><i class="fa fa-cc-mastercard"></i> Pay Online</button>

                         <button type="button" id="walletpay" onclick="payTopupLocal()" class="acting btn btn-pup"><i class="fa  fa-money"></i> Use My Wallet</button>

                       </div>

                     </div>

                    </form> 

                 </div>

               </div>                  

           </div>

           <div class="col-lg-3 col-md-8 col-sm-1 col-xs-12"> </div>

       </div>            	

   </div>



<!-- Popup for data -->

   <div id="buy_data" style="display:none; overflow-x: hidden; width: 99.99%; height: 99.99%; z-index: 99999; position: fixed; top: 0; left: 0; background: rgba(0,0,0,0.5);">

    	 <div class="row"><br><br>

           <div class="col-lg-3 col-md-2 col-sm-1 col-xs-12"> </div>

           <div class="col-lg-6 col-md-8 col-sm-10 col-xs-12">

           	    <div class="popup_closer">

                  <button type="button" onclick="$(&#39;#buy_data&#39;).fadeOut(&#39;slow&#39;);" class="pull-right btn btn-danger"><i class="fa  fa-times"></i></button>

               </div>

               <div class="x_panel">

                 <div class="x_content">

                 	<h3>Buy Data</h3>

                     <div class="ln_solid"></div>

                        <form method="post" id="dpayform" action="https://my.mobilevtu.com.ng/profile" data-parsley-validate="" class="form-horizontal form-label-left">							

                       	<input type="hidden" id="dhash" value="ba895bb38ae495515851321c00d5647f:ZWjIH8vUDVaJWinRjHwSMGIGf1XFMSWs">

                        <input type="hidden" id="demail" value="faccomputers@yahoo.com">

                        <input type="hidden" id="damount" value="0.00">

                        <input type="hidden" id="dvalue_amount2" value="">

                        <div class="form-group doperator_logo" style="display:none">

                        	<center><img id="doperator_logo" src="./profile_files/ajax-loader.gif" style="width:70px;border-radius:5px;"></center>

                        </div>

                        

                        <div class="form-group">

                            <label for="dnumber" class="control-label col-md-3 col-sm-3 col-xs-12">Mobile Number</label>

                            <div class="col-md-8 col-sm-8 col-xs-12">

                                <input id="dnumber" required="required" placeholder="E.g: 2348031234567" class="form-control col-md-7 col-xs-12" type="number" value="">

                            </div>

                        </div>

                        

	                    <div class="form-group dshow_operator" style="display:none">

                        	<label class="control-label col-md-3 col-sm-3 col-xs-12">Select Operator</label>

                            <div class="col-md-8 col-sm-8 col-xs-12">

                                <select id="doperator" style="width:100%;" required="" class="select2a form-control col-md-7 col-xs-12">

								   <option disabled="" selected="" value="">Choose Network Operator</option>

                                   
										<option value="MTN">MTN Nigeria </option>

                                     
										<option value="Glo">Glo Mobile Nigeria </option>

                                     
										<option value="9mobile">9Mobile Nigeria </option>

                                     
										<option value="Airtel">Airtel Nigeria </option>

                                        

                               </select>

                            </div>

                        </div> 

                        

                        <div class="form-group show_when_op" style="display:none">

                            <label class="control-label col-md-3 col-sm-3 col-xs-12">Select Data Package</label>

                            <div class="col-md-8 col-sm-8 col-xs-12">

                                <select id="dvalue_amount" style="width:100%;" required="" class="select2a form-control col-md-7 col-xs-12">

								   <option disabled="" selected="" value="">Choose a Package</option>

                               </select>

                            </div>

                        </div>

                        

                        <div class="form-group">

                            <label for="damount2" class="control-label col-md-3 col-sm-3 col-xs-12">You Pay</label>

                            <div class="col-md-8 col-sm-8 col-xs-12">

                                <span id="damount2" class="form-control col-md-7 col-xs-12" style="border-color:#eee;">₦0.00</span>

                            </div>

                        </div>

                      

                    <div class="ln_solid"></div>

                    <div class="form-group">

                      <div class="col-md-9 col-sm-9 col-xs-12 col-md-offset-3">

                         <button type="button" id="dpaystack" onclick="payDataPaystack()" class="acting btn btn-primary"><i class="fa fa-cc-mastercard"></i> Pay Online</button>

                         <button type="button" id="dwalletpay" onclick="payDataLocal()" class="acting btn btn-pup"><i class="fa  fa-money"></i> Use My Wallet</button>

                       </div>

                     </div>

                    </form> 

                 </div>

               </div>                  

           </div>

           <div class="col-lg-3 col-md-8 col-sm-1 col-xs-12"> </div>

       </div>            	

   </div>



      </div>

    </div>

    <!-- jQuery -->

    <script src="./profile_files/jquery.min.js.download"></script>

    <!-- Bootstrap -->

    <script src="./profile_files/bootstrap.min.js.download"></script>

    <!-- FastClick -->

    <script src="./profile_files/fastclick.js.download"></script>

    <!-- NProgress -->

    <script src="./profile_files/nprogress.js.download"></script>

    <!-- Chart.js -->

    <script src="./profile_files/Chart.min.js.download"></script>

    <!-- gauge.js -->

    <script src="./profile_files/gauge.min.js.download"></script>

    <!-- bootstrap-progressbar -->

    <script src="./profile_files/bootstrap-progressbar.min.js.download"></script>

    <!-- iCheck -->

    <script src="./profile_files/icheck.min.js.download"></script>

    <!-- Skycons -->

    <script src="./profile_files/skycons.js.download"></script>

    <!-- Flot -->

    <script src="./profile_files/jquery.flot.js.download"></script>

    <script src="./profile_files/jquery.flot.pie.js.download"></script>

    <script src="./profile_files/jquery.flot.time.js.download"></script>

    <script src="./profile_files/jquery.flot.stack.js.download"></script>

    <script src="./profile_files/jquery.flot.resize.js.download"></script>

    <!-- Flot plugins -->

    <script src="./profile_files/jquery.flot.orderBars.js.download"></script>

    <script src="./profile_files/jquery.flot.spline.min.js.download"></script>

    <script src="./profile_files/curvedLines.js.download"></script>

    <!-- DateJS -->

    <script src="./profile_files/date.js.download"></script>

    <!-- JQVMap -->

    <script src="./profile_files/jquery.vmap.js.download"></script>

    <script src="./profile_files/jquery.vmap.world.js.download"></script>

    <script src="./profile_files/jquery.vmap.sampledata.js.download"></script>

    <!-- bootstrap-daterangepicker -->

    <script src="./profile_files/moment.min.js.download"></script>

    <script src="./profile_files/daterangepicker.js.download"></script>

    <!-- morris.js -->

    <script src="./profile_files/raphael.min.js.download"></script>

    <script src="./profile_files/morris.min.js.download"></script>

    <script src="./profile_files/sweetalert.min.js.download"></script>



    <script src="./profile_files/featherlight.min.js.download"></script>

    <!-- Custom Theme Scripts -->

    <script src="./profile_files/custom.js.download"></script>

	<script src="./profile_files/tinymce.min.js.download"></script>

    <script src="./profile_files/api.js.download"></script>

    <script src="./profile_files/select2.min.js.download"></script>

	<script src="./profile_files/modernizr.js.download"></script>

	 <script src="./profile_files/inline.js.download"></script> 

    <script src="./profile_files/flwpbf-inline.js.download"></script>

    <script src="./profile_files/google.js.download"></script>

<script>

$(document).ready(function() {

	

});

		

/* Initiate Functions - */

	$(document).ready(function() {				

		init_sparklines();

		init_flot_chart();

		init_sidebar();

		init_wysiwyg();

		init_InputMask();

		init_JQVmap();

		init_cropper();

		init_knob();

		init_IonRangeSlider();

		init_ColorPicker();

		init_TagsInput();

		init_parsley();

		init_SmartWizard();

		init_EasyPieChart();

		init_charts();

		init_echarts();

		init_morris_charts();

		init_skycons();

		init_select2();

		init_validator();

		init_DataTables();

		init_chart_doughnut();

		init_gauge();

		init_PNotify();

		init_starrr();

		init_calendar();

		init_compose();

		init_CustomNotification();

		init_autosize();

		init_autocomplete();		

	});	

</script>

	<script>
	$('#manage-product').on('reset',function(){
		$('input:hidden').val('')
		$('.select2').val('').trigger('change')
	})
	
	$('#manage-product').submit(function(e){
		e.preventDefault()
		start_load()
		$.ajax({
			url:'ajax.php?action=save_product',
			data: new FormData($(this)[0]),
		    cache: false,
		    contentType: false,
		    processData: false,
		    method: 'POST',
		    type: 'POST',
			success:function(resp){
				if(resp==1){
					alert_toast("Data successfully added",'success')
					setTimeout(function(){
						location.reload('index.php?page=orders')
					},1500)

				}
				else if(resp==2){
					alert_toast("Data successfully updated",'success')
					setTimeout(function(){
						location.reload('index.php?page=orders')
					},1500)

				}
			}
		})
	})
	$('.edit_product').click(function(){
		start_load()
		var cat = $('#manage-product')
		cat.get(0).reset()
		cat.find("[name='id']").val($(this).attr('data-id'))
		cat.find("[name='name']").val($(this).attr('data-name'))
		cat.find("[name='description']").val($(this).attr('data-description'))
		cat.find("[name='price']").val($(this).attr('data-price'))
		cat.find("[name='category_id']").val($(this).attr('data-category_id')).trigger('change')
		if($(this).attr('data-status') == 1)
			$('#status').prop('checked',true)
		else
			$('#status').prop('checked',false)
		end_load()
	})
	$('.delete_product').click(function(){
		_conf("Are you sure to delete this product?","delete_product",[$(this).attr('data-id')])
	})
	function delete_product($id){
		start_load()
		$.ajax({
			url:'ajax.php?action=delete_product',
			method:'POST',
			data:{id:$id},
			success:function(resp){
				if(resp==1){
					alert_toast("Data successfully deleted",'success')
					setTimeout(function(){
						location.reload()
					},1500)

				}
			}
		})
	}
	$('table').dataTable()
</script>

        

  



</div><iframe frameborder="0" allowtransparency="true" id="VGD56" name="paystack-checkout-background-VGD56" style="z-index: 2147483647; background: rgba(0, 0, 0, 0.75); border: 0px none transparent; overflow: hidden; margin: 0px; padding: 0px; -webkit-tap-highlight-color: transparent; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; transition: opacity 0.3s ease 0s; visibility: hidden; display: none;" src="./profile_files/saved_resource.html"></iframe><iframe frameborder="0" allowtransparency="true" allowpaymentrequest="true" id="Zn5WJ" name="paystack-checkout-Zn5WJ" src="./profile_files/popup.html" style="z-index: 2147483647; background: transparent; border: 0px none transparent; overflow: hidden; margin: 0px; padding: 0px; -webkit-tap-highlight-color: transparent; position: fixed; left: 0px; top: 0px; width: 100%; height: 100%; visibility: hidden; display: none;"></iframe></body></html>