<?php
session_start();
?>
<!DOCTYPE html>
<html>
    <head>
        <meta content='width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no' name='viewport'>
        <!-- bootstrap 3.0.2 -->
        <link href="css/bootstrap.min.css" rel="stylesheet" type="text/css" />
        <!-- font Awesome -->
        <link href="css/font-awesome.min.css" rel="stylesheet" type="text/css" />
        <!-- Ionicons -->
        <link href="css/ionicons.min.css" rel="stylesheet" type="text/css" />
        <!-- Morris chart -->
        <link href="css/morris/morris.css" rel="stylesheet" type="text/css" />
        <!-- jvectormap -->
        <link href="css/jvectormap/jquery-jvectormap-1.2.2.css" rel="stylesheet" type="text/css" />
        <!-- Date Picker -->
        <link href="css/datepicker/datepicker3.css" rel="stylesheet" type="text/css" />
        <!-- Daterange picker -->
        <link href="css/daterangepicker/daterangepicker-bs3.css" rel="stylesheet" type="text/css" />
        <!-- bootstrap wysihtml5 - text editor -->
        <link href="css/bootstrap-wysihtml5/bootstrap3-wysihtml5.min.css" rel="stylesheet" type="text/css" />
        <!-- Theme style -->
        <link href="css/AdminLTE.css" rel="stylesheet" type="text/css" />
		<link href="css/chat.css" rel="stylesheet" type="text/css" />
			<link href="css/clockedin-admin.css" rel="stylesheet" type="text/css" />

        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
          <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
          <script src="https://oss.maxcdn.com/libs/respond.js/1.3.0/respond.min.js"></script>
        <![endif]-->
		
	<style type="text/css">

