<?php session_start(); ob_start(); ?>

<?php  include 'header.php'; ?>

<?php

if(empty($_SESSION['LOGINID']) && empty($_SESSION['LOGINNM']) ){

	header("Location:index.php");
}


include("user.php");

$temp_id = mysqli_real_escape_string($connection, $_GET['id']);
date_default_timezone_set('Asia/Dhaka');
$date_c = date('Y-m-d H:i:s', time());
?>



<!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">
    <title>Booking Details</title>
    <!-- ================= Favicon ================== -->
    <!-- Standard -->
    <link rel="shortcut icon" href="http://placehold.it/64.png/000/fff">
    <!-- Retina iPad Touch Icon-->
    <link rel="apple-touch-icon" sizes="144x144" href="http://placehold.it/144.png/000/fff">
    <!-- Retina iPhone Touch Icon-->
    <link rel="apple-touch-icon" sizes="114x114" href="http://placehold.it/114.png/000/fff">
    <!-- Standard iPad Touch Icon-->
    <link rel="apple-touch-icon" sizes="72x72" href="http://placehold.it/72.png/000/fff">
    <!-- Standard iPhone Touch Icon-->
    <link rel="apple-touch-icon" sizes="57x57" href="http://placehold.it/57.png/000/fff">
    <!-- Styles -->
    <link href="assets/css/lib/chartist/chartist.min.css" rel="stylesheet">
    <link href="assets/css/lib/font-awesome.min.css" rel="stylesheet">
    <link href="assets/css/lib/themify-icons.css" rel="stylesheet">
    <link href="assets/css/lib/owl.carousel.min.css" rel="stylesheet" />
    <link href="assets/css/lib/owl.theme.default.min.css" rel="stylesheet" />
    <link href="assets/css/lib/weather-icons.css" rel="stylesheet" />
    <link href="assets/css/lib/menubar/sidebar.css" rel="stylesheet">
    <link href="assets/css/lib/bootstrap.min.css" rel="stylesheet">
    <link href="assets/css/lib/unix.css" rel="stylesheet">
    <link href="assets/css/style.css" rel="stylesheet">
	<style>
	.resp-container {
    position: relative;
    overflow: hidden;
    padding-top: 56.25%;
}


.resp-iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 500px;
    border: 0;
}
	
	</style>

</head>

