Hai! Kali ini saya akan menunjukkan bagaimana membuat Aplikasi Pembayaran pada sebuah warung makan
Step 1 : Buatlah design form sesuai yang anda inginkan atau bisa membuat form seperti contoh ini dan jangan lupa untuk membuat file Excel CSV
ComboBox1 = Nama Kasir
DateTimePicker1 = menampilkan pilihan tanggal
ComboBox2 hingga ComboBox6 = Jenis pesanan makanan
TextBox1 hingga TextBox5 = Jumlah pesanan makanan
TextBox6 hingga TextBox10 = Harga pesanan makanan
TextBox11 = Total harga makanan
ComboBox7 hingga ComboBox11 = Jenis pesanan minuman
TextBox12 hingga TextBox16 = Jumlah pesanan minuman
TextBox17 hingga TextBox21 = Harga pesanan minuman
TextBox22 = Total harga minuman
TextBox23 = Total harga makanan dan minuman
TextBox24 = Bayar, jumlah uang yang di berikan customer
TextBox25 = Kembali, jumlah uang yang di berikan customer di kurang total harga makanan dan minuman
BtnTotal = Total harga makanan dan minuman
BtnHitung = menghasilkan TextBox25
BtnHapus = menghapus semua data
BtnSimpan = menyimpan data di excel dan akan muncul di ListBox1
Step 2 : Berikut Source Code dari aplikasi ini
Public Class Form1
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
If ComboBox2.Text = "Nasi Goreng" Then
TextBox6.Text = Val(TextBox1.Text) * 20000
ElseIf ComboBox2.Text = "Bakso" Then
TextBox6.Text = Val(TextBox1.Text) * 10000
ElseIf ComboBox2.Text = "Mie Ayam Bakso" Then
TextBox6.Text = Val(TextBox1.Text) * 15000
ElseIf ComboBox2.Text = "Kwetiau" Then
TextBox6.Text = Val(TextBox1.Text) * 12000
Else
TextBox6.Text = Val(TextBox1.Text) * 7000
End If
End Sub
Private Sub TextBox2_TextChanged(sender As Object, e As EventArgs) Handles TextBox2.TextChanged
If ComboBox3.Text = "Nasi Goreng" Then
TextBox7.Text = Val(TextBox2.Text) * 20000
ElseIf ComboBox3.Text = "Bakso" Then
TextBox7.Text = Val(TextBox2.Text) * 10000
ElseIf ComboBox3.Text = "Mie Ayam Bakso" Then
TextBox7.Text = Val(TextBox2.Text) * 15000
ElseIf ComboBox3.Text = "Kwetiau" Then
TextBox7.Text = Val(TextBox2.Text) * 12000
Else
TextBox7.Text = Val(TextBox2.Text) * 7000
End If
End Sub
Private Sub TextBox3_TextChanged(sender As Object, e As EventArgs) Handles TextBox3.TextChanged
If ComboBox4.Text = "Nasi Goreng" Then
TextBox8.Text = Val(TextBox3.Text) * 20000
ElseIf ComboBox4.Text = "Bakso" Then
TextBox8.Text = Val(TextBox3.Text) * 10000
ElseIf ComboBox4.Text = "Mie Ayam Bakso" Then
TextBox8.Text = Val(TextBox3.Text) * 15000
ElseIf ComboBox4.Text = "Kwetiau" Then
TextBox8.Text = Val(TextBox3.Text) * 12000
Else
TextBox8.Text = Val(TextBox3.Text) * 7000
End If
End Sub
Private Sub TextBox4_TextChanged(sender As Object, e As EventArgs) Handles TextBox4.TextChanged
If ComboBox5.Text = "Nasi Goreng" Then
TextBox9.Text = Val(TextBox4.Text) * 20000
ElseIf ComboBox5.Text = "Bakso" Then
TextBox9.Text = Val(TextBox4.Text * 10000
ElseIf ComboBox5.Text = "Mie Ayam Bakso" Then
TextBox9.Text = Val(TextBox4.Text * 15000
ElseIf ComboBox5.Text = "Kwetiau" Then
TextBox9.Text = Val(TextBox4.Text * 12000
Else
TextBox9.Text = Val(TextBox4.Text * 7000
End If
End Sub
Private Sub TextBox5_TextChanged(sender As Object, e As EventArgs) Handles TextBox5.TextChanged
If ComboBox6.Text = "Nasi Goreng" Then
TextBox10.Text = Val(TextBox5.Text) * 20000
ElseIf ComboBox6.Text = "Bakso" Then
TextBox10.Text = Val(TextBox5.Text) * 10000
ElseIf ComboBox6.Text = "Mie Ayam Bakso" Then
TextBox10.Text = Val(TextBox5.Text) * 15000
ElseIf ComboBox6.Text = "Kwetiau" Then
TextBox10.Text = Val(TextBox5.Text) * 12000
Else
TextBox10.Text = Val(TextBox5.Text) * 7000
End If
End Sub
Private Sub TextBox12_TextChanged(sender As Object, e As EventArgs) Handles TextBox12.TextChanged
If ComboBox7.Text = "Teh Botol" Then
TextBox17.Text = Val(TextBox12.Text) * 4000
ElseIf ComboBox7.Text = "Es Jeruk" Then
TextBox17.Text = Val(TextBox12.Text) * 4000
ElseIf ComboBox7.Text = "Es Campur" Then
TextBox17.Text = Val(TextBox12.Text) * 8000
ElseIf ComboBox7.Text = "Fanta Susu" Then
TextBox17.Text = Val(TextBox12.Text) * 5000
Else
TextBox17.Text = Val(TextBox12.Text) * 3000
End If
End Sub
Private Sub TextBox13_TextChanged(sender As Object, e As EventArgs) Handles TextBox13.TextChanged
If ComboBox8.Text = "Teh Botol" Then
TextBox18.Text = Val(TextBox13.Text) * 4000
ElseIf ComboBox8.Text = "Es Jeruk" Then
TextBox18.Text = Val(TextBox13.Text) * 4000
ElseIf ComboBox8.Text = "Es Campur" Then
TextBox18.Text = Val(TextBox13.Text) * 8000
ElseIf ComboBox8.Text = "Fanta Susu" Then
TextBox18.Text = Val(TextBox13.Text) * 5000
Else
TextBox18.Text = Val(TextBox13.Text) * 3000
End If
End Sub
Private Sub TextBox14_TextChanged(sender As Object, e As EventArgs) Handles TextBox14.TextChanged
If ComboBox9.Text = "Teh Botol" Then
TextBox19.Text = Val(TextBox14.Text) * 4000
ElseIf ComboBox9.Text = "Es Jeruk" Then
TextBox19.Text = Val(TextBox14.Text) * 4000
ElseIf ComboBox9.Text = "Es Campur" Then
TextBox19.Text = Val(TextBox14.Text) * 8000
ElseIf ComboBox9.Text = "Fanta Susu" Then
TextBox19.Text = Val(TextBox14.Text) * 5000
Else
TextBox17.Text = Val(TextBox12.Text) * 3000
End If
End Sub
Private Sub TextBox15_TextChanged(sender As Object, e As EventArgs) Handles TextBox15.TextChanged
If ComboBox10.Text = "Teh Botol" Then
TextBox20.Text = Val(TextBox15.Text) * 4000
ElseIf ComboBox10.Text = "Es Jeruk" Then
TextBox20.Text = Val(TextBox15.Text) * 4000
ElseIf ComboBox10.Text = "Es Campur" Then
TextBox20.Text = Val(TextBox15.Text) * 8000
ElseIf ComboBox10.Text = "Fanta Susu" Then
TextBox20.Text = Val(TextBox15.Text) * 5000
Else
TextBox20.Text = Val(TextBox15.Text) * 3000
End If
End Sub
Private Sub TextBox16_TextChanged(sender As Object, e As EventArgs) Handles TextBox16.TextChanged
If ComboBox11.Text = "Teh Botol" Then
TextBox21.Text = Val(TextBox16.Text) * 4000
ElseIf ComboBox11.Text = "Es Jeruk" Then
TextBox21.Text = Val(TextBox16.Text) * 4000
ElseIf ComboBox11.Text = "Es Campur" Then
TextBox21.Text = Val(TextBox16.Text) * 8000
ElseIf ComboBox11.Text = "Fanta Susu" Then
TextBox21.Text = Val(TextBox16.Text) * 5000
Else
TextBox21.Text = Val(TextBox16.Text) * 3000
End If
End Sub
Private Sub BtnTotal_Click(sender As Object, e As EventArgs) Handles BtnTotal.Click
TextBox11.Text = Val(TextBox6.Text) + Val(TextBox7.Text) + Val(TextBox8.Text) + Val(TextBox9.Text) + Val(TextBox10.Text)
TextBox22.Text = Val(TextBox17.Text) + Val(TextBox18.Text) + Val(TextBox19.Text) + Val(TextBox20.Text) + Val(TextBox21.Text)
TextBox23.Text = TextBox1.Text + TextBox22.Text
End Sub
Private Sub BtnHitung_Click(sender As Object, e As EventArgs) Handles BtnHitung.Click
TextBox25.Text = TextBox24.Text - TextBox23.Text
End Sub
Private Sub BtnHapus_Click(sender As Object, e As EventArgs) Handles BtnHapus.Click
ComboBox1.Text = ""
ComboBox2.Text = ""
ComboBox3.Text = ""
ComboBox4.Text = ""
ComboBox5.Text = ""
ComboBox6.Text = ""
ComboBox7.Text = ""
ComboBox8.Text = ""
ComboBox9.Text = ""
ComboBox10.Text = ""
ComboBox11.Text = ""
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox7.Text = ""
TextBox8.Text = ""
TextBox9.Text = ""
TextBox10.Text = ""
TextBox11.Text = ""
TextBox12.Text = ""
TextBox13.Text = ""
TextBox14.Text = ""
TextBox15.Text = ""
TextBox16.Text = ""
TextBox17.Text = ""
TextBox18.Text = ""
TextBox19.Text = ""
TextBox20.Text = ""
TextBox21.Text = ""
TextBox22.Text = ""
TextBox23.Text = ""
TextBox24.Text = ""
TextBox25.Text = ""
ListBox1.Text = ""
End Sub
Private Sub BtnSimpan_Click(sender As Object, e As EventArgs) Handles BtnSimpan.Click
Dim nofile As Integer
Dim var1, var2, var3, var4, var5, var6, var7 As String
nofile = FreeFile()
FileOpen(nofile, "C:\Users\Velly\Desktop\Data Transaksi Pembayaran.CSV", OpenMode.Append)
var1 = ComboBox1.Text
var2 = DateTimePicker1.Text
var3 = ComboBox2.Text & ComboBox3.Text & ComboBox4.Text & ComboBox5.Text & ComboBox6.Text
var4 = TextBox11.Text
var5 = ComboBox7.Text & ComboBox8.Text & ComboBox9.Text & ComboBox10.Text & ComboBox11.Text
var6 = TextBox22.Text
var7 = TextBox23.Text
ListBox1.Items.Add(var1 & "---" & var2 & "---" & var3 & "---" & var4 & "---" & var5 & "---" & var6 & "---" & var7 & "---")
WriteLine(1, var1, var2, var3, var4, var5, var6, var7)
FileClose(1)
End Sub
End Class
Step 3 : Berikut hasil ketika kita sudah input datanya