Ini adalah tampilan form untuk membuat program penjualan barang. Setelah membuat form seperti di bawah ini, buat agar textbox Nama Barang, Harga Satuan, Total Harga, Discount, PPN, Total Bayar dan Kembali tidak dapat di akses (properti Enabled di set ke false).
Berikut Listingnya :
Option Explicit
Dim nama As String
Dim harga As Currency
Dim diskon As Currency
Dim total As Currency
Dim totalhrg As Currency
Dim ppn As Currency
Private Sub Combo1_Click()
‘Listing untuk combo1
If Combo1.Text = "A001" Then
nama = "Mesin Cuci"
harga = "1000000"
ElseIf Combo1.Text = "B002" Then
nama = "Kulkas"
harga = "1500000"
ElseIf Combo1.Text = "C003" Then
nama = "Televisi"
harga = "1250000"
ElseIf Combo1.Text = "D004" Then
nama = "Komputer"
harga = "3500000"
End If
Text1.Text = nama
Text2.Text = Format(harga, "###,###")
End Sub
Private Sub Command1_Click()
‘Listing Tombol Hitung
totalhrg = harga * Val(Text3.Text)
ppn = totalhrg * 0.1
If Val(Text3.Text) > 5 Then
totalhrg = totalhrg
diskon = totalhrg * 0.3
Else
totalhrg = totalhrg
diskon = 0
End If
Text4.Text = Format(totalhrg, "###,###")
Text5.Text = Format(diskon, "###,###")
Text6.Text = Format(ppn, "###,###")
total = (totalhrg - diskon) + ppn
Text7.Text = Format(total, "###,###")
End Sub
Private Sub Command2_Click()
‘Listing Tombol Ulangi
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Combo1.Text = "-Pilih-"
Combo1.SetFocus
End Sub
Private Sub Command3_Click()
‘Listing Tombol Kembali
End
End Sub
Private Sub Form_Load()
‘Listing untuk Form
Combo1.Text = "-Pilih-"
Combo1.AddItem "A001"
Combo1.AddItem "B002"
Combo1.AddItem "C003"
Combo1.AddItem "D004"
End Sub
Private Sub Text8_LostFocus()
‘Listing untuk Text8
Text9.Text = Format(CSng(Text8.Text) - CSng(Text7.Text), "Standard")
Command2.SetFocus
End Sub
Ini Outputnya :





0 komentar:
Posting Komentar