• Tidak ada hasil yang ditemukan

H. Proses Absen

I. Proses Nilai

Menu ini adalah untuk menambahkan data proses nilai siswa dalam kegiatan akademik

➢ Klik Add untuk menambahkan proses nilai baru. Id nilai muncul otomatis dan akan selalu mulai dari 01 setiap berganti bulan, untuk id kelas dipilih lalu pilih semester, pilih id matpel, dan masukan nis siswa untuk proses rekap absensi.

➢ Klik Save untuk menyimpan proses nilai baru ➢ Klik Cancel untuk membatalkan proses ➢ Klik Exit untuk keluar dari form proses nilai

Coding Program Proses Nilai

Sub tampilgrid() Call koneksi

rstemp.Open "select * from TEMP", KON Set grid.DataSource = rstemp

grid.ColWidth(0) = 50 grid.ColWidth(1) = 1000 grid.ColWidth(2) = 1300 grid.ColWidth(3) = 1300

97 grid.ColWidth(4) = 1300 grid.ColWidth(5) = 1000 grid.ColWidth(6) = 1300 grid.ColWidth(7) = 1000 grid.ColWidth(8) = 1300 grid.ColWidth(9) = 1000

grid.TextMatrix(0, 1) = "Id Nilai" grid.TextMatrix(0, 2) = "Nis"

grid.TextMatrix(0, 3) = "Kode Matpel" grid.TextMatrix(0, 4) = "Tugas" grid.TextMatrix(0, 5) = "UTS" grid.TextMatrix(0, 6) = "UAS" grid.TextMatrix(0, 7) = "Rata" grid.TextMatrix(0, 8) = "Grade" grid.TextMatrix(0, 9) = "Keterangan" End Sub Sub bikinTEMP() Call koneksi

bikin = "create table TEMP(id_nilai varchar(8),nis varchar(5),kode_matpel

varchar(3),nilai_tugas int,nilai_uts int,nilai_uas int,nilai_rata int,grade varchar(1),keterangan varchar(2))" KON.Execute (bikin) tampilgrid End Sub Sub hapusTEMP() Call koneksi

hapus = "drop table if exists TEMP" KON.Execute (hapus)

98 End Sub

Sub simpanTEMP()

simpan = "insert into TEMP() values('" & txtnilai.Text & "','" & txtnis.Text & "','" &

txtmatpel.Caption & "','" & txttugas.Text & "','" & txtuts.Text & "','" & txtuas.Text & "','" & txtakhir.Text & "','" & txtgrade.Text & "','" & txtketerangan.Text & "')"

KON.Execute (simpan) End Sub

Sub simpannilai()

txttanggal.Text = Format(Date, "YYYY/MM/DD")

simpan = "INSERT INTO nilai() VALUES('" & txtnilai.Text & "','" & cmbkelas & "','" & txttanggal.Text & "','" & txtid.Caption & "','" & cmbsemester.Text & "')"

KON.Execute (simpan) End Sub Sub simpandetailnilai() For a = 1 To (grid.Rows - 1) id_nilai = txtnilai.Text nis = grid.TextMatrix(a, 2) kode_matpel = grid.TextMatrix(a, 3) nilai_tugas = grid.TextMatrix(a, 4) nilai_uts = grid.TextMatrix(a, 5) nilai_uas = grid.TextMatrix(a, 6) nilai_rata = grid.TextMatrix(a, 7) grade = grid.TextMatrix(a, 8) keterangan = grid.TextMatrix(a, 9)

simpan = "insert into detail_nilai()values('" & id_nilai & "','" & nis & "','" & kode_matpel & "','" & nilai_tugas & "','" & nilai_uts & "','" & nilai_uas & "','" & nilai_rata & "','" & grade & "','" & keterangan & "')"

KON.Execute (simpan) Next a

99 End Sub

Sub nonaktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = False Next Toolbar1.Buttons(1).Enabled = True Toolbar1.Buttons(2).Enabled = False Toolbar1.Buttons(3).Enabled = False Toolbar1.Buttons(4).Enabled = True cmbkelas.Enabled = False cmbsemester.Enabled = False End Sub Sub aktif()

Dim kontrol As Control

For Each kontrol In Me.Controls

If TypeOf kontrol Is TextBox Then kontrol.Enabled = True Next Toolbar1.Buttons(1).Enabled = False Toolbar1.Buttons(2).Enabled = False Toolbar1.Buttons(3).Enabled = True Toolbar1.Buttons(4).Enabled = True cmbkelas.Enabled = True cmbsemester.Enabled = True End Sub Sub bersih()

For Each kontrol In Me.Controls

100 Next

cmbkelas.Text = "Pilih Kelas"

cmbsemester.Text = "Pilih Semester" End Sub

Sub isicmbkelas() Call koneksi

rskelas.Open "select * from kelas", KON cmbkelas.Clear

Do While Not rskelas.EOF

cmbkelas.AddItem rskelas!id_kelas rskelas.MoveNext

Loop End Sub Sub nomor()

Dim trans As String Dim hitung As Integer trans = Format(Date, "yy") Call koneksi

rsnilai.Open "SELECT * FROM nilai ORDER BY id_nilai DESC LIMIT 1;", KON With rsnilai

If cmbsemester.Text = "Ganjil" Then If .EOF Then

txtnilai.Text = "NGJL" + trans + "01" Else

If Format(Date, "YY") <> Val(Mid(rsnilai!id_nilai, 5, 2)) Then txtnilai.Text = "NGJL" + trans + "01"

