Design Form
Ketentuan Program :
Jurusan Ditentukan berdasarkan 3 Karakter Pertama dari Kode Bus
- PHK = PAHALA KENCANA, Jurusan = Jakarta - Bali
- DWS = DEWI SARTIKA, Jurusan = Jakarta - Solo
- DDJ = DEDY JAYA, Jurusan = Jakarta - Magelang
- A = Rp. 275.000,-
- B = Rp. 325.000,-
- C = Rp. 452.000,-
Private Sub bersih()
'Membuat Prosedur Bersih
Me.txtno.Text = ""
Me.txtnama.Text = ""
Me.txtkode.Text = ""
Me.txtjurusan.Text = ""
Me.txtjumlah.Text = ""
Me.txtjumbay.Text = ""
Me.txtasuransi.Text = ""
Me.txttotal.Text = ""
Me.txtbay.Text = ""
Me.txtkembali.Text = ""
Me.txtbus.Text = ""
Me.txtharga.Text = ""
End Sub
Private Sub mati()
'Membuat Prosedur tidak aktif
Me.txtno.Enabled = False
Me.txtnama.Enabled = False
Me.txtkode.Enabled = False
Me.txtjurusan.Enabled = False
Me.txtjumlah.Enabled = False
Me.txtjumbay.Enabled = False
Me.txtasuransi.Enabled = False
Me.txttotal.Enabled = False
Me.txtbay.Enabled = False
Me.txtkembali.Enabled = False
Me.txtbus.Enabled = False
Me.txtharga.Enabled = False
Me.txtno.BackColor = vbInactiveBorder
Me.txtnama.BackColor = vbInactiveBorder
Me.txtkode.BackColor = vbInactiveBorder
Me.txtjurusan.BackColor = vbInactiveBorder
Me.txtjumlah.BackColor = vbInactiveBorder
Me.txtjumbay.BackColor = vbInactiveBorder
Me.txtasuransi.BackColor = vbInactiveBorder
Me.txttotal.BackColor = vbInactiveBorder
Me.txtbay.BackColor = vbInactiveBorder
Me.txtkembali.BackColor = vbInactiveBorder
Me.txtbus.BackColor = vbInactiveBorder
Me.txtharga.BackColor = vbInactiveBorder
End Sub
Private Sub hidup()
'Membuat Prosedur Aktif
Me.txtno.Enabled = True
Me.txtnama.Enabled = True
Me.txtkode.Enabled = True
Me.txtjurusan.Enabled = True
Me.txtjumlah.Enabled = True
Me.txtjumbay.Enabled = True
Me.txtasuransi.Enabled = True
Me.txttotal.Enabled = True
Me.txtbay.Enabled = True
Me.txtkembali.Enabled = True
Me.txtbus.Enabled = True
Me.txtharga.Enabled = True
Me.txtno.BackColor = vbWhite
Me.txtnama.BackColor = vbWhite
Me.txtkode.BackColor = vbWhite
Me.txtjurusan.BackColor = vbWhite
Me.txtjumlah.BackColor = vbWhite
Me.txtjumbay.BackColor = vbWhite
Me.txtasuransi.BackColor = vbWhite
Me.txttotal.BackColor = vbWhite
Me.txtbay.BackColor = vbWhite
Me.txtkembali.BackColor = vbWhite
Me.txtbus.BackColor = vbWhite
Me.txtharga.BackColor = vbWhite
End Sub
Private Sub cmdbesih_Click()
'Memanggil Prosedur
Call bersih
Call mati
Me.CmdTambah.Enabled = True
Me.CmdTambah.SetFocus
End Sub
Private Sub cmdkeluar_Click()pesan = MsgBox("Yakin dah mau tutup ??.....", vbYesNo, "AGEN BUS MALAM")
If pesan = vbYes Then
End
End If
End Sub
Private Sub cmdtambah_Click()'Memanggil Prosedur
Call hidup
Call bersih
Me.txtno.SetFocus
Me.CmdTambah.Enabled = False
Me.cmdbesih.Enabled = True
End Sub
Private Sub Form_Activate()Me.Label12.Caption = Date
Me.Label13.Caption = Time
Call mati
Call bersih
Me.CmdTambah.SetFocus
Me.cmdbesih.Enabled = False
End Sub
Private Sub txtbay_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then
Me.txtkembali.Text = Val(Me.txtbay.Text) - Val(Me.txttotal.Text)
If Me.txtbay.Text <= Me.txttotal.Text Then
pesan = MsgBox("Jumlah Pembayaran Anda Kurang", vbInformation, "Buzz")
Me.txtbay.Text = ""
Me.txtkembali.Text = ""
Me.txtbay.SetFocus
Else
Me.cmdbesih.SetFocus
Me.CmdTambah.Enabled = False
End If
End If
End Sub
Private Sub txtjumlah_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then
Me.txtjumbay.Text = Val(Me.txtharga.Text) * Val(Me.txtjumlah.Text)
Me.txtasuransi.Text = 0.25 * Val(Me.txtjumbay.Text)
Me.txttotal.Text = Val(Me.txtjumbay.Text) + Val(Me.txtasuransi.Text)
Me.txtbay.SetFocus
End If
Me.txtjumbay.Enabled = False
Me.txtasuransi.Enabled = False
Me.txttotal.Enabled = False
End Sub
Private Sub txtkode_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then
'memanggil Nama bus dan jurusan berdasarkan dari 3 karakter sebelah kiri dari Kode Bus
If Left(txtkode, 3) = "PHK" Or Left(txtkode, 3) = "phk" Then
Me.txtbus.Text = "Pahala Kencana"
Me.txtjurusan.Text = "Jakarta - Bali"
Else
If Left(txtkode, 3) = "DWS" Or Left(txtkode, 3) = "dws" Then
Me.txtbus.Text = "Dewi Sri"
Me.txtjurusan.Text = "Jakarta - Solo"
Else
If Left(txtkode, 3) = "DDJ" Or Left(txtkode, 3) = "ddj" Then
Me.txtbus.Text = "Dedy Jaya"
Me.txtjurusan.Text = "Jakarta - Magelang"
Else
Me.txtbus.Text = ""
Me.txtjurusan.Text = ""
End If
End If
End If
'Menentukan Harga tiket berdasarkan 1 Karakter sebelah kanan dari Kode Bus
If Right(txtkode, 1) = "A" Or Right(txtkode, 1) = "a" Then
Me.txtharga.Text = 275000
Else
If Right(txtkode, 1) = "B" Or Right(txtkode, 1) = "b" Then
Me.txtharga.Text = 325000
Else
If Right(txtkode, 1) = "C" Or Right(txtkode, 1) = "c" Then
Me.txtharga.Text = 452000
Else
Me.txtharga.Text = ""
End If
End If
End If
Me.txtjumlah.SetFocus
End If
End Sub
Private Sub txtnama_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then
Me.txtkode.SetFocus
End If
End Sub
Private Sub txtno_KeyPress(KeyAscii As Integer)If KeyAscii = 13 Then
Me.txtnama.SetFocus
End If
End Sub
0 komentar:
Posting Komentar