<? include("si_confi.php"); ?>
<? include("ad_head.php"); ?>
  <div class="container">
<? include("mn_option.php"); ?>

   <div align="center">
  <div style="margin-top:10px;font-size:22px;font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;"><? echo date("d-m-Y"); ?></div>
  <div style="margin-top:10px;font-size:15px;font-family:'Trebuchet MS', Arial, Helvetica, sans-serif;">
  <? echo date("l"); ?></div>
  <div align="center" style="margin-top:10px;">
  <script type="text/javascript">
function DisplayTime(){
if (!document.all && !document.getElementById)
return
timeElement=document.getElementById? document.getElementById("curTime"): document.all.tick2
var CurrentDate=new Date()
var hours=CurrentDate.getHours()
var minutes=CurrentDate.getMinutes()
var seconds=CurrentDate.getSeconds()
var DayNight="PM"
if (hours<12) DayNight="AM";
if (hours>12) hours=hours-12;
if (hours==0) hours=12;
if (minutes<=9) minutes="0"+minutes;
if (seconds<=9) seconds="0"+seconds;
var currentTime=hours+":"+minutes+":"+seconds+" "+DayNight;
timeElement.innerHTML="<font style='font-family:verdana, arial,tahoma;font-size:12px;color:#E25984; font-weight:bold;'>"+currentTime+"</b>"
setTimeout("DisplayTime()",1000)
}
window.onload=DisplayTime
</script>
<span id=curTime></span>
</div>
  <? $select_count_emp=mysql_query("select count(*) as num from `employee_mng`");
$fetch_count_emp=mysql_fetch_array($select_count_emp);
$total_emp_result=$fetch_count_emp['num'];
 ?>
 
 
 
  <br>
  
  <div style="border:groove;margin-top:10px;border-width:thin;padding:20px;border-radius:4px; height:500px;border-color:#cccccc;box-shadow: 10px 9px 90px #000;">
   <h2>DASHBOARD</h2>
  
  <div style="width:500px; height:auto; float:left; margin-left:70px;">
<? 
  $selec_news=mysql_query("select * from `news_mng` where `id`='1'");
  $fetch_new_eve=mysql_fetch_array($selec_news);
  
  
  $selec_news=mysql_query("select COUNT(*) as ttlnm from `department` ");
  $fetch_new_eve=mysql_fetch_array($selec_news);
  $numdepart=$fetch_new_eve[ttlnm];
  
	?>
   
  <table border="1" width="70%" cellspacing="0" cellpadding="5">
  <tr bgcolor="#0066FF" style="color:#FFF;">
  <td height="18" colspan="3" style="font-size:15px;">Number Of Departments : <? echo $numdepart; ?></td>
  </tr>
  <?
   $selec_newccs=mysql_query("select * from `department` ");
  while($fetch_new_eveccc=mysql_fetch_array($selec_newccs))
  {
  $depart=$fetch_new_eveccc['department'];
  
  $cntmen=mysql_query("select COUNT(*) as ttlnmemn from employee_mng where department='$depart'");
  $fetmemnt=mysql_fetch_array($cntmen);
  $ttllamemnt=$fetmemnt[ttlnmemn];
  ?>
  
   <tr>
    
  <td height="30" style="line-height:24px;"><? echo ucwords($depart); ?></td>
    <td height="30" style="line-height:24px;"><? echo $ttllamemnt; ?></td>
     <td height="30" width="20" style="line-height:24px;"><a href="viwe_empploe.php?department=<? echo $depart; ?>"><img src="ad_img/get_info.png" width="20"></a></td>
    
  </tr>
  <? } ?>
  </table><br>
 
 </div>
 
 
 
  <div style="width:500px; height:auto; float:left;">
<? 
 
  
  $selec_rele=mysql_query("select COUNT(*) as leav from `leave` where `status`='0'  ");
  $selec_releget=mysql_fetch_array($selec_rele);
  $numkbleave=$selec_releget[leav];
  
  $selec_adv=mysql_query("select COUNT(*) as adv from `advance` where status='0'  ");
  $selec_advget=mysql_fetch_array($selec_adv);
  $numadva=$selec_advget[adv];
  
  
        $seleect_employee123=mysql_query("select * from `employee_mng`");
		while($fetch_employee123=mysql_fetch_array($seleect_employee123))
		{ 
	    $emid=$fetch_employee123['emp_id']; 
		$emname=$fetch_employee123['name'];
		 date_default_timezone_set("Asia/Kolkata");
		 $mntth=date('F');
		 $yrar=date("Y");
		 
		  $cdt=date('d');
	  if($cdt==0)
	  {
		  $cdatt=$dt[1];
	  }
	  else
	  {
		 $cdatt=$expldat[2]; 
	  }
      $ckkqu=mysql_query("select * from emp_attendance where empid='$emid' and  month='$mntth' and year='$yrar' and $cdatt='0'  ");
	  $chknum=mysql_num_rows($ckkqu);
	  
	  if($chknum==0)
	  {
	   $pres+=1;
	  }
	  else
	  {
		$obes+=1;  
	  }
}
  
  
  
  
  
  