.weather-widget{position: relative;}.weather-widget i{margin-right: 5px;}.weather-widget .overlay-weather-info{position: absolute;z-index: 1;top: 15px;left: 15px;right: 15px;}.weather-widget .overlay-weather-info .weather-info-city{color: #fff;margin: 20px 0;}.weather-widget .overlay-weather-info .weather-info-city h4{font-size: 16px;font-weight: 600;}.weather-widget .overlay-weather-info h4{color: #fff;font-weight: 400;}.weather-widget .overlay-weather-info .weather-info-city h1{font-weight: 600;padding: 0;margin: 0;}.weather-widget .overlay-weather-info i.weather-icon{font-size: 70px;}
.tab-pane p img{ margin-right:5px;}
svg{
  width: 100% !important
}

.clockedin-admin-click {
font-size: 12px;
font-weight: bold;
padding-top: 15px;
padding-bottom: 15px;
background: #CAEBEC;
}
.timein-time{
float: left;
padding-top:5px;
width: 100px;
text-align: center;
border: thin #666 solid;
margin-left: 20px;
margin-right: 5px;
height: 27px;
font-size: 17px;
background-color:#FFFFFF;
}

.clockin-button{
background: #138bca;
text-align: center;
color: #fff;
font-size: 13px;
font-weight: bold;
border: none;
cursor: pointer;
margin-left: 4px;
margin-top: 4px;
height:20px;
}

.notif-tab .active:hover > a{
background:#BCE5FD!important;
}
.notif-tab .active > a{
background:#BCE5FD!important;
}

</style>	

<script type="text/javascript">
	var loggedUserId = '<?php echo $_SESSION['admin_id'];?>';
	
</script>

</head>
<?php

	if(isset($_SESSION['username']))
	{
	$user=$_SESSION['username'];
	$userdept=$_SESSION['depart_id'];
	$userid=$_SESSION['admin_id'];
	$branch_id=$_SESSION['branch_id'];
	}else{
	
	?>
	<script>
	window.location = "index.php";
	</script>
	<?php
	//header("location:index.php");
	}
	include_once("class/class.MySQL.php");
	$db	=new MySQL();
	$companyDetails = $db->Select('addhrm_company_master');
	$date = date('Y-m-d');
$y = date('Y',strtotime($date));
$base_url = DOC_ROOT;

$where['status'] = 1;
$where['branchid'] = $branch_id;
$employees = $db->fetchAll("employee",$where,'','50',false,'','e_id,e_fname,e_lname,username,e_gender,branchid,departid');


	
	$rowsg = mysql_query("SELECT e_post,e_id,departid FROM employee where e_id='$userid'");
    $rowsg = mysql_fetch_array($rowsg);
	$desigs = mysql_query("SELECT * FROM designation where desig_id='$rowsg[e_post]' and departs_id='$rowsg[departid]'");
    $desigs = mysql_fetch_array($desigs);
	//echo $desigs['desig_rights'];
	
	///code for employees on leave/////
	$emp_sel_stat = mysql_query("SELECT * FROM emp_status where (emply_stat='Terminated' || emply_stat='Resigned') ");
	while($emp_sel_statss=mysql_fetch_array($emp_sel_stat)){	
	 $em_stat[]=$emp_sel_statss['id'];
	}

 $emp_stats=join(',',$em_stat);
 $levemp = mysql_query("SELECT e_id FROM employee  where emp_status not in($emp_stats) and user_type!='Superadmin' and branchid='$branch_id' ");
 $levemp = mysql_num_rows($levemp);

 $levemp_psnt = mysql_query("SELECT distinct t.e_id FROM employee e,time t  where e.e_id=t.e_id and t.e_date='$date' and e.user_type!='Superadmin' and e.branchid='$branch_id' ");
$levemp_psnt = mysql_num_rows($levemp_psnt);
 
  $leav_cnt=$levemp-$levemp_psnt;
 ///code for employees on leave/////
 
	$emp_sel_statss = mysql_query("SELECT * FROM emp_status where (emply_stat='Terminated' || emply_stat='Resigned') ");
   // $emp_sel_stat = mysql_fetch_array($emp_sel_stat);	
	while($emp_sel_statsq=mysql_fetch_array($emp_sel_statss)){	
	 $em_statq[]=$emp_sel_statsq['id'];
	}

 $em_statqs=join(',',$em_statq);

	$resultemp = mysql_query("SELECT * FROM employee  where emp_status not in($em_statqs) and branchid='$branch_id' ");

$resultemp = mysql_num_rows($resultemp);

$resultbnch = mysql_query("SELECT * FROM branches");
$resultbnch = mysql_num_rows($resultbnch);
$date = date('Y-m-d');
$sel_emp = mysql_query("SELECT * FROM employee e,time t,file f,designation d where e.e_id=t.e_id and t.e_date='$date' and e.e_post=d.desig_id and f.e_id=e.e_id group by t.e_id");
$sel_emp = mysql_num_rows($sel_emp);

$y = date('Y',strtotime($date));

$mm=date("m", strtotime($date));

$yrstrt=$y-4; 
$p=0;
for($i=$yrstrt; $i<=$y; $i++)
{
 $w=0; 
 $p=$p+1;
 $ddats=$i.'-12-31';
 $ddatss='31-12-'.$i;
 
 $end_date = $i.'-12-31';

	$timestamp_loop = strtotime($i.'-12-31');

	$sel_dat = mysql_query("SELECT e_id,date_join FROM employee  where   date_join!=''");
	$sel_dat_num_rows = mysql_num_rows($sel_dat);
	while($sel_datss=mysql_fetch_array($sel_dat)){
		$sel_datss['date_join'];	
	$date_join_val_temp = date("Y-m-d", strtotime($sel_datss['date_join']));	
	
		$timestamp_inner = strtotime($date_join_val_temp);
		if($timestamp_inner <=$timestamp_loop)
        {
		$w=$w+1;
		}
	
	}

?>
<input type="hidden" name="datemp" id="datemp<?php echo $p;?>" value="<?php echo $w;?>">
<input type="hidden" name="dateyr" id="dateyr<?php echo $p;?>" value="<?php echo $i;?>" >
<?php
}
?>

<?php 
//echo "SELECT date_join FROM employee e where `date_join` LIKE '%$y%' ";
$sel_datss = mysql_query("SELECT date_join FROM employee e where `date_join` LIKE '%$y%' ");
 $sel_datss = mysql_num_rows($sel_datss);

for($j=1; $j<=12; $j++)
{
  if($j<10){
 $datsrt=$y.'-0'.$j.'-01';
 $datend=$y.'-0'.$j.'-31';
 }else{ $datsrt=$y.'-'.$j.'-01';
 $datend=$y.'-'.$j.'-31';}

$sel_emp_pcnt = mysql_query("SELECT distinct t.e_date,t.e_id FROM employee e,time t where e.date_join LIKE '%$y%'  and e.e_id=t.e_id and   t.e_date BETWEEN '$datsrt' AND '$datend' GROUP BY t.e_date,t.e_id");
$sel_emp_pcnt = mysql_num_rows($sel_emp_pcnt);

 $ppercnt=($sel_emp_pcnt*100);
 $ppercnt=$ppercnt/($sel_datss*30);
?>
<input type="hidden" name="pcntemp" id="pcntemp<?php echo $j;?>" value="<?php echo round($ppercnt); ?>">
<?php
}
?>

<input type="hidden" name="userid" class="userid" value="<?=$userid?>"  /><input type="hidden" name="depart_id" class="depart_id" value="<?=$userdept?>"  /><input type="hidden" name="user_name" class="user_name" value="<?=$user?>"  /><input type="hidden" name="sessionbranch_id" class="sessionbranch_id" value="<?=$branch_id?>"  /><input type="hidden" name="hiddenuser_type" id="hiddenuser_type" class=".hiddenuser_type" value="<?php echo $_SESSION['usertype'];?>" />

<?php
						
						$db	=new MySQL();
						if($_SESSION['usertype']=='Superadmin')
						{
						//echo "SELECT * FROM menu where  sort_order!=0 order by sort_order";
						$menu_list=$db->fetchQuery("SELECT * FROM menu where  sort_order!=0 order by sort_order");
						}
						elseif($_SESSION['branchadmin'] == 'Y')
						{
						//echo "SELECT * FROM menu where  sort_order!=0 order by sort_order";
						$menu_list=$db->fetchQuery("SELECT * FROM menu where  sort_order!=0 order by sort_order");
						}
						else
						{
						//echo "SELECT * FROM menu where menu_id in(".$desigs['desig_rights'].") order by sort_order";
						$menu_list=$db->fetchQuery("SELECT * FROM menu where menu_id in(".$desigs['desig_rights'].") and sort_order!=0 order by sort_order");
						}
$sel_empimg = $db->fetchQuery("SELECT * FROM employee e,file f,designation d where  e.e_post=d.desig_id and f.e_id=e.e_id order by e.e_id desc");
//$sel_emp = mysql_num_rows($sel_emp);			
						?>
						
<script>

var userid = <?php echo $_SESSION['admin_id']; ?>;
<?php
$userdetails = $db->fetchQuery("SELECT * FROM file where e_id='$userid'");
?>
var userimage = "<?php echo $userdetails[0]['photo']; ?>";



</script>					
	<?php
	$userdetailss = $db->fetchQuery("SELECT * FROM file where e_id='$userid'");
	 $imgs=$userdetailss[0]['photo'];?>					
    <body class="skin-blue">
        <!-- header logo: style can be found in header.less -->
        <header class="header">
            <a href="dashboard-branch.php" class="logo">
                <!-- Add the class icon to your logo image or logo icon to add the margining -->
                <img src="images/mc_logo.png" width="150">
            </a>
            <!-- Header Navbar: style can be found in header.less -->
            <nav class="navbar navbar-static-top" role="navigation">
                <!-- Sidebar toggle button-->
                <a href="#" class="navbar-btn sidebar-toggle" data-toggle="offcanvas" role="button">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </a>
                <div class="navbar-right">
                    <ul class="nav navbar-nav">
                        <!-- Messages: style can be found in dropdown.less-->
                     
                        <!-- Notifications: style can be found in dropdown.less -->
                   
                        <!-- Tasks: style can be found in dropdown.less -->
                      
                        <!-- User Account: style can be found in dropdown.less -->
                        <li class="dropdown user user-menu">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                                <i class="glyphicon glyphicon-user"></i>
                                <span> <?php echo $_SESSION['username'];?> <i class="caret"></i></span>
                            </a>
                            <ul class="dropdown-menu">
                                <!-- User image -->
                                <li class="user-header bg-light-blue">
                                    <?php 
									if( $_SESSION['usertype']=='Superadmin'){ 
										?>
										<img src="upload/thumb/<?php echo $companyDetails['company_logo']; ?>" class="img-circle" alt="User Image" />
										<?php 
									} else {
										?>
										<img src="<?php if($imgs==''){?>img/avatar3.png<?php }else {?>upload/image/<?php echo $imgs;?><?php } ?>" class="img-circle" alt="User Image" />
										<?php 
									} ?>
                                    <p>
                                         <?php echo $_SESSION['username'];?>
                                        <small></small>
                                    </p>
                                </li>
                                <!-- Menu Body -->
                      
                                <!-- Menu Footer-->
                                <li class="user-footer">
									<div class="pull-left">
										<?php 
										if( $_SESSION['usertype']!='Superadmin'){ 
											?>
											<a href="profile-view.php?employ_id=<?php echo $userid;?>" class="btn btn-default btn-flat" style="color:#3c8dbc;"><translate>Profile</translate></a>
											<?php 
										} 
										?>
									</div>
									<div class="pull-right"><a href="logout.php" class="btn btn-default btn-flat" style="color:#3c8dbc;"><translate>Sign out</translate></a></div>
								</li>
                            </ul>
                        </li>
                    </ul>
                </div>
            </nav>
        </header>
        <div class="wrapper row-offcanvas row-offcanvas-left">
            <!-- Left side column. contains the logo and sidebar -->
            <aside class="left-side sidebar-offcanvas">
                <!-- sidebar: style can be found in sidebar.less -->
                <section class="sidebar">
                    <!-- Sidebar user panel -->
                    <div class="user-panel">
                        <div class="pull-left image">
                            <?php 
							if( $_SESSION['usertype']=='Superadmin'){ ?>
								<img src="upload/thumb/<?php echo $companyDetails['company_logo']; ?>" class="img-circle" alt="User Image" />
								<?php 
							} 
							else { ?>
								<img src="<?php if($imgs==''){?>img/avatar3.png<?php } else {?>upload/image/<?php echo $imgs;?><?php } ?>" class="img-circle" alt="User Image" />
								<?php 
							} 
							?>
                        </div>
                        <div class="pull-left info">
                            <p><translate>Hello, <?php echo $_SESSION['username'];?></translate></p>

                            <a href="#"><i class="fa fa-circle text-success"></i> <translate>Online</translate></a>
                        </div>
                    </div>
       <!-- .clockedin-admin-tab -->
	   <?php 
	   	$dateq = date('Y-m-d');
		$clockins = mysql_query("SELECT * FROM time t,employee e where t.e_id='$userid' and t.e_date='$dateq' and e.e_id=t.e_id  order by id desc");
        $clockins = mysql_fetch_array($clockins);
	   ?> 
<?php if($clockins['time_in']=='' && $clockins['time_out']==''){?>
<div class="clockedin-admin-tab rrr">


<div class="clockedin-admin-click" >


<div class="timein-time"> </div>
<input type="button"  onClick="clock('<?php echo $userid; ?>',1);" value="Sign In" class="clockin-button"></div>

<?php /*?>
<div class="clockedin-admin-click" ><a href="javascript:void(0)" 
onclick="clock('<?php echo $userid;?>',1);">Clock In</a></div>
<div class="clockedin-admin-click-over"  style="display:none;"><a href="javascript:void(0)" onClick="clock('<?php echo $userid;?>',2);">Clock Out</a></div>
<?php */?>
<?php /*?><div class="clockedin-admin-click-content">
<div><?php echo $clockins['e_fname'];?> <strong> <?php if($clockins['time_in'] !=''){echo 'Clocked In';}else{echo 'Out';}?></strong></div>
<div><?php echo $clockins['e_date'];?>, <?php echo $clockins['time_in'].' '.$clockins['time_inloc'];?></div><?php */?>
</div>


<?php }else if($clockins['time_in']!='' && $clockins['time_out']!='') {?>
<?php /*?><div class="clockedin-admin-tab rrr">
<?php if($clockins['login_stat']==0){?>
<div class="clockedin-admin-click" ><a href="javascript:void(0)" onClick="clock('<?php echo $userid;?>',1);">Clock In</a></div>
<?php } else{?>
<div class="clockedin-admin-click" ><a href="javascript:void(0)" onClick="clock('<?php echo $userid;?>',2);">Clock In</a></div>
<?php }?>

<div class="clockedin-admin-click-content">
<div><?php echo $clockins['e_fname'];?> <strong> <?php if($clockins['time_out'] !=''){echo 'Clock Out';}?></strong></div>
<div><?php echo $clockins['e_date'];?>, <?php echo $clockins['time_out'].' '.$clockins['time_outloc'];?></div>
</div>
</div>


<?php */?>
<!-- #####################################  NEW  ########################################################## -->
<div class="clockedin-admin-tab rrr">
<?php if($clockins['login_stat']==0){?>
<div class="clockedin-admin-click">
<div style="text-align:center;">You have <?php if($clockins['time_out'] !=''){echo 'Signed Out';}?></strong> @ <?php echo $clockins['time_out'].' '.$clockins['time_outloc'];?></div>

<div class="timein-time" ></div>
<input type="button"  onClick="clock('<?php echo $userid;?>',1);" value="Sign In" class="clockin-button">
</div>

<?php } else{?>
<div class="clockedin-admin-click rrr">
<div style="text-align:center;">You have <?php if($clockins['time_out'] !=''){echo 'Signed Out';}?></strong> @ <?php echo $clockins['time_out'].' '.$clockins['time_outloc'];?></div>
<div class="timein-time" ></div>
<input type="button"  onClick="clock('<?php echo $userid;?>',2);" value="Sign In" class="clockin-button">
</div>
<?php }?>
</div>
<!-- ###################################################################################################### -->





<?php }else {?>



<div class="clockedin-admin-tab rrr">
<?php /*?><div class="clockedin-admin-click" style="display:none;"><a href="javascript:void(0)" onclick="clock('<?php echo $userid;?>',1);">Clock In</a></div>
<div class="clockedin-admin-click-over" 
	<?php if($clockins['e_id']){?>style="display:display;"<?php }else {?> 
	style="display:none;"<?php }?>><a href="javascript:void(0)" onClick="clock('<?php echo $userid;?>',2);">Clock Out</a></div>

<div class="clockedin-admin-click-content">
<div><?php echo $clockins['e_fname'];?> <strong> <?php if($clockins['time_in'] !=''){echo 'Clock In';}else{echo 'Out';}?></strong></div>
<div><?php echo $clockins['e_date'];?>, <?php echo $clockins['time_in'].' '.$clockins['time_inloc'];?></div>
</div><?php */?>
<div style="text-align:center;">You have <?php if($clockins['time_in'] !=''){echo 'Signed In';}?></strong> @ <?php echo $clockins['time_in'].' '.$clockins['time_inloc'];?></div>
<div class="clockedin-admin-click">
<div class="timein-time" ></div>
<input type="button"  onClick="clock('<?php echo $userid;?>',2);" value="Sign Out" class="clockin-button">
</div>



</div>




<?php } ?>
<!-- /.clockedin-admin-tab -->
                    <!-- sidebar menu: : style can be found in sidebar.less -->
                    <ul class="sidebar-menu">
                        <li class="active">
                            <a href="dashboard-branch.php">
                                <i class="fa fa-dashboard"></i> <span><translate>Dashboard</translate></span>
                            </a>
                        </li>
						<?php 
						$i=2;
						foreach($menu_list as $menu_items)
						{
						?>
                        <li>
                            <a href="<?php echo $menu_items['menu_link'];?>">
                                <i class="fa fa-th"></i> <span><translate><?php echo $menu_items['menu_name'];?></translate></span> 
                            </a>
                        </li>
						<?php } ?>
              
			  
			  

			  			<li>
                            <a href="income_tax_statement.php">
                                <i class="fa fa-th"></i> <span><translate>Income Tax Statement</translate></span>
                            </a>
                        </li>
					  
					     <li>

                            <a href="income_tax_declarations.php">
                                <i class="fa fa-th"></i> <span><translate>Income Tax Declaration</translate></span>
                            </a>
                        </li>
					  
					  
			  	<li class="treeview"> <a href="#"> <i class="fa fa-folder"></i> Statutories <i class="fa fa-angle-left pull-right"></i> </a>
						  <ul class="treeview-menu">
							<li class="treeview"> <a href="#"> Provident Fund <i class="fa fa-angle-left pull-right"></i> </a>
							  <ul class="treeview-menu">
								<li class="treeview"> <a href="#"> Monthly <i class="fa fa-angle-left pull-right"></i> </a>
								  <ul class="treeview-menu">
									<li> <a href="pf-forms.php?frm=5">Form 5</a> </li>
									<li> <a href="pf-forms.php?frm=10">Form 10</a> </li>
									<li> <a href="pf-forms.php?frm=12a">Form 12A</a> </li>
									<li> <a href="pf-forms.php?frm=mst">Monthly Statement</a> </li>
								  </ul>
								</li>
								<!-- /.third level-->
								<li class="treeview"> <a href="#"> Yearly <i class="fa fa-angle-left pull-right"></i> </a>
								  <ul class="treeview-menu">
									<li> <a href="pf-forms.php?frm=3a">Form 3A</a> </li>
									<li> <a href="pf-forms.php?frm=6a">Form 6A</a> </li>
									<li> <a href="pf-forms.php?frm=ert">E-Return</a> </li>
								  </ul>
								</li>
								<!-- /.third level-->
							  </ul>
							</li>
							<!-- /.second level-->
							<li class="treeview"> <a href="#"> Employee State Insurance <i class="fa fa-angle-left pull-right"></i> </a>
							  <ul class="treeview-menu">
								<li class="treeview"> <a href="#"> Monthly <i class="fa fa-angle-left pull-right"></i> </a>
								  <ul class="treeview-menu">
									<li> <a href="esi-forms.php?frm=3">ESI Form 3</a> </li>
									<li> <a href="esi-forms.php?frm=mst">Monthly Statement</a> </li>
									<li> <a href="esi-forms.php?frm=ert">E-Return</a> </li>
								  </ul>
								</li>
								<!-- /.third level-->
								<li class="treeview"> <a href="#"> Yearly <i class="fa fa-angle-left pull-right"></i> </a>
								  <ul class="treeview-menu">
									<li> <a href="esi-forms.php?frm=5">Form 5</a> </li>
									<li> <a href="esi-forms.php?frm=6">Form 6</a> </li>
								  </ul>
								</li>
								<!-- /.third level-->
							  </ul>
							</li>
							<li class="treeview"> <a href="#">Professional Tax</a> <i class="fa fa-angle-left pull-right"></i>
							  <ul class="treeview-menu">
								<li> <a href="tax-report.php?frm=rpt">Computation Report</a> </li>
								<li> <a href="tax-report.php?frm=stmnt">Statement</a> </li>
							  </ul>
							</li>
							<!-- /.third level-->
							<li class="treeview"> <a href="#"> National Pension Scheme <i class="fa fa-angle-left pull-right"></i> </a>
							  <ul class="treeview-menu">
								<li class="treeview"> <a href="#"> Subscriber Contribution Details </a> </li>
								<li> <a href="#"> NPS Summary</a> </li>
								<li> <a href="#"> PRAN Not Available</a> </li>
							  </ul>
							</li>
							<li class="treeview"> <a href="#"> Gratuity </a> </li>
							<li class="treeview"> <a href="#"> Income Tax <i class="fa fa-angle-left pull-right"></i> </a>
							  <ul class="treeview-menu">
								<li class="treeview"> <a href="#"> Computation </a> </li>
								<li> <a href="#">Salary Projection</a> </li>
								<li> <a href="incometax-report.php?frm=chn">Challan Reconciliation</a> </li>
								<li> <a href="incometax-report.php?frm=rtn">Returns</a> </li>
								<li> <a href="incometax-report.php?frm=ert">E-Return</a> </li>
								<li> <a href="#">Exception Reports</a> </li>
							  </ul>
							</li>
							<li class="treeview"> <a href="#"> Muster Roll </a> </li>
							<li> <a href="register-wages.php"> Wage Register </a> </li>
						  </ul>
						</li>
                      
			  
					  
					  
                        <li>
                            <a href="calendar.php">
                                <i class="fa fa-calendar"></i> <span><translate>Calendar</translate></span>
              <?php /*?>                  <small class="badge pull-right bg-red"></small><?php */?>
                            </a>
                        </li>
                  
                    
                    </ul>
                </section>
                <!-- /.sidebar -->
            </aside>

            <!-- Right side column. Contains the navbar and content of the page -->
            <aside class="right-side">
                <!-- Content Header (Page header) -->
                <section class="content-header">
                    <h1>
                       <translate> Dashboard</translate>
                        <small><translate>Control panel</translate></small>                    </h1>
                    <ol class="breadcrumb">
                        <li><a href="#"><i class="fa fa-dashboard"></i> <translate>Home</translate></a></li>
                        <li class="active"><translate>Dashboard</translate></li>
                    </ol>
                </section>

                <!-- Main content -->
                <section class="content">

                    <!-- Small boxes (Stat box) -->
                    <div class="row">
         					 <div class="col-lg-3 col-xs-6">
                            <!-- small box -->
                            <div class="small-box bg-green">
                                <div class="inner">
                                    <h3>
                                       <translate> <?php echo $resultemp;?></translate><sup style="font-size: 20px"></sup>
                                    </h3>
                                    <p>
                                        <translate>Total Employees</translate>
                                    </p>
                                </div>
                                <div class="icon">
                                   <!-- <i class="ion ion-stats-bars"></i>-->
								    <i class="ion ion-person-add"></i>
                                </div>
                                <a href="employee-lists.php" class="small-box-footer">
                                    <translate>More info</translate> <i class="fa fa-arrow-circle-right"></i>
                                </a>
                            </div>
                        </div><!-- ./col -->
						
                                  <div class="col-lg-3 col-xs-6">
                            <!-- small box -->
                            <div class="small-box bg-yellow">
                                <div class="inner">
                                    <h3>
                                        <translate> <?php echo $sel_emp;?></translate>
                                    </h3>
                                    <p>
                                      <translate>Employees at Work</translate>
                                    </p>
                                </div>
                                <div class="icon">
                                    <i class="ion ion-person-add"></i>
                                </div>
                                <a href="employee-lists_today.php" class="small-box-footer">
                                    <translate>More info</translate> <i class="fa fa-arrow-circle-right"></i>
                                </a>
                            </div>
                        </div><!-- ./col -->
        		<div class="col-lg-3 col-xs-6">
                            <!-- small box -->
                            <div class="small-box bg-redalrt">
                                <div class="inner">
                                    <h3>
                                       <translate> <font color="#FFFFFF"><?php echo $leav_cnt;?></font></translate>
                                    </h3>
                                    <p>
                                       <translate> <font color="#FFFFFF">Employees on Leave </font></translate>
                                    </p>
                                </div>
                                <div class="icon">
                                    <i class="ion ion-bag"></i>
                                </div>
                                <a href="employee-lists_leave.php" class="small-box-footer">
                                    <translate>More info</translate> <i class="fa fa-arrow-circle-right"></i>
                                </a>
                            </div>
                      </div><!-- ./col -->
                         <div class="col-lg-3 col-xs-6">
						 
						 
						 
              <div class="nav-tabs-custom bg-lightblue" style="background-color:#036D72;">
                                <ul class="nav nav-tabs notif-tab">
                      <li class="active" ><a href="#btab_1" data-toggle="tab" >Birthday</a></li>
                                    <li><a href="#btab_2" data-toggle="tab">Anniversary</a></li>
                                </ul>
                        <div class="tab-content" style="height:85px; background-color:#94D6FF;">
                                    <div class="tab-pane active" id="btab_1" >
									
                                         <?php 
  $sql = "SELECT * FROM employee WHERE branchid='$branch_id' and DATE_ADD(e_dob, INTERVAL YEAR(CURDATE())-YEAR(e_dob) YEAR) BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 10 DAY);";
				  
  $emp_birth = mysql_query($sql);
  
  $pcnts=mysql_num_rows($emp_birth);
  
  while($emp_b_cnt=mysql_fetch_array($emp_birth)){	

	//	$displayDate = date("d F",strtotime($emp_b_cnt['e_dob']));
		
		if( date("d-m") == date("d-m",strtotime($emp_b_cnt['e_dob'])) ){
			
			$displayDate = "Today.";
		}else{
			$displayDate = date("d F",strtotime($emp_b_cnt['e_dob']));
		}
		
		
		echo "<img src='images/cake.png'> <strong style='font-size:12px;'>".
							$emp_b_cnt['e_fname'].'\'s </strong><span style="font-size:12px;"> B\'day is on '.$displayDate.'</span><br/>';

	
  }
  if($pcnts==0){echo 'No Notifications';}?>
                                  
										
                                    </div><!-- /.tab-pane -->
                                    <div class="tab-pane" id="btab_2">
                               <?php /*?>                                   <?php
														  
	 $emp_joins = mysql_query("SELECT * FROM employee where date_join!='' and date_join NOT LIKE '%".date('Y')."%' ");
  $pcntq=0;
  while($emp_join_dat=mysql_fetch_array($emp_joins)){	
  	$emp_join = date('Y-m-d',strtotime($emp_join_dat['date_join']));
	$emp_join_arr = explode('-', $emp_join);
	$emp_join_arr[0] = date('Y');
    $emp_join  = $emp_join_arr[0].'-'.$emp_join_arr[1].'-'.$emp_join_arr[2];
	
	$cur_days = date('Y-m-d');
	$dec_days = date('Y-m-d', strtotime('-10 days'));
	
	
	if($dec_days <= $emp_join && $emp_join < $cur_days){  $pcntq=$pcntq+1;
		echo "<img src='images/gifts.png'> <strong style='font-size:12px;'>". $emp_join_dat['e_fname'].'\'s </strong><span style="font-size:12px;">Anniversary is on '.date("d M",strtotime($emp_join)).'</span><br/>';
	}

  } if($pcntq==0){echo 'No Notifications';}?><?php */?>
  
   <?php 
 $sql = "SELECT * FROM employee WHERE branchid='$branch_id' and DATE_ADD(date_join, INTERVAL YEAR(CURDATE())-YEAR(date_join) YEAR) BETWEEN CURDATE() AND DATE_ADD(CURDATE(), INTERVAL 10 DAY);";
				  
  $emp_birth = mysql_query($sql);
  
  $pcnts=mysql_num_rows($emp_birth);
  
  while($emp_b_cnt=mysql_fetch_array($emp_birth)){	

	//	$displayDate = date("d F",strtotime($emp_b_cnt['e_dob']));
		
		if( date("d-m") == date("d-m",strtotime($emp_b_cnt['date_join'])) ){
			
			$displayDate = "Today.";
		}else{
			$displayDate = date("d F",strtotime($emp_b_cnt['date_join']));
		}
		
		
		echo "<img src='images/gifts.png'> <strong style='font-size:12px;'>". $emp_b_cnt['e_fname'].'\'s </strong><span style="font-size:12px;">Anniversary is on '.$displayDate.'</span><br/>';

	
  }
  if($pcnts==0){echo 'No Notifications';}?>
  
                                    </div><!-- /.tab-pane -->
                </div><!-- /.tab-content -->
                           </div>
                         
						 
						 
						 
						 
                        </div><!-- ./col -->
                    </div><!-- /.row -->

                    <!-- Main row -->
                    <div class="row">
                        <!-- Left col -->
                        <section class="col-lg-6 connectedSortable">                            


                            <!-- Custom tabs (Charts with tabs)style="width:535px !important;"-->
             
							              <div class="nav-tabs-custom">
								
                                <ul class="nav nav-tabs">
                                    <li class="active" ><a href="#ltab_1" data-toggle="tab" >Leave Request</a></li>
                                    <li><a href="#ltab_2" data-toggle="tab" >Attendence Request</a></li>
									<!--<li><a href="#ltab_3" data-toggle="tab" >Delay Report</a></li>-->
									<li><a href="#ltab_3" data-toggle="tab" >Reminder</a></li>
									<?php /*?><li><a href="#ltab_3" data-toggle="tab" >OverTime Report</a></li><?php */?>
                                </ul>
                                <div class="tab-content" style="height:300px;overflow-y:scroll;" >
                                    <div class="tab-pane active" id="ltab_1" style="overflow:auto !important;" >
									
				<!-------------tab for leave request-A.is_cancelled='0' and A.imd_status='0' and A.is_blocked='0' and A.is_cancelled='0' and-------------------->
									
										
  <?php 

  $emp_leave_req = mysql_query(" SELECT * FROM payroll_user_leave_requests A 
								LEFT JOIN employee B ON A.employee_id = B.e_id 
								LEFT JOIN payroll_leave C ON A.leave_id = C.lid 
								LEFT JOIN designation D ON B.e_post = D.desig_id 
								WHERE   A.day_from  >= '$dateq' and B.branchid='$branch_id' order by A.day_from asc");
								
								
	
  ?>
  <table width="100%"  cellpadding="1" cellspacing="1" style="border-collapse:separate !important; border-spacing:1px !important;">
  <tr bgcolor="#E7EDF3">
  <td><b>Name</b></td>
 
  <td><b>Branch </b></td>
  <td><b>Date From</b></td>
  <td><b>Date To</b></td>
   <td><b>Action</b></td>
  </tr>
 <?php  $lvcnt=0; while($emp_leave_reqs=mysql_fetch_array($emp_leave_req)){

$branch_leave = mysql_fetch_array(mysql_query(" SELECT * FROM branches where branch_id='$emp_leave_reqs[branchid]'")); 
  $lvcnt=$lvcnt+1; 

  if($lvcnt<=10){
  
      
  ?>
 
   <tr bgcolor="#E7EDF3">
  
<td><?php echo $emp_leave_reqs['e_fname'];?></td>

<td><?php echo $branch_leave['branch_name'];?></td>
<td><?php echo date('d-m-Y', strtotime($emp_leave_reqs['day_from']));?></td>
<td><?php echo date('d-m-Y', strtotime($emp_leave_reqs['day_from']));?></td>
<td>


<select name="approveleave" id="approveleave" onChange="approveLeaves('<?php echo $emp_leave_reqs['id'];?>',this.value);">

												<option value="" >Select Status</option>
												<option value="1" <?php if($emp_leave_reqs['imd_status']==1){ ?>selected="selected"<?php } ?>>Approve</option>
	<option value="0" <?php if($emp_leave_reqs['imd_status']==0 && ($emp_leave_reqs['is_blocked']==1 || $emp_leave_reqs['is_cancelled']==1 ) ){ ?>selected="selected"<?php } ?>>Decline</option>
												</select>
												
<?php /*?><?php if($emp_leave_reqs['imd_status']==1){ ?>
<img class="addleaves" data-id="0" src="images/active-icon.png" id="actimg<?php echo $lvcnt;?>"  onClick="approveLeaves('<?php echo $emp_leave_reqs['id'];?>',0,'<?php echo $lvcnt;?>');" style="cursor:pointer;" >
<?php } ?>
<?php if($emp_leave_reqs['imd_status']==0  ){ ?>
<img class="addleaves" data-id="1" src="images/inactive-icon.png" id="inactimg<?php echo $lvcnt;?>"   onClick="approveLeaves('<?php echo $emp_leave_reqs['id'];?>',1,'<?php echo $lvcnt;?>');" style="cursor:pointer;">
<?php } ?>	<?php */?>									
					</td>
  </tr>
  <?php  } }?>
  <tr><td colspan="4"></td></tr>
  <?php if($lvcnt > 0){?>
    <tr><td colspan="4" align="right"><a href="leave-request.php#leaveRequests"><font color="#006600"><b>View All</b></font></a></td></tr>
	<?php }?>
  </table>
  					<!-------------tab for leave request--------------------->
  							
                                    </div><!-- /.tab-pane -->
                                    <div class="tab-pane" id="ltab_2">

		
		  <?php 
  
  	
	 
	$emp_attends_req = mysql_query("select * from employee join time_approval on employee.e_id = time_approval.eid and is_blocked=1 and employee.branchid='$branch_id'");
  ?>
  <table width="100%"  cellpadding="1" cellspacing="1" style="border-collapse:separate !important; border-spacing:1px !important;">
  <tr bgcolor="#E7EDF3">
  <td><b>Name</b></td>
  <td><b>Branch</b></td>
  <td><b>Date</b></td>
  <td><b>Time In</b></td>
  <td><b>Time Out</b></td>
  </tr>
  <?php $atcnt=0; while($emp_attends_reqs=mysql_fetch_array($emp_attends_req)){
  
  	  $branch_attndce = mysql_fetch_array(mysql_query(" SELECT * FROM branches where branch_id='$emp_attends_reqs[branchid]'")); 
  $atcnt=$atcnt+1;
  if($atcnt<=10){?>
  <tr bgcolor="#E7EDF3">
  
<td><?php echo $emp_attends_reqs['e_fname'];?></td>
<td><?php echo $branch_attndce['branch_name'];?></td>
<td><?php echo date("d-m-Y", strtotime($emp_attends_reqs['edate']));?></td>
<td><?php echo $emp_attends_reqs['timein'].' '.$emp_attends_reqs['timeinloc'];?></td>
<td><?php echo $emp_attends_reqs['timeout'].' '.$emp_attends_reqs['timeoutloc'];?></td>
  </tr>
  <?php }} ?>
    <tr><td colspan="4"></td></tr>
	<?php if($atcnt > 0){?>
    <tr><td colspan="4" align="right"><a href="timesheet-adjustable-form.php#timesheet_approval"><font color="#006600"><b>View All</b></font></a></td></tr>
	<?php } ?>
  </table>
		
                                    </div><!-- /.tab-pane -->
									<!-----tab for delay or Overtime--------->
									<div class="tab-pane" id="ltab_3">

		
		  <?php 
  

		 $emp_delay = mysql_query("SELECT * FROM employee where emp_status not in($emp_stats) and user_type!='Superadmin' and branchid='$branch_id' ");
  ?>
  <table width="100%"  cellpadding="1" cellspacing="1" style="border-collapse:separate !important; border-spacing:1px !important;">
  <tr><th colspan="3" style="background-color:#CCCCCC">Denied/SignIn/SignOut</th></tr>
  <tr bgcolor="#E7EDF3">
  <td><b>Name</b></td>
  <td><b>Branch</b></td>
  <td><b>Activity</b></td>
  </tr>
    <?php $atcnt=0; while($emp_delay_tim=mysql_fetch_array($emp_delay)){

	$leave_payroll = mysql_num_rows(mysql_query("SELECT * FROM payroll_user_leave_requests where employee_id='$emp_delay_tim[e_id]' and day_from='$date' ")); 
  
  $rep_delay = mysql_fetch_array(mysql_query("SELECT * FROM time where e_id='$emp_delay_tim[e_id]' and e_date='$date' "));
  
    $branch_attndce = mysql_fetch_array(mysql_query(" SELECT * FROM branches where branch_id='$emp_delay_tim[branchid]'")); 
		
	$master_delay = mysql_fetch_array(mysql_query("SELECT * FROM report_time where brch_id='$emp_delay_tim[branchid]'"));
$t1 = strtotime($rep_delay['e_in']);
$t2 = strtotime($master_delay['late_time']);
if($leave_payroll==0)
{
if($rep_delay['e_in']=='')
{

  $atcnt=$atcnt+1;
 ?>
  <tr bgcolor="#E7EDF3">
  
<td><?php echo $emp_delay_tim['e_fname'];?></td>
<td><?php echo $branch_attndce['branch_name'];?></td>

<?php if($rep_delay['e_in']==''){?>
<td>Not Logged In</td>
<?php } else {?>
<td><?php echo $rep_delay['e_in'].' '.$rep_delay['time_inloc'];?></td>
<?php } ?>

  </tr>
  <?php } } }?>
    <tr><td colspan="4"></td></tr>
    <tr><td colspan="4" align="right"></td></tr>
  </table>
		
                                    </div>
									
									
									<!----------Over Time-------->
									<?php /*?><div class="tab-pane" id="ltab_4">

		
		  <?php 
  
  	 //$emp_leave_req = mysql_query("SELECT * FROM payroll_user_leave_requests r,employee e where imd_status='0' and is_blocked='0' and is_cancelled='0' and r.employee_id=e.e_id ");
	 
	$emp_delay = mysql_query("SELECT * FROM employee e,time t  where e.e_id=t.e_id and t.e_date='$date' ");
	
  ?>
  <table width="100%"  cellpadding="1" cellspacing="1" style="border-collapse:separate !important; border-spacing:1px !important;">
  <tr bgcolor="#E7EDF3">
  <td><b>Name</b></td>
  <td><b>Branch</b></td>
  <td><b>Time In</b></td>
  </tr>
  <?php $atcnt=0; while($emp_delay_tim=mysql_fetch_array($emp_delay)){
    $branch_attndce = mysql_fetch_array(mysql_query(" SELECT * FROM branches where branch_id='$emp_delay_tim[branchid]'")); 
	
	$master_delay = mysql_fetch_array(mysql_query("SELECT * FROM report_time where brch_id='$emp_delay_tim[branchid]'"));
	 $t1 = strtotime($emp_delay_tim['e_in']).'-'.$emp_delay_tim['e_in'].'<br />';
     $t2 = strtotime($master_delay['late_time']).'-'.$master_delay['late_time'];
if($t2 < $t1)
{

  $atcnt=$atcnt+1;
  if($atcnt<=10){?>
  <tr bgcolor="#E7EDF3">
  
<td><?php echo $emp_delay_tim['e_fname'];?></td>
<td><?php echo $branch_attndce['branch_name'];?></td>
<td><?php echo $emp_delay_tim['e_in'].' '.$emp_delay_tim['timeinloc'];?></td>
  </tr>
  <?php }} }?>
    <tr><td colspan="4"></td></tr>
    <tr><td colspan="4" align="right"><a href="timesheet-adjustable-form.php#timesheet_approval">View All</a></td></tr>
  </table>
		
                                    </div><?php */?>
									
                                </div><!-- /.tab-content -->
                            </div>
							<!-- /.nav-tabs-custom -->

                                                     
 
 							<!---RSS READER--->	
							<div class="nav-tabs-custom rss-reader-tabs">
                                <ul class="nav nav-tabs rss-tabs">

                                </ul>
                                <div class="tab-content" style="height:300px; overflow-y:scroll;" >
                                </div><!-- /.tab-content -->
                            </div>
                            
							
							

                            <!-- quick email widget -->
                            <div class="box box-info">
                                <div class="box-header">
                                    <i class="fa fa-envelope"></i>
                                    <h3 class="box-title"><translate>Quick Email</translate></h3>
                                    <!-- tools box -->
                                    <div class="pull-right box-tools">
                                        <!--<button class="btn btn-info btn-sm" data-widget="remove" data-toggle="tooltip" title="Remove"><i class="fa fa-times"></i></button>-->
                                    </div><!-- /. tools -->
                                </div>
                                <div class="box-body">
                                    <form action="#" method="post" name="myform" id="myform">
                                        <div class="form-group">
                                            <input type="email" class="form-control" name="emailto" id="emailto" placeholder="Email to:"/>
                                        </div>
                                        <div class="form-group">
                                            <input type="text" class="form-control" name="subjects" id="subjects" placeholder="Subject"/>
                                        </div>
                                        <div>
                                            <textarea class="textarea" placeholder="Message" name="msgs" id="msgs" style="width: 100%; height: 125px; font-size: 14px; line-height: 18px; border: 1px solid #dddddd; padding: 10px;"></textarea>
                                        </div>
                                    </form>
                                </div>
                                <div class="box-footer clearfix">
                                    <button class="pull-right btn btn-default" id="sendEmail" type="button" onClick="zendmail();"><translate>Send </translate><i class="fa fa-arrow-circle-right"></i></button>
                                </div>
                            </div>
							
							               <div class="nav-tabs-custom" >
                                <!-- Tabs within a box -->
                                <ul class="nav nav-tabs pull-right">
                                   <!-- <li class="active"><a href="#revenue-chart" data-toggle="tab">Area</a></li>
                                    <li><a href="#sales-chart" data-toggle="tab">Donut</a></li>-->
                                    <li class="pull-left header"><i class="fa fa-inbox"></i> <translate>Employee Graph</translate></li>
                                </ul>
                                <div class="tab-content no-padding">
                                    <!-- Morris chart - Sales -->
                                    <div class="chart tab-pane active" id="revenue-chart" style="position: relative; height: 300px;"></div>
                                    <div class="chart tab-pane" id="sales-chart" style="position: relative; height: 300px;"></div>
									
								
                                </div>
                            </div>
							 <!-- Image gallery -->
                            <?php /*?><div class="box box-info">
                                <div class="box-header">
                                    <i class="fa fa-envelope"></i>
                                    <h3 class="box-title">Image Gallery</h3>
                                    <!-- tools box -->
                                </div>
                                <div class="box-body">
                                    <form action="#" method="post">
                                      
                                        <div class="form-group">
                                            <input type="file" class="form-control" name="imgfil" id="imgfil" placeholder="Subject"/>
                                        </div>
                                      
                                    </form>
                                </div>
                                <div class="box-footer clearfix">
                                    <button class="pull-right btn btn-default" id="sendEmail">Send <i class="fa fa-arrow-circle-right"></i></button>
                                </div>
                            </div><?php */?>
							 <!-- /Image gallery -->


                        </section><!-- /.Left col -->
                        <!-- right col (We are only adding the ID to make the widgets sortable)-->
                        <section class="col-lg-6 connectedSortable"> 
						
						<!-- Calendar -->
                            <div class="box box-solid bg-gradient">
                                <div class="box-header">
                                    <i class="fa fa-calendar"></i>
                                    <h3 class="box-title"><translate>Calendar</translate></h3>
                                    <!-- tools box -->
                                    <div class="pull-right box-tools">
                        <a href="calendar.php" style="text-decoration:underline"><b><font color="#990000">Add Events</font></b></a>                                    
                                    </div><!-- /. tools -->
                                </div><!-- /.box-header -->
                                <div class="box-body no-padding" style="height:475px;">
                                    <!--The calendar -->
                                    <div id="calendars" style="width: 100%"></div>
                                </div><!-- /.box-body -->  
                                <?php /*?><div class="box-footer text-black">
                                    <div class="row">
                                        <div class="col-sm-6">
                                            <!-- Progress bars -->
                                           
                                        

                                          
                                          
                                        </div><!-- /.col -->
                                       
                                    </div><!-- /.row -->                                                                        
                                </div><?php */?>
                            </div><!-- /.box -->
						

                            <!-- Map box -->
                      <div class="nav-tabs-custom">
                                
								 <div class="box box-primary">
                                <div class="box-header">
                                    <i class="ion ion-clipboard"></i>
                                    <h3 class="box-title">Organization News</h3>
                                   </div><!-- /.box-header -->
								
								
                                <div class="box-body" style="height:300px;">
                                    <ul class="todo-list feed-list">
                                    </ul>
                                </div><!-- /.box-body -->
								
			                   </div>
								
								
                          </div>
                            <!-- /.box -->

                            <!-- solid sales graph -->
									  <div class="nav-tabs-custom">
                                <!-- Tabs within a box -->
                                <ul class="nav nav-tabs ">
                                   <!-- <li class="active"><a href="#revenue-chart" data-toggle="tab">Area</a></li>
                                    <li><a href="#sales-chart" data-toggle="tab">Donut</a></li>-->
                                    <li class="pull-left header"><i class="fa fa-inbox"></i><translate> Employee Attendence Graph</translate></li>
                                </ul>
								<select name="yer" id="yer"  onChange="getgraph(this)">
								<option value="">Select Year</option>
								<?php for($i=$yrstrt; $i<=$y; $i++){?>
								<option value="<?php echo $i;?>"><?php echo $i;?></option>
								<?php }?>
								</select>
								
								
								
								 &nbsp;
								<select name="mnth" id="mnth" onChange="getgraph_mn(this)" >
								<option value="">Select Month</option>
								
               <option value="01" >Jan</option> <option value="02" >Feb</option> <option value="03" >Mar</option> <option value="04" >Apr</option>
			    <option value="05" >May</option><option value="06" >Jun</option><option value="07" >Jul</option>
				 <option value="08" >Aug</option><option value="09" >Sep</option><option value="10" >Oct</option>
				  <option value="11" >Nov</option><option value="12" >Dec</option>
    
								</select>
                                <div class="tab-content no-padding">
                                       <div id="chart_div" style="height: 300px;"></div>
								
                                </div>
                            </div>                         

                                                        


<!-----new section sgk------------>
   
<!-----new section sgk------------>


<!-----Employee Gallery------------>

<!-----/Employee Gallery------------>


                        </section><!-- right col -->
                    </div><!-- /.row (main row) -->

                </section><!-- /.content -->
            </aside><!-- /.right-side -->
        </div><!-- ./wrapper -->

        <!-- add new calendar event modal -->


        <!-- jQuery 2.0.2 -->
        <script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>
		<script src="js/app.js" type="text/javascript"></script>
        <!-- jQuery UI 1.10.3 -->
        <script src="js/jquery-ui-1.10.3.min.js" type="text/javascript"></script>
		<script src="js/chat.js" type="text/javascript"></script>
		<script src="js/rss.js" type="text/javascript"></script>
		<script>
		$(function(){

			var location;
			var country;
			var condition;
			var temp;
			
		     var geoFORECAST = 'http://query.yahooapis.com/v1/public/yql?q=select%20*%20from%20weather.forecast%20where%20woeid=1940345%20and%20u=%27c%27&format=json';
                    $.getJSON(geoFORECAST, function(json) {
                       console.log(json);
                      results = json.query.results.channel;
					  location = results.location.city+", "+results.location.country;
					  condition = results.item.condition.text;
					  temp  = results.item.condition.temp;
					  
					  $('.condition').text(condition);
					   $('.temp').text(temp);
					   $('.location').text(location);
					  $('.weather-widget').show('blind',500);
                     });
		 
		});
		</script>
		                           
      <!--   Bootstrap -->
        <script src="js/bootstrap.min.js" type="text/javascript"></script>
        <!-- Morris.js charts -->
        <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
        <script src="js/plugins/morris/morris.min.js" type="text/javascript"></script>
        <!-- Sparkline -->
        <script src="js/plugins/sparkline/jquery.sparkline.min.js" type="text/javascript"></script>
        <!-- jvectormap -->
        <script src="js/plugins/jvectormap/jquery-jvectormap-1.2.2.min.js" type="text/javascript"></script>
        <script src="js/plugins/jvectormap/jquery-jvectormap-world-mill-en.js" type="text/javascript"></script>
        <!-- jQuery Knob Chart -->
        <script src="js/plugins/jqueryKnob/jquery.knob.js" type="text/javascript"></script>
        <!-- daterangepicker -->
        <script src="js/plugins/daterangepicker/daterangepicker.js" type="text/javascript"></script>
        <!-- datepicker -->
        <script src="js/plugins/datepicker/bootstrap-datepicker.js" type="text/javascript"></script>
        <!-- Bootstrap WYSIHTML5 -->
        <script src="js/plugins/bootstrap-wysihtml5/bootstrap3-wysihtml5.all.min.js" type="text/javascript"></script>
        <!-- iCheck -->
        <script src="js/plugins/iCheck/icheck.min.js" type="text/javascript"></script>

        <!-- AdminLTE App -->
        <script src="js/AdminLTE/app.js" type="text/javascript"></script>

        <!-- AdminLTE dashboard demo (This is only for demo purposes) -->
        <script src="js/AdminLTE/dashboard.js" type="text/javascript"></script>

        <!-- AdminLTE for demo purposes -->
        <script src="js/AdminLTE/demo.js" type="text/javascript"></script>
<script src="js/showpath.js" type="text/javascript"></script>
	<div id="atndgr" ></div>
    </body>
</html>


<!-- <script type="text/javascript" src="https://www.google.com/jsapi"></script>-->
<script type="text/javascript" src="js/barimage.js"></script>

<script type="text/javascript">




setClock();
var ClockSecond=0;
function setClock(){

$('.timein-time').text(moment().format("hh.mm A"));
setTimeout(function(){ $('.timein-time').text(moment().format("hh:mm A")); },100);
	

setTimeout(setClock,1000);
}
     var empc1=Number(document.getElementById("pcntemp1").value);
	var empc2=Number(document.getElementById("pcntemp2").value);
	var empc3=Number(document.getElementById("pcntemp3").value);
	var empc4=Number(document.getElementById("pcntemp4").value);
	var empc5=Number(document.getElementById("pcntemp5").value);
	var empc6=Number(document.getElementById("pcntemp6").value);
	var empc7=Number(document.getElementById("pcntemp7").value);
	var empc8=Number(document.getElementById("pcntemp8").value);
	var empc9=Number(document.getElementById("pcntemp9").value);
	var empc10=Number(document.getElementById("pcntemp10").value);
	var empc11=Number(document.getElementById("pcntemp11").value);
	var empc12=Number(document.getElementById("pcntemp12").value);
	///years
	var yr1=document.getElementById("dateyr1").value;
	var yr2=document.getElementById("dateyr2").value;
	var yr3=document.getElementById("dateyr3").value;
	var yr4=document.getElementById("dateyr4").value;
	var yr5=document.getElementById("dateyr5").value;
	
      google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart);
function drawChart() {

  var data = google.visualization.arrayToDataTable([
    ['Month', 'Attendance'],
    ['Jan',  empc1],
    ['Feb',  empc2],
    ['Mar',  empc3],
    ['Apr',  empc4],
    ['May',  empc5],
    ['Jun',  empc6],
    ['Jul',  empc7],
    ['Aug',  empc8],
    ['Sep',  empc9],
    ['Oct',  empc10],
    ['Nov',  empc11],
    ['Dec',  empc12]
  ]);

  var options = {
    title: 'Attendance In %',
    hAxis: {title: 'Month', titleTextStyle: {color: 'red'}},
	'chartArea': {'width': '80%', 'height': '80%'}
  };

  var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));

  chart.draw(data, options);
  
 
}
    </script>
		<link href='fullcalendar/fullcalendar.css' rel='stylesheet' />
