System: Windows NT WINDOWS18 10.0 build 17763 (Windows Server 2016) AMD64 | User: IWPD_3544(appclien)

Path: D:\Inetpub\vhosts\appclients.in\fruits-vegitables.nmvm.org

[Back to List]
<?php
date_default_timezone_set('Asia/Calcutta');
$currentTime=strtotime(date('d-m-Y  H:i:s'));
include "includes/main-action.php";
if(!isset($_SESSION['user_id']) && empty($_SESSION['user_id']) || empty($_SESSION['cart'])){
header('location:index.php');
}
$obj=new admin_main();
$sel_cs=$obj->select_all("menu","order by menu_id");
$sel_banner_top=$obj->select_all("adv_tbl1","order by adv_id desc limit 1");
$sel_banner_right=$obj->select_all("adv_tbl3","order by adv_id desc limit 2");
$sel_slider=$obj->select_all("adv_tbl2","order by adv_id desc");
//select customer details
$sel_customer_dtl=$obj->select_all("register","where reg_id='$_SESSION[user_id]'");
$customerDetails=mysqli_fetch_array($sel_customer_dtl); 
extract($customerDetails);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<title><?php include('title.php')?></title>
<meta charset="utf-8">
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="author" content="">
<meta name="robots" content="index, follow" />
<!-- Mobile specific metas
    ============================================ -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<!-- Favicon
    ============================================ -->
<link rel="shortcut icon" type="image/png" href="<?php echo $url?>image/icon/favicon.png"/>
<!-- Libs CSS
    ============================================ -->
<link rel="stylesheet" href="<?php echo $url?>css/bootstrap/css/bootstrap.min.css">
<link href="<?php echo $url?>css/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="<?php echo $url?>js/datetimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet">
<link href="<?php echo $url?>js/owl-carousel/owl.carousel.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/lib.css" rel="stylesheet">
<link href="<?php echo $url?>js/jquery-ui/jquery-ui.min.css" rel="stylesheet">
<link href="<?php echo $url?>js/minicolors/miniColors.css" rel="stylesheet">
<!-- Theme CSS
    ============================================ -->
<link href="<?php echo $url?>css/themecss/so_searchpro.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so_megamenu.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-categories.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-listing-tabs.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-category-slider.css" rel="stylesheet">
<link href="<?php echo $url?>css/themecss/so-newletter-popup.css" rel="stylesheet">
<link href="<?php echo $url?>css/footer/footer2.css" rel="stylesheet">
<link href="<?php echo $url?>css/header/header2.css" rel="stylesheet">
<link id="color_scheme" href="<?php echo $url?>css/home2.css" rel="stylesheet">
<link href="<?php echo $url?>css/responsive.css" rel="stylesheet">
<!-- Google web fonts
    ============================================ -->
<link href='https://fonts.googleapis.com/css?family=Poppins:300,400,500,600,700' rel='stylesheet' type='text/css'>
<style type="text/css">
         body{font-family:'Poppins', sans-serif}
		 table td{padding:5px}
</style>
<link rel="stylesheet" href="<?php echo $url?>https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">
<script src="<?php echo $url?>https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="<?php echo $url?>https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>
	
