-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathakd.lap.krsmhsw.php
155 lines (145 loc) · 5.38 KB
/
akd.lap.krsmhsw.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
<?php
// Author: Emanuel Setio Dewo
// 16 April 2006
// Happy Easter - Selamat Paskah
// *** Functions ***
function HeaderKrs($tahun, $_prid, $_prodi, $div, $maxcol, &$hal, $RentangNPM=''){
Global $_lf;
$hal++;
$hdr = str_pad("*** Daftar KRS Mahasiswa ***", $maxcol, ' ', STR_PAD_BOTH).$_lf;
$hdr .= str_pad("Program : $_prid", $maxcol, ' '). $_lf;
$hdr .= str_pad("Program Studi : $_prodi", 40, ' ') . str_pad("Halaman : $hal", 50, ' ', STR_PAD_LEFT).$_lf;
$hdr .= str_pad("Semester : " . NamaTahun($_SESSION['tahun']), 50, ' ') .
$_lf . $RentangNPM. $_lf . $div;
$hdr .= "No. NPM NAMA T.SKS SKS IPS Kode Nama Matakuliah SKS".$_lf;
$hdr .= $div;
return $hdr;
}
function DftrAkdLapKRSMhsw() {
global $_HeaderPrn, $_lf;
$whr = array();
if (!empty($_SESSION['prodi'])) $whr[] = "m.ProdiID='$_SESSION[prodi]'";
if (!empty($_SESSION['prid'])) $whr[] = "m.ProgramID='$_SESSION[prid]'";
if (!empty($_SESSION['DariNPM']) && !empty($_SESSION['SampaiNPM'])) $whr[] = " '$_SESSION[DariNPM]' <= m.MhswID and m.MhswID <= '$_SESSION[SampaiNPM]' ";
$_whr = implode(" and ", $whr);
if (!empty($_whr)) $_whr = " and ".$_whr;
// query
$s = "select krs.KRSID, krs.MKID, krs.StatusKRSID, mk.MKKode, j.JenisJadwalID,
LEFT(mk.Nama, 25) as NamaMK, mk.SKS,
krs.MhswID, LEFT(m.Nama, 15) as NamaMhsw,
m.ProdiID, m.ProgramID, prd.Nama as PRD, m.TotalSKS
from krstemp krs
left outer join mhsw m on krs.MhswID=m.MhswID
left outer join prodi prd on m.ProdiID=prd.ProdiID
left outer join mk mk on krs.MKID=mk.MKID
left outer join jadwal j on krs.JadwalID=j.JadwalID
where krs.StatusKRSID='A' and krs.TahunID='$_SESSION[tahun]' $_whr
order by m.ProdiID, m.MhswID, mk.MKKode";
$r = _query($s);
// Buat file
$nmf = "tmp/$_SESSION[_Login].dwoprn";
$f = fopen($nmf, 'w');
// parameter2
$brs = 55;
$maxbrs = 55;
$maxcol = 90;
$div = str_pad('-', $maxcol, '-').$_lf;
$tgl = date('d-m-Y h:i');
fwrite($f, chr(18).chr(27).chr(15));
fwrite($f, chr(27).chr(67).chr(66)); // --> set 66 baris (kuarto)
// Buat header
$RentangNPM = (!empty($_SESSION['DariNPM']) && !empty($_SESSION['SampaiNPM']))? "Dari NPM: $_SESSION[DariNPM] s/d $_SESSION[SampaiNPM] " : '';
$_npm = '';
$prd = '';
$first = 1;
$hal = 0;
$jumlahrec = _num_rows($r);
$jumhal = ceil($jumlahrec/$maxbrs);
while ($w = _fetch_array($r)) {
// Tampilkan Prodi
$brs++;
$_prodi = GetaField('prodi', 'ProdiID', $w['ProdiID'], 'Nama');
$_prid = GetaField('program', 'ProgramID', $w['ProgramID'], 'Nama');
if ($brs > $maxbrs) {
if ($first == 0) {
fwrite($f, $div.chr(12));
}
$hd = HeaderKrs($_SESSION['tahun'], $_prid, $_prodi, $div, $maxcol, $hal, $RentangNPM);
fwrite($f, $hd);
$brs = 0;
$first = 0;
$prodi = $w['ProdiID'];
}
elseif ($prodi != $w['ProdiID']) {
$prodi = $w['ProdiID'];
if ($first == 0){
fwrite($f, $div);
}
fwrite($f, chr(12));
fwrite($f, HeaderKrs($_SESSION['tahun'], $_prid, $_prodi, $div, $maxcol, $hal, $RentangNPM));
$brs=0;
$_n=0;
}
if ($_npm != $w['MhswID']) {
$_npm = $w['MhswID'];
$_mhswid = $w['MhswID'];
$_mhswnm = $w['NamaMhsw'];
$_TOTSKS = $w['TotalSKS'];
$_n++;
$_strn = str_pad($_n, 3, '0', STR_PAD_LEFT);
$_SKS = GetaField('krs left outer join jadwal j on j.JadwalID = krs.JadwalID', "krs.TahunID='$_SESSION[tahun]' and j.JenisJadwalID = 'K' and krs.MhswID", $w['MhswID'], "sum(krs.SKS)")+0;
$_IPS = GetIPSLalu($w['MhswID']);
}
else {
$_mhswid = '';
$_mhswnm = '';
$_str = '';
$_strn = ' ';
$_SKS = ' ';
$_IPS = ' ';
$_TOTSKS = ' ';
}
// Tuliskan
$jj = ($w['JenisJadwalID'] <> 'K')? " ($w[JenisJadwalID])" : '';
$isi = $_strn . ' ';
$isi .= str_pad($_mhswid, 12, ' ') . ' ';
$isi .= str_pad($_mhswnm, 15, ' ') . ' ';
$isi .= str_pad($_TOTSKS,3,' ',STR_PAD_LEFT) . ' ';
$isi .= str_pad($_SKS, 3, ' ', STR_PAD_LEFT) . ' ';
$isi .= str_pad($_IPS, 4, ' ', STR_PAD_LEFT) . ' ';
$isi .= str_pad($w['MKKode'], 7) . ' ';
$isi .= str_pad($w['NamaMK'].$jj, 30) . ' ';
$isi .= str_pad($w['SKS'], 2, ' ', STR_PAD_LEFT) . ' ';
$isi .= $_lf;
fwrite($f, $isi);
}
fwrite($f, $div);
fwrite($f, str_pad("Dicetak oleh: ". $_SESSION['_Login'] . ", ".date("d-m-Y H:i"), 50, ' '));
// str_pad("(Akhir Laporan) Hal. : ".$hal.'/'.$jumhal, 29, ' ', STR_PAD_LEFT));
// Tutup & tampilkan
fwrite($f, chr(12));
fclose($f);
TampilkanFileDWOPRN($nmf, 'akd.lap');
}
function GetIPSLalu($MhswID){
$s = "select IP from khs
where MhswID = '$MhswID'
and right(TahunID, 1) <> '3'
and IP <> 0
order by TahunID DESC";
$r = _query($s);
$w = _fetch_array($r);
return $w['IP'];
}
// *** Parameters ***
$tahun = GetSetVar('tahun');
$prodi = GetSetVar('prodi');
$prid = GetSetVar('prid');
$DariNPM = GetSetVar('DariNPM');
$SampaiNPM = GetSetVar('SampaiNPM');
// *** Main ***
TampilkanJudul("Daftar KRS Mahasiswa");
//TampilkanTahunProdiProgram('akd.lap.krsmhsw', 'DftrAkdLapKRSMhsw');
TampilkanTahunProdiProgram('akd.lap.krsmhsw', 'DftrAkdLapKRSMhsw', '', '', 1);
if (!empty($tahun) || !empty($prid)) DftrAkdLapKRSMhsw();
?>