<link href='fullcalendar/fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='fullcalendar/fullcalendar.min.js'></script>
<link rel="stylesheet" href="css/simplePagination.css" /><?php /*?><?php */?>
	<script type="text/javascript">
	function zendmail()
	{
	
	var serviceURLHR 	=localStorage['serviceURLHR'];
var HRPATH 			=localStorage['basicPATH'];
var hosturl    		=localStorage['basicURL'];
var HRPATH 			=HRPATH+'AdminLTE-master/';
	
		var frms = $('#myform').serialize(); 
	   		 	var rel=this.value;
			   $.ajax({
							type: "POST",
							url: serviceURLHR + "quickmail.php",
							data: frms,
							cache: false,
							beforeSend: function()
							{
				
							//$("#karygdistdiv").html('Loading..');
							
							},
							success: function(data)
							{
				
								//$("#msgs").val('');alert();
							}
	 	 });
		 
		 			
					goto_clr();
	}
	
	
	function goto_clr()
{

  document.getElementById('emailto').value = "";
    document.getElementById('subjects').value = "";
  
 $('#msgs').data("wysihtml5").editor.clear();
}
		</script>
	
<script>


var url_path=serviceURL + "advertisement.php?act=new";

var dataString = $('.save-advt').serialize();

  var formData = new FormData($('.save-advt')[0]);
  
  $.ajax({
   url: url_path,  //Server script to process data
   type: 'POST',
   data: formData,
   dataType:'json',
   processData: false,  // tell jQuery not to process the data
   contentType: false ,  // tell jQuery not to set contentType
   success: function(data)
   {
   }
   
   });
