VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form frmPeringkat 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Data Peringkat -  Siswa"
   ClientHeight    =   3840
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7050
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   3840
   ScaleWidth      =   7050
   Begin MSComctlLib.ListView Lv1 
      Height          =   1215
      Left            =   120
      TabIndex        =   20
      Top             =   1560
      Width           =   6855
      _ExtentX        =   12091
      _ExtentY        =   2143
      View            =   3
      LabelEdit       =   1
      LabelWrap       =   -1  'True
      HideSelection   =   -1  'True
      FullRowSelect   =   -1  'True
      GridLines       =   -1  'True
      _Version        =   393217
      ForeColor       =   -2147483640
      BackColor       =   -2147483643
      BorderStyle     =   1
      Appearance      =   1
      NumItems        =   8
      BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         Text            =   "No."
         Object.Width           =   882
      EndProperty
      BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   1
         Text            =   "Tahun Ajaran"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   2
         Text            =   "Semester"
         Object.Width           =   2117
      EndProperty
      BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   3
         Text            =   "Kode Kelas"
         Object.Width           =   1764
      EndProperty
      BeginProperty ColumnHeader(5) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   4
         Text            =   "Nama Kelas"
         Object.Width           =   1764
      EndProperty
      BeginProperty ColumnHeader(6) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   5
         Text            =   "NIS"
         Object.Width           =   1587
      EndProperty
      BeginProperty ColumnHeader(7) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   6
         Text            =   "Nama Siswa"
         Object.Width           =   2540
      EndProperty
      BeginProperty ColumnHeader(8) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
         SubItemIndex    =   7
         Text            =   "Peringkat"
         Object.Width           =   1764
      EndProperty
   End
   Begin VB.ComboBox cboSemester 
      Enabled         =   0   'False
      Height          =   315
      ItemData        =   "frmPeringkat.frx":0000
      Left            =   3720
      List            =   "frmPeringkat.frx":000A
      TabIndex        =   18
      Top             =   120
      Width           =   1095
   End
   Begin VB.TextBox txtPeringkat 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1320
      MaxLength       =   2
      TabIndex        =   17
      Top             =   1200
      Width           =   495
   End
   Begin VB.CommandButton cmdTambah 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Tambah"
      Height          =   405
      Left            =   2040
      TabIndex        =   8
      Top             =   3240
      Width           =   945
   End
   Begin VB.CommandButton cmdSimpan 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Simpan"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   405
      Left            =   3000
      TabIndex        =   7
      Top             =   3240
      Width           =   945
   End
   Begin VB.CommandButton cmdEdit 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Edit"
      Enabled         =   0   'False
      Height          =   405
      Left            =   3960
      TabIndex        =   6
      Top             =   3240
      Width           =   945
   End
   Begin VB.CommandButton cmdTutup 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Tutup"
      Height          =   405
      Left            =   5880
      TabIndex        =   5
      Top             =   3240
      Width           =   945
   End
   Begin VB.CommandButton cmdHapus 
      BackColor       =   &H00D8E9EC&
      Caption         =   "&Hapus"
      Enabled         =   0   'False
      Height          =   405
      Left            =   4920
      TabIndex        =   4
      Top             =   3240
      Width           =   945
   End
   Begin VB.ComboBox CmbKelas 
      Enabled         =   0   'False
      Height          =   315
      Left            =   1320
      TabIndex        =   3
      Top             =   480
      Width           =   1335
   End
   Begin VB.ComboBox cmbNIS 
      Enabled         =   0   'False
      Height          =   315
      Left            =   1320
      TabIndex        =   2
      Top             =   840
      Width           =   1335
   End
   Begin VB.TextBox Text1 
      Enabled         =   0   'False
      Height          =   285
      Left            =   1320
      MaxLength       =   4
      TabIndex        =   1
      Top             =   120
      Width           =   495
   End
   Begin VB.TextBox Text2 
      Enabled         =   0   'False
      Height          =   285
      Left            =   2160
      MaxLength       =   4
      TabIndex        =   0
      Top             =   120
      Width           =   495
   End
   Begin VB.Label Label2 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   " Semester"
      Height          =   195
      Index           =   2
      Left            =   2880
      TabIndex        =   19
      Top             =   120
      Width           =   720
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Peringkat:"
      Height          =   195
      Index           =   4
      Left            =   540
      TabIndex        =   16
      Top             =   1200
      Width           =   735
   End
   Begin VB.Line Line2 
      BorderColor     =   &H8000000D&
      X1              =   1920
      X2              =   6960
      Y1              =   3120
      Y2              =   3120
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackColor       =   &H80000018&
      Caption         =   "P r o s e s"
      ForeColor       =   &H00004000&
      Height          =   255
      Index           =   1
      Left            =   1920
      TabIndex        =   15
      Top             =   2880
      Width           =   5055
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Kode Kelas:"
      Height          =   195
      Index           =   0
      Left            =   435
      TabIndex        =   14
      Top             =   480
      Width           =   840
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "NIS:"
      Height          =   195
      Index           =   1
      Left            =   960
      TabIndex        =   13
      Top             =   840
      Width           =   315
   End
   Begin VB.Shape Shape1 
      BorderColor     =   &H00FF8080&
      Height          =   855
      Index           =   1
      Left            =   1920
      Top             =   2880
      Width           =   5055
   End
   Begin VB.Label LblKelas 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "--"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C25418&
      Height          =   195
      Left            =   2760
      TabIndex        =   12
      Top             =   480
      Width           =   150
   End
   Begin VB.Label lblNama 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "--"
      BeginProperty Font 
         Name            =   "Tahoma"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C25418&
      Height          =   195
      Left            =   2760
      TabIndex        =   11
      Top             =   840
      Width           =   150
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Tahun Ajaran:"
      Height          =   195
      Index           =   3
      Left            =   240
      TabIndex        =   10
      Top             =   120
      Width           =   1035
   End
   Begin VB.Label Label4 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      Caption         =   "/"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      Left            =   1935
      TabIndex        =   9
      Top             =   120
      Width           =   105
   End
