<!doctype html>
<html lang="en">

<head>


	<style>
		@media (min-width: 200px) {
			.form-control-quantity {
				width: 100%;

			}

			.checkout-container {
				padding: 0px 0px;
			}
		}

		@media (min-width: 600px) {
			.form-control-quantity {
				width: 100%;

			}


			.checkout-products {
				padding-top: 10px;
				padding-bottom: 10px;
				border-top: 1xp solid #99EEF8;

			}

			.checkout-container {
				padding: 5% 5%;
			}
		}

		@media (min-width: 990px) and (max-width: 1799px) {
			.form-control-quantity {
				width: 84px;

			}


			.checkout-products {
				padding-top: 10px;
				padding-bottom: 10px;
				display: -webkit-inline-box;
				border-top: 1xp solid #99EEF8;

			}


			.checkout-container {
				padding: 0% 15%;
			}
		}

		@media (min-width: 1800px) {
			.form-control-quantity {
				width: 84px;

			}

			.checkout-products {
				padding-top: 10px;
				padding-bottom: 10px;
				display: -webkit-inline-box;
				border-top: 1xp solid #99EEF8;

			}

			.checkout-container {
				padding: 0px 25%;
			}
		}

		.checkout-tablebottom {
			border: 1px solid #e0e0e0;
			padding: 20px;
			padding-bottom: 20px;

		}

		.checkout-instructions {
			border: 1px solid #e0e0e0;
			border-bottom: 0px;
			padding: 20px;
		}

		.checkout-li {
			border-bottom: 1px solid #e0e0e0;
			padding-bottom: 15px;
			display: list-item;
			list-style-type: none;
			padding-bottom: 35px;
		}


		.prod-thumbnail {
			padding: 0px;
			width: 100%;

		}

		.row {
			margin-bottom: 10px
		}

		.prod-title-variation {
			padding-left: 10px;
		}

		.checkout-img-info {
			padding: 0px;
			padding-left: 15px;
			text-align: left;

		}

		.checkout-prod-info {
			padding: 0px;
			text-align: center;

		}

		.checkout-img {
			padding: 0px;
		}

		.form-control {
			padding: 4px 40px;
		}

		.checkout-Customer-Info .form-control {
			padding: 4px 5px;
			margin-bottom: 10px
		}

		.checkout-prod-info-r {
			text-align: right;
			font-size: 20px;
			padding: 10px 0px;

		}

		.sign-ro-login {
			padding: 10px 10px;
			background: #99EEF8;
			border-radius: 5px;
			margin-bottom: 10px;
		}

		.place-order {
			margin-top: 20px;

		}

		.btn-place-order {
			margin-top: 10px;
		}
	</style>

</head>