</script>

<script type="text/javascript">
holidayCalendars();
function holidayCalendars(){
	

	$("#calendars").append('<table class="calendarHolder" style="display:none;" ><tr></td><div id="calendar-div"></div></td></tr></table>');

	
	
		var calendar = $('#calendar-div').fullCalendar({
			eventSources: [ {url: "holidat.php?act=list&loggedUserId="+loggedUserId}],
			eventDrop: function(event, delta) {
				date = new Date(event.start).format("yyyy-mm-dd");
				$.get("holidat.php?act=update&title"+event.title+"&start="+date+"&id="+event.id);
			},
				 eventAfterRender: function(event, element, view) {
                      $(element).css({'width':'30px','margin-left':'30px','-webkit-border-radius':'15','border-radius':'15px','-moz-border-radius':'15px','text-align':'center','background':'#FFB802','font-weight':'bold'});
                    },
					eventMouseover: function(event, element) {
	var layer =	"<div id='events-layer' class='fc-transparent' style='position:absolute; width:95px; height:auto; top:-35px; text-align:center; z-index:100;background-color:#999999;opacity: .9;margin-left:-38px; border-radius: 25px;'>"+event.titles+"</div>";
	$(this).append(layer);
},
eventMouseout: function(event, element) {
$('#events-layer').remove();
}, 
	
			selectable: true,
			selectHelper: true,
		
		/*	eventClick: function (calEvent, jsEvent, view) {       
				 if(confirm('Are you sure from removing the event?')){
					 $.get("holidat.php?act=remove&id="+calEvent._id)
						$('#calendar-div').fullCalendar('removeEvents', calEvent._id);
				 }
			},*/
			
			loading: function(bool) {
				if (bool) $('#loading').show();
				else $('#loading').hide();
			}
			
		});
	$('.calendarHolder').show('blind',500);
	//calendar.fullCalendar()
	
}
</script>

