-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patholdreportcard.php
More file actions
383 lines (346 loc) · 10.2 KB
/
oldreportcard.php
File metadata and controls
383 lines (346 loc) · 10.2 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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
<!DOCTYPE html >
<head>
<title>Report Card</title>
<style type="text/css">
#markstable, #totaltable,#resulttable
{
border-width: 1px 1px 1px 1px;
border-spacing: 0;
border-style: solid;
}
#markstable td, th
{
margin: 0;
border-width: 1px 1px 0px 0px;
border-style: solid;
}
#totaltable td, th
{
margin: 0;
border-width: 0px 1px 0px 0px;
border-style: solid;
}
#endtable td, th
{
margin: 0;
border-width: 1px 1px 1px 1px;
border-style: solid;
}
</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>
</head>
<body>
<?php
//}
function str($terms){
if($terms=="first") {$txt = "First Term";}
if($terms=="second") {$txt = "Second Term";}
if($terms=="third") {$txt = "Final";}
return $txt;
}
function getname($sid){
$sql="SELECT * FROM main where ID=$sid";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$row=mysql_fetch_array($result);
$name=$row['name'];
}
return $name;
}
function getclass($sid){
$sql="SELECT * FROM main where ID=$sid";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$row=mysql_fetch_array($result);
$class=$row['class'];
}
return $class;
}
function getroll($sid){
$sql="SELECT * FROM main where ID=$sid";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$row=mysql_fetch_array($result);
$roll=$row['roll'];
}
return $roll;
}
?>
<?php
include("connectdb.php");
$sid=$_GET['sid'];
//$this_term=$_GET['term'];
$myname=getname($sid);
$first="first";
$second="second";
$resultpf="";
$percent=0;
$attend=0;
$rank=0;
$terms=$_GET['term'];
$historymain = "historymain";
$historyfirst = "historyfirst";
$historysecond = "historysecond";
$historythird = "historythird";
//$terms="third";
$actfm[14]=0;$actpm[14]=0;
//showresults($sid,$first);
//start of logic
//$marks[20]=0;
//$myclass=0;
//$numsubs=0;
//$sub[20]="";
//$fm[20]=0;
//$pm[20]=0;
//$flag[20]="";
//function showresults($sid,$terms)
//{
$myclass=getclass($sid);
if($myclass<=5){$numsubs=9;$group=5;}
else if($myclass<=8){$numsubs=12;$group=8;}
else {$numsubs=12;$group=10;}
$sql="SELECT * FROM $historymain where ID=$sid ";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$row=mysql_fetch_array($result);
for($i=1;$i<=$numsubs;$i++) {$marks[$i] = $row[$i];}
}
$sql="SELECT * FROM `first` where ID=$sid";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$row=mysql_fetch_array($result);
for($i=1;$i<=$numsubs;$i++) {$firstmarks[$i] = $row[$i];}
}
$sql="SELECT * FROM `second` where ID=$sid";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$row=mysql_fetch_array($result);
for($i=1;$i<=$numsubs;$i++) {$secondmarks[$i] = $row[$i];}
}
$sql="SELECT * FROM `third` where ID=$sid";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$row=mysql_fetch_array($result);
for($i=1;$i<=$numsubs;$i++) {$thirdmarks[$i] = $row[$i];}
}
if($terms=="third"){
$sql="SELECT * FROM `main` where ID=$sid";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$row=mysql_fetch_array($result);
for($i=1;$i<=$numsubs;$i++) {$finalmarks[$i] = $row[$i];$resultpf=$row['flag'];$attend=$row['attend'];$percent=$row['percent'];$rank=$row['rank'];}
}
}
if ($terms!="third"){
$sql="SELECT * FROM $terms where ID=$sid";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$row=mysql_fetch_array($result);
for($i=1;$i<=$numsubs;$i++) {$resultpf=$row['flag'];$attend=$row['attend'];$percent=$row['percent'];$rank=$row['rank'];}
}
}
$sql="SELECT * FROM `$group`";
$result = mysql_query($sql) or die(mysql_error());
if($result)
{
$totalfm=0;
for($k=1; $k<=$numsubs; $k++)
{
$row=mysql_fetch_array($result);
$sub[$k]=$row['subject'];
$fm[$k]=$row['FM'];
$actfm[$k]=$fm[$k];
$totalfm=$totalfm+$fm[$k];
if ($terms=="first"){$fm[$k]=$row['FM']*1/10;$dpfm[$k]=$row['FM'];}
else if ($terms=="second"){$fm[$k]=$row['FM']*3/10;$dpfm[$k]=$row['FM'];}
else if ($terms=="third"){$fm[$k]=$row['FM']*6/10;$dpfm[$k]=$row['FM'];}
$flag[$k]=$row['flag'];
if($myclass<=5){
$pm[$k]=(4/10)*$fm[$k];
$actpm[$k]=(4/10)*$actfm[$k];
}
else if ($myclass<=10 && $flag[$k]=='T'){
$pm[$k]=(32/100)*$fm[$k];
$actpm[$k]=(32/100)*$actfm[$k];}
else if ($myclass<=10 && $flag[$k]=='P'){
$pm[$k]=(4/10)*$fm[$k];
$actpm[$k]=(4/10)*$actfm[$k];}
else
echo "There is apparently something wrong with the full marks in the database. Please contact your administrator.";
}
}
//end of logic
//rowdisplay($numsubs);
?>
<table width="650" border="0" id="headtable">
<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>
<tr>
<td align="center" valign="middle" bgcolor="#FFFFFF"><?php echo str($terms);?> Examination, 2068</td>
</tr>
</table>
<br>
<table width="655" border="0" id="nametable">
<tr>
<td width="420">Name: <?php echo getname($sid);?></td>
<td width="136">Class: <?php echo getclass($sid);?></td>
<td width="85">Roll: <?php echo getroll($sid);?></td>
</tr>
</table>
<table width="625" border="1">
<tr align="center" valign="middle">
<td width="40" rowspan="2"><strong>SN</strong></td>
<td width="195" rowspan="2"><strong>Subjects</strong></td>
<td width="39" rowspan="2"><strong>FM</strong></td>
<td width="39" rowspan="2"><strong>PM</strong></td>
<td width="83" rowspan="2"><strong>Term Marks</strong><br></td>
<td colspan="4"><strong>Annual Result</strong></td>
</tr>
<tr>
<td width="39" align="center"><font size="-2">I (10%)</font></td>
<td width="40" align="center">II (30%)</td>
<td width="42" align="center">III (60%)</td>
<td width="50" align="center">Total</td>
</tr>
</table>
<table width="627" border="0" id="markstable">
<?php
$full_fm=0;
$full_pm=0;
$grandfinal=0;
for($k=1; $k<=$numsubs; $k++)
{?>
<tr>
<td width="42" rowspan="2" align="center"><?php echo $k;?></td>
<td width="209" rowspan="2" valign="middle"><?php echo $sub[$k];?></td>
<td width="42" rowspan="2" align="center"><?php echo $actfm[$k];?></td>
<td width="42" rowspan="2" align="center"><?php echo $actpm[$k];?></td>
<td width="90" rowspan="2" align="center"><?php
//pf lgic
if($marks[$k]<$actpm[$k]){
echo $marks[$k]."*";
}
else
echo $marks[$k];?></td>
</tr>
<tr>
<td width="42" height="30" align="center"><?php if ($terms == "first" || $terms == "third" ){echo round($firstmarks[$k]*10/$actfm[$k],1);} ?></td>
<td width="42" align="center"><?php if ($terms == "second" || $terms == "third" ){echo round($secondmarks[$k]*30/$actfm[$k],1);} ?></td>
<td width="42" align="center"><?php if ($terms == "third" || $terms == "third" ){echo round($thirdmarks[$k]*60/$actfm[$k],1);} ?></td>
<td width="51" align="center"><?php
//////////////////////////////////////////////////////////////////
$full_pm = $full_pm+$actpm[$k];
if($terms=="third"){
$grandfinal=$grandfinal+$finalmarks[$k];
if($finalmarks[$k]>= $actpm[$k])
echo $finalmarks[$k];
else
echo $finalmarks[$k]."*";
}
else{
$grandfinal=$grandfinal+$marks[$k];
if($marks[$k]>= $actpm[$k])
echo $marks[$k];
else
echo $marks[$k]."*";
}
?></td>
</tr>
<?php } ?>
</table>
<table width="627" border="0" id="totaltable">
<tr>
<td width="43"><strong>Total</strong></td>
<td width="209"> </td>
<td width="29"><strong><?php echo $totalfm; ?></strong></td>
<td width="31" align="center"><strong><?php echo $full_pm; ?></strong></td>
<td width="90"> </td>
<td width="128"> </td>
<td width="51" align="center"><strong><?php echo $grandfinal; ?></strong></td>
</tr>
</table>
<br>
<table width="627" border="0" id="resulttable">
<tr id="endtable">
<td width="157" align="left" valign="top">Result: <strong>
<?php if ($resultpf=="P"){echo "Pass";} else if($resultpf=="F"){echo "<b>Fail</b>";} ?>
</strong></td>
<td width="171" align="left" valign="top">Percentage: <?php echo $percent."%"; ?></td>
<td width="135" align="left" valign="top">Position: <?php if ($resultpf=="P"){echo $rank;} else if($resultpf=="F"){echo "";}?></td>
<td width="146" align="left" valign="top">Attendance: <?php echo $attend; ?></td>
</tr>
<tr>
<td height="55" colspan="4" valign="top"><br>
Teacher's Comments:<br>
<table width="592" height="62" border="1" id="comment-table">
<tr>
<td width="582" height="56"> </td>
</tr>
</table><br></td>
</tr>
<tr>
<td><p>___________________<br>
Class Teacher
</p></td>
<td colspan="2"> Date: <?php echo date("j/n/Y")?></td>
<td>________________<br>
Principal</td>
</tr>
</table>
<p> </p>
</body>
</html>