End
Attribute VB_Name = "frmPeringkat"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub cboSemester_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
    If cboSemester.Text <> "" Then
        DaftarKelas
        CmbKelas.Enabled = True
        CmbKelas.SetFocus
        Exit Sub
    End If
End If
End Sub

Private Sub cmbNIS_KeyPress(KeyAscii As Integer)
KeyAscii = AutoComplete(cmbNIS, KeyAscii, True, Ubah)
End Sub

Private Sub cmdSimpan_Click()
Me.MousePointer = 11
On Error GoTo salah

Datasiswa.BeginTrans
For i = 1 To Lv1.ListItems.Count
Datasiswa.Execute "Insert Into Peringkat Values ('" & Lv1.ListItems(i).SubItems(1) & "'," & _
"'" & Lv1.ListItems(i).SubItems(2) & "','" & Lv1.ListItems(i).SubItems(3) & "','" & Lv1.ListItems(i).SubItems(5) & "'," & _
"'" & Lv1.ListItems(i).SubItems(7) & "')"
Next i
Datasiswa.CommitTrans

Me.MousePointer = 1
Semula
Exit Sub
salah:
MsgBox Err.Description
End Sub

Private Sub Form_Load()
Ketengah Me
End Sub

Private Sub Text1_Change()
If Len(Text1.Text) = 4 Then
    Fokus Text2
    Text2.Text = Val(Text1.Text) + 1
    Exit Sub
End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= Asc("0") & Chr(13) _
     And KeyAscii <= Asc("9") & Chr(13) _
     Or KeyAscii = vbKeyBack _
     Or KeyAscii = vbKeyDelete) Then
        Beep
        KeyAscii = 0
   End If
End Sub

Private Sub Text2_Change()
If Len(Text2.Text) = 4 Then
    If Text1.Text > Text2.Text Then
        MsgBox "Isikan Tahun Ajaran dengan benar....", vbInformation
        Fokus Text2
        Exit Sub
    End If
End If
End Sub



Sub Bersih()
Dim Control
For Each Control In Me.Controls
    If TypeOf Control Is TextBox Then
        Control.Text = ""
    End If
Next Control
End Sub

Sub Semula()
    cmdSimpan.Enabled = False
    cmdTambah.Caption = "&Tambah"
    Bersih
    vEdit = False
    vTrans = False
    NotAktif
    LblPegawai = "--"
    LblKelas = "--"
    Lv1.ListItems.Clear
End Sub

Sub NotAktif()
Dim Control
For Each Control In Me.Controls
    If TypeOf Control Is TextBox Then
        Control.Enabled = False
    End If
    If TypeOf Control Is ComboBox Then
        Control.Enabled = False
    End If
Next Control
End Sub



Private Sub cmdTambah_Click()
    Me.MousePointer = 11
    If cmdTambah.Caption = "&Tambah" Then
        cmdTambah.Caption = "&Batal"
       Fokus Text1
       Bersih
    Else
        Semula
    End If
    Me.MousePointer = 1