<script type="text/javascript">

	

function clock(eid,i)
{

if(i==1){
	c= confirm("You will Sign in @ "+moment().format("h:mm a"));
}else{
	c= confirm("You will Sign out @ "+moment().format("h:mm a"));
}

if(c==true){


if(i==1)
{

$(".clockedin-admin-click").hide();
$(".clockedin-admin-click-over").show();
}
if(i==2)
{

$(".clockedin-admin-click").show();
$(".clockedin-admin-click-over").hide();
}
			   $.ajax({
							type: "POST",
							url: "clockin.php",
							data: "rel_ID="+i,
							cache: false,
							beforeSend: function()
							{
						
							$(".clockedin-admin-click").html('Loading..');
							
							},
							success: function(data) alert(data);
							{ if(i==2 || i==1){
								$(".rrr").html(data);}
							}
	 	 });
	}	 
}


function getgraph(obj)
{
//alert(obj.value);
var yrs=obj.value;

	k=1;
	document.getElementById("mnth").value = "";

	document.getElementById("atndgr").innerHTML = "";

	$.getJSON('graph_emp_attndce_branch.php?yrs='+yrs,function(data){
		document.getElementById("atndgr").innerHTML = "";
		atndce = data.name;	
		$.each(atndce, function(index, atndce) {		
			$('#atndgr').append('<input type="hidden" name="atnd'+k+'" id="atnd'+k+'" value="'+atndce.ppercnt+'">	');
			k++;			
		});
		gotograph();	
	});

}
function gotograph()
{


      google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawChart());

 }