<body>
  <?php include("sidebar.php"); ?>
	
	
    <!-- /# sidebar -->
     <?php include("top.php"); ?>
	<!-- /# topebar --> 
	
	
	
    <div class="content-wrap">
        <div class="main">
            <div class="container-fluid">
                <div class="row">
                    <div class="col-lg-8 p-r-0 title-margin-right">
                        <div class="page-header">
                            <div class="page-title">
                                <h1>Hello, <span>Welcome Here</span></h1>
                            </div>
                        </div>
                    </div>
                    <!-- /# column -->
                    <div class="col-lg-4 p-l-0 title-margin-left">
                        <div class="page-header">
                            <div class="page-title">
                                <ol class="breadcrumb text-right">
                                    <li><a href="#">Dashboard</a></li>
                                    <li class="active">Home</li>
                                </ol>
                            </div>
                        </div>
                    </div>
                    <!-- /# column -->
                </div>
                <!-- /# row -->
				
					<?php if ($user_type==1){ ?>
                <section id="main-content">
				
				
			
				
				
				
				
				
				<div class="row">
				
				        <div class="col-lg-12">
						
						<div class="panel panel-info m-t-15">
                                            <div class="panel-heading">Booking Details</div>
											
											
											
											 
                                            <div class="panel-body">
						
                          						  
						  
	<?php
	
		
if (isset($_POST['notes_submit'])) {
	 $new_special_notes = $_POST['special_notes'];
	 $sqlUpdate = "UPDATE bookings SET
 special_notes = '$new_special_notes',
 updated_at = '$date_c'
												  											  
 WHERE
 id = '$temp_id'           
";
mysqli_query($connection, $sqlUpdate); 
date_default_timezone_set('Asia/Dhaka');
$date_c = date('Y-m-d H:i:s', time());
$sqlUpdate = "INSERT INTO `activity_log` (`id`, `user`, `activity`, `time`, `temp_id`) VALUES (NULL, '$ad_id', 'booking special notes updated', '$date_c','$temp_id')";
$sqlUpdate = mysqli_query($connection, $sqlUpdate); 

}
	
if (isset($_POST['save'])) {
									  
 
 
								    $new_booking_id = $_POST['booking_id'];
							
									$client_name = $_POST['client_name'];
								    $email = $_POST['email'];
									$address = $_POST['address'];
									$cell_1 = $_POST['cell_1'];
									$cell_2 = $_POST['cell_2'];
									$fb = $_POST['fb'];
									$booking_name = mysqli_real_escape_string($connection,$_POST['booking_name']);
										$groom_name = $_POST['groom_name'];
					$groom_father = $_POST['groom_father'];
					$groom_mother = $_POST['groom_mother'];
					$groom_brother = $_POST['groom_brother'];
					$groom_sister = $_POST['groom_sister'];
					$groom_fb = $_POST['groom_fb'];
					$groom_email = $_POST['groom_email'];
					$groom_mobile = $_POST['groom_mobile'];
					
					$bride_name = $_POST['bride_name'];
					$bride_father = $_POST['bride_father'];
					$bride_mother = $_POST['bride_mother'];
					$bride_brother = $_POST['bride_brother'];
					$bride_sister = $_POST['bride_sister'];
					$bride_fb = $_POST['bride_fb'];
					$bride_email = $_POST['bride_email'];
                    $bride_mobile = $_POST['bride_mobile'];
									$special_notes = $_POST['special_notes'];
//**												  
												  
$sqlUpdate = "UPDATE bookings SET
  booking_id = '$new_booking_id',
 name = '$client_name',
 email = '$email',
 address = '$address',
 cell_1 = '$cell_1',
 cell_2 = '$cell_2',
 fb = '$fb',
 booking_name = '$booking_name',
groom_name = '$groom_name',
 groom_father = '$groom_father',
 groom_mother = '$groom_mother',
 groom_brother = '$groom_brother',
 groom_sister = '$groom_sister',
 groom_fb = '$groom_fb',
 groom_mobile = '$groom_mobile',
 groom_email = '$groom_email',
 bride_name = '$bride_name',
 bride_father = '$bride_father',
 bride_mother = '$bride_mother',
 bride_brother = '$bride_brother',
 bride_sister = '$bride_sister',
 bride_fb = '$bride_fb',
 bride_mobile = '$bride_mobile',
 bride_email = '$bride_email',
 special_notes = '$special_notes',
 updated_at = '$date_c'
												  											  
 WHERE
 id = '$temp_id'           
";
$sqlUpdate = mysqli_query($connection, $sqlUpdate); 



date_default_timezone_set('Asia/Dhaka');
$date_c = date('Y-m-d H:i:s', time());
$sqlUpdate = "INSERT INTO `activity_log` (`id`, `user`, `activity`, `time`, `temp_id`) VALUES (NULL, '$ad_id', 'booking updated from booking details page', '$date_c','$temp_id')";
$sqlUpdate = mysqli_query($connection, $sqlUpdate); 
											 
 echo "<div>
 </br>
 </div>";
 include_once('updated.html');									  
}
	
	
	
	
	
	
	
	
	
	
	
if (isset($_POST['pay_submit'])) {
									  
 
 
								    $amount = $_POST['amount'];
									$method = $_POST['method'];
									$details = mysqli_real_escape_string($connection, $_POST['details']);
									
								    $date = date("Y/m/d");
									$mr_no = $_POST['mr_no'];
									$mr_no = mysqli_query($connection, "SELECT max(mr_no) mr FROM `transactions` limit 1");
			                           
	                                $mr_no = mysqli_fetch_object($mr_no);
	                                $mr_no = $mr_no->mr;
	                                $mr_no = $mr_no+1;
									
									$invno = mysqli_real_escape_string($connection, $_POST['invno']);
									
									$type=1;
                                    if($invno>0){
										$type=2;
									}									
//**												  
												  
$sqlinsert = "INSERT INTO `transactions` (`id`, `date`, `temp_booking_id`,`mr_no`,`method`, `details`, `amount`,`type`,`inv_id`, `updated_by`, `added_at`, `updated_at`) VALUES (NULL, '$date', '$temp_id','$mr_no', '$method','$details', '$amount','$type','$invno', '$ad_id', '$date_c', NULL);           
";
$sqlinsert = mysqli_query($connection, $sqlinsert); 

date_default_timezone_set('Asia/Dhaka');
$date_c = date('Y-m-d H:i:s', time());
$sqlUpdate = "INSERT INTO `activity_log` (`id`, `user`, `activity`, `time`, `temp_id`) VALUES (NULL, '$ad_id', 'payment added mr no $mr_no from booking details page', '$date_c','$temp_id')";
$sqlUpdate = mysqli_query($connection, $sqlUpdate); 
											 
 echo "<div>
 </br>
 </div>";
 include_once('updated.html');									  
}	
	
	
	

	
	
	
	
	
	
	
	
	
$bookingtSQL = mysqli_query($connection, "select f1.* , f2.paid from (SELECT v1.*,v2.title as ref_name from (SELECT t1.*,t2.name ev_type FROM `bookings` as t1 left join booking_types as t2 on t1.event_type=t2.id where t1.id='$temp_id') as v1 left join ref as v2 on v1.ref=v2.id) as f1 left join (SELECT temp_booking_id, sum(amount) as paid FROM `transactions` GROUP BY temp_booking_id) as f2 on f1.id=f2.temp_booking_id ");
$list= mysqli_fetch_object($bookingtSQL);
									
                                    $idn = $list->id;
									 $name = $list->name;
									$cell_1 = $list->cell_1;
									$cell_2 = $list->cell_2;
									 $email = $list->email;
									  $address = $list->address;
									 $ev_type = $list->ev_type;
									 
								   
									  $fb= $list->fb;  
									    $ref= $list->ref_name;  
										 $groom_name= $list->groom_name;  
										  $groom_fb= $list->groom_fb;  
										   $groom_email= $list->groom_email;  
										    $groom_mobile= $list->groom_mobile;  
										    $groom_father= $list->groom_father;  
											 $groom_mother= $list->groom_mother; 
											  $groom_brother= $list->groom_brother; 
											   $groom_sister= $list->groom_sister; 
											   $bride_name= $list->bride_name;  
											    $bride_fb= $list->bride_fb;  
										   $bride_email= $list->bride_email;  
										     $bride_mobile= $list->bride_mobile;
										    $bride_father= $list->bride_father;  
											 $bride_mother= $list->bride_mother; 
											  $bride_brother= $list->bride_brother;  
											  $bride_sister= $list->bride_sister; 


                               
$booking_id = $list->booking_id;
$booking_name = $list->booking_name;
$additional_notes = $list->additional_notes;
$special_notes = $list->special_notes;
$vas = $list->vas;
$pkg_charge = $list->pkg_charge;
$discount = $list->discount;

$advance = $list->advance;	
$added_at = $list->added_at;	
$updated_at = $list->updated_at;	


$pkg_charge=0;
$bookingtSQL = mysqli_query($connection, "SELECT id, IFNULL(ev_value,'0') as ev_value FROM `events` WHERE `temp_id` = '$temp_id' ");
 while ($listEV = mysqli_fetch_object($bookingtSQL)) {
		 $ev_value=$listEV->ev_value;
		$pkg_charge=$pkg_charge+$ev_value;
	 }
$paid=0;	 
$bookingtSQL = mysqli_query($connection, "SELECT * FROM `transactions` WHERE `temp_booking_id` = '$temp_id' AND type=1 ");
 while ($listTR = mysqli_fetch_object($bookingtSQL)) {
		 $tramount=$listTR->amount;
		$paid=$paid+$tramount;
	 }
                         
$total_charge=round($pkg_charge-(($pkg_charge*$discount)/100));

$due=$total_charge-$paid;


$invSQL = mysqli_query($connection, "select h1.customer_id, sum(h1.inv_amount)-SUM(h1.discount) inv_amount, sum(paid) paid from (select t1.*,IFNULL(t4.paid,0) paid,(t1.inv_amount-IFNULL(t4.paid,0) ) as due, t2.id, t2.date,t2.discount, t2.customer_id,t2.notes, t2.added_at, t2.updated_at from (SELECT invoice_id, sum(total) inv_amount FROM `invoice_items` group by invoice_id order by invoice_id desc) as t1 left join invoices as t2 on t1.invoice_id=t2.inv_id left join (SELECT inv_id, sum(amount) paid FROM `transactions` where type=2 GROUP by inv_id) as t4 on t1.invoice_id=t4.inv_id) as h1 where h1.customer_id='$temp_id' ");
$invSQL_exist = mysqli_num_rows($invSQL);	
$inv_list= mysqli_fetch_object($invSQL);											  
$inv_amount=$inv_list->inv_amount;
$inv_paid=$inv_list->paid;	
							   
?>
   

<?php

	if (isset($_POST['submit_sms'])) {
		
		$fullNumber = '880' . substr(preg_replace('/\D/', '', $cell_1), -10);
		
		$sms=$_POST['sms'];
		$smsContent=urlencode($sms);
		   $settingsSQL = mysqli_query($connection, "SELECT * FROM `settings` where name='sms_api' ");
           $settingsSQL = mysqli_fetch_object($settingsSQL);
           $sms_api = $settingsSQL->value;
		   
		   
		   $orginal_text = ["%text%", "%number%"];
		   $replace_text = [$smsContent, $fullNumber];
            $curl_url = str_replace($orginal_text, $replace_text, $sms_api);
			
		  $curl = curl_init();
		  curl_setopt_array($curl, array(
   CURLOPT_CONNECTTIMEOUT => 20,
  CURLOPT_TIMEOUT => 520,
  CURLOPT_RETURNTRANSFER => 1,
  CURLOPT_URL =>$curl_url,
   CURLOPT_USERAGENT =>'jadukor IT Browser'
 ));
 
$resp = curl_exec($curl);
curl_close($curl);
		
		date_default_timezone_set('Asia/Dhaka');
$date_c = date('Y-m-d H:i:s', time());
$sqlUpdate = "INSERT INTO `activity_log` (`id`, `user`, `activity`, `time`, `temp_id`) VALUES (NULL, '$ad_id', 'sms sent from booking details page', '$date_c','$temp_id')";
$sqlUpdate = mysqli_query($connection, $sqlUpdate); 


		 echo "<div>
 </br>
 </div>";
 include_once('updated.html');
	
		
	}

?>						  
	





   
<a href="booking_details.php?id=<?php echo $temp_id; ?>"><button type="button" class="btn btn-danger m-b-10 m-l-5"> <span class="ti-reload"></span></button></a>
                          
                                    <div class="alert alert-default">
                                          <form action="booking_details.php?id=<?php echo $idn; ?>" method="post">
										  <table>
										  <td>   <strong> <font color="red"> Special Notes: &nbsp;&nbsp; </font></strong>
										  </td>
										  <td>     <textarea name="special_notes" cols="50">  <?php echo $special_notes; ?> </textarea>
										  </td>
										  <td> &nbsp;&nbsp;  <input type="submit" name="notes_submit" value="save">
										  </td>
										  </table>
										 

										
										  
										  
										 
										
										  </form>
                                    </div>
									

                                    <ul class="nav nav-tabs">
                                        <li class="active"><a data-toggle="tab" href="#home"><button type="button" class="btn btn-default m-b-10 m-l-5">Booking Details</button></a></li>
                                        <li><a data-toggle="tab" href="#payment"><button type="button" class="btn btn-warning m-b-10 m-l-5">Payment</button></a></li>
										
										<?php

						$sqltab = "SELECT t1.id, t2.name from (SELECT * FROM `events` WHERE temp_id = '$temp_id') as t1 left join event_types as t2 on t1.type = t2.id ORDER BY TIMESTAMP(t1.date,t1.time) ";

$sqltab = mysqli_query($connection, $sqltab);
while ($list = mysqli_fetch_object($sqltab)) {

                                    
                                   
                                    $tab_id = $list->id;
								    $tab_title = $list->name;
								
									
								
									     
										 	
											   
                                  
								
                                    
                                   
                                ?>
								
								
										
										 <li><a data-toggle="tab" href="#<?php echo $tab_id;  ?>"><button type="button" class="btn btn-danger m-b-10 m-l-5"><?php echo $tab_title;  ?></button></a></li>
										 
										 
<?php } ?>		 
                                    </ul>

                                    <div class="tab-content">
                                        <div id="home" class="tab-pane fade in active">
                                            <div class="card-body">
                                    <div class="table-responsive">
									
							
									
                                        <table class="table table-hover ">
                                           
                                            <tbody>
											
											  <form action="booking_details.php?id=<?php echo $idn; ?>" method="post">
											
                                                <tr>
                                                    <th scope="row">Client Name:</th>
                                                    <td><input type="text" name='client_name' value="<?php echo $name;  ?>"></td>
													 <td>Booking ID:</td>
                                                    <td><input type="text" name='booking_id' value="<?php echo $booking_id;  ?>"></td>
                                                     <td></td>
													  <td></td>
                                                </tr>
                                                 <tr>
                                                    <th scope="row">Email:</th>
                                                    <td><input type="text" name='email' value="<?php echo $email;  ?>"></td>
													 <td>Primary Cell:</td>
                                                    <td><input type="text" name='cell_1' value="<?php echo $cell_1;  ?>"></td>
                                                     <td></td>
													  <td></td>
                                                </tr>
												<tr>
                                                    <th scope="row">Address:</th>
                                                    <td><input type="text" name='address' value="<?php echo $address;  ?>"></td>
													  <td>Alternative Cell:</td>
                                                    <td><input type="text" name='cell_2' value="<?php echo $cell_2;  ?>"></td>
                                                     <td></td>
													  <td></td>
                                                </tr>
												<tr>
                                                    <th scope="row">Facebook:</th>
                                                    <td><input type="text" name='fb' value="<?php echo $fb;  ?>"></td>
													 <td>Diary of:</td>
                                                   <td><input type="text" name='booking_name' value="<?php echo $booking_name;  ?>"></td>
                                                     <td></td>
													 <td></td>
                                                </tr>
												<tr>
                                                    <th scope="row">Groom Name:</th>
                                                    <td><input type="text" name='groom_name' value="<?php echo $groom_name;  ?>"></td>
													 <td>Bride Name:</td>
                                                    <td><input type="text" name='bride_name' value="<?php echo $bride_name;  ?>"></td>
                                                     <td></td>
													 <td></td>
                                                </tr>
												
												<tr>
                                                    <th scope="row"> Father &nbsp;
                                            <input type="checkbox" <?php echo $groom_father;  ?> name="groom_father" value="checked"> Mother &nbsp;
                                            <input type="checkbox" <?php echo $groom_mother;  ?> name="groom_mother" value="checked">
                                          </th>
                                                    <td>
													
													  Sister <select name="groom_sister">
													  <option value="<?php echo $groom_sister;  ?>"> <?php echo $groom_sister;  ?> </option> 
											<option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option>
											<option value="4"> 4 </option>
											</select>
											 Brother <select name="groom_brother">
											   <option value="<?php echo $groom_brother;  ?>"> <?php echo $groom_brother;  ?> </option> 
											<option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option>
											<option value="4"> 4 </option>
											</select>
													
													</td>
													 <td>
													Father&nbsp;
                                            <input type="checkbox" <?php echo $bride_father;  ?> name="bride_father" value="checked"> Mother&nbsp;
                                            <input type="checkbox" <?php echo $bride_mother;  ?> name="bride_mother" value="checked">
                                            
													 
													 </td>
                                                    <td>
													 Sister <select name="bride_sister">
													  <option value="<?php echo $bride_sister;  ?>"> <?php echo $bride_sister;  ?> </option> 
											<option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option>
											<option value="4"> 4 </option>
											</select>
											 Brother <select name="bride_brother">
											  <option value="<?php echo $bride_brother;  ?>"> <?php echo $bride_brother;  ?> </option> 
											<option value="0"> 0 </option> <option value="1"> 1 </option> <option value="2"> 2 </option> <option value="3"> 3 </option>
											<option value="4"> 4 </option>
											</select>
													
													
													</td>
                                                     <td></td>
													 <td></td>
                                                </tr>
												
												
												<tr>
                                                    <th scope="row">Groom Facebook:</th>
                                                    <td><input type="text" name='groom_fb' value="<?php echo $groom_fb;  ?>"></td>
													 <td>Bride Facebook:</td>
                                                    <td><input type="text" name='bride_fb' value="<?php echo $bride_fb;  ?>"></td>
                                                     <td></td>
													 <td></td>
                                                </tr>
												
												<tr>
                                                    <th scope="row">Groom Email:</th>
                                                    <td><input type="text" name='groom_email' value="<?php echo $groom_email;  ?>"></td>
													 <td>Bride Email:</td>
                                                    <td><input type="text" name='bride_email' value="<?php echo $bride_email;  ?>"></td>
                                                     <td></td>
													 <td></td>
                                                </tr>
												
												<tr>
                                                    <th scope="row">Groom Mobile:</th>
                                                    <td><input type="text" name='groom_mobile' value="<?php echo $groom_mobile;  ?>"></td>
													 <td>Bride Mobile:</td>
                                                    <td><input type="text" name='bride_mobile' value="<?php echo $bride_mobile;  ?>"></td>
                                                     <td></td>
													 <td></td>
                                                </tr>
												<tr>
                                                    <th scope="row">Special Notes:</th>
                                                    <td><textarea name="special_notes"><?php echo $special_notes;  ?> </textarea> </td>
													 <td> Edit / Re-Print Form </td>
                                                    <td> 
													<a href="booking_tmp.php?id=<?php echo $temp_id; ?>" >   <span class="ti-pencil-alt"></span> </a> 
													<a href="booking_print.php?id=<?php echo $temp_id; ?>" target="blank"> <span class="ti-printer"></span> </a>  </td>
                                                     <td>  </td>
													 <td>   </td>
                                                </tr>
												<tr>
                                                    <th scope="row"></th>
                                                    <td>    <button type="submit" name="save" class="btn btn-primary">Apply Change</button> </td>
													 <td></td>
                                                    <td></td>
                                                     <td></td>
													 <td></td>
                                                </tr>
												
												</form>
												
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
                                        </div>
                                        <div id="payment" class="tab-pane fade">
										
						<div class="card-body">
						<div class="row">
						
				      
					  <form action="booking_details.php?id=<?php echo $idn; ?>" method="post">
						 <div class="col-lg-2"><div class="form-group">					
												<input type="number" class="form-control input-focus" name="invno" placeholder="Invoice No" >
                             </div>
							 
						 </div>	
						 
						 <div class="col-lg-2"><div class="form-group">					
												<input type="text" class="form-control input-focus" name="amount" placeholder="Amount">
                             </div>
							 
						 </div>	
						  <div class="col-lg-2"><div class="form-group">					
												<input type="text" class="form-control input-focus" name="details" size="10" placeholder="details">
                             </div>
							 
						 </div>	
						  <div class="col-lg-2"><div class="form-group">					
											<select name="method" class="form-control input-focus" placeholder="payment method">
											    <option value=""> </option>
											   <option value="cash"> cash </option>
											   <option value="bkash"> bkash </option>
											   <option value="cheque"> cheque </option>
											   <option value="bank"> bank </option>
											    <option value="card"> card </option>
											   </select>
                             </div>
							 
						 </div>	
						 
						 <div class="col-lg-1"><div class="form-group">			 
												<button class="btn btn-primary" type="submit" name="pay_submit" onclick="return confirm('Are you sure you want to add this payment on booking ID ??');">Add Invoice Payment</button>
                          </div>
						  
						
						  
						 </div>	
						  </form> 
						  </div> 
						  <div class="row">
						  <div class="panel panel-warning m-t-11 col-lg-6">
                                            <div class="panel-heading">* Invoice Payments So Far</div>
                                            <div class="panel-body">                    
							
				 <div class="card-body">
                                    <div class="table-responsive">
                                        <table class="table table-hover ">
                                            <thead>
                                                <tr>
                                                    <th>Inv No</th>
													 <th>MR</th>
													  <th>Method</th>
                                                    <th>Date</th>
                                                    <th>Payment</th>
                                                    <th>Edited By</th>
													<th>Actions</th>
                                                  
                                                </tr>
                                            </thead>
                                            <tbody>
												<?php
                         $sl=0;
						$sqlSelectedLG = "select f1.* , f2.name from transactions as f1 left join users as f2 on f1.updated_by = f2.id where temp_booking_id = '$temp_id' and f1.type=2 order by f1.date desc";

$sqlSelectedLG = mysqli_query($connection, $sqlSelectedLG);
while ($list = mysqli_fetch_object($sqlSelectedLG)) {

                                    
                                   $pytype=$list->type;
                                    $tr_id = $list->id;
									$in_id = $list->inv_id;
								    $tr_date = $list->date;
								    $sl=$sl+1;
									$amount = $list->amount;
									$updated_by = $list->name;   
										$mr_no = $list->mr_no; 	
											 $method = $list->method; 	     
                                  
								
                                    
                                   
                                ?>
									
											
											
											
                                                <tr>
                                                    <th scope="row"><?php echo $in_id;  ?></th>
                                                    <td><?php echo $mr_no;  ?></td>
													<td><?php echo $method;  ?></td>
													 <td><?php echo $tr_date;  ?></td>
                                                    <td><span class="badge badge-primary"><?php echo $amount;  ?></span> <?php if($pytype==2){echo "*" ; } ?></td>
                                                   
                                                     <td class="color-danger"><?php echo $updated_by;  ?></td>
													<td> <form action='payments.php' method='post'> <a href='payments.php?action=edit&id=<?php echo $tr_id;  ?>'><button class="btn btn-success btn-md" type="button"><i class="ti-pencil-alt"></i></button>  </a>
												
													<input type='hidden' name='sub' value='3'>
													<input type='hidden' name='del_id' value='<?php echo $tr_id;  ?>'>
													<button class="btn remove btn-danger btn-md" onclick="return confirm('Are you sure you want to Remove?');" type="submit" name='submit' ><i class="ti-close"></i></button> 
													
													</td>
													
												   </form>
                                                </tr>
                                              
<?php } ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
								
								
								</div>
								</div>
								<div class="panel panel-warning m-t-11 col-lg-6">
                                            <div class="panel-heading">Invoice List</div>
                                            <div class="panel-body">                    
							
				 <div class="card-body">
                                    <div class="table-responsive">
                                        <table class="table table-hover ">
                                            <thead>
                                                <tr>
                                                    <th>Inv No</th>
													 <th>Invoice Date</th>
													  <th>Notes</th>
                                                    <th>Amount</th>
                                                    <th>Payable</th>
                                                    <th>Paid</th>
													 <th>Due</th>
													<th>Actions</th>
                                                  
                                                </tr>
                                            </thead>
                                            <tbody>
												<?php 
											$sl=0;
                                $sqlSelectedLG = "select t1.*,IFNULL(t4.paid,0) paid,(t1.inv_amount-t2.discount-IFNULL(t4.paid,0) ) as due, t2.id, t2.date, t2.customer_id,t2.notes,t2.discount, t2.added_at, t2.updated_at,t3.name c_name from (SELECT invoice_id, sum(total) inv_amount FROM `invoice_items` group by invoice_id order by invoice_id desc) as t1 left join invoices as t2 on t1.invoice_id=t2.inv_id left join bookings as t3 on t2.customer_id=t3.id left join (SELECT inv_id, sum(amount) paid FROM `transactions` where type=2 GROUP by inv_id) as t4 on t1.invoice_id=t4.inv_id where t3.id=$temp_id ";
								
								

                               $sqlSelectedLG = mysqli_query($connection, $sqlSelectedLG);


                               while ($list = mysqli_fetch_object($sqlSelectedLG)) {

                                 $invoice_id1 = $list->invoice_id;
								 $inv_amount1 = $list->inv_amount;
								 $inv_discount1 = $list->discount;
								 $payable1=$inv_amount-$inv_discount;
								 $paid_amount1 = $list->paid;
								 $due_amount1 = $list->due;
								 $idn1 = $list->id;
								 $date1 = $list->date;
								 $date = date("d-m-Y", strtotime($date1));
								 $customer_id1 = $list->customer_id;
								 $customer_name1 = $list->c_name;
								 $added_at = $list->added_at;
								 $updated_at = $list->updated_at;
								 
								 
								 $notes = $list->notes;
								
								$inv_amount1=IND_money_format($inv_amount1);
								
									?>
                                              <tr  id="<?php echo $invoice_id1 ?>">
                                                     <td><?php echo  $invoice_id1;  ?></td>
                                                    <td><?php echo  $date1;  ?></td>
                                                    <td><?php echo $customer_name1; ?></td>
                                                    <td><?php echo $notes1;  ?></td>
                                                    <td><?php echo $inv_amount1;  ?></td>
													 <td><?php echo $payable1;  ?></td>
													
                                                  <td><?php echo $paid_amount1;  ?></td>
												   <td><?php echo $due_amount1;  ?></td>
														
                                                    <td>
                                                       <a href="pos_invoice_print.php?id=<?php echo $idn1;  ?>" target="blank"><i class="ti-printer color-success"></i></a>
                                                        <a href="pos_invoice_edit.php?id=<?php echo $idn1;  ?>"><i class="ti-pencil-alt color-success"></i></a>
                                                        <form action='pos_invoice_list.php' method='post'> 
													<input type='hidden' name='del_id' value='<?php echo $invoice_id1;  ?>'>
													<button class="btn remove btn-danger btn-sm" onclick="return confirm('Are you sure you want to Remove? All Items and payments will be removed as well !');" type="submit" name='submit_del' ><i class="ti-close"></i></button> 
												   </form>
                                                    </td>
                                                </tr>
												
							   <?php }			?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
								
								
								</div>
								</div>
								</div>
						<div class="row">
						
				      
					  <form action="booking_details.php?id=<?php echo $idn; ?>" method="post">
						 <div class="col-lg-2"><div class="form-group">					
												<input type="text" class="form-control input-focus" name="amount" placeholder="Amount">
                             </div>
							 
						 </div>	
						  <div class="col-lg-2"><div class="form-group">					
												<input type="text" class="form-control input-focus" name="details" size="10" placeholder="details">
                             </div>
							 
						 </div>	
						  <div class="col-lg-2"><div class="form-group">					
											<select name="method" class="form-control input-focus" placeholder="payment method">
											    <option value=""> </option>
											   <option value="cash"> cash </option>
											   <option value="bkash"> bkash </option>
											   <option value="cheque"> cheque </option>
											   <option value="bank"> bank </option>
											    <option value="card"> card </option>
											   </select>
                             </div>
							 
						 </div>	
						 
						 <div class="col-lg-1"><div class="form-group">			 
												<button class="btn btn-primary" type="submit" name="pay_submit" onclick="return confirm('Are you sure you want to add this payment on booking ID ??');">Add Booking Payment</button>
                          </div>
						  
						
						  
						 </div>	
						  </form> 
						  </div> 
						  
						  <div class="row">
						  
						  
						  <form action="booking_details.php?id=<?php echo $idn; ?>" method="post">
						 <div class="col-lg-4">				
												<textarea rows="3" cols="40" name="sms">Your Payment Received... Total Paid <?php echo $paid_total;  ?> , Due Now: <?php echo $due;  ?> </textarea>
                           
						 </div>	
						 
						 <div class="col-lg-2"><div class="form-group">			 
												<button class="btn btn-primary" type="submit" name="submit_sms" onclick="return confirm('Are you sure you want to send this sms ??');" >Send SMS</button>
                          </div>
						  
						
						  
						 </div>	
						  </form> 
						   </div>	
						 
						
						<div class="row">
							
				        <div class="col-lg-4">
						
						
						<div class="card bg-warning">
                                <div class="stat-widget-nine">
                                   
                                    <div class="google-plus-card horizontal">
                                        <div class="stat-content m-t-13 dib">
                                            <div class="stat-text">Total</div>
                                        
                                        </div>
                                        <div class="all-like dib">
                                            <span class="like-count m-t-12"><font size="3">&nbsp;&nbsp;&nbsp;<?php echo $total_charge;  ?></font></span>
									
                                        </div>
                                    </div>
                                </div>
                            </div>
						
						 </div>	
						
						 
						  <div class="col-lg-4">
						
						
						<div class="card bg-success">
                                <div class="stat-widget-nine">
                                   
                                    <div class="google-plus-card horizontal">
                                        <div class="stat-content m-t-13 dib">
                                            <div class="stat-text">Paid</div>
                                          
                                        </div>
                                        <div class="all-like dib">
                                            <span class="like-count m-t-12"><font size="3">&nbsp;&nbsp;&nbsp;<?php echo $paid;  ?></font></span>
											
                                        </div>
                                    </div>
                                </div>
                            </div>
						
						 </div>	
						 
						 
						 
						 
						   <div class="col-lg-4">
						
						
						<div class="card bg-danger">
                                <div class="stat-widget-nine">
                                   
                                    <div class="google-plus-card horizontal">
                                        <div class="stat-content m-t-13 dib">
                                            <div class="stat-text">Due</div>
                                         
                                        </div>
                                        <div class="all-like dib">
                                            <span class="like-count m-t-12"><font size="3">&nbsp;&nbsp;&nbsp;<?php echo $due;  ?></font></span>
										
                                        </div>
                                    </div>
                                </div>
                            </div>
						
						 </div>	
						 
						 
						 
						  </div>
						  
						  <?php
						  if($inv_amount>0){ ?>
							
<div class="row">
							
				        <div class="col-lg-4">
						
						
						<div class="card bg-warning">
                                <div class="stat-widget-nine">
                                   
                                    <div class="google-plus-card horizontal">
                                        <div class="stat-content m-t-13 dib">
                                            <div class="stat-text">Invoice Total</div>
                                        
                                        </div>
                                        <div class="all-like dib">
                                            <span class="like-count m-t-12"><font size="3">&nbsp;&nbsp;&nbsp;<?php echo $inv_amount;  ?></font></span>
									
                                        </div>
                                    </div>
                                </div>
                            </div>
						
						 </div>	
						
						 
						  <div class="col-lg-4">
						
						
						<div class="card bg-success">
                                <div class="stat-widget-nine">
                                   
                                    <div class="google-plus-card horizontal">
                                        <div class="stat-content m-t-13 dib">
                                            <div class="stat-text">Invoice Paid</div>
                                          
                                        </div>
                                        <div class="all-like dib">
                                            <span class="like-count m-t-12"><font size="3">&nbsp;&nbsp;&nbsp;<?php echo $inv_paid;  ?></font></span>
											
                                        </div>
                                    </div>
                                </div>
                            </div>
						
						 </div>	
						 
						 
						 
						 
						   <div class="col-lg-4">
						
						
						<div class="card bg-danger">
                                <div class="stat-widget-nine">
                                   
                                    <div class="google-plus-card horizontal">
                                        <div class="stat-content m-t-13 dib">
                                            <div class="stat-text">Invoice Due</div>
                                         
                                        </div>
                                        <div class="all-like dib">
                                            <span class="like-count m-t-12"><font size="3">&nbsp;&nbsp;&nbsp;<?php echo $inv_amount-$inv_paid;  ?></font></span>
										
                                        </div>
                                    </div>
                                </div>
                            </div>
						
						 </div>	
						 
						 
						 
						  </div>

							
						<?php  }
						  ?>
						  
						  
						  
							
						  
						</div>				
                    	<div class="panel panel-warning m-t-15">
                                            <div class="panel-heading">Previous Payments</div>
                                            <div class="panel-body">                    
							
				 <div class="card-body">
                                    <div class="table-responsive">
                                        <table class="table table-hover ">
                                            <thead>
                                                <tr>
                                                    <th>#</th>
													 <th>MR</th>
													  <th>Method</th>
                                                    <th>Date</th>
                                                    <th>Payment</th>
                                                    <th>Edited By</th>
													<th>Actions</th>
                                                  
                                                </tr>
                                            </thead>
                                            <tbody>
												<?php
                         $sl=0;
						$sqlSelectedLG = "select f1.* , f2.name from transactions as f1 left join users as f2 on f1.updated_by = f2.id where temp_booking_id = '$temp_id' and f1.type=1 order by f1.date desc";

$sqlSelectedLG = mysqli_query($connection, $sqlSelectedLG);
while ($list = mysqli_fetch_object($sqlSelectedLG)) {

                                    
                                   $pytype=$list->type;
                                    $tr_id = $list->id;
								    $tr_date = $list->date;
								    $sl=$sl+1;
									$amount = $list->amount;
									$updated_by = $list->name;   
										$mr_no = $list->mr_no; 	
											 $method = $list->method; 	     
                                  
								
                                    
                                   
                                ?>
									
											
											
											
                                                <tr>
                                                    <th scope="row"><?php echo $sl;  ?></th>
                                                    <td><?php echo $mr_no;  ?></td>
													<td><?php echo $method;  ?></td>
													 <td><?php echo $tr_date;  ?></td>
                                                    <td><span class="badge badge-primary"><?php echo $amount;  ?></span> <?php if($pytype==2){echo "*" ; } ?></td>
                                                   
                                                     <td class="color-danger"><?php echo $updated_by;  ?></td>
													<td> <form action='payments.php' method='post'> <a href='payments.php?action=edit&id=<?php echo $tr_id;  ?>'><button class="btn btn-success btn-md" type="button"><i class="ti-pencil-alt"></i></button>  </a>
												
													<input type='hidden' name='sub' value='3'>
													<input type='hidden' name='del_id' value='<?php echo $tr_id;  ?>'>
													<button class="btn remove btn-danger btn-md" onclick="return confirm('Are you sure you want to Remove?');" type="submit" name='submit' ><i class="ti-close"></i></button> 
													
													</td>
													
												   </form>
                                                </tr>
                                              
<?php } ?>
                                            </tbody>
                                        </table>
                                    </div>
                                </div>
								
								
								</div>
								</div>
								
								
								
								
								
                                        </div>
										
										
										
								<?php
$srl=0;
						$sqltab = "SELECT v1.* , GROUP_CONCAT(v2.name ORDER BY v2.id) as vd_names FROM (SELECT p1.* , GROUP_CONCAT(p2.name ORDER BY p2.id) as ph_names FROM (select a1.* , a2.name as event_type from (SELECT t1.*, t2.name as client_name, t2.booking_id, t2.cell_1,t2.cell_2 FROM `events` as t1 left join bookings as t2 on t1.temp_id=t2.id order by t1.date) as a1 left join event_types as a2 on a1.type=a2.id) as p1 left join artists as p2 ON FIND_IN_SET(p2.id, p1.photographers) group by p1.id) as v1 left join artists as v2 ON FIND_IN_SET(v2.id, v1.videographers) where v1.temp_id='$temp_id' group by v1.id ORDER BY TIMESTAMP(v1.date,v1.time)";

$sqltab = mysqli_query($connection, $sqltab);
while ($list = mysqli_fetch_object($sqltab)) {

                                    
                                   $srl=$srl+1;
                                    $tab_id = $list->id;
								    $date = $list->date;
									$subid=$tab_id;
									
									$event_name = $list->diary_of;
									$trailer = $list->trailer_song;
									
									
									
									
									$name = $list->client_name;
									$booking_id = $list->booking_id;
									$cell_1 = $list->cell_1;
									$cell_2 = $list->cell_2;
									$event_type = $list->event_type;
									$venue = $list->venue;
									$time = $list->time;
									$ph_package = $list->ph_package;
									$pr = $list->pr;
									if($pr=="checked"){$pr="Yes";}
									$photographers = $list->photographers;
									$ph_names = $list->ph_names;
									$vd_package = $list->vd_package;
									$videographers = $list->videographers;
									$vd_names = $list->vd_names;
									
									 $asst = $list->asst;
									 $makeover = $list->makeover;
									 	$ev_notes = $list->ev_notes;
										
										$ph_namesArray = explode(',', $ph_names);
										$photographersArray = explode(',', $photographers);
										$vd_namesArray = explode(',', $vd_names);
										$videographersArray = explode(',', $videographers);
								
									 $state=$list->state;
								
									     
										 	 $videoincluded=$list->videoincluded;
									 
									 if($videoincluded=="checked") {$vdo_button="yes";
									 $state_img="vd".$state.".jpg";
									 } else {$vdo_button="no";
									$state_img="ph".$state.".jpg";
									 }
											   
                                  
								
                                    
                                   
                                ?>		
										
										
										<div id="<?php echo $tab_id;  ?>" class="tab-pane fade">
                                            <div class="card-body">
											
											<div class="row">
							
				                               <div class="col-lg-4">
										<div class="row"> 

                                              <div class="col-lg-4">
                                              <form>
                                              <input type='hidden' id='ev_next<?php echo $srl;  ?>' value='<?php echo $tab_id;  ?>'>
											   <input type='hidden' id='ev_vdo<?php echo $srl;  ?>' value='<?php echo $vdo_button;  ?>'>
											  <button class="btn btn-success btn-lg" id="next<?php echo $srl;  ?>" type="button">&nbsp;<i class="ti-camera"></i> &nbsp;&nbsp; <i class="ti-control-forward"></i>&nbsp;</button> 
											  </form>
											  
											  
											  </div>
											   <div class="col-lg-4"> 
											    <form>
                                              <input type='hidden' id='ev_prev<?php echo $srl;  ?>' value='<?php echo $tab_id;  ?>'>
											   <input type='hidden' id='ev_vdo<?php echo $srl;  ?>' value='<?php echo $vdo_button;  ?>'>
											   <button class="btn btn-danger btn-lg" id="prev<?php echo $srl;  ?>" type="button">&nbsp; <i class="ti-camera"></i> &nbsp;&nbsp;  <i class="ti-control-backward"></i> &nbsp; </button> 
											     </form>
											   </div>
											    <div class="col-lg-4">  </div>
												
												
											  
									    </div>
										
										<?php if($vdo_button=="yes") { ?>
										
										<div> &nbsp;
										</div>
										<div class="row"> 

                                              <div class="col-lg-4">
											    <form>
                                              <input type='hidden' id='vd_next<?php echo $srl;  ?>' value='<?php echo $tab_id;  ?>'>
											  <button class="btn btn-success btn-lg" id="vdnext<?php echo $srl;  ?>" type="button">&nbsp;<i class="ti-video-camera"></i> &nbsp;&nbsp; <i class="ti-control-forward"></i>&nbsp;</button>
											   </form>
											  </div>
											   <div class="col-lg-4">
											    <form>
                                              <input type='hidden' id='vd_prev<?php echo $srl;  ?>' value='<?php echo $tab_id;  ?>'>
											   <button class="btn btn-danger btn-lg" id="vdprev<?php echo $srl;  ?>" type="button">&nbsp; <i class="ti-video-camera"></i> &nbsp;&nbsp;  <i class="ti-control-backward"></i> &nbsp; </button> 
											    </form>
											   </div>
											    <div class="col-lg-4">  </div>
												
												
											  
									    </div>
										<?php } ?>
										<div class="row"> 

   
   <div class="col-lg-12">
   
  <div style="background-image: url(assets/images/loading.gif); background-repeat: repeat-y; height: 300px; width: 300px;" id="responseContainer<?php echo $srl;  ?>">
    <img src="assets/images/<?php echo $state_img;  ?>" width="300"/>
</div>



										



											  </div>
											 
									    </div>
										
										
											   </div>
											   
											   
											   
											   
											   <div class="col-lg-8">
											   
											  
											
											 
										
											  <div class="col-lg-12"> 

<div class="resp-container">
    <iframe class="resp-iframe" src="song_list.php?ev_id=<?php echo $tab_id; ?>" gesture="media"  allow="encrypted-media" allowfullscreen></iframe>
</div>								
										 </div>	 
											 
											 
											 <table height="100"> <tr>
								  <td>
								  
								  </td> </tr>
								  </table>
											 
											 
											<div class="row"> 

                                              <div class="col-lg-3"> <a href="event_print.php?id=<?php echo $tab_id; ?>" target="_blank"> <button class="btn btn-primary" type="submit">Print</button>  </a> </div>
											  <div class="col-lg-6"> </div>
											  <div class="col-lg-3"> </div>
											
											
											  
											</div>
											
											
											   </div>
											   
											  
													
										  </div>		
                                   
                                </div>
								  
								  <table height="200"> <tr>
								  <td>
								  
								  </td> </tr>
								  </table>
								
								
								
								
                                        </div>
										
									<?php } ?>	
										
                                       
                                    </div>


							 </div> </div>
							
                        </div>
				
				
                        <!-- /# column -->
                        
                    </div>
				
				
				
				
				
                    <!-- /# row -->
                           <?php include("footer.php"); ?>
                </section>
				
				
				<?php } ?>
            </div>
        </div>
    </div>

    <div id="search">
        <button type="button" class="close">×</button>
        <form>
            <input type="search" value="" placeholder="type keyword(s) here" />
            <button type="submit" class="btn btn-primary">Search</button>
        </form>
    </div>


    </div>
    <script src="assets/js/lib/jquery.min.js"></script>
    <!-- jquery vendor -->
    <script src="assets/js/lib/jquery.nanoscroller.min.js"></script>
    <!-- nano scroller -->
    <script src="assets/js/lib/menubar/sidebar.js"></script>
    <script src="assets/js/lib/preloader/pace.min.js"></script>
    <!-- sidebar -->
    <script src="assets/js/lib/bootstrap.min.js"></script>
    <!-- bootstrap -->
    <script src="assets/js/lib/weather/jquery.simpleWeather.min.js"></script>
    <script src="assets/js/lib/weather/weather-init.js"></script>
    <script src="assets/js/lib/circle-progress/circle-progress.min.js"></script>
    <script src="assets/js/lib/circle-progress/circle-progress-init.js"></script>
    <script src="assets/js/lib/chartist/chartist.min.js"></script>
    <script src="assets/js/lib/chartist/chartist-init.js"></script>
    <script src="assets/js/lib/sparklinechart/jquery.sparkline.min.js"></script>
    <script src="assets/js/lib/sparklinechart/sparkline.init.js"></script>
    <script src="assets/js/lib/owl-carousel/owl.carousel.min.js"></script>
    <script src="assets/js/lib/owl-carousel/owl.carousel-init.js"></script>
    <script src="assets/js/scripts.js"></script>
	

