-
Notifications
You must be signed in to change notification settings - Fork 0
/
ec_distsum.php
154 lines (120 loc) · 4.31 KB
/
ec_distsum.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
// ec_his.php
// $Revision: 1.2 - $Date: 2008-08-10 10:12:48-04 $
//
// arpsc_ecrept displays the FSD-212 results for a month. If there
// are no parameters, the most recent period is displayed, otherwise
// the requested period is displayed.
//
include('includes/session.inc');
$title=_('Michigan Section FSD-212');
include('includes/functions.inc');
// Remember the launch time
$starttime = strftime("%A, %B %d %Y, %H:%M");
// Open the database
$db = mysql_connect($host , $dbuser, $dbpassword);
mysql_select_db($DatabaseName,$db);
$start = 144;
$end = 155;
// $period=92;
// Get the requested period, if blank choose the latest
$period = $_GET['period'];
if ( $period < 1 )
{
$SQL="SELECT MAX(`period`) FROM `arpsc_ecrept`";
$period = singleResult($SQL,$db);;
}
$p9 = $start;
$p1 = $end;
// Display the month name for this report
$SQL = 'SELECT lastday FROM `periods` WHERE `periodno`=' . $period;
$usedate=singleResult($SQL,$db);
$monthnames = array('J','F','M','A','M','J','J','A','S','O','N','D');
ARESheader($title,"ARPSC Michigan Section FSD-212");
ARESleftBar( $db );
echo ' <div id="main">' . "\n";
echo " <p><h1><center>FSD-212 Reporting History - 2012</center></h1></p>\n";
echo " <center>\n";
echo " <table width=\"60%\">\n";
echo "\t<tr>\n";
echo " <th class=\"rowS0\">Dist</th>\n";
echo " <th class=\"rowS0\">County</th>\n";
/*for ( $i=$start; $i<$end+1; $i++ )
{
$index = $i % 12;
echo "\t\t<td class=\"rowS0\" width=\"15px\">" . $monthnames[$index] . "</td>\n";
}*/
echo "\t\t<th>Reports<br />Rec'd</th>\n";
echo "\t</tr>\n";
// CSS classes used in the table
$s0="class=\"rowS0\"";
$s1="class=\"rowS1\"";
$s1B="class=\"rowS1B\"";
$s1S="class=\"rowS1S\"";
$s1L="class=\"rowS1L\"";
$s2="class=\"rowS2\"";
$s2S="class=\"rowS2S\"";
//==================================================================================================
// D e t a i l L i n e s
//==================================================================================================
$q1='SELECT `districtkey`, `district_code` from `arpsc_districts` ORDER BY `district_code`';
$r1=getResult($q1,$db);
$olddistrict=0;
$totalhours = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
$reports = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
while ( $row1 = getRow($r1,$db) )
{
$district=$row1[1];
$q2="SELECT `countyname`, `countycode` FROM `arpsc_counties` WHERE `district`='" .
$district . "' ORDER BY `countyname`";
$r2=getResult($q2,$db);
if ( $district < ":" )
{
echo "\t<tr></tr>\n";
$sqlc='SELECT COUNT(*) FROM `arpsc_counties` WHERE `district`='
. $district;
$lc=singleResult($sqlc,$db);
/* For each county */
while ( $row2 = getRow($r2,$db) )
{
$countycount = 0;
$q3='SELECT `period`, `drillshrs`,`pseshrs`,`eopshrs`,`aresops` ' .
"FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] .
"' AND `period` BETWEEN " . $start . ' AND ' . $end;
$r3=getResult($q3,$db);
$reported = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
while ( $row3 = getRow($r3,$db) )
{
$countycount++;
$index = $row3[0] - $start;
$reported[$index] = 1;
$totalhours[$index]=$totalhours[$index]+
$row3[1]+$row3[2]+$row3[3]+$row3[4];
$reports[$index] = $reports[$index] + 1;
}
echo "\t<tr>\n";
if ( $district != $olddistrict )
{
echo "\t\t<td " . $s1B . " rowspan=\"" . $lc . "\">" . $district . " </td>\n";
$olddistrict = $district;
}
echo "\t\t<td " . $s1S . "><a href=\"ecrpti.php?county=". $row2[1] .
"\">" . $row2[0] . "</a> </td>\n";
echo "<td class=\"rowS0\">" . $countycount . "</td>\n";
echo "\t</tr>\n";
}
}
}
echo " </table>\n";
echo " </center>\n";
echo " <p>Note that \"report received\" does not necessarily indicate that report was received\n";
echo " in time to be reported to headquarters. Reports received late or data included in later\n";
echo " reports is added to the database to make the data as complete as possible.</p>\n";
echo " </div>\n\n";
sectLeaders($db);
footer($starttime . "Z",$maxdate,
"\$Revision: 1.2 $ - \$Date: 2008-08-10 16:06:57-04 $");
?>
</div>
</body>
</html>