function drawChart() {
	var empc1=Number(document.getElementById("atnd1").value);
	var empc2=Number(document.getElementById("atnd2").value);
	var empc3=Number(document.getElementById("atnd3").value);
	var empc4=Number(document.getElementById("atnd4").value);
	var empc5=Number(document.getElementById("atnd5").value);
	var empc6=Number(document.getElementById("atnd6").value);
	var empc7=Number(document.getElementById("atnd7").value);
	var empc8=Number(document.getElementById("atnd8").value);
	var empc9=Number(document.getElementById("atnd9").value);
	var empc10=Number(document.getElementById("atnd10").value);
	var empc11=Number(document.getElementById("atnd11").value);
	var empc12=Number(document.getElementById("atnd12").value);	

    var yr1=document.getElementById("dateyr1").value;
	var yr2=document.getElementById("dateyr2").value;
	var yr3=document.getElementById("dateyr3").value;
	var yr4=document.getElementById("dateyr4").value;
	var yr5=document.getElementById("dateyr5").value;
  var data = google.visualization.arrayToDataTable([
    ['Month', 'Attendance'],
    ['Jan',  empc1],
    ['Feb',  empc2],
    ['Mar',  empc3],
    ['Apr',  empc4],
    ['May',  empc5],
    ['Jun',  empc6],
    ['Jul',  empc7],
    ['Aug',  empc8],
    ['Sep',  empc9],
    ['Oct',  empc10],
    ['Nov',  empc11],
    ['Dec',  empc12]
  ]);

  var options = {
    title: 'Attendance In %',
    hAxis: {title: 'Month', titleTextStyle: {color: 'red'}},
	'chartArea': {'width': '80%', 'height': '80%'}
  };

  var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));

  chart.draw(data, options);
  }
  
