Jumat, 02 April 2010

Dim awal, akhir As Date
Dim lama As Double

Private Sub cmd_keluar_Click()
End
End Sub


Private Sub txt_bg_change()
Ado_parkir.RecordSource = “Select*from tb_parkir where no_polisi=” ‘”&txt_bg.text&”‘”
Ado_parkir.Refresh
With Ado_parkir.Recordset
If .PageCount <> 0 Then
If !Status = “T” Then
TXT_MULAI.Text = !jam_masuk
cmd_mulai.Caption = “&Stop”
cmd_mulai.SetFocus
Else
MsgBox “Nomor Polisi Yang Telah tersimpan Silahkan Anda Tekan Tombol Mulai”, vbInformation + vbOKOnly, “BG”
cmd_mulai.SetFocus
End If
Else
TXT_MULAI.Text = “”
TXT_SELESAI.Text = “”
TXT_TOTAL.Text = “”
TXT_BIAYA.Text = “”
cmd_mulai.Caption = “&Mulai”
End If
End With
End Sub
Private Sub txt_bg_keypress(KeyASCII As Integer)
If KeyASCII = 13 Then cmd_mulai.SetFocus
End Sub
Private Sub cmd_mulai_Click()
Dim biaya As Integer

If TXT_BG.Text = “” Then
MsgBox “Masukkan Nomor BG Terlebih Dahulu”, vbInformation + vbOKOnly, “Information”
TXT_BG.SetFocus
Else
If cmd_mulai.Caption = “&Mulai” Then
awal = Time
TXT_MULAI.Text = awal
cmd_mulai.Caption = “&Simpan”
ElseIf cmd_mulai.Caption = “&Simpan” Then
Ado_parkir.RecordSource = “Select*from tb_parkir”
Ado_parkir.Refresh
With Ado_parkir.Recordset
.AddNew
!no_polisi = TXT_BG.Text
!jam_masuk = TXT_MULAI.Text
.Update
End With
cmd_mulai.Caption = “&Mulai”
TXT_MULAI.Text = “”
TXT_BG.Text = “”
TXT_BG.SetFocus

ElseIf cmd_mulai.Caption = “&Stop” Then
akhir = Time
TXT_SELESAI.Text = akhir
cmd_mulai.Caption = “&Lama”

ElseIf cmd_mulai.Caption = “&Lama” Then
Ado_parkir.RecordSource = “Select jam_masuk from”
tb_parkir where no_polisi=’”&txt_bg.text&”‘”
Ado_parkir.Refresh
lama = akhir - Ado_parkir.Recordset!jam_masuk
TXT_TOTAL.Text = Format(lama, “hh:mm:ss”)
cmd_mulai.Caption = “&Biaya”

ElseIf cmd_mulai.Caption = “&Biaya” Then
biaya = 50000 * lama
TXT_BIAYA.Text = Format(biaya, “Rp #,#”)
Ado_parkir.RecordSource = “select*from tb_parkir”
where ado_parkir=’”&txt_bg.text&”‘”
Ado_parkir.Refresh
With Ado_parkir.Recordset
!jam_keluar = TXT_SELESAI.Text
!biaya = biaya
!Status = “Y”
.Update
End With
cmd_mulai.Caption = “&Parkir”

ElseIf cmd_mulai.Caption = “&Parkir” Then
TXT_MULAI.Text = “”
TXT_SELESAI.Text = “”
TXT_TOTAL.Text = “”
TXT_BG.Text = “”
TXT_BIAYA.Text = “”
TXT_BG.SetFocus
cmd_mulai.Caption = “&Mulai”
End If
End If
End Sub
Private Sub cmd_cari_click()
On Error GoTo Error:

Cari = InputBox(“Masukkan Nomor Polisi Yang Akan Dicari:”, “Cari No.Polisi”)

If Cari <> Empty Then
ado_parkir.RecordSource=”Select*from tb_parkir where no_polisi=’”&Cari”‘”
Ado_parkir.Refresh
With Ado_parkir.Recordset
If !Status = “T” Then
TXT_BG.Text = !no_polisi
TXT_MULAI.Text = !jam_masuk
cmd_mulai.Caption = “&Stop”
TXT_SELESAI.Text = “”
TXT_BIAYA.Text = “”
TXT_TOTAL.Text = “”
Else
TXT_BG.Text = !no_polisi
TXT_MULAI.Text = “”
TXT_SELESAI = “”
TXT_BIAYA = “”
TXT_TOTAL = “”
cmd_mulai.Caption = “&Mulai”
End If

Exit Sub
Error:
MsgBox “No.Polisi Yang Anda Cari Tidak Ada!”, vbQuestion + vbOKOnly, “Pencarian”
TXT_BG.SetFocus
End With
End If
End Sub

0 komentar:

Posting Komentar

Mohon Tidak Mengirim Spam : Karena Setiap Spam akan kami hapus