Dengan rincian Form:
No.
|
Object
|
Properties
|
Nilai
|
1.
|
Form1
|
Text
|
Program Perhitungan Pembelian Buah
|
2.
|
Label1
|
Text
|
TOKO BUAH SETIA HATI
|
Style Font
|
Monotype Corsiva
|
||
Font Size
|
16
|
||
Italic Bold
|
True
|
||
3.
|
Label2
|
Text
|
Kode Buah
|
4.
|
Label3
|
Text
|
Jumlah
|
5.
|
Label4
|
Text
|
Kg
|
6.
|
Label5
|
Text
|
____________________________________
|
7.
|
Label6
|
Text
|
Hasil Begadang : Riki Hardiyanto
|
8.
|
Label7
|
Text
|
Data Tersimpan
|
9.
|
Label8
|
Text
|
Input Pembelian
|
9.
|
Label9
|
Text
|
Input Pembayaran
|
10.
|
Label10
|
Text
|
Nominal Pembayaran
|
11.
|
Label11
|
Text
|
Kembalian
|
12.
|
Label12
|
Text
|
.............
|
13.
|
Label13
|
Text
|
Harga Pokok
|
14.
|
Label14
|
Text
|
.............
|
15
|
Label15
|
Text
|
Discount
|
16.
|
Label16
|
Text
|
.............
|
17.
|
Label17
|
Text
|
Total Bayar
|
18.
|
Label18
|
Text
|
.............
|
19.
|
TextBox1
|
||
20.
|
TextBox2
|
||
21.
|
TextBox3
|
||
22.
|
TextBox4
|
||
23.
|
ListBox1
|
||
24.
|
ListBox2
|
||
25.
|
Button1
|
Text
|
Simpan
|
26.
|
Button2
|
Text
|
Reset
|
27.
|
Button3
|
Text
|
Cetak Nota
|
28.
|
Button4
|
Text
|
Reset All
|
29.
|
Button5
|
Text
|
Keluar
|
30.
|
Button6
|
Text
|
Info Kode
|
31.
|
Button7
|
Text
|
Hitung Kembalian
|
32.
|
Button8
|
Text
|
Hitung Bayar
|
33.
|
Panel1
|
Setelah itu kita buat Source Codenya:
Public Class Form1
Dim
jumlahA, jumlahK, jumlahS, jumlahbeli, nominal As Integer
Dim
hargaA, hargaK, hargaS, hargapokok, discount, totalharga, kembali As Double
Dim
tampil(2, 2) As String
Private Sub
Form1_Load(sender As Object,
e As EventArgs)
Handles MyBase.Load
TextBox3.Text = ("Nama
Buah" & vbTab & "Jumlah Beli"
& vbTab & "Harga / Kilo")
End Sub
Private Sub
Button1_Click(sender As Object,
e As EventArgs)
Handles Button1.Click
If
TextBox1.Text = "A" Then
TextBox1.Text = "1"
tampil(TextBox1.Text - 1, 0) = "Anggur"
If
TextBox2.Text = "" Then
Dim
response As MsgBoxResult
response = MsgBox("Inputkan
Jumlah", MsgBoxStyle.Information
+ MsgBoxStyle.RetryCancel, "Warning!!")
If
response = MsgBoxResult.Retry Then
Me.TextBox1.Text
= ""
Me.TextBox2.Text
= ""
ElseIf
response = MsgBoxResult.Cancel Then
Exit
Sub
End If
Else
tampil(TextBox1.Text - 1, 1) =
TextBox2.Text
tampil(TextBox1.Text - 1, 2) = "35000"
ListBox1.Items.Add(tampil(TextBox1.Text - 1, 0) & vbTab & vbTab
& tampil(TextBox1.Text - 1, 1) & " kg" & vbTab & vbTab
& tampil(TextBox1.Text - 1, 2))
jumlahA = TextBox2.Text
End If
ElseIf
TextBox1.Text = "K" Then
TextBox1.Text = "2"
tampil(TextBox1.Text - 1, 0) = "Kiwi"
If
TextBox2.Text = "" Then
Dim
response As MsgBoxResult
response = MsgBox("Inputkan
Jumlah", MsgBoxStyle.Information
+ MsgBoxStyle.RetryCancel, "Warning!!")
If
response = MsgBoxResult.Retry Then
Me.TextBox1.Text
= ""
Me.TextBox2.Text
= ""
ElseIf
response = MsgBoxResult.Cancel Then
Exit
Sub
End If
Else
tampil(TextBox1.Text - 1, 1) =
TextBox2.Text
tampil(TextBox1.Text - 1, 2) = "25000"
ListBox1.Items.Add(tampil(TextBox1.Text
- 1, 0) & vbTab & vbTab & tampil(TextBox1.Text - 1, 1) & " kg" & vbTab & vbTab
& tampil(TextBox1.Text - 1, 2))
jumlahK = TextBox2.Text
End If
ElseIf
TextBox1.Text = "S" Then
TextBox1.Text = "3"
tampil(TextBox1.Text - 1, 0) = "Sunkis"
If
TextBox2.Text = "" Then
Dim
response As MsgBoxResult
response = MsgBox("Inputkan
Jumlah", MsgBoxStyle.Information
+ MsgBoxStyle.RetryCancel, "Warning!!")
If
response = MsgBoxResult.Retry Then
Me.TextBox1.Text
= ""
Me.TextBox2.Text
= ""
ElseIf
response = MsgBoxResult.Cancel Then
Exit
Sub
End If
Else
tampil(TextBox1.Text - 1, 1) =
TextBox2.Text
tampil(TextBox1.Text - 1, 2) = "20000"
ListBox1.Items.Add(tampil(TextBox1.Text - 1, 0) & vbTab & vbTab
& tampil(TextBox1.Text - 1, 1) & " kg" & vbTab & vbTab
& tampil(TextBox1.Text - 1, 2))
jumlahS = TextBox2.Text
End If
ElseIf
TextBox1.Text <> "A"
+ "K" + "S"
+ "" Then
Dim
response As MsgBoxResult
response = MsgBox("Kode
Anda Salah", MsgBoxStyle.Information
+ MsgBoxStyle.RetryCancel, "Warning!!")
If
response = MsgBoxResult.Retry Then
Me.TextBox1.Clear()
Me.TextBox2.Clear()
ElseIf
response = MsgBoxResult.Cancel Then
Exit Sub
End If
End If
End Sub
Private Sub
Button2_Click(sender As Object,
e As EventArgs)
Handles Button2.Click
TextBox1.Text = ""
TextBox2.Text = ""
End Sub
Private Sub
Button5_Click(sender As Object,
e As EventArgs)
Handles Button5.Click
Dim
response As MsgBoxResult
response = MsgBox("Anda
yakin Ingin keluar??", MsgBoxStyle.Question
+ MsgBoxStyle.YesNo, "Confirm")
If
response = MsgBoxResult.Yes Then
Me.Dispose()
ElseIf
response = MsgBoxResult.No Then
Exit Sub
End If
End Sub
Private Sub
Button4_Click(sender As Object,
e As EventArgs)
Handles Button4.Click
TextBox1.Text = ""
TextBox2.Text = ""
TextBox4.Text = ""
ListBox1.Items.Clear()
ListBox2.Items.Clear()
Label14.Text = ("....................")
Label16.Text = ("....................")
Label18.Text = ("....................")
Label12.Text = ("....................")
End Sub
Private Sub
Button6_Click(sender As Object,
e As EventArgs)
Handles Button6.Click
MsgBox("Kode
Buah :"
& vbNewLine & "A : Anggur"
& vbNewLine & "K : Kiwi"
& vbNewLine & "S : Sunkis",
MsgBoxStyle.MsgBoxHelp, "Info
Kode")
End Sub
Private Sub
Button8_Click(sender As Object,
e As EventArgs)
Handles Button8.Click
jumlahbeli = jumlahA + jumlahK +
jumlahS
hargaA = jumlahA * 35000
hargaK = jumlahK * 25000
hargaS = jumlahS * 20000
hargapokok = hargaA + hargaK + hargaS
If
jumlahbeli >= 50 Then
discount = hargapokok * 0.05
totalharga = hargapokok - discount
Else
totalharga = hargapokok
End If
Label14.Text = hargapokok
Label16.Text = discount
Label18.Text = totalharga
End Sub
Private Sub
Button7_Click(sender As Object,
e As EventArgs)
Handles Button7.Click
nominal = TextBox4.Text
If
nominal < totalharga Then
TextBox4.Text = ""
Dim
respon As MsgBoxResult
MsgBox("Uang
Tidak Cukup", MsgBoxStyle.Information
+ MsgBoxStyle.RetryCancel, "Warning!!")
If
respon = MsgBoxResult.Retry Then
Me.Label12.Text
= ""
ElseIf
respon = MsgBoxResult.Cancel Then
Exit Sub
End If
Else
kembali = nominal - totalharga
Label12.Text = kembali
End If
End Sub
Private Sub
Button3_Click(sender As Object,
e As EventArgs)
Handles Button3.Click
jumlahbeli = jumlahA + jumlahK +
jumlahS
hargaA = jumlahA * 35000
hargaK = jumlahK * 25000
hargaS = jumlahS * 20000
hargapokok = hargaA + hargaK + hargaS
If
jumlahbeli >= 50 Then
discount = hargapokok * 0.05
totalharga = hargapokok - discount
Else
totalharga = hargapokok
End If
ListBox2.Items.Add(vbTab & " NOTA TOKO BUAH SETIA HATI ")
ListBox2.Items.Add(vbTab & "__________________________________")
ListBox2.Items.Add("")
ListBox2.Items.Add("Nama
Buah" & vbTab & "Jumlah Beli"
& vbTab & "Total Harga")
ListBox2.Items.Add("")
ListBox2.Items.Add("Anggur"
& vbTab & vbTab & jumlahA & " kg" & vbTab & vbTab
& hargaA)
ListBox2.Items.Add("Kiwi"
& vbTab & vbTab & jumlahK & " kg" & vbTab & vbTab
& hargaK)
ListBox2.Items.Add("Sunkis"
& vbTab & vbTab & jumlahS & " kg" & vbTab & vbTab
& hargaS)
ListBox2.Items.Add("________________________________________________")
ListBox2.Items.Add("")
ListBox2.Items.Add("Harga
Pokok " & vbTab & vbTab & vbTab &
hargapokok)
ListBox2.Items.Add("Discount
" & vbTab & vbTab & vbTab & vbTab &
discount)
ListBox2.Items.Add("Total
Bayar " & vbTab & vbTab & vbTab &
totalharga)
ListBox2.Items.Add("________________________________________________")
ListBox2.Items.Add("")
ListBox2.Items.Add("Nominal
" & vbTab & vbTab & vbTab & vbTab & nominal)
ListBox2.Items.Add("Kembali
" & vbTab & vbTab & vbTab & vbTab &
kembali)
End Sub
End Class
Setelah kita buat semua maka hasilnya kurang lebih seperti ini
Terima Kasih Semoga Bermanfaat.
Tidak ada komentar:
Posting Komentar