-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathlistdatanilaisiswadetail.php
239 lines (223 loc) · 10.5 KB
/
listdatanilaisiswadetail.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
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
<?php
$ds = mysql_fetch_array(mysql_query("SELECT nis, nama_siswa FROM `data_siswa` WHERE nis = '".$_GET['nis']."'"));
/*
$dk = mysql_fetch_array(mysql_query("SELECT k.`nama_kelas`, b.thn_ajaran, k.kode_kelas FROM `data_belajar` b LEFT JOIN `data_kelas` k ON k.`kode_kelas` = b.`kode_kelas` WHERE nis = '".$_GET['nis']."' GROUP BY b.`kode_kelas`"));
*/
$dk = mysql_fetch_array(mysql_query("select * from data_kelas where kode_kelas = '".$_GET['kelas']."'"));
?>
<title>Nilai Rapor <?php echo $ds['nama_siswa']; ?> [<?php echo $ds['nis']; ?>] - <?php echo $dk['nama_kelas']; ?></title>
<table width="100%" border="0">
<tr>
<td align="center"><h2>NILAI RAPOR</h2></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><table width="50%" border="0">
<tr>
<td width="24%">Nama Siswa</td>
<td width="3%">:</td>
<td width="73%"><strong><?php echo $ds['nama_siswa']; ?></strong></td>
</tr>
<tr>
<td>NIS</td>
<td>:</td>
<td><?php echo $ds['nis']; ?></td>
</tr>
<tr>
<td>Kelas</td>
<td>:</td>
<td><?php echo $dk['nama_kelas']; ?></td>
</tr>
<tr>
<td>Semester</td>
<td>:</td>
<td><?php echo $_GET['semester']; ?></td>
</tr>
</table></td>
</tr>
<tr>
<td><table width="100%" border="1" style="border-collapse:collapse; border: 1px solid #000;display:table;">
<tr>
<td colspan="2" rowspan="2" align="center" valign="middle" bgcolor="#CCCCCC">Program Pendidikan dan Pelatihan</td>
<td colspan="2" bgcolor="#CCCCCC"><div align="center"><strong>Nilai Pengetahuan</strong></div></td>
<td colspan="2" bgcolor="#CCCCCC"><div align="center"><strong>Nilai Keterampilan</strong></div></td>
<td colspan="2" bgcolor="#CCCCCC"><div align="center"><strong>Nilai Sikap</strong></div></td>
</tr>
<tr>
<td width="7%" bgcolor="#CCCCCC"><div align="center">Angka</div></td>
<td width="7%" bgcolor="#CCCCCC"><div align="center">Huruf</div></td>
<td width="7%" bgcolor="#CCCCCC"><div align="center">Angka</div></td>
<td width="7%" bgcolor="#CCCCCC"><div align="center">Huruf</div></td>
<td width="7%" bgcolor="#CCCCCC"><div align="center">Angka</div></td>
<td width="9%" bgcolor="#CCCCCC"><div align="center">Huruf</div></td>
</tr>
<?php
$no = 1;
$a = 0;
$nilairatarata1 = 0;
$nilairatarata2 = 0;
$nilairatarata3 = 0;
$qbl = mysql_query("SELECT b.`id_belajar`, p.`nama_pelajaran`, b.thn_ajaran, b.kode_pelajaran, b.nip, b.kode_kelas
FROM `data_belajar` b
LEFT JOIN `data_pelajaran` p ON p.`kode_pelajaran` = b.`kode_pelajaran`
LEFT JOIN data_siswa s ON b.`kode_kelas` = s.`kode_kelas` AND b.`kode_kelas` = '".$_GET['kelas']."'
WHERE nis = '".$_GET['nis']."'");
while($dbl = mysql_fetch_array($qbl)) {
//nilai angka pengetahuan ============================================================================================
$dnp = mysql_fetch_array(mysql_query("SELECT SUM(uh1+uh2+uh3+uh4+uh5) AS total_uh, uts, uas FROM nilai_pengetahuan
WHERE nis = '".$_GET['nis']."' AND tahun_ajaran = '".$dbl['thn_ajaran']."' AND nip = '".$dbl['nip']."' AND kode_pelajaran = '".$dbl['kode_pelajaran']."' AND kode_kelas = '".$dbl['kode_kelas']."' AND semester = '".$_GET['semester']."'"));
$nilaiproses = $dnp['total_uh'] / 5;
$nilaiangka1 = $nilaiproses + $dnp['uts'];
$nilaiangka2 = $dnp['uas']*3;
$nilaiangka3 = $nilaiangka1 + $nilaiangka2;
$nilaiangka4 = $nilaiangka3/5;
//nilai predikat
if($nilaiangka4 > 95) {
$predikat = "A";
} elseif($nilaiangka4 > 90) {
$predikat = "A-";
} elseif($nilaiangka4 > 85) {
$predikat = "B+";
} elseif($nilaiangka4 > 80) {
$predikat = "B";
} elseif($nilaiangka4 > 74) {
$predikat = "B-";
} elseif($nilaiangka4 > 69) {
$predikat = "C+";
} elseif($nilaiangka4 > 64) {
$predikat = "C";
} elseif($nilaiangka4 > 59) {
$predikat = "C-";
} elseif($nilaiangka4 > 54) {
$predikat = "D+";
} else {
$predikat = "D";
}
//nilai keterampilan =======================================================================
$dnp2 = mysql_fetch_array(mysql_query("SELECT SUM(np1+np2+np3+np4+np5) AS total_uh, nfolio, nproyek FROM nilai_keterampilan
WHERE nis = '".$_GET['nis']."' AND tahun_ajaran = '".$dbl['thn_ajaran']."' AND nip = '".$dbl['nip']."' AND kode_pelajaran = '".$dbl['kode_pelajaran']."' AND kode_kelas = '".$dbl['kode_kelas']."' AND semester = '".$_GET['semester']."'"));
$nilaiproses2 = $dnp2['total_uh'] / 5;
//nilai angka
//$nilaiangka1 = ($nilaiproses + $d['uts']+($d['uas']*3))/5;
$nilaiangka12 = $nilaiproses2 + $dnp2['nfolio'] + $dnp2['nproyek'];
$nilaiangka22 = $nilaiangka12/3;
//nilai predikat
if($nilaiangka22 > 95) {
$predikat2 = "A";
} elseif($nilaiangka22 > 90) {
$predikat2 = "A-";
} elseif($nilaiangka22 > 85) {
$predikat2 = "B+";
} elseif($nilaiangka22 > 80) {
$predikat2 = "B";
} elseif($nilaiangka22 > 74) {
$predikat2 = "B-";
} elseif($nilaiangka22 > 69) {
$predikat2 = "C+";
} elseif($nilaiangka22 > 64) {
$predikat2 = "C";
} elseif($nilaiangka22 > 59) {
$predikat2 = "C-";
} elseif($nilaiangka22 > 54) {
$predikat2 = "D+";
} else {
$predikat2 = "D";
}
//nilai sikap ===================================================================================================================
$dnp3 = mysql_fetch_array(mysql_query("SELECT SUM(observasi+antarteman+dirisendiri+jurnalguru) AS total_uh FROM nilai_sikap
WHERE nis = '".$_GET['nis']."' AND tahun_ajaran = '".$dbl['thn_ajaran']."' AND nip = '".$dbl['nip']."' AND kode_pelajaran = '".$dbl['kode_pelajaran']."' AND kode_kelas = '".$dbl['kode_kelas']."' AND semester = '".$_GET['semester']."'"));
//nilai angka
$nilaiangka3 = $dnp3['total_uh'] / 4;
//nilai predikat
if($nilaiangka3 > 90) {
$predikat3 = "SB";
} elseif($nilaiangka3 > 70) {
$predikat3 = "B";
} elseif($nilaiangka3 > 60) {
$predikat3 = "C";
} else {
$predikat3 = "K";
}
?>
<tr>
<td width="2%"><div align="center"><?php echo $no; ?></div></td>
<td width="54%" style="font-size:13px"> <?php echo $dbl['nama_pelajaran']; ?></td>
<td><div align="center">
<?php print number_format($nilaiangka4,2); ?>
</div></td>
<td><div align="center"><?php echo $predikat; ?></div></td>
<td><div align="center"><?php print number_format($nilaiangka22,2); ?></div></td>
<td><div align="center"><?php echo $predikat2; ?></div></td>
<td><div align="center"><?php print number_format($nilaiangka3,2); ?></div></td>
<td><div align="center"><?php echo $predikat3; ?></div></td>
</tr>
<?php
$nilairatarata1 += $nilaiangka4;
$nilairatarata2 += $nilaiangka22;
$nilairatarata3 += $nilaiangka3;
$no++; $a++; } ?>
<tr>
<td colspan="2">Nilai Rata-Rata</td>
<td colspan="6">
<?php
$aa = $a * 3;
$nilairatarata4 = $nilairatarata1 + $nilairatarata2 + $nilairatarata3;
$nilairatarata5 = $nilairatarata4 / $aa;
//echo "N1:".$nilairatarata1." | N2:".$nilairatarata2." | N3:".$nilairatarata3." | N4:".$nilairatarata4." | N5:".$nilairatarata5." | No:".$a;
/*$nilaitotal = $nrtpengetahuan['nilai1'] + $nrtpengetahuan['nilai2'] + $nrtpengetahuan['nilai3'] + $nrtpengetahuan['nilai4'] + $nrtpengetahuan['nilai5'] + $nrtpengetahuan['nilaiutas'] + $nrtpengetahuan['nilaiuas'] + $nrtketerampilan['nilai1'] + $nrtketerampilan['nilai2'] + $nrtketerampilan['nilai3'] + $nrtketerampilan['nilai4'] + $nrtketerampilan['nilai5'] + $nrtketerampilan['nilaifolio'] + $nrtketerampilan['nilaipoyek'] + $nrtsikap['nilai1'] + $nrtsikap['nilai2'] + $nrtsikap['nilai3'] + $nrtsikap['nilai4'];
$nilairatarata = $nilaitotal / 18;*/
//echo $a."|";
print number_format($nilairatarata5,2); //nilairatarata ?> </td>
</tr>
<tr>
<td colspan="2">Peringkat</td>
<?php
list($nilai,$koma)=explode(".",$nilairatarata5);
$cekdgt = strlen($nilai);
if($cekdgt==1) {
$nilairatarata6 = "0".$nilairatarata5;
} else {
$nilairatarata6 = $nilairatarata5;
}
//update nilai rapor
//cek sudah ada datanya atau belum
if($nilairatarata6 > 0) {
$qcn = mysql_query("select * from data_rapor where nis = '".$_GET['nis']."' and kode_kelas = '".$dk['kode_kelas']."' and thn_ajaran = '".$_GET['tahun']."'");
$dcn = mysql_fetch_array($qcn);
//cek nilainya ada atau tidak
if(isset($dcn['id_rapor']) && $dcn['id_rapor'] != "") {
if($dcn['nilai'] != $nilairatarata6) {
//jika nilai tidak sama maka update nilai yang terbaru
mysql_query("UPDATE `data_rapor` SET `nilai` = '$nilairatarata6' WHERE `id_rapor` = '".$dcn['id_rapor']."'");
}
} else {
mysql_query("INSERT INTO `data_rapor` (`kode_kelas`,`thn_ajaran`,`nis`,`nilai`) VALUES ('".$dk['kode_kelas']."','".$_GET['tahun']."','".$_GET['nis']."','$nilairatarata6')");
}
}
$qrapor = mysql_query("SELECT nis, nilai, FIND_IN_SET( nilai, (
SELECT GROUP_CONCAT( nilai
ORDER BY nilai DESC )
FROM data_rapor WHERE kode_kelas = '".$dk['kode_kelas']."' and thn_ajaran = '".$_GET['tahun']."' )
) AS rangking
FROM data_rapor WHERE nis = '".$_GET['nis']."'");
$draport = mysql_fetch_array($qrapor);
$totalsiswakelasnya = mysql_num_rows(mysql_query("select id_rapor from data_rapor
where kode_kelas = '".$dk['kode_kelas']."' and thn_ajaran = '".$_GET['tahun']."'"));
?>
<?php
$totalsiswa = mysql_num_rows(mysql_query("SELECT * FROM `data_siswa` WHERE kode_kelas = '".$dk['kode_kelas']."' AND tahun = '".$_GET['tahun']."'"));
?>
<td colspan="6">Ke <strong><?php echo $draport['rangking']; ?></strong> dari <strong><?php echo $totalsiswa; //totalsiswakelasnya; ?></strong> Siswa</td>
</tr>
</table></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td></td>
</tr>
</table>
<button type="button" class="btn" onclick="location.href='?mod=listdatanilaisiswaview&kelas=<?php echo $_GET['kelas']; ?>&tahun=<?php echo $_GET['tahun']; ?>&nip=<?php echo $_GET['nip']; ?>'">Kembali</button>