-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.php
93 lines (90 loc) · 2.27 KB
/
report.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
require_once("./include/session.php");
require_once("./include/function.php");
check_permission("REPORT_VIEW");
log_event("REPORT_VIEW",$_SESSION["userid"],-1)
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" type="text/css" href="css/default.css" />
<script type="text/javascript" language="JavaScript">
</script>
<style type="text/css">
</style>
</head>
<body>
<div id="wrapper">
<?php require_once("./include/header.php"); ?>
<?php require_once("./include/nav.php"); ?>
<div id="content">
<h2>Report</h2>
Current Active Members:
<?php
$sql = "
SELECT
count(*)
FROM `tbl_youth`
LEFT JOIN (
SELECT
registrationid,
youthid,
fee,
paid,
MAX(registration_date) AS registration_date
FROM `tbl_youth_registration`
GROUP BY youthid
) AS table2
ON tbl_youth.youthid = table2.youthid
WHERE registration_date + INTERVAL 1 YEAR > now() AND
tbl_youth.delete=0";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
echo $row[0];
?>
<table border="1">
<tr>
<th>year</th>
<th># of registration</th>
<th>male</th>
<th>female</th>
<th>membership (new)</th>
<th>membership (renewal)</th>
</tr>
<?php
$sql = "
SELECT
YEAR(registration_date) AS 'colYear',
COUNT(*) AS 'Total',
SUM(CASE WHEN gender='Male' THEN 1 ELSE 0 END) AS 'Male',
SUM(CASE WHEN gender='Female' THEN 1 ELSE 0 END) AS 'Female'
FROM
`tbl_youth`
INNER JOIN `tbl_youth_registration`
ON tbl_youth.youthid = tbl_youth_registration.youthid
WHERE
tbl_youth.delete=0
GROUP BY
colYear
ORDER BY
colYear DESC";
$result = mysql_query($sql);
while($row=mysql_fetch_array($result))
{
echo '<tr>';
echo '<td>' . $row[0] . '</td>';
echo '<td>' . $row[1] . '</td>';
echo '<td>' . $row[2] . '</td>';
echo '<td>' . $row[3] . '</td>';
echo '<td></td>';
echo '<td></td>';
echo '</tr>';
}
?>
</table>
</div>
<?php require_once("./include/footer.php"); ?>
</div>
</body>
</html>