</head>
<body class="common-home res layout-2">
<div id="wrapper" class="wrapper-fluid banners-effect-7">
<!-- Header Container  -->
<?php include "includes/topbar.php";?>
<!-- //Header Top -->
<!-- Header center -->
<?php include "includes/searchbar.php";?>
<!-- //Header center -->
<!-- Header Bottom -->
<?php include "includes/navbar.php";?>
</header>
<!-- //Header Container  -->
<!-- //Header Container  -->
<!-- Main Container  -->
<div class="main-container container">
  <ul class="breadcrumb">
    <li><a href="<?php echo $url?>"><i class="fa fa-home"></i></a></li>
    <li><a href="<?php echo $url?> ">Proceed Now</a></li>
  </ul>
  <div class="row">
    <div id="content" class="col-sm-12">
      <div class="page-login">
        <div class="account-border">
          <div class="row">
            <div class="col-sm-6 new-customer">
              <div class="well">
                <div class="panel panel-default">
                  <div class="panel-heading">
                    <h4 class="panel-title"><i class="fa fa-user"></i> Delivery Details </h4>
                  </div>
                  <div class="panel-body">
                    <form method="post">
                      <fieldset id="account">
                      <div class="col-sm-6" style="padding-left:0px">
                        <div class="form-group required">
                          <label for="input-payment-firstname" class="control-label">Name</label>
                        <input type="text" class="form-control" id="input-payment-firstname" placeholder="Name" name="firstname" value="<?php echo $cfname." ".$clname?>" required>
                        </div>
                      </div>
                      <div class="col-sm-6" style="padding-left:0px">
                        <div class="form-group required">
                          <label for="input-payment-email" class="control-label">E-Mail</label>
                          <input type="mail" class="form-control" id="input-payment-email" placeholder="E-Mail" name="email" value="<?php echo $cemail?>" required>
                        </div>
                      </div>
                      <div class="col-sm-6" style="padding-left:0px;">
                        <div class="form-group required">
                          <label for="input-payment-telephone" class="control-label">Mobile No</label>
                          <input type="number" class="form-control" id="input-payment-telephone" pattern="[1-9]{1}[0-9]{9}" title="Invalid Mobile no" maxlength="10" placeholder="Mobile No" name="phone" value="<?php echo $ctel?>" required>
                        </div>
                      </div>
                      <div class="col-sm-6" style="padding-left:0px">
                        <div class="form-group required">
                          <label for="input-city" class="control-label">City</label>
                          <input type="text" class="form-control" id="input-payment-email" placeholder="City" name="city" value="<?php echo $ccity?>" required>
                        </div>
                      </div>
                      <div class="col-sm-6" style="padding-left:0px;">
                        <div class="form-group required">
                          <label for="input-payment-telephone" class="control-label">State</label>
                          <input type="text" class="form-control" id="input-payment-telephone" placeholder="State" name="state" value="<?php echo $cstate?>" required>
                        </div>
                      </div>
                      <div class="col-sm-6" style="padding-left:0px">
                        <div class="form-group required">
                          <label for="input-city" class="control-label">Pin Code</label>
                          <input type="number" class="form-control" id="input-payment-email" placeholder="Pin Code" name="zipcode" value="<?php echo $cpincode ?>" required>
                        </div>
                      </div>
                      <div class="form-group required">
                        <label for="input-full-address" class="control-label">Full Address</label>
                        <textarea class="form-control" id="input-payment-fax" placeholder="Full Address" name="address1" required><?php echo $cadd1." ".$cadd2  ?></textarea>
                      </div>
					  
					  <div class="col-sm-6" style="padding-left:0px; display:none">
					   <label for="input-city" class="control-label">Sponsor Code</label>
                          <input type="text" class="form-control" id="input-payment-email" style="display:none" placeholder="Enter Sponsor Code" value="<?php echo $_SESSION['marketingID']?>" name="marketingCode">
					  </div>
					  <div class="col-sm-12" style="padding-left:0px">
					  <div class="form-group required">
                        <label for="input-full-address" class="control-label">Pay By</label>
                        <select class="form-control" name="paymentMethod" required onChange="checkW(this.value)">
						<option value="">Select Payment Method</option>
						<option value="COD">COD</option>
						<option>Online</option>
						</select>
                      </div>
					  </div>
					  <script>
					  /* function checkW(GetV){
					     if(GetV=='Online'){
						   document.getElementById('WalletU').style.display='block';
						 }else{
						   document.getElementById('WalletU').style.display='none';
						   document.getElementById('wlV').checked = false;
						 }
					   }*/
					  </script>
					  <div class="form-group required" id="WalletU" style="display:none">
                        <label for="input-full-address">Use Wallet?</label>
                        <input type="radio" name="walletuse" value="yes" id="wlV"> &nbsp;Yes &nbsp;&nbsp; <input type="radio" id="input-payment-fax" name="walletuse" value="no"> &nbsp; No 
                      </div>
                      <div class="bottom-form" style="padding-left: 0;">
                        <input type="submit" name="proceedNow" value="Proceed" class="btn btn-default pull-right">
                      </div>
                      </fieldset>
                    </form>
                  </div>
                </div>
              </div>
            </div>
            <div class="col-sm-6 customer-login">
              <div class="well">
                <h2><i class="fa fa-file-text-o" aria-hidden="true"></i> Order Summary</h2>
			<table cellspacing="10" cellpadding="10">
			<?php
			$max=count($_SESSION['cart']);
			$total_amt=0; $tot_shipping_charge=0;$mahaBachat=0;$bachat=0;$totalOldprc=0;$totalNewprc=0;
		    for($i=0;$i<$max;$i++){
			$pid=$_SESSION['cart'][$i]['productid'];
			$q=$_SESSION['cart'][$i]['qty'];
			$s=$_SESSION['cart'][$i]['psize'];
			$c=$_SESSION['cart'][$i]['pcolor'];
			$img=$_SESSION['cart'][$i]['img_name'];
			//$imgID=$_SESSION['cart'][$i]['imgID'];
			//$price=get_price($pid);
			$sql_Q=mysqli_query($con,"select * from product where id='$pid'");
			$rtt = mysqli_fetch_array($sql_Q);
			$path=json_decode($rtt['img']);
			$totalStock=$rtt['stock'];
            $productSize = explode(",",$rtt['oldprice']);
            $expPrice = explode(",",$rtt['price']);
            for($y=0;$y<sizeof($productSize);$y++){
            if($productSize[$y]==$s){
             $price = $expPrice[$y];
             break;
            }
          }

			$total_amt=$total_amt+$price*$q;
			$tot_shipping_charge=$rtt['D_shipping'];
			
			//insert into cart as wishlist
             $sel_wish_Q=mysqli_query($con,"SELECT pid FROM wishlist_tbl WHERE currentDate='$currentTime' AND pid='$pid' AND userID='$_SESSION[user_id]'") or die();
			 if(mysqli_num_rows($sel_wish_Q)>0){
			     $queryIS="UPDATE wishlist_tbl SET qty='$q' WHERE pid='$pid'";
			 }else{
			      $queryIS="INSERT INTO wishlist_tbl(pid,qty,currentDate,userID,status) values('$pid','$q','$currentD','$_SESSION[user_id]','1')";
			 }
				mysqli_query($con,$queryIS);
			?>
			
			<tr><td><a href="<?php echo $url?>product.php?pid=<?php echo $pid?>">
			<img width="70px" src="<?php echo $url?>image/product/<?php echo $path[0]; ?>" alt="<?php echo $rtt['name'] ?>" title="<?php echo $rtt['name'] ?>" class="img-thumbnail" /></a></td><td><?php echo $rtt['name'] ?><br>
					<?php if(!empty($s))echo $s; ?></td></tr>
			<tr><td>Unit price :</td><td><?php echo number_format($price,2)." <i class='fa fa-rupee'></i>" ?></td></tr>
			<tr><td>Total price :</td><td><?php echo $q."*".$price." = "; echo number_format($price*$q,2)." <i class='fa fa-rupee'></i>" ?></td></tr>
			<tr><td colspan="2" style="padding: 0;"><img src="<?php echo $url?>dot.png" style="background-repeat: repeat;background-size: cover;width: 100%;height: 5px;"></td></tr>
		     <?php }
			  //$mahaBachat=$totalOldprc-$totalNewprc;
		      $mahaBachat=0;
			 ?>	
			 <tr><td>Shipping Price :</td><td><?php 
				   /*	
				    if($total_amt<349){
						$tot_shipping_charge=20;
					}else{
						$tot_shipping_charge=0;
					}
				    */
					$shippingCharge=$tot_shipping_charge;
					$finalAmt=$total_amt+$shippingCharge;
					echo number_format($tot_shipping_charge,2)." <i class='fa fa-rupee'></i>"; ?></td></tr>
			<?php if($mahaBachat!=0 && $mahaBachat>0){?>	
			 <tr><td>Bachat :</td><td><?php echo round($mahaBachat,2)." <i class='fa fa-rupee'></i>"?></td></tr>
			<?php }?> 				
			 <tr><td>Payable Amount :</td><td><?php echo number_format($finalAmt,2)." <i class='fa fa-rupee'></i>"?></td></tr>		
			</table>
			
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>
<br/>
<br/>
<!-- //Main Container -->
<!-- Footer Container -->
<?php include "includes/footer.php" ?>
<!-- Include Libs & Plugins
	============================================ -->