<script src=”http://code.jquery.com/jquery-3.1.1.min.js”></script>


   
   


<script> 


$(document).ready(function() {
$("#next1").click(function() {
var ev_next = $("#ev_next1").val();
var ev_vdo = $("#ev_vdo1").val();
if (ev_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_next: ev_next,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer1').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#next2").click(function() {
var ev_next = $("#ev_next2").val();
var ev_vdo = $("#ev_vdo2").val();
if (ev_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_next: ev_next,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer2').html(data);
alert("Done");
});
}
});
});

$(document).ready(function() {
$("#next3").click(function() {
var ev_next = $("#ev_next3").val();
var ev_vdo = $("#ev_vdo3").val();
if (ev_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_next: ev_next,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer3').html(data);
alert("Done");
});
}
});
});

$(document).ready(function() {
$("#next4").click(function() {
var ev_next = $("#ev_next4").val();
var ev_vdo = $("#ev_vdo4").val();
if (ev_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_next: ev_next,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer4').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#next5").click(function() {
var ev_next = $("#ev_next5").val();
var ev_vdo = $("#ev_vdo5").val();
if (ev_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_next: ev_next,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer5').html(data);
alert("Done");
});
}
});
});

$(document).ready(function() {
$("#next6").click(function() {
var ev_next = $("#ev_next6").val();
var ev_vdo = $("#ev_vdo6").val();
if (ev_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_next: ev_next,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer6').html(data);
alert("Done");
});
}
});
});

