<?php   session_start(); include 'xyz.php';
//get the Bill
if(QueryDB("SELECT COUNT(*) FROM payment where pay_status=0 and cus_id='".$_SESSION['mycus']."' ")->fetchColumn()>0){
$getIt=QueryDB("SELECT * FROM payment where cus_id ='".$_SESSION['mycus']."' and pay_status=0 ");
$rhoda = $getIt->fetch(PDO::FETCH_ASSOC);

if(getBiller($rhoda['id'])!=null){
	$biller = @getBiller($rhoda['id']); $bill = @explode(',',$biller['organization']);
}else{
	$biller = @getBillerRecent($_SESSION['mycus']); $bill = @explode(',',$biller['organization']);
}



}



$shipCost =2000;
$charges =1000;

?>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1">
		<?php  include 'inc/outl_toplinks.php'; ?>
		<link rel="stylesheet" type="text/css" href="css/outl_ulib.css">
</head>
<body><?php include 'inc/outl_header.php';  include 'inc/outl_nav.php'; include 'process.php';  ?>

		<!-- BREADCRUMB -->
		<div id="breadcrumb" class="section">
			<!-- container -->
			<div class="container">
				<!-- row -->
				<div class="row">
					<div class="col-md-12">
						<h3 class="breadcrumb-header">Checkout</h3>
						
					</div>
				</div>
				<!-- /row -->
			</div>
			<!-- /container -->
		</div>
		<!-- /BREADCRUMB -->

		<!-- SECTION -->
		<div class="section">
			<!-- container -->
			<div class="container">
				<!-- row -->
	<form action="" method="POST">
				<div class="row">

					<div class="col-md-7">
						<!-- Billing Details -->
						<div class="billing-details">
							<div class="section-title">
								<h3 class="title">WayBill Address</h3>
							</div>
<div class="form-group"><input class="input" type="text" name="receiver" placeholder="Receivers Full name" required value="<?php echo @$bill[0] ?>"></div><div class="form-group"><input class="input" type="text" name="eqPhone" placeholder="Receiver Phone" required value="<?php echo @$bill[1] ?>"></div>
<div class="form-group"><input class="input" type="email" name="email" placeholder="Receiver Email" value="<?php echo @$bill[2] ?>">
</div>
<div class="form-group">
<select class="form-control" required name="eqSex">
  <option value="">--Sex-</option>  <option value="M" <?php  if(@$bill[3]=='M'){echo 'selected';}  ?>>Male</option> <option value="F"  <?php  if(@$bill[3]=='F'){echo 'selected';}  ?>>Female</option> </select></div>
<div class=" form-group mb-2">
<select class="form-control" required name="pcountry" id="state_set">
	<option value="">- Select State-</option>
<?php foreach(QueryDB("SELECT * FROM nig_states WHERE status=0")as $states){?>
	<option value="<?php echo $states['id']; ?>" id="<?php echo $states['id']; ?>" <?php if(@$bill[4]==$states['name']){ echo 'selected';}  ?>><?php echo $states['name']; ?></option>
<?php } ?>
</select>
</div>


          <div class="form-group  mb-2">
            <select name="pstate" id="lga_set" class="form-control select-lga" required>
    <option value="<?php echo @$bill[5]; ?>"><?php echo @$bill[5]; ?></option>
            </select></div>

<div class="form-group"><input class="input" type="text" name="landmark" placeholder="Receiver Closest Landmark" maxlength="100" minlength="4" value="<?php echo @$bill[6]; ?>"></div>

<div class="order-notes"><label>Address</label><textarea class="input" name="address" placeholder="Address" maxlength="160"><?php echo @$bill[7]; ?></textarea></div>

<div class="order-notes"><label>Notes</label><textarea class="input" name="note" placeholder="Order Notes" maxlength="160"><?php echo @$bill[8]; ?></textarea></div>
						

<div class="form-group"><div class="caption"><p style="color:red;">If within Kogi State, Delivery will be made within 2 days and 3-5 days outside Kogi State.</p></div>
								
							</div>
						</div>
						<!-- /Billing Details -->

					

						
					</div>

					<!-- Order Details -->
					<div class="col-md-5 order-details">
						<div class="section-title text-center">
							<h3 class="title">Your Order</h3>
						</div>
						<div class="order-summary">
							<div class="order-col">
								<div><strong>PRODUCT</strong></div>
								<div><strong>TOTAL</strong></div>
							</div>
							<div class="order-products">
	<?php foreach(QueryDB("SELECT * FROM payment where cus_id ='".$_SESSION['mycus']."' and pay_status=0 ")as $listProd){
		$dateReg = $listProd['day'];
		$nameExp = explode(',',$listProd['item']);
		$itemQty = explode(',',$listProd['qty']);
		$itemSingle = explode(',',$listProd['s_price']);
		$itemBulks = explode(',',$listProd['bulk_price']);
		$whereNum = $listProd['id'];		$addAll=0;
for($y=0;$y<count($nameExp);$y++){
		$itemFull = getProduct($nameExp[$y]);
 ?>
								<div class="order-col">
									<div><?php echo $itemQty[$y]; ?>x <?php  echo $itemFull['item_name'].' '.$company[$itemFull['company']].' '.$brand[$itemFull['brand']]; ?></div>
									<div>&#8358;<?php echo number_format($listProd['amt'],2);  ?></div>
								</div>
				<?php  } }?>
					
			
							</div>
							<div class="order-col">
								<div>Shiping</div>
								<div><strong>&#8358; <?php echo $shipCost; ?></strong></div>
							</div>
							<div class="order-col">
								<div>Payment Processing</div>
								<div><strong>&#8358; <?php echo $charges; ?></strong></div>
							</div>
							<div class="order-col">
								<div><strong>TOTAL</strong></div>
								<div><strong class="order-total"><?php  $totalBill = $listProd['amt']+$shipCost+$charges;

									echo '&#8358;'. number_format($totalBill,2);
								 ?></strong></div>
							</div>
						</div>
<input type="hidden" name="totalPay" value="<?php echo $totalBill; ?>">
<input type="hidden" name="userEmail" value="<?php echo $results['frm_email']; ?>">
<input type="hidden" name="rowNumber" value="<?php echo $rhoda['id']; ?>">


						<div class="payment-method">
							<div class="input-radio">
								<input type="radio" name="payment" id="payment-1" value="1" required>
								<label for="payment-1">
									<span></span>
									Paystack
								</label>
							
							</div>
							<div class="input-radio">
								<input type="radio" name="payment" id="payment-2" value="2" required>
								<label for="payment-2">
									<span></span>
									Flutterwave
								</label>
								
							</div>
							
						</div>
						<div class="input-checkbox">
							<input type="checkbox" id="terms" required>
							<label for="terms">
								<span></span>
								I've read and accept the <a href="#">terms & conditions</a>
							</label>
						</div>
		<input type="submit" name="order" class=" form-control" value="Pay to Complete Order" style="background:red;color:white;font-weight:bolder;">
					</div>
					<!-- /Order Details -->
				</div></form>
				<!-- /row -->
			</div>
			<!-- /container -->
		</div>
		<!-- /SECTION -->

	
<?php include 'inc/outl_newsbottom.php'; include 'inc/outl_footer.php';  
include 'js/outl_footlinks.php'; ?>



	</body>
</html>