End Sub

Private Sub cmdTutup_Click()
Unload Me
End Sub

Sub DaftarGuru()
Me.MousePointer = 11
    Set TNilai = New ADODB.Recordset
        Kata = "Select * from Guru Order By [NIP]"
        TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
        cmbNIP.Clear
        If Not TNilai.EOF Then
           TNilai.MoveFirst
           While Not TNilai.EOF
                cmbNIP.AddItem TNilai![NIP]
                TNilai.MoveNext
            Wend
        End If
        TNilai.Close
        Set TNilai = Nothing

    Me.MousePointer = 1

End Sub

Sub DaftarKelas()
Me.MousePointer = 11
    Set TNilai = New ADODB.Recordset
        Kata = "Select * from Kelas Order By [kode Kelas]"
        TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
        CmbKelas.Clear
        If Not TNilai.EOF Then
           TNilai.MoveFirst
           While Not TNilai.EOF
                CmbKelas.AddItem TNilai![Kode kelas]
                TNilai.MoveNext
            Wend
        End If
        TNilai.Close
        Set TNilai = Nothing

    Me.MousePointer = 1

End Sub

Sub DaftarSiswa()
Me.MousePointer = 11
    Set TNilai = New ADODB.Recordset
        Kata = "Select * from QKelas where [Kode Kelas]='" & CmbKelas.Text & "' Order By [NIS]"
        TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
        cmbNIS.Clear
        If Not TNilai.EOF Then
           TNilai.MoveFirst
           While Not TNilai.EOF
                cmbNIS.AddItem TNilai![NIS]
                TNilai.MoveNext
            Wend
        End If
        TNilai.Close
        Set TNilai = Nothing
    Me.MousePointer = 1

End Sub

Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If Len(Text2.Text) = 4 Then
        If Text1.Text > Text2.Text Then
            MsgBox "Isikan Tahun Ajaran dengan benar....", vbInformation
            Fokus Text2
            Exit Sub
        End If
        cboSemester.Enabled = True
        cboSemester.SetFocus
    End If
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= Asc("0") & Chr(13) _
     And KeyAscii <= Asc("9") & Chr(13) _
     Or KeyAscii = vbKeyBack _
     Or KeyAscii = vbKeyDelete) Then
        Beep
        KeyAscii = 0
   End If
End Sub

Private Sub cmbKelas_Click()
 If CmbKelas.Text <> "" Then
        Me.MousePointer = 11
        Kata = "Select * from kelas where [kode Kelas]='" & CmbKelas.Text & "'"
        Set TNilai = New ADODB.Recordset
            TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TNilai.EOF Then
                TNilai.Close
                Set TNilai = Nothing
                Me.MousePointer = 1
                MsgBox "Kelas = " & CmbKelas.Text & " tidak terdaftar...", vbExclamation
                CmbKelas.SetFocus
                Exit Sub
            End If
            LblKelas = TNilai![kelas]
            TNilai.Close
            Set TNilai = Nothing
            DaftarSiswa
            CmbKelas.Enabled = False
            cmbNIS.Enabled = True
            cmbNIS.SetFocus
            Me.MousePointer = 1
        End If
End Sub

Private Sub cmbKelas_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If CmbKelas.Text <> "" Then
        Me.MousePointer = 11
        Kata = "Select * from kelas where [kode Kelas]='" & CmbKelas.Text & "'"
        Set TNilai = New ADODB.Recordset
            TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TNilai.EOF Then
                TNilai.Close
                Set TNilai = Nothing
                Me.MousePointer = 1
                MsgBox "Kelas = " & CmbKelas.Text & " tidak terdaftar...", vbExclamation
                CmbKelas.SetFocus
                Exit Sub
            End If
            LblKelas = TNilai![kelas]
            TNilai.Close
            Set TNilai = Nothing
            DaftarSiswa
            CmbKelas.Enabled = False
            cmbNIS.Enabled = True
            cmbNIS.SetFocus
            Me.MousePointer = 1
        End If
    End If
End Sub

Private Sub CmbKelas_KeyPress(KeyAscii As Integer)
KeyAscii = AutoComplete(CmbKelas, KeyAscii, True, Ubah)
End Sub

