<?php
ob_start();
error_reporting(0);
include("connect.php");
session_start();
$ver = $_SESSION['distributor_user_id'];
$user_role= $_SESSION['user_role']; 
?>
<!DOCTYPE html>
<html lang="en">
    <head>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$("#myModal").modal('show');
		});
	</script>
	
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
      <?php include("link_head.php");?>
	  
	<script>
/*	$(document).ready(function(){
		$("#welcomnote").delay("slow").fadeIn();
		$("#welcomnote").delay("slow").fadeOut();
	}); */
	</script> 
	
    <!-- END HEAD -->
<!--		<script>
			function myFunction() {
				var txt;
				var r = confirm("Are you sure to cancel!");
				if (r == true) {
					window.location.href="category-detail.php";
				} 
			}
			</script>-->
	
<!--<style>
	::-webkit-scrollbar {
		display: none;
		overflow: hidden;
	}
	</style>
	<script>
	window.onscroll = function () {
	window.scrollTo(0,0);
	}
	</script>-->
	</head>
	
    <body class="">
        <!-- BEGIN HEADER -->
		<?php // include("header.php");?>
        <!-- END HEADER -->
		
        <!-- BEGIN CONTAINER -->
    <!--<div class="container-fluid">-->
    <!--    <div class="page-content page-content-popup">-->
				<!--<div class="portlet-body">-->
				<?php /*
				$res = mysqli_query($con,"select * from tbl_distributor_users where distributor_user_id='$ver'");
				$row  = mysqli_num_rows($res);
				$a=mysqli_fetch_array($res);
				if($row>0)
				{
					$r_temp=$_SESSION['user_session'];
					$user_name=$a['distributor_name'];
					$temp_activity=$a['activity_time'];
					$session_temp_r=$a['session_id'];
					$temp_time=time();
				} */
				?>
		<!--	<div style="height:60px; width:200px; border:2px solid red; color:black; background-color:powderblue;" id="welcomnote">
					<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
					<center><h3>Hello <?php // echo $user_name; ?></h3></center>
				</div>
		<!--	</div>-->
	<!--	</div>-->
    <!--</div>-->
        <!-- END CONTAINER -->
        <!-- BEGIN QUICK SIDEBAR -->
<!--    <a href="javascript:;" class="page-quick-sidebar-toggler">
            <i class="icon-login"></i>
        </a>-->
        
        <!-- END QUICK SIDEBAR -->
        <!-- BEGIN QUICK NAV -->
        
<!--    <div class="quick-nav-overlay"></div>-->
        <!-- END QUICK NAV -->
        
        <!-- BEGIN CORE PLUGINS -->
        <?php include("link_script.php");?>  
        <!-- END THEME LAYOUT SCRIPTS -->
        <script>
		/*
            $(document).ready(function()
            {
                $('#clickmewow').click(function()
                {
                    $('#radio1003').attr('checked', 'checked');
                });
            })  */
        </script>
		
<div id="myModal" class="modal fade" style="width:px;">
    <div class="modal-dialog">
        <div class="modal-content">
			<?php
			$res1 = mysqli_query($con,"select * from tbl_distributor_users where distributor_user_id='$ver'");
			$row1  = mysqli_num_rows($res1);
			$a=mysqli_fetch_array($res1);
			if($row1>0)
			{
				$r_temp=$_SESSION['user_session'];
				$user_name=$a['distributor_name'];
				$temp_activity=$a['activity_time'];
				$session_temp_r=$a['session_id'];
				$temp_time=time();
			}
			?>
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h3 class="modal-title">Hello <?php echo $user_name; ?></h3>
            </div>
			<div class="modal-body">
				<?php
				$res2 = mysqli_query($con,"select * from tbl_master_customer where distributor_id='$ver'");
				$row2  = mysqli_num_rows($res2);
				?>
				<p>Total Customers: <?php echo $row2 ?></p>
				<?php
				$res3 = mysqli_query($con,"select * from tbl_master_customer,tbl_transaction where tbl_master_customer.customer_id=tbl_transaction.customer_id and tbl_master_customer.distributor_id='$ver' && tbl_transaction.transaction_status='Pending'");
				$row3  = mysqli_num_rows($res3);
				?>
				<p>Pending Orders: <?php echo $row3; ?></p>
				<?php
				$res4 = mysqli_query($con,"select * from tbl_master_customer,tbl_transaction where tbl_master_customer.customer_id=tbl_transaction.customer_id and tbl_master_customer.distributor_id='$ver' && tbl_transaction.transaction_status='Accept'");
				$row4  = mysqli_num_rows($res4);
				?>				
				<p>Accepted Orders: <?php echo $row4; ?></p>
			</div>
        </div>
    </div>
</div>
    </body>
</html>