?>
   
  <table border="1" width="70%" cellspacing="0" cellpadding="5">
  <tr bgcolor="#0066FF" style="color:#FFF;">
  <td height="18" colspan="3" style="font-size:15px;">Number of Employee : <? echo $total_emp_result; ?></td>
  </tr>
  
   <tr>
  <td height="30" style="line-height:24px;">Today Present </td>
  <td height="30" style="line-height:24px;"><? echo $pres; ?></td>
  <td height="30" style="line-height:24px;">
  <a href="viwe_empploe.php?department=<? echo $depart; ?>"><img src="ad_img/get_info.png" width="20"></a></td>
 
  </tr>
  
  
  
   <tr>
  <td height="30" style="line-height:24px;">Today Obsent </td>
  <td height="30" style="line-height:24px;"><? if($obes!='') { echo $obes; } else { echo "0"; } ?></td>
  <td height="30" style="line-height:24px;">
  <a href="viwe_empploe.php?department=<? echo $depart; ?>"><img src="ad_img/get_info.png" width="20"></a></td>
  </tr>
  
  
   <tr>
  
  <td height="30" style="line-height:24px;">Request For Leave</td>
  <td height="30" style="line-height:24px;"><? if($numkbleave!='') { echo $numkbleave; } else { echo "0"; } ?></td>
   <td height="30" style="line-height:24px;">
  <a href="leave_req.php"><img src="ad_img/get_info.png" width="20"></a></td>
   
  </tr>
  
  
   <tr>
  <td height="30" style="line-height:24px;">Request For Advance</td>
  <td height="30" style="line-height:24px;"><? if($numadva!='') { echo $numadva; } else { echo "0"; } ?></td>
  <td height="30" style="line-height:24px;">
  <a href="viwe_advance2.php"><img src="ad_img/get_info.png" width="20"></a></td>
  </tr>
  
  
  
 
  </table><br>
 
 </div>
 
 
 
 
 <div style="width:500px; height:auto; float:left; margin-left:70px;"> 
 <? 
  $selec_news=mysql_query("select * from `news_mng` where `id`='1'");
  $fetch_new_eve=mysql_fetch_array($selec_news);
	?>
    <? if($fetch_new_eve['news']!=NULL){ ?>
  <table border="1" width="70%" cellspacing="0" cellpadding="5">
  <tr bgcolor="#66FF00" style="color:#FFF;">
  <td height="18" style="font-size:15px;">News</td>
  </tr>
   <tr>
  <td height="30" style="line-height:24px;"><? echo base64_decode($fetch_new_eve['news']); ?></td>
  </tr>
  </table><br>
  <? } ?>
 
  
  
  
  <? 
  $selec_news=mysql_query("select * from `news_mng` where `id`='1'");
  $fetch_new_eve=mysql_fetch_array($selec_news);
	?>
    <? if($fetch_new_eve['news']!=NULL){ ?>
  <table border="1" width="70%" cellspacing="0" cellpadding="5">
  <tr bgcolor="#993300" style="color:#FFF;">
  <td height="18" style="font-size:15px;">News</td>
  </tr>
   <tr>
  <td height="30" style="line-height:24px;"><? echo base64_decode($fetch_new_eve['news']); ?></td>
  </tr>
  </table><br>
  <? } ?>
  </div>
  
  <div style="width:500px; height:auto; float:left;"> 
  
  <? if($fetch_new_eve['events']!=NULL){ ?>
  <table border="1" width="70%" cellspacing="0" cellpadding="5">
  <tr bgcolor="#006699" style="color:#FFF;">
  <td height="18" style="font-size:15px;">Events</td>
  </tr>
   <tr>
  <td height="30" style="line-height:24px;"><? echo base64_decode($fetch_new_eve['events']); ?></td>
  </tr>
  </table><br>
  <? } ?>
  
  <? if($fetch_new_eve['circulars']!=NULL){ ?>
  <table border="1" width="70%" cellspacing="0" cellpadding="5">
  <tr bgcolor="#006600" style="color:#FFF;">
  <td height="18" style="font-size:15px;">Circulars</td>
  </tr>
   <tr>
  <td height="30" style="line-height:24px;"><? echo base64_decode($fetch_new_eve['circulars']); ?></td>
  </tr>
  </table><br>
  <? } ?>
  
  
 <!-- <table border="1" width="70%" cellspacing="0" cellpadding="5">
  <tr bgcolor="#FF9900" style="color:#000;">
  <td height="18" style="font-size:15px;">Website Links</td>
  </tr>
   <tr>
   <td>
 <table>
 <tr>
 <td><img src="ad_img/Link.png" width="25"></td>
 <td>&nbsp;<a href="http://aakashisp.com/" target="_blank">Aakashisp.com</a></td>
 </tr>
 </table>-->
 </td>
  </tr>
  </table>
  </div>
  
  </div>
  
  
  </div>
  
 </div></div>
</div><!-- container -->
  </body>
</html>
