<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0">
	<title>EMI Commision Summary | Admin Panel</title>

	<!-- Favicons -->
<link rel="shortcut icon" type="image/x-icon" href="../UserProfile/images/logo/logo.png">

	<!-- Bootstrap CSS -->
	<link rel="stylesheet" href="assets/plugins/bootstrap/css/bootstrap.min.css">

	<!-- Fontawesome CSS -->
	<link rel="stylesheet" href="assets/plugins/fontawesome/css/fontawesome.min.css">
	<link rel="stylesheet" href="assets/plugins/fontawesome/css/all.min.css">
	 
	<!-- Animate CSS -->
	<link rel="stylesheet" href="assets/css/animate.min.css">

	<!-- Main CSS -->
	<link rel="stylesheet" href="assets/css/admin.css">
		<!-- Datatables CSS -->
	<link rel="stylesheet" href="assets/plugins/datatables/datatables.min.css">
 <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css"> 
  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/buttons/1.5.6/css/buttons.dataTables.min.css">
  <style>
input[type=search]
{
    display: block;
    width: 100%;
    padding: .50rem 1rem;
    font-size: 1rem;
    line-height: 1.25;
    color: #4E5154;
    background-color:#FFF;
    background-clip: padding-box;
    border: 1px solid #BABFC7;
    border-radius: .25rem;
}
input[type=button]
{
 
    background-color:#140dec;

}
</style>
</head>

