-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathExport.php
184 lines (148 loc) · 5.8 KB
/
Export.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
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
<?php require_once("../common/_header.php"); ?>
<?php
require_once("../includes/database.class.php"); ?>
<?php
if(isset($_POST["export"]))
{
$table = "exam_details as ED
LEFT JOIN master_college as MClg ON MClg.id = ED.college_id
LEFT JOIN exam_user as EU ON EU.exam_id = ED.id
LEFT JOIN master_user as MU ON MU.id = EU.user_id ";
$where = "1 ORDER BY seat_no ASC";
$select = "ED.*, MClg.name as college_name, EU.*, MU.name as user_name, EU.id as exam_user_id, MU.enroll_no ";
$data = $dbObj->fetchMultiple($table, $where, $select);
if($data){
foreach ($data as $key => $row) {
$table = "exam_marksheet";
$where = "exam_user_id = " . $row["exam_user_id"]; //tya student che marks ghyayche jyacha exam_user_id ha row variable madhe ahe
$select = "*";
$data[$key]["marksheet"] = $dbObj->fetchMultiple($table, $where, $select);
}
}
?>
<?php //display
if($data){
?>
<thead>
<tr>
<?php
$count=0;
$total_noof_students=0;
$dist=0;
$first=0;
$second=0;
$atkt=0;
$fail=0;
$output .= '
<table class="table" bordered="10">
<th>Name </th>
<th>Enrollment no</th>
<th>Seat no</th>
';
foreach ($data as $record_key => $record_value) {
$row = $record_value; //ekach student cha data store kela row madhe
$total_noof_students= $total_noof_students+1;
$marksheet = $row["marksheet"];
if($count==0)
{ //marksheet madhe bakicha data store na karat fakta marksheet array store kela
if($marksheet)
{
foreach ($marksheet as $key => $value)
{
$output .=
'
<th>'.$value['short_code'].'<br>'.
$value['type'].'</th>
';
}
$count=$count+1;
}
$output .= ' <th>Total </th>
<th>Result</th>
';
}
?>
</tr>
</thead><?php
?>
<?php
?>
<?php
$output .= '
<tr>
<td>'.$row['user_name'].'</td>
<td>'.$row['enroll_no'].'</td>
<td>'.$row['seat_no'].'</td>
';
foreach ($marksheet as $key => $value)
{
$output .=
'
<td>'.$value['obtained'].'
'.$value['special_char'].'</td>
';
}
$output .= '
<td>'.$row['marks_total'].'</td>
<td>'.$row['result'].'</td>
';
if($row['result']=='FIRST CLASS DIST.')
{
$dist=$dist+1;
}
if($row['result']=='FIRST CLASS' || $row['result']=='FIRST CLASS CON')
{
$first=$first+1;
}
if($row['result']=='SECOND CLASS' || $row['result']=='SECOND CLASS CON')
{
$second=$second+1;
}
if($row['result']=='A.T.K.T.')
{
$atkt=$atkt+1;
}
if($row['result']=='FAIL')
{
$fail=$fail+1;
}
?>
<?php
}
}
$output .= '</table>';
// header('Content-Type: application/xls');
// header('Content-Disposition: attachment; filename=download.xls');
echo $output;
?>
<br>
<br>
<table class="table table-bordered">
<th>Appeared</th>
<th>Distingtion</th>
<th>1st class</th>
<th>2nd class</th>
<th>Total Pass</th>
<th>A.T.K.T.</th>
<th>Fail</th>
<th>%Result</th>
<th>%Result with ATKT</th>
<?php
$total_pass=$dist+$first+$second;
$pass_per=($total_pass/$total_noof_students)*100;
$pass_per_atkt=(($total_pass+$atkt)/$total_noof_students)*100;
echo "<tr>
<td>".$total_noof_students."</td>
<td>".$dist."</td>
<td>".$first."</td>
<td>".$second."</td>
<td>".$total_pass."</td>
<td>".$atkt."</td>
<td>".$fail."</td>
<td>".$pass_per."</td>
<td>".$pass_per_atkt."</td>
</tr>";
}
?>
</table>
<?php require_once("../common/_footer.php"); ?>