Private Sub CmbNIS_Click()
 If cmbNIS.Text <> "" Then
    
    For i = 1 To Lv1.ListItems.Count
        If cmbNIS.Text = Lv1.ListItems(i).SubItems(5) Then
            MsgBox "NIS Sudah Ada pada daftar....", vbExclamation, "Ooops..."
            cmbNIS.SetFocus
            Exit Sub
        End If
    Next
        Me.MousePointer = 11
        Kata = "Select * from Siswa where [NIS]='" & cmbNIS.Text & "'"
        Set TNilai = New ADODB.Recordset
            TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TNilai.EOF Then
                TNilai.Close
                Set TNilai = Nothing
                Me.MousePointer = 1
                MsgBox "NIS = " & cmbNIS.Text & " tidak terdaftar...", vbExclamation
                cmbNIS.SetFocus
                Exit Sub
            End If
            LblPegawai = TNilai![Nama Siswa]
            TNilai.Close
            Set TNilai = Nothing
            Set TSiswa = New ADODB.Recordset
                Kata = "Select * from Peringkat where [Tahun Ajaran]='" & Text1.Text & "/" & Text2.Text & "' and semester='" & _
                cboSemester.Text & "' And [Kode Kelas]='" & CmbKelas.Text & "' And NIS='" & cmbNIS.Text & "'"
                TSiswa.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
                If TSiswa.EOF Then
                    TSiswa.Close
                    Set TSiswa = Nothing
                    
                    Fokus txtPeringkat
                    Me.MousePointer = 1
                    Exit Sub
                End If
                    TSiswa.Close
                    Set TSiswa = Nothing
                    Me.MousePointer = 1
                    MsgBox "NIS " & cmbNIS.Text & " sudah di input data peringkat...", vbInformation
                    cmbNIS.SetFocus
        End If
    
End Sub

Private Sub CmbNIS_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If cmbNIS.Text <> "" Then
    For i = 1 To Lv1.ListItems.Count
        If cmbNIS.Text = Lv1.ListItems(i).SubItems(5) Then
            MsgBox "NIS Sudah Ada pada daftar....", vbExclamation, "Ooops..."
            cmbNIS.SetFocus
            Exit Sub
        End If
    Next
        Me.MousePointer = 11
        Kata = "Select * from Siswa where [NIS]='" & cmbNIS.Text & "'"
        Set TNilai = New ADODB.Recordset
            TNilai.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
            If TNilai.EOF Then
                TNilai.Close
                Set TNilai = Nothing
                Me.MousePointer = 1
                MsgBox "NIS = " & cmbNIS.Text & " tidak terdaftar...", vbExclamation
                cmbNIS.SetFocus
                Exit Sub
            End If
            LblPegawai = TNilai![Nama Siswa]
            TNilai.Close
            Set TNilai = Nothing
            Set TSiswa = New ADODB.Recordset
                Kata = "Select * from Peringkat where [Tahun Ajaran]='" & Text1.Text & "/" & Text2.Text & "' and semester='" & _
                cboSemester.Text & "' And [Kode Kelas]='" & CmbKelas.Text & "' And NIS='" & cmbNIS.Text & "'"
                TSiswa.Open Kata, Datasiswa, adOpenDynamic, adLockPessimistic
                If TSiswa.EOF Then
                    TSiswa.Close
                    Set TSiswa = Nothing
                    
                    Fokus txtPeringkat
                    Me.MousePointer = 1
                    Exit Sub
                End If
                    TSiswa.Close
                    Set TSiswa = Nothing
                    Me.MousePointer = 1
                    MsgBox "NIS " & cmbNIS.Text & " sudah di input data peringkat...", vbInformation
                    cmbNIS.SetFocus
        End If
    End If
End Sub


Private Sub txtPeringkat_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If txtPeringkat <> "" Then
    Set Vbutir = Lv1.ListItems.Add(, , Lv1.ListItems.Count + 1 & ".")
        Vbutir.SubItems(1) = Text1.Text & "/" & Text2.Text
        Vbutir.SubItems(2) = cboSemester.Text
        Vbutir.SubItems(3) = CmbKelas.Text
        Vbutir.SubItems(4) = LblKelas.Caption
        Vbutir.SubItems(5) = cmbNIS.Text
        Vbutir.SubItems(6) = lblNama.Caption
        Vbutir.SubItems(7) = txtPeringkat.Text
        vTrans = True
        Kata = MsgBox("Masih Ada Peringkat yang mau di entry ....", vbInformation + vbYesNo, "Informasi")
        If Kata = vbYes Then
            cmbNIS.Enabled = True
            cmbNIS.SetFocus
            Exit Sub
        End If
        cmdSimpan.Enabled = True
        cmdSimpan.SetFocus
    End If
    End If

End Sub