<body>
	<div class="main-wrapper">
	
		<!-- Header -->
	<?php include 'include/header.php'; ?>
		<!-- /Header -->
		
		<!-- Sidebar -->
		<?php include 'include/leftmenu.php'; ?>
		<!-- /Sidebar -->
		
		<div class="page-wrapper">
			<div class="content container-fluid">
			    <?php $emi_reference_no=$_REQUEST['emi_reference_no'];  ?>
				<!-- Page Header -->
				<div class="page-header">
					<div class="row">
						<div class="col">
							<h5 class="page-title text-white">EMI Commision Summary</h5>
						</div>

					</div>
				</div>
			  
                	<div class="row">
 
		   <?php 
	   $emi_reference_no=$_REQUEST['emi_reference_no'];
	   $booking_random_no=$_REQUEST['booking_random_no'];

	   $strPr="Select * from tbl_plot_registry_booking where booking_random_no='$booking_random_no'";
	   $resPr=mysqli_query($connection,$strPr);
	   $rowPr=mysqli_fetch_array($resPr);
	   $project_id=$rowPr['project_id'];
	   $project=get_value("Select project_name from  tbl_prject_master where project_id='$project_id'");
	   
	   $qry="Select * from tbl_plot_emi_payment where emi_reference_no='$emi_reference_no' and booking_random_no='$booking_random_no'";
	   $result=mysqli_query($connection,$qry);
	   $rows=mysqli_fetch_array($result);
	   ?>
            <div class="col-sm-12">
              <div class="card">
                <div class="card-content collapse show">
                  <div class="card-body card-dashboard">                   
                    <div class="row">
					<div class="col-md-6">
					  <span>Customer Id : <?php echo $rowPr['member_user_id']; ?></span>
					  </div>
					   <div class="col-md-6">
					   <span>
					  Customer Name : <?php echo $rowPr['member_name']; ?></span>
					  </div>
					    <div class="col-md-6">
					   <span>Plot Details : <?php echo $rowPr['plot_code']; ?>-<?php echo $project; ?> </span>
					  </div>
					  <div class="col-md-6">
					  <span> EMI Payment Date : <?php echo date("d-M-Y",strtotime($rows['emi_date'])); ?></span>
					  </div>
					   <div class="col-md-6">
					  <span> EMI Amount : <?php echo $rows['payment_amt']; ?></span>
					  </div>
					 <div class="col-md-6">
					  <span> Business(%) : <?php echo $rows['businessper']; ?></span>
					  </div>
					   <div class="col-md-6">
					  <span> Business Amount : <?php echo $rows['comm_business_amt']; ?></span>
					  </div>
					   <div class="col-md-6">
					  <span>Total Commission : <?php echo $rows['total_comm_amt']; ?>(<?php echo round($rows['comm_per'],2); ?>%)</span>
					  </div>
				</div>
                  </div>
                </div>
              </div>
            </div>
        	<div class="col-sm-12">
							<div class="card">
				
								<div class="card-body">
               						<div class="table-responsive">
										<table class="table table-stripped" id="example">
											<thead>
												<tr style="background-color: #140dec;color:#FFF">
											<th>#</th>
                                            <th>Member User Id</th>
                                            <th>Member Name</th>
                                            <th>Business Amt.</th>
                                            <th>Comm(%)</th>
                                            <th>Comm. Amt</th>
                                            <th>Comm Type</th>
									  
												</tr>
											</thead>
											<tbody>
											    <?php 
											    $cnt=1;
                							  $total_paid_amt=0;$total_comm_amt=0;
                							   	$str="Select * FROM tbl_member_income_dtails where emi_reference_no='$emi_reference_no'";
                							  $result=mysqli_query($connection,$str);
                								while($row=mysqli_fetch_array($result))
                								{  
                								    $total_comm_amt=$total_comm_amt+$row['income_amt'];
                							$member_user_id=$row['member_user_id'];
                																	    ?>
												<tr>
												    
								<td><?php echo $cnt++; ?></td>
							<td><?php echo $row['member_user_id']; ?></td>
							<td><?php echo get_value("Select member_name from tbl_memberreg where member_user_id='$member_user_id'"); ?></td>
							<td><?php echo $row['matching_business']; ?></td>
							<td><?php echo $row['income_per']; ?></td>
							<td><?php echo $row['income_amt']; ?></td>
							<td><?php echo $row['income_type']; ?></td>
												</tr>
												<?php } ?>
                                            <tr>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td></td>
                                                <td><b>Total</b></td>
                                                <td><b><?php echo $total_comm_amt; ?></b></td>
                                                <td></td>
                                            </tr>
											</tbody>
										</table>
									</div>
								
								</div>
							</div>
						</div>
						
					</div>
			</div>
		</div> 
	</div>

	<!-- jQuery -->
	<script src="assets/js/jquery-3.5.0.min.js"></script>

	<!-- Bootstrap Core JS -->
	<script src="assets/js/popper.min.js"></script>
	<script src="assets/plugins/bootstrap/js/bootstrap.min.js"></script>

	<!-- Slimscroll JS -->
	<script src="assets/plugins/slimscroll/jquery.slimscroll.min.js"></script>
		<script src="assets/plugins/datatables/jquery.dataTables.min.js"></script>
	<script src="assets/plugins/datatables/datatables.min.js"></script> 

	<!-- Custom JS -->
	<!-- Custom JS -->
	<script src="assets/js/admin.js"></script>
<script src="https://code.jquery.com/jquery-3.3.1.js" type="text/javascript"></script>
  <script src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js" type="text/javascript"></script> 
  <script src="https://cdn.datatables.net/buttons/1.5.6/js/dataTables.buttons.min.js" type="text/javascript"></script>
  <script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.flash.min.js" type="text/javascript"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.1.3/jszip.min.js" type="text/javascript"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/pdfmake.min.js" type="text/javascript"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/pdfmake/0.1.53/vfs_fonts.js" type="text/javascript"></script>
  <script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.html5.min.js" type="text/javascript"></script>
  <script src="https://cdn.datatables.net/buttons/1.5.6/js/buttons.print.min.js" type="text/javascript"></script>
 <script>
$(document).ready(function() {
    $('#example').DataTable( {
        dom: 'Bfrtip',
        buttons: [
            'copy', 'csv', 'excel', 'pdf', 'print'
        ]
    } );
} );
</script>

</body>

</html>