Langkah 1.
Buatlah desain tampilan aplikasi kasir seperti gambar di bawah :
Langkah 2.
Atur propertinya sebagai berikut :
1 | Name : lblTanggal | Caption : - |
2 | Name : lblJam | Caption : - |
3 | Name : txtId | Text : - |
4 | Name : txtMenu | Text : - |
5 | Name : txtSatuan | Text : - |
6 | Name : txtHarga | Text : - |
7 | Name : txtPesanan | Text : - |
8 | Name : txtTotal | Text : - |
9 | Name : txtBayar | Text : - |
10 | Name : txtKembali | Text : - |
11 | Name : cmdBaru | Caption : Menu Baru |
12 | Name : cmdTutup | Caption : Tutup |
13 | Name : Timer1 | Interval : 1 |
Menuliskan source code sesuai dengan fungsinya masing-masing.
Klik 2x Timer1 dan copas kode di bawah :
1: Private Sub Timer1_Timer()
2: lblTanggal.Caption = Format(Date, "dd mmmm yyyy")
3: lblJam.Caption = Format(Time, "hh:mm:ss")
4: End Sub
Klik 2x txtId.text dan isi kode berikut :
1: Private Sub txtId_KeyPress(KeyAscii As Integer)
2: If KeyAscii = 13 Then
3: If txtId.Text = 101 Then
4: txtMenu.Text = "Sate Kambing"
5: txtSatuan.Text = "Porsi"
6: txtHarga.Text = 15000
7:
8: ElseIf txtId.Text = 102 Then
9: txtMenu.Text = "Gulai"
10: txtSatuan.Text = "Porsi"
11: txtHarga.Text = 10000
12:
13: ElseIf txtId.Text = 103 Then
14: txtMenu.Text = "Soto Ayam"
15: txtSatuan.Text = "Porsi"
16: txtHarga.Text = 17000
17:
18: ElseIf txtId.Text = 104 Then
19: txtMenu.Text = "Coto Makasar"
20: txtSatuan.Text = "Porsi"
21: txtHarga.Text = 20000
22:
23: Else
24: MsgBox ("Menu yang dipesan belum ada...!")
25: End If
26: txtPesanan.SetFocus
27:
28: End If
29: End Sub
1: Private Sub txtPesanan_Change()
2: txtTotal.Text = Val(txtHarga.Text) * Val(txtPesanan.Text)
3: End Sub
1: Private Sub txtBayar_Change()
2: txtKembali.Text = Val(txtBayar.Text) - Val(txtTotal.Text)
3: End Sub
1: Private Sub cmdBaru_Click()
2: txtId.Text = ""
3: txtMenu.Text = ""
4: txtSatuan.Text = ""
5: txtHarga.Text = ""
6: txtPesanan.Text = ""
7: txtTotal.Text = ""
8: txtBayar.Text = ""
9: txtKembali.Text = ""
10:
11: txtId.SetFocus
12: End Sub
1: Private Sub cmdTutup_Click()
2: Unload Me
3: End Sub
Tidak ada komentar:
Posting Komentar