Mini Kabibi Habibi
Current Path : C:/Users/ITO/Desktop/ |
|
Current File : C:/Users/ITO/Desktop/accomplishments_overview.php |
<?php
@include 'include/config.php';
session_start();
if (!isset($_SESSION['username'])) {
header('Location: login.php');
exit();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Accomplishments Overview - PROJECT COURSE</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="images/favicon.ico" type="image/ico" />
<link href="../vendors/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<link href="../vendors/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="../vendors/nprogress/nprogress.css" rel="stylesheet">
<link href="../vendors/iCheck/skins/flat/green.css" rel="stylesheet">
<link href="../vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css" rel="stylesheet">
<link href="../vendors/jqvmap/dist/jqvmap.min.css" rel="stylesheet"/>
<link href="../vendors/bootstrap-daterangepicker/daterangepicker.css" rel="stylesheet">
<link href="../build/css/custom.min.css" rel="stylesheet">
<!-- Custom Style to Prevent Line Breaks in Month -->
<style>
.nowrap-month {
white-space: nowrap;
}
</style>
</head>
<body class="nav-md">
<div class="container body">
<div class="main_container">
<!-- Sidebar -->
<div class="col-md-3 left_col">
<div class="left_col scroll-view">
<div class="navbar nav_title" style="border: 0;">
<a href="admin_index.php" class="site_title"><i class="fa fa-spinner"></i> <span>PROJ. COURSE</span></a>
</div>
<div class="clearfix"></div>
<div class="profile clearfix">
<div class="profile_info">
<span>Welcome,</span>
<h2><?php echo htmlspecialchars($_SESSION['username']); ?></h2>
</div>
</div>
<br />
<!-- Sidebar Menu -->
<div id="sidebar-menu" class="main_menu_side hidden-print main_menu">
<div class="menu_section">
<h3>General</h3>
<ul class="nav side-menu">
<li><a><i class=""></i> Home <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="admin_index.php">Dashboard</a></li>
</ul>
</li>
<li><a><i class=""></i> Activities <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="form.php">View Activities</a></li>
</ul>
</li>
<li><a><i class="glyphicon glyphicon"></i> Daiy Accomplishments<span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="accomplishments_overview.php">All Accomplishments</a></li>
<li><a href="accomplishments_overview.php?designation=EPS">EPS</a></li>
<li><a href="accomplishments_overview.php?designation=PSDS">PSDS</a></li>
<li><a href="accomplishments_overview.php?designation=ALS">ALS</a></li>
</ul>
</li>
<li><a><i class="glyphicon glyphicon"></i> Monthly Accomplishment Reports <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="admin_monthly_reports_view.php">View Monthly Reports</a></li>
</ul>
</li>
<li><a><i class="glyphicon glyphicon"></i> MISTA Plans <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="admin_mistap_view.php">View MISTA Plans</a></li>
</ul>
</li>
<li><a><i class="glyphicon glyphicon"></i> MISTA Reports <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="admin_mistar_view.php">View MISTA Reports</a></li>
</ul>
</li>
<li><a><i class="glyphicon glyphicon"></i> MCAIS Reports <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="admin_mcais_view.php">View MCAIS Reports</a></li>
</ul>
</li>
<li><a><i class="glyphicon glyphicon"></i> QCAIS Reports <span class="fa fa-chevron-down"></span></a>
<ul class="nav child_menu">
<li><a href="create_qcais_report.php">Create QCAIS Report</a></li>
<li><a href="view_qcais_reports.php">View QCAIS Reports</a></li>
</ul>
</li>
</div>
</div>
<div class="sidebar-footer hidden-small">
<a title="Settings"><span class="glyphicon glyphicon-cog"></span></a>
<a title="FullScreen"><span class="glyphicon glyphicon-fullscreen"></span></a>
<a title="Lock"><span class="glyphicon glyphicon-eye-close"></span></a>
<a title="Logout" href="logout.php"><span class="glyphicon glyphicon-off"></span></a>
</div>
</div>
</div>
<!-- Top Navigation -->
<div class="top_nav">
<div class="nav_menu">
<div class="nav toggle"><a id="menu_toggle"><i class="fa fa-bars"></i></a></div>
<nav class="nav navbar-nav">
<ul class="navbar-right">
<li class="nav-item dropdown open" style="padding-left: 15px;">
<a href="javascript:;" class="user-profile dropdown-toggle" data-toggle="dropdown">
<?php echo htmlspecialchars($_SESSION['username']); ?>
<span class="fa fa-angle-down"></span>
</a>
<div class="dropdown-menu dropdown-usermenu pull-right">
<a class="dropdown-item" href="index.php"><i class="fa fa-sign-out pull-right"></i> Log Out</a>
</div>
</li>
</ul>
</nav>
</div>
</div>
<!-- Page Content -->
<div class="right_col" role="main">
<div class="clearfix"></div>
<div class="row">
<div class="col-md-12 col-sm-12">
<div class="x_panel">
<div class="x_title">
<h2>
Submitted Accomplishment Reports
<?php
if (!empty($_GET['designation'])) {
echo " - " . htmlspecialchars($_GET['designation']);
}
?>
</h2>
<div class="clearfix"></div>
</div>
<div class="x_content">
<form method="GET" class="form-inline mb-3">
<?php if (!empty($_GET['designation'])): ?>
<input type="hidden" name="designation" value="<?php echo htmlspecialchars($_GET['designation']); ?>">
<?php endif; ?>
</form>
<?php
// Fetch overall yearly totals
$sql_yearly = "
SELECT
YEAR(date_added) AS report_year,
SUM(no_of_shs_provided_ta) AS total_shs_ta,
SUM(no_of_teachers_observed) AS total_teachers_observed,
SUM(no_of_teachers_provided_ta) AS total_teachers_provided_ta
FROM daily_accomplishments
";
if (!empty($_GET['designation'])) {
$sql_yearly .= " WHERE designation = ?";
}
$sql_yearly .= " GROUP BY YEAR(date_added)
ORDER BY report_year DESC";
$stmt_yearly = $conn->prepare($sql_yearly);
if ($stmt_yearly === false) {
echo "<div class='alert alert-danger'>Query error: " . $conn->error . "</div>";
} else {
if (!empty($_GET['designation'])) {
$stmt_yearly->bind_param('s', $_GET['designation']);
}
$stmt_yearly->execute();
$result_yearly = $stmt_yearly->get_result();
if ($result_yearly->num_rows > 0) {
echo "<h6>Overall Yearly Total</h6>";
echo "<table class='table table-bordered'>";
echo "<thead><tr>
<th>Year</th>
<th>Total SHs Provided TA</th>
<th>Total Teachers Observed</th>
<th>Total Teachers Provided TA</th>
</tr></thead><tbody>";
while ($row_yearly = $result_yearly->fetch_assoc()) {
echo "<tr>
<td>" . htmlspecialchars($row_yearly['report_year']) . "</td>
<td>" . htmlspecialchars($row_yearly['total_shs_ta']) . "</td>
<td>" . htmlspecialchars($row_yearly['total_teachers_observed']) . "</td>
<td>" . htmlspecialchars($row_yearly['total_teachers_provided_ta']) . "</td>
</tr>";
}
echo "</tbody></table><br>";
} else {
echo "<div class='alert alert-info'>No yearly totals available.</div>";
}
$stmt_yearly->close();
}
// Fetch overall monthly totals
$sql_total = "
SELECT
MONTH(date_added) AS report_month,
YEAR(date_added) AS report_year,
SUM(no_of_shs_provided_ta) AS total_shs_ta,
SUM(no_of_teachers_observed) AS total_teachers_observed,
SUM(no_of_teachers_provided_ta) AS total_teachers_provided_ta
FROM daily_accomplishments
";
if (!empty($_GET['designation'])) {
$sql_total .= " WHERE designation = ?";
}
$sql_total .= " GROUP BY YEAR(date_added), MONTH(date_added)
ORDER BY report_year DESC, report_month DESC";
$stmt_total = $conn->prepare($sql_total);
if ($stmt_total === false) {
echo "<div class='alert alert-danger'>Query error: " . $conn->error . "</div>";
} else {
if (!empty($_GET['designation'])) {
$stmt_total->bind_param('s', $_GET['designation']);
}
$stmt_total->execute();
$result_total = $stmt_total->get_result();
if ($result_total->num_rows > 0) {
echo "<h6>Overall Monthly Total</h6>";
echo "<table class='table table-bordered'>";
echo "<thead><tr>
<th>Month</th>
<th>Total SHs Provided TA</th>
<th>Total Teachers Observed</th>
<th>Total Teachers Provided TA</th>
</tr></thead><tbody>";
while ($row_total = $result_total->fetch_assoc()) {
$month_year = date("F Y", strtotime($row_total['report_year'] . '-' . $row_total['report_month'] . '-01'));
echo "<tr>
<td style='white-space: nowrap;'>" . $month_year . "</td>
<td>" . htmlspecialchars($row_total['total_shs_ta']) . "</td>
<td>" . htmlspecialchars($row_total['total_teachers_observed']) . "</td>
<td>" . htmlspecialchars($row_total['total_teachers_provided_ta']) . "</td>
</tr>";
}
echo "</tbody></table><br>";
} else {
echo "<div class='alert alert-info'>No monthly totals available.</div>";
}
$stmt_total->close();
}
?>
<div class="table-responsive">
<table class="table table-striped jambo_table bulk_action">
<thead>
<tr class="headings">
<th>Name</th>
<th>Designation</th>
<th>No. of SHs Provided TA (Monthly Total)</th>
<th>No. of Teachers Observed (Monthly Total)</th>
<th>No. of Teachers Provided TA (Monthly Total)</th>
<th>Month</th>
</tr>
</thead>
<tbody>
<?php
$conditions = [];
$params = [];
$types = '';
if (!empty($_GET['designation'])) {
$conditions[] = "designation = ?";
$params[] = $_GET['designation'];
$types .= 's';
}
$sql = "
SELECT
name,
designation,
MONTH(date_added) AS report_month,
YEAR(date_added) AS report_year,
SUM(no_of_shs_provided_ta) AS total_shs_ta,
SUM(no_of_teachers_observed) AS total_teachers_observed,
SUM(no_of_teachers_provided_ta) AS total_teachers_provided_ta
FROM daily_accomplishments
";
if (!empty($conditions)) {
$sql .= " WHERE " . implode(" AND ", $conditions);
}
$sql .= " GROUP BY name, designation, YEAR(date_added), MONTH(date_added)
ORDER BY report_year DESC, report_month DESC, name ASC";
$stmt = $conn->prepare($sql);
if ($stmt === false) {
echo "<tr><td colspan='6'>Query error: " . $conn->error . "</td></tr>";
} else {
if (!empty($params)) {
$stmt->bind_param($types, ...$params);
}
$stmt->execute();
$result = $stmt->get_result();
if ($result->num_rows > 0) {
while ($row = $result->fetch_assoc()) {
echo "<tr>
<td>" . htmlspecialchars($row['name']) . "</td>
<td>" . htmlspecialchars($row['designation']) . "</td>
<td>" . htmlspecialchars($row['total_shs_ta']) . "</td>
<td>" . htmlspecialchars($row['total_teachers_observed']) . "</td>
<td>" . htmlspecialchars($row['total_teachers_provided_ta']) . "</td>
<td class='nowrap-month'>" . date("F Y", strtotime($row['report_year'] . '-' . $row['report_month'] . '-01')) . "</td>
</tr>";
}
} else {
echo "<tr><td colspan='6'>No results found.</td></tr>";
}
$stmt->close();
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<footer>
<div class="pull-right">
SDO BATANGAS CITY - CID PROJECT COURSE
</div>
<div class="clearfix"></div>
</footer>
</div>
</div>
<script src="../vendors/jquery/dist/jquery.min.js"></script>
<script src="../vendors/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="../vendors/fastclick/lib/fastclick.js"></script>
<script src="../vendors/nprogress/nprogress.js"></script>
<script src="../vendors/iCheck/icheck.min.js"></script>
<script src="../build/js/custom.min.js"></script>
</body>
</html>