<!-- Placed at the end of the document so the pages load faster -->
<script type="text/javascript" src="<?php echo $url?>js/jquery-2.2.4.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/bootstrap.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/owl-carousel/owl.carousel.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/slick-slider/slick.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/libs.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/unveil/jquery.unveil.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/countdown/jquery.countdown.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/dcjqaccordion/jquery.dcjqaccordion.2.8.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/datetimepicker/moment.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/datetimepicker/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/jquery-ui/jquery-ui.min.js"></script>
<!-- Theme files
	============================================ -->
<script type="text/javascript" src="<?php echo $url?>js/themejs/homepage.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/so_megamenu.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/addtocart.js"></script>
<script type="text/javascript" src="<?php echo $url?>js/themejs/application.js"></script>
<?php
 if(isset($_POST['proceedNow'])){
 
 require('phpmailer/class.phpmailer.php');
			$_SESSION['amount']=$finalAmt;
			$_SESSION['firstname']=$_POST['firstname'];
			$name=$_POST['firstname'];
			$_SESSION['email']=$_POST['email'];
			$email=$_POST['email'];
			$_SESSION['phone']=$_POST['phone'];
			$mobileno=$_POST['phone'];
			$_SESSION['productinfo']="e-shopping product";
			$_SESSION['address1']=$_POST['address1'];
			$address=$_POST['address1'];
			$_SESSION['city']=$_POST['city'];
			$city=$_POST['city'];
			$_SESSION['state']=$_POST['state'];
			$state=$_POST['state'];
			$_SESSION['zipcode']=$_POST['zipcode'];
			$pincode=$_POST['zipcode'];
			$walletuse=$_POST['walletuse'];
			$_SESSION['tot_shipping_charge']=$tot_shipping_charge;
			$_SESSION['marketingCode']=$_POST['marketingCode'];
			if(!empty($walletuse) && $walletuse=='yes'){
			  $_SESSION['walletuse']=$_POST['walletuse'];
			}else{
			  unset($_SESSION['walletuse']);
			}

		//count no order products	
		$orderCount = mysqli_query($con,"select * from cart group BY code_id");
		$_SESSION['totCount'] = mysqli_num_rows($orderCount)+1+10000;
		$orderID=$_SESSION['totCount'];
		if($_POST['paymentMethod']=="COD"){
			    //insert order details 
			     $orderDate = strtotime(date('d-m-Y'));
				 $orderTime = date('H');
				$generalField= "reg_id='$_SESSION[user_id]',order_date='$orderDate',code_id='$orderID',bll_name='$_POST[firstname]',bll_email='$_POST[email]',bll_mob='$_POST[phone]',	bll_addr='$_POST[address1]',bll_city='$_POST[city]',bll_pin='$_POST[zipcode]',bll_state='$_POST[state]',bll_country='India',orderBy='$_SESSION[userType]',marketingCode='$_POST[marketingCode]',tot_shipping_charge='$tot_shipping_charge',orderTime='$orderTime'";
				
		 $tableRow='';$finalAmt=0;$total_amt=0;		
		 for($i=0;$i<$max;$i++){
			$pid=$_SESSION['cart'][$i]['productid'];
			$q=$_SESSION['cart'][$i]['qty'];
			$s=$_SESSION['cart'][$i]['psize'];
			$c=$_SESSION['cart'][$i]['pcolor'];
			
				//select product details
				$slProduct=mysqli_query($con,"select * from product where id='$pid'");
				$productData=mysqli_fetch_array($slProduct);
				$productName=$productData['name'];
				$eximg=json_decode($productData['img']);
				$venID=$productData['reg_id'];
			    $imgProductPath = $url."image/product/".$eximg[0];
				$imageName='<img src="'.$imgProductPath.'" style="height:100px"';
				//$price=get_price($pid);
			    $productSize = explode(",",$productData['oldprice']);
                $expPrice = explode(",",$productData['price']);
			    for($y=0;$y<sizeof($productSize);$y++){
                  if($productSize[$y]==$s){
                    $price = $expPrice[$y];
                    break;
                  }
                }
				$total_amt=$total_amt+$price*$q; 
				
				//remove wishlist product
			    mysqli_query($con,"UPDATE wishlist_tbl SET status='0' WHERE pid='$pid'");
				//insert into cart
			$insertOrder=mysqli_query($con,"insert into cart set product_id='$pid',quantity='$q',Size='$s',Color='$price',vendor_ID='$venID',$generalField");
				
				//update stock from product table
				$restStock=$productData['stock']-$q;
				mysqli_query($con,"UPDATE product set stock='$restStock' where id='$pid'") or die(mysqli_error($con));
				
			    if(empty($tableRow)){
				$tableRow='<tr>
				<td>'.($i+1).'</td>
				<td>'.$imageName.'</td>
				<td style="width:200px">'.$productName." <br> ".$s.'</td>
				<td>'.$price.'</td>
				<td>'.$q.'</td>
				<td>'.$price*$q.'</td>
			  </tr>';
			  }else{
			    $tableRow .='<tr>
				<td>'.($i+1).'</td>
				<td>'.$imageName.'</td>
				<td style="width:200px">'.$productName." <br> ".$s.'</td>
				<td>'.$price.'</td>
				<td>'.$q.'</td>
				<td>'.$price*$q.'</td>
			  </tr>';
			  }
			}	
		
		/*	
		 if($total_amt<349){
				$tot_shipping_charge=20;
			}else{
				$tot_shipping_charge=0;
			}
		*/
			
		$shippingCharge=$tot_shipping_charge;
		$finalAmt=$total_amt+$shippingCharge;	
		
	
	$message = "Hi! $name,<br><br><p>Your Order Details:-</p><br>";
	
	$message .= '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
  <tr><td colspan="6" style="background-color:#ff5c01; color:#FFFFFF; padding: 5px;"><b>Order ID : '.$orderID.'</b></td></tr>
  <tr>
    <th scope="col">S. No.</th>
	<th scope="col">Image</th>
    <th scope="col">Product Name</th>
	<th scope="col">Price</th>
    <th scope="col">Quantity</th>
	<th scope="col">Total Price</th>
  </tr>';
    $message.=$tableRow;
    $message .='<tr>
    <td colspan="6" style="text-align:right;padding-right: 113px;">Shipping Charge: '.$tot_shipping_charge.'</td>
    </tr>
  <tr>
    <td colspan="6" style="text-align:right;padding-right: 113px;">Final Amount: '.number_format($finalAmt,2).'</td>
  </tr>
</table>';

	$message .= "<p>Thanks for showing interest with us.</p><br>
	<br><strong>Thanks & Regards,<br>Support Team<br>www.annratnam.co.in</strong><br>";
	
	$message1='A new order '.$orderID.' from  annratnam.co.in<br><br>';
	$message1 .= '<table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="table">
<tr><td colspan="6" style="background-color:#ff5c01; color:#FFFFFF; padding: 5px;"><b>Order ID : '.$orderID.'</b></td></tr>
  <tr>
    <th scope="col">S. No.</th>
	<th scope="col">Image</th>
    <th scope="col">Product Name</th>
	<th scope="col">Price</th>
    <th scope="col">Quantity</th>
	<th scope="col">Total Price</th>
  </tr>';
  
  $message1.=$tableRow;

  $message1 .='<tr>
    <td colspan="6" style="text-align:right;padding-right: 113px;">Shipping Charge: '.$tot_shipping_charge.'</td>
    </tr>
  <tr>
    <td colspan="6" style="text-align:right;padding-right: 113px;">Final Amount: '.number_format($finalAmt,2).'</td>
  </tr>
</table>';

    $message1.='<br>Customer Details:-<br><br>Name: '.$name."<br>Email ID: ".$email."<br>Mobile No: ".$mobileno."<br>Address: ".$address."<br>City: ".$city."<br>State: ".$state."<br>PIN Code: ".$pincode;		


    //for customer
    $from = "support@annratnam.co.in";
	$headers = "From:" . $from . "\r\n";
	$headers .= "Content-type: text/html; charset=UTF-8" . "\r\n"; 
	mail($email,"Order details on annratnam.co.in",$message,$headers);
	
	 //for admin
    $from = $email;
	$headers1 = "From:" . $from . "\r\n";
	$headers1 .= "Content-type: text/html; charset=UTF-8" . "\r\n"; 
	mail("support@annratnam.co.in","A new order from annratnam.co.in",$message1,$headers1);




/*
$mail = new PHPMailer;
$mail->IsSMTP();                                      // Set mailer to use SMTP
$mail->Host = "annratnam.co.in";                 // Specify main and backup server
//$mail->Host = "Give IP Address";                 // If the above does not work.
$mail->Port = 25;                                    // Set the SMTP port
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = "support@annratnam.co.in";                // SMTP username
$mail->Password = "Admin@@987";                  // SMTP password
//$mail->SMTPSecure = "ssl";                            // Enable encryption, 'ssl' also accepted
$mail->From = 'support@annratnam.co.in';
$mail->FromName = 'Annratnam';
$mail->AddAddress($email);  // Add a recipient
$mail->AddAddress("mkumar96.mithlesh@gmail.com");  // Add a recipient
$mail->IsHTML(true); 
	
   //send mail to customer 
	$sendmail_customer = $mail->AddAddress($email,$name);
	$mail->Subject = "Order details on annratnam.co.in"; 
	$mail->Body = $message;     
	$mail->Send(); 
	$mail->ClearAddresses(); 		
	
   //send mail to admin
	$sendmail_admin = $mail->AddAddress("support@annratnam.co.in","Annratnam"); 
	$mail->Subject = "A new order from annratnam.co.in";
	$mail->Body = $message1; 
	$mail->Send(); 
	*/
	
	unset($_SESSION['cart']);
		  echo "<script>window.location='thank-you.php'</script>";
	}else{
		 echo "<script>window.location='payment/'</script>";
	}
		
}		
?>
</body>
</html>