<?PHP
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">Dashboard</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>
								Dashboard
							</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 -->
<br />

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

						<div class="row">
							<div class="col-xs-12">
                            
								<!-- PAGE CONTENT BEGINS -->
                                
                                <?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>
		
											<i class="ace-icon fa fa-check green"></i>
		
											Logged in
											<strong class="green">Successfully.</strong>
			
										</div>';
										
									 }
								}



echo"<center><b>Date - ".date('d-m-Y')."</b></center>";

$date=date('Y-m-d');

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


echo"<br /><center><b>Today's Follow Up - ".date('d-m-Y')."</b></center>";

echo"<br /><table style='width:90%; margin:auto;'>
<tr><td><table id='example' class='table table-bordered table-condensed' style='font-size:12px;'>
<thead><tr><th>Customer</th><th>District</th><th>Crop</th><th>Mobile</th><th>Time</th><th style='width:15%;'>Last Remarks</th><th style='width:15%;'>Remarks</th><th>Executive</th><th>Status</th></tr></thead>";

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

if($nmrw>0)
{
$exct=0;
}
else
{
	
	$empd=mysql_query("select * from employee where username='$user'");
	$empd1=mysql_fetch_array($empd);

	$usr=$empd1['ID'];
	
	$exct=$usr;
}

$ddt="'".$date."'";

echo"</table></td></tr></table>";


?>



                                <table style="margin:10% auto auto auto;">

                                <tr><td><img src="assets/images/logo.png" style="width:180px;" /></td><td valign="middle"><b style="font-size:21px; color:#06C; text-transform:uppercase;"><?php echo $compname; ?></b></td></tr>

                                </table>


<script type="text/javascript" language="javascript" class="init">

		var nmrw=<?php echo $nmrw; ?>;
		var date=<?php echo $ddt; ?>;
		var exct=<?php echo $exct; ?>;
		
		$(document).ready(function() {
			$('#example').dataTable( {
				"processing": true,
				"serverSide": true,
				"ajax": "dailyfollowupserver.php?exct="+ exct +"&date="+ date +"&nmrw="+ nmrw,
				"language": {
                    "processing": '<i class="fa fa-spinner fa-spin" style="font-size:24px;color:rgb(75, 183, 245);"></i>'
                 }
			} );
		} );

</script>


								<!-- PAGE CONTENT ENDS -->
							</div><!-- /.col -->
						</div><!-- /.row -->
					

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


<?php

include 'bottom.php';

}
else
{

 header("location:login.php");
 
}


?>