<?PHP

ob_start();

session_start();

include 'connect.php';

if(isset($_SESSION['adminemail']))

{

$user=$_SESSION['adminemail'];



$gtp=mysql_query("select * from admin where username='$user'");

$gtp1=mysql_fetch_array($gtp);



include 'top.php';

?>



			<div class="main-content">

				<div class="main-content-inner">

					<div class="breadcrumbs ace-save-state" id="breadcrumbs">

						<ul class="breadcrumb">

							<li>

								<i class="ace-icon fa fa-home home-icon"></i>

								<a href="#">Home</a>

							</li>

							<li class="active">Premium Customer</li>

						</ul><!-- /.breadcrumb -->

					</div>



					<div class="page-content">

			



						<div class="page-header">

                        

<?php



$aca=mysql_query("select * from financial where user='$user' order by ID desc");

$aca1=mysql_fetch_array($aca);



$financial=$aca1['financial'];



?>

                        

                        <table style="width:100%;">

                        

                        <tr><td style="width:50%;">

                        

							<h1>

								Premium Customer

							</h1>

                            

                            </td>

                            

                            <td style="width:50%; text-align:right; padding-right:15px; font-size:15px;">

                            

                            <i class="fa fa-calendar"></i>&nbsp; <?php echo $financial; ?>

                            

                            </td></tr></table>

                            

						</div><!-- /.page-header -->



						<div class="row">

							<div class="col-xs-12">

                            

								<!-- PAGE CONTENT BEGINS -->





<script src="assets/js/jquery.js"></script>



<script>

	

jQuery(function($){

		   

	// simple jQuery validation script

	$('#course').submit(function(){

		

		var valid = true;

		var errormsg = 'This field is required!';

		var errorcn = 'error';

		

		$('.' + errorcn, this).remove();			

		

		$('#required', this).each(function(){

			var parent = $(this).parent();

			if( $(this).val() == '' ){

				var msg = $(this).attr('title');

				msg = (msg != '') ? msg : errormsg;

				$('<span style="font-size:13px;color:#FF0000; padding-left:3px;" class="'+ errorcn +'">'+ msg +'</span>')

					.appendTo(parent)

					.fadeIn('fast')

					.click(function(){ $(this).remove(); });

				valid = false;

			};

		});

		

	});

	

});	



</script>







<?php





	if(isset($_GET['s'])) 	

	{

	 $status=$_GET['s'];

		

		 if($status=='1')

		 {

			 echo'<div class="alert alert-block alert-success">

									<button type="button" class="close" data-dismiss="alert">

										<i class="ace-icon fa fa-times"></i>

									</button>

						Values Updated Successfully.

				  </div>';

		 }

	}



$sel=mysql_query("select * from admin where username='$user'");

$nmrw=mysql_num_rows($sel);

$sel1=mysql_fetch_array($sel);



echo'<table style="width:99%; margin:11px auto 10px auto;">

                                        

                                        <tr><td style="width:20%;">

                                        <a href="updatepremium.php"><button class="btn btn-minier btn-info">+ Update Premium</button></a>

                                        </td>

                                        

                                        <td style="width:50%;"></td>

                                        

                                        <td style="width:30%; text-align:right;">

										

										<a href="premiumcustomerexcel.php"><button type="submit" class="btn btn-minier btn-info">Excel</button></a>

										

										</td></tr>

                                        

                                        </table>';



	echo"<table id='dynamic-table' class='table table-striped table-bordered table-hover'>



	<thead><th width='15%'>Name</th>

	<th width='15%'>Address</th>

	<th width='11%'>Mobile</th>

	<th width='15%'>State</th>

	<th width='15%'>District</th>

	<th width='15%'>Taluk</th>

	</thead>";



if($nmrw>0)

{	

	$getsite3="select * from crm_customer where premium!='' order by name asc";

}

else

{

	$empd=mysql_query("select * from employee where username='$user'");

	$empd1=mysql_fetch_array($empd);



	$usr=$empd1['ID'];



	$getsite3="select * from crm_customer where executive='$usr' and premium!='' order by name asc";

}



	$getsite4=mysql_query($getsite3) or die("Could not get");

	$sno=0;

	while($getsite5=mysql_fetch_array($getsite4))

	{

		$sno=$sno+1;

		

		$ste=mysql_query("select * from statecode where ID='$getsite5[state]'");

		$ste1=mysql_fetch_array($ste);

		

		$dis=mysql_query("select * from districts where ID='$getsite5[district]'");

		$dis1=mysql_fetch_array($dis);

		

		$tlk=mysql_query("select * from taluk where ID='$getsite5[taluk]'");

		$tlk1=mysql_fetch_array($tlk);

		

		echo"<tr><td>".$getsite5['name']."</td>

		<td>".$getsite5['address']."</td>

		<td>".$getsite5['mobile']."</td>

		<td>".$ste1['state']."</td>

		<td>".$dis1['district']."</td>

		<td>".$tlk1['taluk']."</td>

		</tr>";



		}



		echo"</table>";



?>









										<!-- PAGE CONTENT ENDS -->

									</div><!-- /.col -->

								</div><!-- /.row -->

							</div><!-- /.page-content -->

						</div>

					</div><!-- /.main-content -->





<?php



include 'bottom.php';



}

else

{



 header("location:login.php");

 

}



ob_flush();





?>