101 hitung = Val(Right(rsnilai!id_nilai, 2)) + 1

txtnilai.Text = "NGJL" + trans + Right("00" & hitung, 2) End If

End If

ElseIf cmbsemester.Text = "Genap" Then If .EOF Then

txtnilai.Text = "NGNP" + trans + "01" Else

If Format(Date, "YY") <> Val(Mid(rsnilai!id_nilai, 5, 2)) Then txtnilai.Text = "NGNP" + trans + "01"

Else

hitung = Val(Right(rsnilai!id_nilai, 2)) + 1

txtnilai.Text = "NGNP" + trans + Right("00" & hitung, 2) End If

End If End If End With End Sub

Private Sub cmbkelas_Click() Call koneksi

rskelas.Open "select * from kelas ", KON With rskelas

kelas = "select * from kelas where id_kelas='" & cmbkelas.Text & "'" Set rskelas = KON.Execute(kelas)

txtkelas.Text = rskelas.Fields("kelas") End With

102 Private Sub cmbsemester_click()

nomor End Sub

Private Sub Form_Load()

If menu_utama.StatusBar1.Panels(3) = "Pengajar" Then txtnik.Caption = menu_utama.StatusBar1.Panels(4)

rsguru.Open "select * from guru where nik='" & txtnik.Caption & "'", KON txtmatpel.Caption = rsguru.Fields("kode_matpel")

rsjadwal.Open "select * from jadwal where nik='" & txtnik.Caption & "'", KON cmbkelas.Clear

Do While Not rsjadwal.EOF

cmbkelas.AddItem rsjadwal!id_kelas rsjadwal.MoveNext Loop 'isicmbkelas End If bersih nonaktif txttanggal.Text = Date txtid.Caption = menu_utama.StatusBar1.Panels(1) End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) If Button.Index = 1 Then bikinTEMP tampilgrid aktif bersih txttanggal.Text = Date

103 cmbkelas.SetFocus

ElseIf Button.Index = 2 Then

If cmbkelas.Text = "" Or txtkelas.Text = "" Or cmbsemester.Text = "" Or txtnis.Text = "" Or txtnama.Text = "" Or txttugas.Text = "" Or txtuts.Text = "" Or txtuas.Text = "" Or txtakhir.Text = "" Or txtgrade.Text = "" Or txtketerangan.Text = "" Then

MsgBox "Silahkan Lengkapi Data!!", vbInformation, "Informasi" If cmbkelas.Text = "" Then

cmbkelas.SetFocus

ElseIf txtkelas.Text = "" Then txtkelas.SetFocus

ElseIf cmbsemester.Text = "" Then cmbsemester.SetFocus

ElseIf txtnis.Text = "" Then txtnis.SetFocus

ElseIf txtnama.Text = "" Then txtnama.SetFocus

ElseIf txttugas.Text = "" Then txttugas.SetFocus

ElseIf txtuts.Text = "" Then txtuts.SetFocus

ElseIf txtuas.Text = "" Then txtuas.SetFocus

ElseIf txtakhir.Text = "" Then txtakhir.SetFocus

ElseIf txtgrade.Text = "" Then txtgrade.SetFocus

ElseIf txtketerangan.Text = "" Then txtketerangan.SetFocus

104 Exit Sub

End If

Call simpannilai Call simpandetailnilai Y = "delete from temp" KON.Execute (Y) tampilgrid

Form_Load Call hapusTEMP

ElseIf Button.Index = 3 Then Form_Load

hapusTEMP grid.Clear

ElseIf Button.Index = 4 Then

a = MsgBox("Selesai Proses nilai??", vbQuestion + vbYesNo, "Konfirmasi") If a = vbYes Then Unload proses_nilai menu_utama.Enabled = True menu_utama.Show Else Form_Load End If End If End Sub

Private Sub txtuas_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then

Dim rata As Integer

105 txtakhir.Text = rata

If txtakhir >= 80 Then txtgrade.Text = "A" txtketerangan.Text = "K" ElseIf txtakhir.Text >= 70 Then txtgrade.Text = "B"

txtketerangan.Text = "K" ElseIf txtakhir.Text >= 60 Then txtgrade.Text = "C"

txtketerangan.Text = "K" ElseIf txtakhir.Text >= 40 Then txtgrade.Text = "D" txtketerangan.Text = "BK" Else txtgrade.Text = "E" txtketerangan.Text = "BK" End If Call koneksi Call simpanTEMP Call tampilgrid

t = MsgBox("Input Lagi??", vbQuestion + vbYesNo, "Konfirmasi") If t = vbYes Then txtnis = "" txtnis.SetFocus txtnama = "" txttugas = "" txtuts = "" txtuas = ""

106 txtakhir.Text = "" txtgrade.Text = "" txtketerangan.Text = "" Else Me.Refresh grid.Refresh Toolbar1.Buttons(2).Enabled = True End If End If End Sub

Private Sub txtnis_KeyPress(KeyAscii As Integer) Call koneksi

KeyAscii = Asc(UCase(Chr(KeyAscii))) If KeyAscii = 13 Then

rssiswa.Open "SELECT * FROM siswa WHERE nis='" & txtnis.Text & "'", KON With rssiswa

If .BOF And .EOF Then

psn = MsgBox("NIS " + txtnis + " Tidak Ada", vbInformation, "Perhatian") txtnis = "" txtnis.SetFocus Else txtnama = .Fields("nama_siswa") txtnama.Enabled = False txttugas.SetFocus End If End With End If End Sub

107

Dokumen terkait