VERSION 5.00
Object = "{00025600-0000-0000-C000-000000000046}#5.2#0"; "Crystl32.OCX"
Begin VB.Form frmLapNilai 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Daftar Nilai Siswa"
   ClientHeight    =   1680
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   6165
   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     =   1680
   ScaleWidth      =   6165
   Begin VB.ComboBox cmbSemester 
      Enabled         =   0   'False
      Height          =   315
      ItemData        =   "frmLapNilai.frx":0000
      Left            =   1560
      List            =   "frmLapNilai.frx":000A
      TabIndex        =   14
      Top             =   1200
      Width           =   1095
   End
   Begin Crystal.CrystalReport CrtLaporan 
      Left            =   720
      Top             =   480
      _ExtentX        =   741
      _ExtentY        =   741
      _Version        =   348160
      PrintFileLinesPerPage=   60
   End
   Begin VB.TextBox Text1 
      Height          =   285
      Left            =   120
      MaxLength       =   4
      TabIndex        =   12
      Top             =   1200
      Width           =   495
   End
   Begin VB.TextBox Text2 
      Enabled         =   0   'False
      Height          =   285
      Left            =   960
      MaxLength       =   4
      TabIndex        =   11
      Top             =   1200
      Width           =   495
   End
   Begin VB.ComboBox CmbNIS 
      Enabled         =   0   'False
      Height          =   315
      Left            =   2760
      TabIndex        =   10
      Top             =   1200
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      Caption         =   "&Tutup"
      Height          =   735
      Left            =   5280
      Picture         =   "frmLapNilai.frx":0023
      Style           =   1  'Graphical
      TabIndex        =   9
      Top             =   720
      Width           =   735
   End
   Begin VB.CommandButton cmdCetak 
      Caption         =   "Print"
      Enabled         =   0   'False
      Height          =   735
      Left            =   4440
      Picture         =   "frmLapNilai.frx":078D
      Style           =   1  'Graphical
      TabIndex        =   8
      Top             =   720
      Width           =   735
   End
   Begin VB.PictureBox Picture1 
      BackColor       =   &H80000016&
      BorderStyle     =   0  'None
      Height          =   615
      Left            =   120
      ScaleHeight     =   615
      ScaleWidth      =   9975
      TabIndex        =   0
      Top             =   0
      Width           =   9975
      Begin VB.Label Label3 
         AutoSize        =   -1  'True
         BackStyle       =   0  'Transparent
         Caption         =   "Report Siswa SMP Negeri 2 Medan"
         BeginProperty Font 
            Name            =   "Tahoma"
            Size            =   8.25
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00C0C0C0&
         Height          =   195
         Index           =   0
         Left            =   600
         TabIndex        =   1
         Top             =   360
         Width           =   2865
      End
      Begin VB.Image Image1 
         Height          =   480
         Left            =   120
         Picture         =   "frmLapNilai.frx":639F
         Top             =   120
         Width           =   480
      End
      Begin VB.Line Line1 
         BorderColor     =   &H00800000&
         BorderWidth     =   2
         X1              =   600
         X2              =   4320
         Y1              =   600
         Y2              =   600
      End
   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            =   720
      TabIndex        =   13
      Top             =   1200
      Width           =   105
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "NIS:"
      Height          =   195
      Index           =   1
      Left            =   2880
      TabIndex        =   7
      Top             =   960
      Width           =   315
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "."
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   435
      Index           =   2
      Left            =   2760
      TabIndex        =   6
      Top             =   720
      Width           =   105
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "."
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   435
      Index           =   1
      Left            =   120
      TabIndex        =   5
      Top             =   720
      Width           =   105
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Tahun Ajaran:"
      Height          =   195
      Index           =   3
      Left            =   240
      TabIndex        =   4
      Top             =   960
      Width           =   1035
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "Semester"
      Height          =   195
      Index           =   4
      Left            =   1680
      TabIndex        =   3
      Top             =   960
      Width           =   675
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "."
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   18
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   435
      Index           =   3
      Left            =   1560
      TabIndex        =   2
      Top             =   720
      Width           =   105
   End
End
Attribute VB_Name = "frmLapNilai"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False


Private Sub CmbNIS_Click()
If CmbNIS.Text <> "" Then
        Me.MousePointer = 11
        Kata = "Select * from [Master Nilai] Where NIS='" & CmbNIS.Text & "' And [Semester]='" & _
        cmbSemester.Text & "' And [Tahun Ajaran]='" & Text1.Text & "/" & Text2.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 " Data Nilai Siswa tidak ada dalam database...", vbInformation
                Semula
                Exit Sub
            End If
            cmdCetak.Enabled = True
            cmdCetak.SetFocus
            TNilai.Close
            Set TNilai = Nothing
            Me.MousePointer = 1
        End If
End Sub

Private Sub cmdCetak_Click()
With CrtLaporan
        .Reset
        .ReportFileName = App.Path & "\Lap hasil.rpt"
        .DataFiles(0) = App.Path & "\Siswa.mdb"
        .SelectionFormula = "{Master Nilai.NIS}='" & CmbNIS.Text & "' And {Master Nilai.Semester}='" & cmbSemester.Text & "'And {Master Nilai.Tahun Ajaran}='" & Text1.Text & "/" & Text2.Text & "'"
        .WindowMinButton = False
        .WindowShowCancelBtn = True
        .WindowShowCloseBtn = True
        .WindowShowPrintBtn = True
        .WindowShowPrintSetupBtn = True
        .WindowParentHandle = frmUtama.hWnd
        .WindowState = crptMaximized
        .Action = 1
        
    End With
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Form_Load()
Ketengah Me
Fokus Text1
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

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
        cmbSemester.Enabled = True
        cmbSemester.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

Sub DaftarKelas()
Me.MousePointer = 11
    Set TNilai = New ADODB.Recordset
        Kata = "Select Distinct [Kode Kelas] from Master 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 Distinct NIS from [Master Nilai] 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 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 CmbNIS_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If CmbNIS.Text <> "" Then
        Me.MousePointer = 11
        Kata = "Select * from Master Where NIS='" & CmbNIS.Text & "' And [Semester]='" & _
        cmbSemester.Text & "' And [Tahun Ajaran]='" & Text1.Text & "/" & Text2.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 " Data Nilai Siswa tidak ada dalam database...", vbInformation
                Semula
                Exit Sub
            End If
            cmdCetak.Enabled = True
            cmdCetak.SetFocus
            TNilai.Close
            Set TNilai = Nothing
            Me.MousePointer = 1
        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
    If TypeOf Control Is ComboBox Then
        Control.Text = ""
    End If
Next Control
End Sub

Sub Semula()
    Bersih
    cmdCetak.Enabled = False
    NotAktif
    Fokus Text1
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 cmbSemester_Click()
If cmbSemester.Text <> "" Then
        DaftarSiswa
        CmbNIS.Enabled = True
        CmbNIS.SetFocus
        Exit Sub
    End If
End Sub

Private Sub cmbSemester_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    If cmbSemester.Text <> "" Then
        DaftarSiswa
        CmbNIS.Enabled = True
        CmbNIS.SetFocus
        Exit Sub
    End If

End If
End Sub

Private Sub cmbSemester_KeyPress(KeyAscii As Integer)
KeyAscii = AutoComplete(cmbSemester, KeyAscii, True, Ubah)
End Sub