<body>

	<!-- head -->
	<div class="checkout-container" id="verify-checkout-container"> <button style="display:block; float:right" onClick="print()">Print Order Details</button>

		<h2><strong>Please verify your order details and select payment type.</strong> </h2>

		<!-- End head -->

		<!-- part1 -->
		<div class="checkout-instructions " style="height:70px;">
			<div class="col-lg-6 col-md-6 col-sm-6 col-xs-6">
				<h1 style=" margin:5px 5px;">Order Details</h1>
			</div>
		</div>
		<!-- End part1  -->

		<!-- part2 subject-->

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

			<div class="checkout-tabletop checkout-cart-items">
				<div class="checkout-li hidden-sm hidden-xs">
					<div class="col-md-6">Product Description</div>
					<div class="col-md-2 text-center">Unit Price</div>
					<div class="col-md-2 text-center">Quantity</div>
					<div class="col-md-2 text-right">Sub-total</div>
				</div>

				<!--End part2 subject-->

				<!-- part3 cart-items-->
				<script>
					function amount1(id, value, price) {
						var xmlhttp1;
						xmlhttp1 = new XMLHttpRequest();
						xmlhttp1.onreadystatechange = function() {
							if (xmlhttp1.readyState == 4 && xmlhttp1.status == 200) {
								if (xmlhttp1.responseText > 0) {
									document.getElementsByName("pv5" + id)[0].value = xmlhttp1.responseText;

									var newamount = xmlhttp1.responseText - parseFloat(document.getElementById("pv6" + id).innerHTML);

									document.getElementById("pv6" + id).innerHTML = xmlhttp1.responseText;
									document.getElementById("pv7" + id).innerHTML = xmlhttp1.responseText * price;

									<?php
									if ($_POST["discount_rate"] == 1) {
										echo '
    document.getElementById("total2").innerHTML=(parseFloat(document.getElementById("total2").innerHTML)+newamount*price);
  ';
									} else {
										echo '
    document.getElementById("original_subtotal").innerHTML = parseFloat(document.getElementById("original_subtotal").innerHTML + newamount * price;
    document.getElementById("total2").innerHTML=
    Math.round(
    (
    parseFloat(document.getElementById("original_subtotal").innerHTML)*parseFloat(' . $_POST["discount_rate"] . ')
    )
    *10)/10;

    document.getElementById("discounted_amount1").innerHTML=
    Math.round(
    (
    parseFloat(document.getElementById("original_subtotal").innerHTML) - (parseFloat(document.getElementById("total2").innerHTML))
    )
    *10)/10;
  ';
									}
									?>


									if ("<?php echo $_POST["delivery_methods"] ?>" == "SF Express Refrigerated Delivery Service") {
										if (parseFloat(document.getElementById("total2").innerHTML) <= 800) {
											document.getElementById("subtotal2").innerHTML = parseFloat(document.getElementById("total2").innerHTML) + 48;
											document.getElementById("deliveryfee1").innerHTML = 48;
										} else {
											document.getElementById("subtotal2").innerHTML = parseFloat(document.getElementById("total2").innerHTML) + 0;
											document.getElementById("deliveryfee1").innerHTML = 0;
										}
									} else {
										document.getElementById("subtotal2").innerHTML = parseFloat(document.getElementById("total2").innerHTML) + 1;
									}

									document.getElementsByName("total")[0].value = document.getElementById("subtotal2").innerHTML;
								} else {
									alert("Input invalid.");
								}
							}
						}
						xmlhttp1.open("GET", "includes/amount.php?id=" + id + "&value=" + value + "&username=<?php echo $_SESSION["username"] ?>", true);
						xmlhttp1.send();
					}
				</script>

				<div class='cart-products'>
					<?php
					$first_time = 0;
					$subtotal = 0;
					$bought_items = "";
					$_SESSION["subtotal"] = 0;
					$_SESSION["bought_items"] = "";

					if ($_POST["discount_rate"] == 1) {
						$query = "select * from cart where username='" . mysqlSecurity($conn, $_SESSION['username']) . "'";
						$result = mysqli_query($conn, $query);
						if (mysqli_num_rows($result) > 0) {
							echo "<div>";

							while ($row = mysqli_fetch_assoc($result)) {
								echo "<div class='checkout-products'>";
								echo "<div class='checkout-prod-info prod-meta col-md-6' ng-class=" . '"' . "{ 'col-md-4': showPromotions, 'col-md-6': !showPromotions }" . '"' . ">";
								echo "<a href='' target='_blank' class='product-link'>";
								echo "<div class='checkout-img col-lg-2 col-md-2 col-sm-12 col-xs-12'>";
								echo "<img class='prod-thumbnail' src='" . $row["image"] . "'>";
								echo "</div>";
								echo "</a>";
								echo "<div class='checkout-img-info col-lg-10 col-md-10 col-sm-12 col-xs-12'>";
								echo $row['product_name'];
								echo "<div ng-repeat='field in item.variation.fields' class='ng-scope'>";
								echo "<span class='variation ng-binding' id='pv6" . $row["id"] . "'>" . $row["amount"] . "</span><span class='variation ng-binding'>XHK$" . $row["price"] . " </spam>";
								echo "</div>";
								echo "</div>";
								echo "</div>";
								echo "<div style=' padding-top:10px; font-size:20px;' class='checkout-prod-info col-md-2 text-center-md  hidden-sm hidden-xs'>HK$" . $row["price"] . "</div>";

								echo "<!-- button -->";
								echo "<div class='checkout-prod-info col-md-2 text-center' style='padding-top:5px'>";
								echo "<div class='info-input-group'>";
								echo "<div class='input-group-btn'>";
								echo "<input type='submit' value='-' class='btn btn-default btn-checkout' onClick='amount1(\"" . $row["id"] . "\",\"-\"," . $row["price"] . ")' />";
								echo "</div>";
								echo "<input name='pv5" . $row["id"] . "' type='number' step='1' min='1' class='form-inline form-control-quantity ' value='" . $row["amount"] . "' onChange='amount1(" . $row["id"] . ",this.value," . $row["price"] . ")'>";
								echo "<div class='input-group-btn'>";
								echo "<input type='submit' value='+' class='btn btn-default btn-checkout' onClick='amount1(" . $row["id"] . ",\"%2b\"," . $row["price"] . ")' />";
								echo "</div>";
								echo "</div>";
								echo "</div>";
								echo "<!--End  button -->";

								$price = $row["price"] * $row["amount"];

								echo "
			<div class='checkout-prod-info-r col-md-2 text-right'>
			HK$
			<span id='pv7" . $row["id"] . "'>" . $price . "</span>
			<br>
			<a style='font-size:15px' href='includes/add_cart.php?check=delete&name=" . $row["product_name"] . "&from=checkout'>remove&nbsp;&nbsp;</a>
			</div>";
								echo "</div>";
								$_SESSION["subtotal"] += $price;
								if ($first_time == 0) {
									$item_name = str_replace('<div class="Dark">', 'D.', $row['product_name']);
									$item_name = str_replace('<div class="White">', 'W.', $item_name);
									$item_name = str_replace('<div class="Pink">', 'P.', $item_name);
									$item_name = str_replace('<div class="Brown">', 'B.', $item_name);
									$item_name = str_replace('</div>', '_', $item_name);
									$item_name = htmlentities($item_name, ENT_QUOTES, "UTF-8");

									$bought_items = $item_name . "*" . $row["amount"];
									$first_time++;
								} else {
									$item_name = str_replace('<div class="Dark">', 'D.', $row['product_name']);
									$item_name = str_replace('<div class="White">', 'W.', $item_name);
									$item_name = str_replace('<div class="Pink">', 'P.', $item_name);
									$item_name = str_replace('<div class="Brown">', 'B.', $item_name);
									$item_name = str_replace('</div>', '_', $item_name);
									$item_name = htmlentities($item_name, ENT_QUOTES, "UTF-8");

									$bought_items = "," . $item_name . "*" . $row["amount"];
								}
								$_SESSION["bought_items"] .= $bought_items;
							}
							$_SESSION["Tsubtotal"] = round($_SESSION["subtotal"], 1);
							if ($_POST["delivery_methods"] == "SF Express Refrigerated Delivery Service") {
								if ($_SESSION["Tsubtotal"] <= 800) {
									$_SESSION["subtotal"] = round($_SESSION["Tsubtotal"] +48, 1);
									$_SESSION["bought_items"] .= ",Delivery Fee";
								}
							} else {
								$_SESSION["subtotal"] = round($_SESSION["Tsubtotal"] + 1, 1);
								$_SESSION["bought_items"] .= ",Plastic Bag Charge";
							}
							echo "</div>";
						} else {
							echo "none";
						}
					} else {
						$query = "select * from cart where username='" . mysqlSecurity($conn, $_SESSION['username']) . "'";
						$result = mysqli_query($conn, $query);
						if (mysqli_num_rows($result) > 0) {
							echo "<div>";

							while ($row = mysqli_fetch_assoc($result)) {
								echo "<div class='checkout-products'>";
								echo "<div class='checkout-prod-info prod-meta col-md-6' ng-class=" . '"' . "{ 'col-md-4': showPromotions, 'col-md-6': !showPromotions }" . '"' . ">";
								echo "<a href='' target='_blank' class='product-link'>";
								echo "<div class='checkout-img col-lg-2 col-md-2 col-sm-12 col-xs-12'>";
								echo "<img class='prod-thumbnail' src='" . $row["image"] . "'>";
								echo "</div>";
								echo "</a>";
								echo "<div class='checkout-img-info col-lg-10 col-md-10 col-sm-12 col-xs-12'>";
								echo $row['product_name'];
								echo "<div ng-repeat='field in item.variation.fields' class='ng-scope'>";
								echo "<span class='variation ng-binding' id='pv6" . $row["id"] . "'>" . $row["amount"] . "</span><span class='variation ng-binding'>XHK$" . $row["original_price"] . " </spam>";
								echo "</div>";
								echo "</div>";
								echo "</div>";
								echo "<div style=' padding-top:10px; font-size:20px;' class='checkout-prod-info col-md-2 text-center-md  hidden-sm hidden-xs'>HK$" . $row["original_price"] . "</div>";

								echo "<!-- button -->";
								echo "<div class='checkout-prod-info col-md-2 text-center' style='padding-top:5px'>";
								echo "<div class='info-input-group'>";
								echo "<div class='input-group-btn'>";
								echo "<input type='submit' value='-' class='btn btn-default btn-checkout' onClick='amount1(\"" . $row["id"] . "\",\"-\"," . $row["original_price"] . ")' />";
								echo "</div>";
								echo "<input name='pv5" . $row["id"] . "' type='number' step='1' min='1' class='form-inline form-control-quantity ' value='" . $row["amount"] . "' onChange='amount1(" . $row["id"] . ",this.value," . $row["original_price"] . ")'>";
								echo "<div class='input-group-btn'>";
								echo "<input type='submit' value='+' class='btn btn-default btn-checkout' onClick='amount1(" . $row["id"] . ",\"%2b\"," . $row["original_price"] . ")' />";
								echo "</div>";
								echo "</div>";
								echo "</div>";
								echo "<!--End  button -->";

								$price = $row["original_price"] * $row["amount"];

								echo "
			<div class='checkout-prod-info-r col-md-2 text-right'>
			HK$
			<span id='pv7" . $row["id"] . "'>" . $price . "</span>
			<br>
			<a style='font-size:15px' href='includes/add_cart.php?check=delete&name=" . $row["product_name"] . "&from=checkout'>remove&nbsp;&nbsp;</a>
			</div>";
								echo "</div>";
								$_SESSION["subtotal"] += $price;
								if ($first_time == 0) {
									$item_name = str_replace('<div class="Dark">', 'D.', $row['product_name']);
									$item_name = str_replace('<div class="White">', 'W.', $item_name);
									$item_name = str_replace('<div class="Pink">', 'P.', $item_name);
									$item_name = str_replace('<div class="Brown">', 'B.', $item_name);
									$item_name = str_replace('</div>', '_', $item_name);
									$item_name = htmlentities($item_name, ENT_QUOTES, "UTF-8");

									$bought_items = $item_name . "*" . $row["amount"];
									$first_time++;
								} else {
									$item_name = str_replace('<div class="Dark">', 'D.', $row['product_name']);
									$item_name = str_replace('<div class="White">', 'W.', $item_name);
									$item_name = str_replace('<div class="Pink">', 'P.', $item_name);
									$item_name = str_replace('<div class="Brown">', 'B.', $item_name);
									$item_name = str_replace('</div>', '_', $item_name);
									$item_name = htmlentities($item_name, ENT_QUOTES, "UTF-8");

									$bought_items = "," . $item_name . "*" . $row["amount"];
								}
								$_SESSION["bought_items"] .= $bought_items;
							}
							$_SESSION["original_subtotal"] = round($_SESSION["subtotal"], 1);
							$_SESSION["Tsubtotal"] = round($_SESSION["subtotal"] * $_POST["discount_rate"], 1);
							if ($_POST["delivery_methods"] == "SF Express Refrigerated Delivery Service") {
								if ($_SESSION["Tsubtotal"] <= 800) {
									$_SESSION["subtotal"] = round($_SESSION["Tsubtotal"] +48, 1);
									$_SESSION["bought_items"] .= ",Delivery Fee";
								} else {
									$_SESSION["subtotal"] = round($_SESSION["subtotal"] * $_POST["discount_rate"], 1);
								}
							} else {
								$_SESSION["subtotal"] = round($_SESSION["Tsubtotal"] + 1, 1);
								$_SESSION["bought_items"] .= ",Plastic Bag Charge";
							}
							echo "</div>";
						} else {
							echo "none";
						}
					}
					?>
				</div>
			</div>
		</div>

		<!-- End part3 cart-items-->

		<!-- part4 Coupon Customer Info Place Order-->
		<div class="checkout-tablebottom col-lg-12 col-md-12 col-sm-12 col-xs-12">
			<!-- part4.1 Coupon-->

			<!-- Nav tabs -->
			<!-- End part4.1 Coupon-->

			<!-- Tab panes -->

			<form method="post" action="includes/paypal_checkout.php?Payment_Type=<?php if ($_POST["payment_method"] == "bank") {
																																							echo "Bank_Transfer";
																																						} else {
																																							echo "paypal";
																																						} ?>">
				<div class="place-order col-lg-6 col-md-6 col-sm-12 col-xs-12" style="margin-top:0;    padding-left: 15px;padding-top: 5px;">

					<?php
					if ($_POST["discount_rate"] < 1) {
						echo '
	  <h2>Coupon Code:</h2>
	  <input name="code" type="text" class="form-control" value="' . $_POST["code"] . '" readonly="readonly" />
	';
					}
					echo "
  <input name=\"discount_rate\" style=\"display:none\" value=\"" . $_POST["discount_rate"] . "\" />
  <input name=\"bought_items\" style=\"display:none\" value=\"" . $_SESSION["bought_items"] . "\" />
  <input name=\"total\" style=\"display:none\" value='" . $_SESSION["subtotal"] . "' />
  <input name=\"time\" style=\"display:none\" value='" . date("Y-m-d H:i:s") . "' />
