-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsheet.php
More file actions
219 lines (197 loc) · 5.51 KB
/
sheet.php
File metadata and controls
219 lines (197 loc) · 5.51 KB
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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html ><head>
<title>Summary Card</title>
<style type="text/css">
#headtable{border:0px; width:600px;}
#tailtable{margin:auto;}
#class{
font-size:20px;
text-align:center;
}
#term{
font-weight:bold;
font-size:20px;
text-align:center;
}
#name{
font-size:13px;
}
#sub{
font-size:14px;
}
#summary
{
border-width: 1px 1px 1px 1px;
border-spacing: 0;
border-style: solid;
width:auto;
margin:auto;
}
#summary td, th
{
margin: 0;
border-width: 1px 1px 1px 1px;
border-style: solid;
text-align:center;
}
</style>
<script language="JavaScript">
DA = (document.all) ? 1 : 0
function HandleError()
{
alert("\nNothing was printed. \n\nIf you do want to print this page, then\nclick on the printer icon in the toolbar above.")
return true;
}
</script>
</head>
<script language="VBScript">
Sub window_onunload()
On Error Resume Next
Set WB = nothing
On Error Goto 0
End Sub
Sub Print()
OLECMDID_PRINT = 6
OLECMDEXECOPT_DONTPROMPTUSER = 2
OLECMDEXECOPT_PROMPTUSER = 1
On Error Resume Next
If DA Then
call WB.ExecWB(OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER,1)
Else
call WB.IOleCommandTarget.Exec(OLECMDID_PRINT ,OLECMDEXECOPT_DONTPROMPTUSER,"","","")
End If
If Err.Number <> 0 Then
If DA Then
Alert("Nothing Printed :" & err.number & " : " & err.description)
Else
HandleError()
End if
End If
On Error Goto 0
End Sub
If DA Then
wbvers="8856F961-340A-11D0-A96B-00C04FD705A2"
Else
wbvers="EAB22AC3-30C1-11CF-A7EB-0000C05BAE0B"
End If
document.write "<object ID=""WB"" WIDTH=0 HEIGHT=0 CLASSID=""CLSID:"
document.write wbvers & """> </object>"
</script>
<body>
<table width="650" border="0" id="headtable" align="center">
<tr>
<td width="618" align="center" valign="middle" bgcolor="#FFFFFF"><font size="+2"><strong>Central Higher Secondary School for the Deaf</strong></font></td>
</tr>
<tr>
<td align="center" valign="middle" bgcolor="#FFFFFF">Naxal, Kathmandu</td>
</tr>
<?php
include("connectdb.php");
if (!empty($_GET['class'])){
$class=$_GET['class'];}
if (!empty($_GET['term'])){
$term=$_GET['term'];}
if (!empty($_GET['year'])){
$year=$_GET['year'];
printsheet($class,$term,$year);}
function printsheet($myclass,$term,$year){
?>
<tr>
<td align="center" valign="middle" bgcolor="#FFFFFF"><?php echo "<span id = 'term'><b>".ucwords($term)." Term Exam, </b><b>".$year."</b></span>"; ?></td>
</tr>
<tr>
<td align="center" valign="middle" bgcolor="#FFFFFF"><?php echo "<div id = 'class'><b>Class: </b>".$myclass."</div>"; ?></td>
</tr>
</table>
<table border="1" id = "summary">
<?php
if($myclass<=5){$numsubs=9;$group=5;}
else if($myclass<=8){$numsubs=12;$group=8;}
else {$numsubs=12;$group=10;}
printheaders($myclass);
if($term=="third"){$term = "main";}
$sql="SELECT * FROM `$term` WHERE class=$myclass ORDER by `roll` ASC";
$result = mysql_query($sql) or die(mysql_error());
if ($result){
$num = mysql_numrows($result);
for($k=0; $k<$num; $k++)
{
$row=mysql_fetch_array($result);
$id=$row['ID'];
printstat($id,$myclass,$term);
}
}?>
</table>
<?php
}
function printheaders($myclass){
?>
<tr><td>Roll</td><td>Name</td>
<?php
if($myclass<=5){$numsubs=9;$group=5;}
else if($myclass<=8){$numsubs=12;$group=8;}
else {$numsubs=12;$group=10;}
$sql="SELECT * FROM `$group`";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
for($k=1; $k<=$numsubs; $k++)
{
$row=mysql_fetch_array($result);
$sub[$k]=$row['subject'];
?>
<td><div id = "name"><?php echo $sub[$k];?></div></td>
<?php
}
}
?>
<span id = "name">
<td>Result</td>
<td>Percent</td>
<td>Rank</td>
<td>Attendance</td>
</span>
</tr>
<?php
}
function printstat($id,$myclass,$term){
?>
<tr>
<span id = "name">
<?php
if($myclass<=5){$numsubs=9;$group=5;}
else if($myclass<=8){$numsubs=12;$group=8;}
else {$numsubs=12;$group=10;}
$sql="SELECT * FROM `$term` WHERE ID=$id";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$row=mysql_fetch_array($result);
?>
<td><?php echo $row['roll'];?></td>
<td><?php echo ucwords(strtolower($row['name']));?></td>
<?php
for($i=1;$i<=$numsubs;$i++) {
?><td><?php $finalmarks[$i] = $row[$i]; echo $finalmarks[$i]; ?></td><?php
}
?><td><?php echo $row['flag']; ?></td>
<td><?php echo $row['percent']; ?></td>
<td><?php echo $row['rank']; ?></td>
<td><?php echo $row['attend']; ?></td>
</span>
</tr>
<?php
}
}
?>
<table id = "tailtable">
<tr>
<td><p>___________________<br>
Class Teacher
</p></td>
<td colspan="2"> </td>
<td>________________<br>
Principal</td>
</tr>
</table>
</body>
</html>