$(document).ready(function() {
$("#prev1").click(function() {
var ev_prev = $("#ev_prev1").val();
var ev_vdo = $("#ev_vdo1").val();
if (ev_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_prev: ev_prev,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer1').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#prev2").click(function() {
var ev_prev = $("#ev_prev2").val();
var ev_vdo = $("#ev_vdo2").val();
if (ev_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_prev: ev_prev,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer2').html(data);
alert("Done");
});
}
});
});

$(document).ready(function() {
$("#prev3").click(function() {
var ev_prev = $("#ev_prev3").val();
var ev_vdo = $("#ev_vdo3").val();
if (ev_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_prev: ev_prev,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer3').html(data);
alert("Done");
});
}
});
});

$(document).ready(function() {
$("#prev4").click(function() {
var ev_prev = $("#ev_prev4").val();
var ev_vdo = $("#ev_vdo4").val();
if (ev_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_prev: ev_prev,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer4').html(data);
alert("Done");
});
}
});
});

$(document).ready(function() {
$("#prev5").click(function() {
var ev_prev = $("#ev_prev5").val();
var ev_vdo = $("#ev_vdo5").val();
if (ev_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_prev: ev_prev,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer5').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#prev6").click(function() {
var ev_prev = $("#ev_prev6").val();
var ev_vdo = $("#ev_vdo6").val();
if (ev_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
ev_prev: ev_prev,
ev_vdo: ev_vdo,
}, function(data) {
	$('#responseContainer4').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#vdnext1").click(function() {
var vd_next = $("#vd_next1").val();
if (vd_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_next:vd_next,
}, function(data) {
	$('#responseContainer1').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#vdnext2").click(function() {
var vd_next = $("#vd_next2").val();
if (vd_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_next:vd_next,
}, function(data) {
	$('#responseContainer2').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#vdnext3").click(function() {
var vd_next = $("#vd_next3").val();
if (vd_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_next:vd_next,
}, function(data) {
	$('#responseContainer3').html(data);
alert("Done");
});
}
});
});



$(document).ready(function() {
$("#vdnext4").click(function() {
var vd_next = $("#vd_next4").val();
if (vd_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_next:vd_next,
}, function(data) {
	$('#responseContainer4').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#vdnext5").click(function() {
var vd_next = $("#vd_next5").val();
if (vd_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_next:vd_next,
}, function(data) {
	$('#responseContainer5').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#vdnext6").click(function() {
var vd_next = $("#vd_next6").val();
if (vd_next == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_next:vd_next,
}, function(data) {
	$('#responseContainer6').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#vdprev1").click(function() {
var vd_prev = $("#vd_prev1").val();
if (vd_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_prev:vd_prev,
}, function(data) {
	$('#responseContainer1').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#vdprev2").click(function() {
var vd_prev = $("#vd_prev2").val();
if (vd_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_prev:vd_prev,
}, function(data) {
	$('#responseContainer2').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#vdprev3").click(function() {
var vd_prev = $("#vd_prev3").val();
if (vd_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_prev:vd_prev,
}, function(data) {
	$('#responseContainer3').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#vdprev4").click(function() {
var vd_prev = $("#vd_prev4").val();
if (vd_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_prev:vd_prev,
}, function(data) {
	$('#responseContainer4').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#vdprev5").click(function() {
var vd_prev = $("#vd_prev5").val();
if (vd_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_prev:vd_prev,
}, function(data) {
	$('#responseContainer5').html(data);
alert("Done");
});
}
});
});


$(document).ready(function() {
$("#vdprev6").click(function() {
var vd_prev = $("#vd_prev6").val();
if (vd_prev == '') {
alert("Insertion Failed Some Fields are Blank....!!");
} else {
// Returns successful data submission message when the entered information is stored in database.
$.post("save_data.php", {
vd_prev:vd_prev,
}, function(data) {
	$('#responseContainer6').html(data);
alert("Done");
});
}
});
});


</script>
	
</body>

</html>