Dim jlh, jlhontime, jlhontime1, jlhper, jlhper1, jlhtelat, jlhtelat1 As Integer
Private Sub cmbid_Click()
If Trim(cmbid.Text) <> “” Then
cmdcetak.Enabled = True
cmdcetak.SetFocus
End If
End Sub
Private Sub cmdbatal_Click()
Form_Activate
End Sub
Private Sub cmdcetak_Click()
Dim str As String
jlhontime = 0
jlhontime1 = 0
jlhper = 0
jlhper1 = 0
jlhtelat = 0
jlhtelat1 = 0
jlh = 0
If OptSeluruh.Value = True Then
crpcetak.ReportFileName = App.Path & “\lap2.rpt”
crpcetak.WindowTitle = “Laporan Absensi Pegawai”
crpcetak.GroupSelectionFormula = “{tabsen.Tanggal}>=Date(” & Mid(Trim(DtAwal.Value), 7, 4) & “,” & Mid(Trim(DtAwal.Value), 4, 2) & “,” & Mid(Trim(DtAwal.Value), 1, 2) & “) and {tabsen.Tanggal}<=Date(” & Mid(Trim(DtAkhir.Value), 7, 4) & “,” & Mid(Trim(DtAkhir.Value), 4, 2) & “,” & Mid(Trim(DtAkhir.Value), 1, 2) & “)”
ElseIf OptPegawai.Value = True Then
crpcetak.ReportFileName = App.Path & “\lap1.rpt”
Koneksi
str = “select * from tabsen where tanggal>=#” & DtAwal.Value & “#” & ” and tanggal<=#” & DtAkhir.Value & “#” & ” and noid=’” & Trim(cmbid.Text) & “‘”
rsabsen.Open str, dbabsensi, adOpenDynamic, adLockOptimistic
If Not rsabsen.EOF Then
Do While Not rsabsen.EOF
‘—— menghitung jumlah ontime —————-’
If Trim(rsabsen!ketmasuk) = “On Time” Then
jlhontime = jlhontime + 1
End If
‘—— menghitung jumlah telat —————-’
If Trim(rsabsen!ketmasuk) = “Telat” Then
jlhtelat = jlhtelat + 1
End If
‘—— menghitung jumlah telat —————-’
If Trim(rsabsen!ketmasuk) = “Permisi” Then
jlhper = jlhper + 1
End If
‘—— menghitung jumlah ontime —————-’
If Trim(rsabsen!ketkeluar) = “On Time” Then
jlhontime1 = jlhontime1 + 1
End If
‘—— menghitung jumlah telat —————-’
If Trim(rsabsen!ketkeluar) = “Lbh Awal” Then
jlhtelat1 = jlhtelat1 + 1
End If
‘—— menghitung jumlah telat —————-’
If Trim(rsabsen!ketkeluar) = “Permisi” Then
jlhper1 = jlhper1 + 1
End If
‘—— jika di akhir keluar dari while ———’
If rsabsen.EOF Then
GoTo a
Else
rsabsen.MoveNext
End If
Loop
End If
a:
crpcetak.GroupSelectionFormula = “{tabsen.Tanggal}>=Date(” & Mid(Trim(DtAwal.Value), 7, 4) & “,” & Mid(Trim(DtAwal.Value), 4, 2) & “,” & Mid(Trim(DtAwal.Value), 1, 2) & “) and {tabsen.Tanggal}<=Date(” & Mid(Trim(DtAkhir.Value), 7, 4) & “,” & Mid(Trim(DtAkhir.Value), 4, 2) & “,” & Mid(Trim(DtAkhir.Value), 1, 2) & “) and {tabsen.noid}=’” & Trim(cmbid.Text) & “‘”
crpcetak.Formulas(4) = “jlhontime=’” & jlhontime & “‘”
crpcetak.Formulas(5) = “jlhper=’” & jlhper & “‘”
crpcetak.Formulas(6) = “jlhtelat=’” & jlhtelat & “‘”
crpcetak.Formulas(7) = “jlhontime1=’” & jlhontime1 & “‘”
crpcetak.Formulas(8) = “jlhper1=’” & jlhper1 & “‘”
crpcetak.Formulas(9) = “jlhtelat1=’” & jlhtelat1 & “‘”
End If
crpcetak.WindowTitle = “Laporan Absensi Pegawai”
crpcetak.Formulas(3) = “periode=’” & Format(DtAwal.Value, “dd-mm-yyyy”) & “ \ ” & Format(DtAkhir.Value, “dd-mm-yyyy”) & “‘”
crpcetak.WindowState = crptMaximized
crpcetak.Destination = crptToWindow
crpcetak.RetrieveDataFiles
crpcetak.Action = 1
cmdcetak.Enabled = False
End Sub
Private Sub cmdkeluar_Click()
Unload Me
End Sub
Private Sub DtAkhir_CloseUp()
If DtAkhir.Value < DtAwal.Value Then
MsgBox “Tanggal Akhir Harus Lebih Besar Dari Tanggal Awal”, vbCritical, “Warning “
DtAkhir.SetFocus
DtAkhir.Value = Date
OptSeluruh.Enabled = False
OptPegawai.Enabled = False
Else
OptSeluruh.Enabled = True
OptPegawai.Enabled = True
End If
End Sub
Private Sub DtAwal_CloseUp()
If DtAwal.Value > DtAkhir.Value Then
MsgBox “Tanggal Awal Harus Lebih Kecil Dari Tanggal Akhir”, vbCritical, “Warning “
DtAwal.SetFocus
DtAwal.Value = Date
OptSeluruh.Enabled = False
OptPegawai.Enabled = False
Else
OptSeluruh.Enabled = True
OptPegawai.Enabled = True
End If
End Sub
Private Sub Form_Activate()
jlhontime = 0
jlhontime1 = 0
jlhper = 0
jlhper1 = 0
jlhtelat = 0
jlhtelat1 = 0
jlh = 0
OptSeluruh.Value = False
OptPegawai.Value = False
OptSeluruh.Enabled = False
OptPegawai.Enabled = False
cmdcetak.Enabled = False
cmbid.Text = “”
cmbid.Enabled = False
DtAwal.SetFocus
DtAwal.Value = Date
DtAkhir.Value = Date
End Sub
Private Sub Form_Load()
Koneksi
rsabsen.Open “select * from tbiodata “, dbabsensi, adOpenDynamic, adLockOptimistic
If Not rsabsen.EOF Then
rsabsen.MoveFirst
Do While Not rsabsen.EOF
cmbid.AddItem rsabsen!noid
If Not rsabsen.EOF Then
rsabsen.MoveNext
Else
Exit Sub
End If
Loop
End If
End Sub
Private Sub OptPegawai_Click()
cmbid.Enabled = True
cmbid.SetFocus
cmdcetak.Enabled = False
End Sub
Private Sub OptSeluruh_Click()
cmbid.Enabled = False
cmbid.Text = “”
If DtAwal.Value <= DtAkhir.Value Then
cmdcetak.Enabled = True
cmdcetak.SetFocus
Else
cmdcetak.Enabled = False
End If
End Sub
maaf Pak,
kami mau tanya soal tugas yang bapak kasi ma kami.
tentang Review TV Digital????????
dari anak D1 gelombang 3 mewakili
Oleh: hardian90 on Oktober 22, 2009
at 4:25 pm