";

					echo "<input name='token' id='verify-token' type='hidden' value={$_POST['token']} >";

					?>

					<h2>Customer Info:</h2>
					<strong>Customer's First Name</strong>
					<input class="form-control" placeholder="" type="text" name="customer_Fname" value="<?php echo $_POST["customer_Fname"]; ?>" required>

					<strong>Customer's Last Name</strong>
					<input class="form-control" placeholder="" type="text" name="customer_Lname" value="<?php echo $_POST["customer_Lname"]; ?>" required>


					<strong>Customer's Email</strong>
					<input class="form-control" style="text-align: center;" placeholder="" type="email" name="customer_email" value="<?php echo $_POST["customer_email"]; ?>" required>

					<strong>Customer's Phone</strong>
					<input class="form-control" placeholder="" type="text" name="customer_phone" value="<?php echo $_POST["customer_phone"]; ?>" required>

					<strong>Billing Address</strong>
					<textarea class="form-control" rows="2" name="customer_address" wrap='physical' required><?php

																																																		$address = preg_replace("<br>", '/\r\n/', ($_POST["customer_address"]));
																																																		echo $address; ?></textarea>


					<strong>Company Name</strong>
					<input class="form-control" placeholder="" type="text" name="company_name" value="<?php echo $_POST["company_name"]; ?>" required>

					<h2>Delivery Details:</h2>

					<strong>Recipient's First Name</strong>
					<input class="form-control" placeholder="" type="text" name="recipient_Fname" value="<?php echo $_POST["recipient_Fname"]; ?>" required>

					<strong>Recipient's Last Name</strong>
					<input class="form-control" placeholder="" type="text" name="recipient_Lname" value="<?php echo $_POST["recipient_Lname"]; ?>" required>

					<strong>Recipient's Email</strong>
					<input class="form-control" style="text-align: center;" placeholder="" name="email" value="<?php echo $_POST["email"]; ?>" required>

					<strong>Recipient's phone</strong>
					<input class="form-control" placeholder="" type="text" name="phone" value="<?php echo $_POST["phone"]; ?>" required>

					<?php
					if ($_POST["delivery_time"] == "09:00 - 15:00") {
						$time_slot1 = "selected='selected'";
						$time_slot2 = "";
					} else {
						$time_slot1 = "";
						$time_slot2 = "selected='selected'";
					}

					if ($_POST["delivery_methods"] == "SF Express Refrigerated Delivery Service") {
						echo '
            <strong>Delivery Methods</strong>
			<br>
			<img src="../img/delivery_en2.jpg" width="210px" height="50px" />
            <input style="display:none" type="text" name="delivery_methods" value="SF Express Refrigerated Delivery Service" required>
			
            <br>
			<strong>Delivery Address</strong>
            <textarea class="form-control" rows="2" name="address" wrap="physical" required>' . $_POST["address"] . '</textarea>
                 
            <strong>Delivery Date</strong>
            
			<input class="form-control" placeholder="Please select delivery date" type="text" name="delivery_date" id="datepicker1"   value="' . $_POST["delivery_date"] . '" required></input>  
            
            <strong>Delivery Time Slot</strong>
            
			<select class="form-control" name="delivery_time">
            <option value="09:00 - 15:00" ' . $time_slot1 . '>9:00AM - 3:00PM</option>
            <option value="13:00 - 19:00" ' . $time_slot2 . '>1:00PM - 7:00PM</option>
            </select>  
		';
					} else {
						echo '
            <strong>Delivery Methods</strong>
			<br>
			<img src="../img/Selfpickup_en2.jpg" width="210px" height="50px" />            
			<input style="display:none" type="text" name="delivery_methods" value="Self pick up" required>
			
            <textarea class="form-control" style="display:none" rows="2" name="address" wrap="physical" required>self pick up</textarea>
            
			<br>
            <strong>Pick Up Date</strong>
            
			<input class="form-control" placeholder="Please select pick up date" type="text" name="delivery_date" id="datepicker1"  value="' . $_POST["delivery_date"] . '" required></input>  
            
			<input style="display:none" name="delivery_time" value="">
		';
					}
					?>

					<strong>Remarks</strong>
					<textarea class="form-control" rows="4" name="remarks" placeholder="Enter your message" wrap='physical'><?php echo $_POST["remarks"]; ?></textarea>
				</div>




				<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12" style="margin-top:0;padding-right:15px;padding-top: 5px;">
					<h2 align="right">Order Summary</h2>

					<?php
					if ($_POST["discount_rate"] == 1) {
						echo '
      	<div class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div class="">Sub-total:</div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <span>HK$</span><span id="total2" class="" >';
						echo $_SESSION["Tsubtotal"];
						echo '</span>
 			</div>
        </div>
	';

						if ($_POST["delivery_methods"] == "SF Express Refrigerated Delivery Service") {
							if ($_SESSION["Tsubtotal"] <= 800) {
								echo '
				<div class="row">
					<div class="col-xs-4 col-sm-7" style="text-align:right"> 
						 <div>Delivery Fee:</div>
					</div>
					<div class="col-xs-8 col-sm-5" style="text-align:right">
						 <span>HK$48</span>
					</div>
				</div>
			';
							} else {
								echo '
				<div class="row">
					<div class="col-xs-4 col-sm-7" style="text-align:right"> 
						 <div>Delivery Fee:</div>
					</div>
					<div class="col-xs-8 col-sm-5" style="text-align:right">
						 <span>HK$0</span>
					</div>
				</div>
			';
							}
						} else {
							echo '
			<div class="row">
				<div class="col-xs-4 col-sm-7" style="text-align:right"> 
					 <div>Plastic Bag Charge:</div>
				</div>
				<div class="col-xs-8 col-sm-5" style="text-align:right">
					 <span>HK$1</span>
				</div>
			</div>
		';
						}

						echo '
      	<div class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div class=""><strong>Total:</strong></div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <span>HK$</span><strong><span id="subtotal2">';
						echo $_SESSION["subtotal"];
						echo '</span></strong>
 			</div>
        </div> 
	';
					} else {
						echo '
      	<div class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div class="">Total Original Price:</div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <span>HK$</span><span id="original_subtotal">';
						echo $_SESSION["original_subtotal"];
						echo '</span>
 			</div>
        </div>
        
      	<div class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div>Coupon Discount:</div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <div>';
						echo 100 - $_POST["discount_rate"] * 100;
						echo '%</div>
 			</div>
        </div>   
        
        <div class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div>Discounted Amount:</div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <span>HK$</span><span id="discounted_amount1" class="" >';
						echo $_SESSION["original_subtotal"] - $_SESSION["Tsubtotal"];
						echo '</span>
 			</div>
        </div>   
        
        <div class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div>Sub-total:</div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <span>HK$</span><span id="total2" class="" >';
						echo $_SESSION["Tsubtotal"];
						echo '</span>
 			</div>
        </div>   
	';

						if ($_POST["delivery_methods"] == "SF Express Refrigerated Delivery Service") {
							if ($_SESSION["Tsubtotal"] <= 800) {
								echo '
				<div class="row">
					<div class="col-xs-4 col-sm-7" style="text-align:right"> 
						 <div>Delivery Fee:</div>
					</div>
					<div class="col-xs-8 col-sm-5" style="text-align:right">
						 <span>HK$48</span>
					</div>
				</div>
			';
							} else {
								echo '
				<div class="row">
					<div class="col-xs-4 col-sm-7" style="text-align:right"> 
						 <div>Delivery Fee:</div>
					</div>
					<div class="col-xs-8 col-sm-5" style="text-align:right">
						 <span>HK$0</span>
					</div>
				</div>
			';
							}
						} else {
							echo '
			<div class="row">
				<div class="col-xs-4 col-sm-7" style="text-align:right"> 
					 <div>Plastic Bag Charge:</div>
				</div>
				<div class="col-xs-8 col-sm-5" style="text-align:right">
					 <span>HK$1</span>
				</div>
			</div>
		';
						}

						echo '
      	<div class="row">
        	<div class="col-xs-4 col-sm-7" style="text-align:right"> 
   				 <div class=""><strong>Total:</strong></div>
  			</div>
        	<div class="col-xs-8 col-sm-5" style="text-align:right">
   				 <span>HK$</span><strong><span id="subtotal2">';
						echo $_SESSION["subtotal"];
						echo '</span></strong>
 			</div>
        </div> 
	';
					}
					?>

					<h2 align="middle">Payment Method</h2>
					<?php
					if ($_POST["payment_method"] == "bank") {
						echo '<img src="../img/pic1a.jpg" width="260px" height="60px">
<p style="color:rgba(107,180,211,1.00)">If you want to pay with bank transfer, please transfer with the following account</p>
<p style="color:rgba(107,180,211,1.00)">(only available in Hong Kong Dollars)</p>
<p style="color:rgba(230,149,148,1.00)">Company Name: Patisserie Sayvour Limited</p>
<p style="color:rgba(230,149,148,1.00)">Beneficiary`s Bank Name: HSBC</p>
<p style="color:rgba(230,149,148,1.00)">Beneficiary`s Account no: 023-462187-838</p>
<p style="color:rgba(230,149,148,1.00)">SWIFT address: HSBCHKHHHKH</p>
<p style="color:rgba(230,149,148,1.00)">Bank address: 1 Queen`s Road Central, Hong Kong</p>
<br>
<div class="controls input-group">
	<div class="g-recaptcha" data-sitekey="6LenKhYUAAAAAIwseMuOsziCxRQ5bxg5-gals1Cv"></div>
</div>
<input class="btn btn-place-order" type="submit" name="submit" value="Confirm Order">';
					} else {
						echo '<img src="../img/pic3a.jpg" width="260px" height="60px">
	<p style="color:rgba(107,180,211,1.00)">PayPal account owner can pay through PayPal account.</p>
	<p style="color:rgba(107,180,211,1.00)">Customers without PayPal account can pay through credit card directly.</p>
<div class="controls input-group">
	<div class="g-recaptcha" data-sitekey="6LenKhYUAAAAAIwseMuOsziCxRQ5bxg5-gals1Cv"></div>
</div>
	<br>
	<input class="btn btn-place-order" type="submit" name="submit" value="Confirm Order">';
					}
					?>
				</div>
			</form>
		</div>
	</div>


	<!-- End part4 Coupon Customer Info Place Order-->

	<script>
		(function passingTokenCheck() {
			var passingToken = document.querySelector('#verify-token').value,
				container = document.querySelector('#verify-checkout-container'),
				header = document.createElement('h2');
			header.innerText = 'Missing verification data,please return to checkout page and reconfirm the order.';

			if (passingToken === '') {
				container.innerHTML = '';
				container.appendChild(header);
			}
		})();
	</script>

</body>

</html>