///////////////////month graph////////////////////////////
 
 function getgraph_mn(obj)
 {
   var yrs=document.getElementById("yer").value;
   var mn=obj.value;

var year=yrs;
var month=mn;


	k=1;
	var days = Math.round(((new Date(year, month))-(new Date(year, month-1)))/86400000);

	document.getElementById("atndgr").innerHTML = "";
	$.getJSON('graph_emp_attndce.php?yrs='+yrs+'&mns='+mn+'&dys='+days,function(data){
		document.getElementById("atndgr").innerHTML = "";
		atndce = data.name;	
		$.each(atndce, function(index, atndce) {		
			$('#atndgr').append('<input type="hidden" name="atnd'+k+'" id="atnd'+k+'" value="'+atndce.ppercnt+'">	');
			k++;			
		});
		gotograph_mnth(year,month);	
	});
 
 
 }
 
 
 function gotograph_mnth(year,month)
{


      google.load("visualization", "1", {packages:["corechart"]});
google.setOnLoadCallback(drawCharts(year,month));

 }


function drawCharts(year,month) {  // Create and populate the data table.
var days = Math.round(((new Date(year, month))-(new Date(year, month-1)))/86400000);
var dy=[];
var pcnt=[];
for(p=1;p<=days;p++)
{
dy.push(p.toString() );
var pcc=Number(document.getElementById('atnd'+p).value);
pcnt.push(pcc);
}


var years = dy;
  var sales = pcnt;

  var data = new google.visualization.DataTable();
  data.addColumn('string', 'years');
  data.addColumn('number', 'Attendence');

  for(i = 0; i < years.length; i++)
  {
    data.addRow([years[i], sales[i]]);
	}

  // Create and draw the visualization.
  new google.visualization.ColumnChart(document.getElementById('chart_div')).
    draw(data, {});}
  
  
  function approveLeaves(id,val)
{	
/*if(val==1)
{,cnt

document.getElementById("inactimg"+cnt).src='images/active-icon.png';
//$('#inactimg').bind('click', approveLeaves(id,0));
$("#inactimg"+cnt).attr("onclick","approveLeaves("+id+",0,"+cnt+")");
$("#inactimg"+cnt).attr("id","actimg"+cnt);
}

if(val==0)
{

document.getElementById("actimg"+cnt).src='images/inactive-icon.png';
$("#actimg"+cnt).attr("onclick","approveLeaves("+id+",1,"+cnt+")");
$("#actimg"+cnt).attr("id","inactimg"+cnt);
}
*/

	var dataString='id='+id+'&status='+val;
	$.post( serviceURL+ "mookadanadmin/manageLeaves.php?act=approveleave",dataString,function(data){});
	//leaveRequests();
}
	
  
</script>
			