<?php
#ini_set('display_errors',1);
#error_reporting(E_ALL);
session_start();
include ('start.php'); ## ÑÑиÑаем вÑÐµÐ¼Ñ Ð½Ð° генеÑаÑÐ¸Ñ ÑÑÑаниÑÑ
require ('functions/base.functions.php');
include ('classes/global.class.php');
set_lang($_SESSION['lang']);
$login_type = new users();
if ($_SESSION['permissions']['fd'] !== "1"){
Header("Location: timesheet.php");
exit();
}
$year = isset($_GET['year'])? $_GET['year'] : date(Y);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="css/jqueryslidemenu.css" />
<link rel="stylesheet" href="css/green/style.css" type="text/css" media="print, projection, screen" />
<link rel="stylesheet" href="js/addons/pager/jquery.tablesorter.pager.css" type="text/css" media="print, projection, screen" />
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.1.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.tablesorter.js"></script>
<script type="text/javascript" src="js/jqueryslidemenu.js"></script>
<script type="text/javascript" src="js/addons/pager/jquery.tablesorter.pager.js"></script>
<link rel="stylesheet" href="js/addons/pager/jquery.tablesorter.pager.css" type="text/css" media="print, projection, screen" />
<!--[if lte IE 7]>
<style type="text/css">
html .jqueryslidemenu{height: 1%;} /*Holly Hack for IE7 and below*/
</style>
<![endif]-->
<title>Year Stats</title>
</head>
<body>
<?php
#add menu
include ('include/menu.reports.inc.html');
$stats= new Stats;
echo '<table class="tablesorter" cellspacing="1"><tr>';
echo '<th>'.gettext('stats').'</th>';
for($i=1;$i<13;$i++){
echo '<th>'.gettext('month_'.$i.'').'</th>';
}
echo '<th>ÐÑего</th>';
echo '</tr>';
$ftee = $stats->getFTEEyear($year);
echo '<tr><td>'.gettext('ftee').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.round($ftee[$i],2).'</td>';
}
echo '<td>ÐÑего</td>';
echo '</tr>';
$br = $stats->getFTEEyear($year);
echo '<tr><td>'.gettext('br').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.round($ftee[$i],2).'</td>';
}
echo '<td>ÐÑего</td>';
echo '</tr>';
$by_project = $stats->getAllhoursYearByTypes($year);
echo '<tr><td>'.gettext('projects').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.$by_project[$i]['project'].'</td>';
$summ += $by_project[$i]['project'];
}
echo '<td>'.$summ.'</td>';unset($summ);
echo '</tr>';
echo '<tr><td>'.gettext('tenders').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.$by_project[$i]['tender'].'</td>';
$summ += $by_project[$i]['tender'];
}
echo '<td>'.$summ.'</td>';unset($summ);
echo '</tr>';
echo '<tr><td>'.gettext('office').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.$by_project[$i]['office'].'</td>';
$summ += $by_project[$i]['office'];
}
echo '<td>'.$summ.'</td>';unset($summ);
echo '</tr>';
echo '<tr><td>'.gettext('off_hours').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.$by_project[$i]['off_hours'].'</td>';
$summ += $by_project[$i]['off_hours'];
}
echo '<td>'.$summ.'</td>';unset($summ);
echo '</tr>';
$idle_hours = $stats->getAllhoursYearByProject($year,'38');
echo '<tr><td>'.gettext('idle_hours').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.$idle_hours[$i].'</td>';
$summ += $idle_hours[$i];
}
echo '<td>'.$summ.'</td>';unset($summ);
echo '</tr>';
$vacation = $stats->getAllhoursYearByProject($year,'4');
echo '<tr><td>'.gettext('vacation').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.$vacation[$i].'</td>';
$summ += $vacation[$i];
}
echo '<td>'.$summ.'</td>';unset($summ);
echo '</tr>';
$paid_abs = $stats->getAllhoursYearByProject($year,'28');
echo '<tr><td>'.gettext('paid_abs').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.$paid_abs[$i].'</td>';
$summ += $paid_abs[$i];
}
echo '<td>'.$summ.'</td>';unset($summ);
echo '</tr>';
$unpaid_abs = $stats->getAllhoursYearByProject($year,'5');
echo '<tr><td>'.gettext('paid_abs').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.$unpaid_abs[$i].'</td>';
$summ += $unpaid_abs[$i];
}
echo '<td>'.$summ.'</td>';unset($summ);
echo '</tr>';
$users = $stats->getUsersFromBase($year);
echo '<tr><td>'.gettext('users').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.$users[$i].'</td>';
$summ += $users[$i];
}
echo '<td>'.$summ.'</td>';unset($summ);
echo '</tr>';
$all_hours = $stats->getAllhoursYear($year);
echo '<tr><td>'.gettext('all hours').'</td>';
for($i=1;$i<13;$i++){
echo '<td>'.$all_hours[$i].'</td>';
$summ += $all_hours[$i];
}
echo '<td>'.$summ.'</td>';unset($summ);
echo '</tr>';
echo "</table>";
include ('end.php');
?>