Cara Membuat Aplikasi Pemesanan Barang Di VB 06 - Pertama - tama marilah kita panjatkan puji syukur kepada Allah SWT yang telah banyak memberikan banyak nikmat kepada kita sehingga kita bisa bertemu kembali di Blog Download Sourcecode ini, mudah-mudahan niat kita untuk belajar ilmu ini dapat bermanfaat bagi kita.
Sholawat dan salam selalu tercurahkan kepada Nabi Muhammad SAW yang telah menunjukan jalan yang benar, semoga sholawatnya bersambung kepada Keluarga dan Sahabat dan bersambung kepada Para pengikutnya.
Pada kesempatan kali ini saya akan membahas bagaimana cara membuat aplikasi pemesanan barang menggunakan Visual Basic 0.6, mari kita simak panduannya dibawah ini.
- Buka Aplikasi Microsoft Visual Basic 0.6
- Kemudian buatlah sebuah form seperti berikut ini dengan dilengkapi label chekbox dan yang lainnya, seperti pada gambar berikut ini.
- Selanutnya double klik pada form yang telah kita buat, masukan script berikut untuk menjalankan aplikasinya.Dim menu(0 To 12) As String
Dim price(0 To 12) As Integer
Dim prices(0 To 12) As Integer
Private Sub cmdAdd_Click()
'FOODS
menu(0) = "Bakso"
menu(1) = "Mie Ayam"
menu(2) = "Gorengan"
menu(3) = "Batagor"
menu(4) = "Sayur Asem"
'DRINKS
menu(5) = "Es Teh"
menu(6) = "Kopi"
menu(7) = "Teh Anget"
menu(8) = "Air Putih"
menu(9) = "Jus Lemon"
menu(10) = "Es Dawet"
menu(11) = "Wedang Bajigur"
menu(12) = "Es Kelapa Muda"
If MsgBox("Apakah Njenengan Yakin ?", vbQuestion + vbYesNo, "Proses Pesanan ?") = vbYes Then
cmdAdd.Enabled = False
Call lockcontrol
cmdNew.Enabled = True
cmdPay.Enabled = True
cmdCancel.Enabled = True
If chkSpag.Value = 1 Then
price(0) = 10000
lstOrder.AddItem menu(0) & Space(30) & Format((price(0)), "###,###0.00")
Else
price(0) = 0
End If
If chkBread.Value = 1 Then
price(1) = 7000
lstOrder.AddItem menu(1) & Space(37) & Format((price(1)), "###,###0.00")
Else
price(1) = 0
End If
If chkCarb.Value = 1 Then
price(2) = 1000
lstOrder.AddItem menu(2) & Space(28) & Format((price(2)), "###,###0.00")
Else
price(2) = 0
End If
If chkCake.Value = 1 Then
price(3) = 5000
lstOrder.AddItem menu(3) & Space(39) & Format((price(3)), "###,###0.00")
Else
price(3) = 0
End If
If chkValue.Value = 1 Then
price(4) = 10000
lstOrder.AddItem menu(4) & Space(27) & Format((price(4)), "###,###0.00")
Else
price(4) = 0
End If
If chkCoke.Value = 1 Then
price(5) = 1500
lstOrder.AddItem menu(5) & Space(38) & Format((price(5)), "###,###0.00")
Else
price(5) = 0
End If
If chkSprite.Value = 1 Then
price(6) = 2000
lstOrder.AddItem menu(6) & Space(37) & Format((price(6)), "###,###0.00")
Else
price(6) = 0
End If
If chkRoyal.Value = 1 Then
price(7) = 1500
lstOrder.AddItem menu(7) & Space(37) & Format((price(7)), "###,###0.00")
Else
price(7) = 0
End If
If chkC2.Value = 1 Then
price(8) = 1000
lstOrder.AddItem menu(8) & Space(44) & Format((price(8)), "###,###0.00")
Else
price(8) = 0
End If
If chktrop.Value = 1 Then
price(9) = 5000
lstOrder.AddItem menu(9) & Space(29) & Format((price(9)), "###,###0.00")
Else
price(9) = 0
End If
If chkMount.Value = 1 Then
price(10) = 3000
lstOrder.AddItem menu(10) & Space(22) & Format((price(10)), "###,###0.00")
Else
price(10) = 0
End If
If chkPepsi.Value = 1 Then
price(11) = 3000
lstOrder.AddItem menu(11) & Space(39) & Format((price(11)), "###,###0.00")
Else
price(11) = 0
End If
If chkSpark.Value = 1 Then
price(12) = 6000
lstOrder.AddItem menu(12) & Space(35) & Format((price(12)), "###,###0.00")
Else
price(12) = 0
End If
'COMBO MEALS
If chkA1.Value = 1 Then
prices(0) = 50
prices(11) = 50
lstOrder.AddItem menu(0) & Space(30) & Format((prices(0)), "###,###0.00")
lstOrder.AddItem menu(11) & Space(39) & Format((prices(11)), "###,###0.00")
Else
prices(0) = 0
prices(11) = 0
End If
If chkA2.Value = 1 Then
prices(3) = 150
prices(9) = 50
lstOrder.AddItem menu(3) & Space(39) & Format((prices(3)), "###,###0.00")
lstOrder.AddItem menu(9) & Space(29) & Format((prices(9)), "###,###0.00")
Else
prices(3) = 0
prices(9) = 0
End If
If chkA3.Value = 1 Then
prices(4) = 80
prices(8) = 20
lstOrder.AddItem menu(4) & Space(27) & Format((prices(4)), "###,###0.00")
lstOrder.AddItem menu(8) & Space(44) & Format((prices(8)), "###,###0.00")
Else
prices(4) = 0
prices(8) = 0
End If
If chkA4.Value = 1 Then
prices(2) = 100
prices(7) = 50
lstOrder.AddItem menu(2) & Space(28) & Format((prices(2)), "###,###0.00")
lstOrder.AddItem menu(7) & Space(37) & Format((prices(7)), "###,###0.00")
Else
prices(2) = 0
prices(7) = 0
End If
'Label9.Caption = "Php "
Dim total As Integer
Dim subTotal As Integer
Dim L9 As Integer
Dim L7 As Integer
total = 0
subTotal = 0
'price(Index) = 0
' prices(Index) = 0
For i = 0 To 12
total = Format((total + price(i) + prices(i)), "###,###0.00")
Next i
Label9.Caption = Format(total, "###,###0.00")
Label7.Caption = Format(0.12 * Label9.Caption, "###,###0.00")
subTotal = Label8.Caption * Label9.Caption
L9 = Label9.Caption
L7 = Label7.Caption
Label10.Caption = Format(((L7 + L9) - subTotal), "###,###0.00")
Else
Exit Sub
End If
End Sub
Private Sub cmdCancel_Click()
lstOrder.Clear
Call Clear
cmdAdd.Enabled = False
cmdCancel.Enabled = False
Call lockcontrol
End Sub
Private Sub cmdClose_Click()
End
End Sub
Private Sub cmdNew_Click()
cmdNew.Enabled = False
cmdAdd.Enabled = True
cmdClose.Enabled = True
cmdCancel.Enabled = False
Call unlockcontrol
Call Clear
lstOrder.Clear
End Sub
Private Sub cmdPay_Click()
Frame5.Visible = True
txtCash.Text = ""
txtChange.Text = "0.00"
txtCash.SetFocus
End Sub
Private Sub cmdProcess_Click()
If Val(txtChange.Text) < 0 Or txtCash.Text = "" Then
MsgBox "Cannot be processed!", vbCritical, "Invalid Transaction"
Else
Label11.Caption = Format(txtChange.Text, "###,###0.00")
Dim strPath As String
strPath = "C:\Users\RUJITO\Downloads\order\print.txt"
Dim OpenExe As String
Open strPath For Output As #1
Print #1, " _ _ ____ _____ _"
Print #1, " | | | | _ \ / ____| |"
Print #1, " | |__| | |_) | | (___ | |_ ___ _ __ ___"
Print #1, " | __ | _ < \___ \| __/ _ \| '__/ _ \"
Print #1, " | | | | |_) | ____) | || (_) | | | __/"
Print #1, " |_| |_|____/ |_____/ \__\___/|_| \___|"
Print #1, Space(17) & "HB STORE"
Print #1, Space(8) & "Quezon St., Masbate City"
Print #1, Space(8) & "TIN: 0000-0123-4567-8910"
Print #1, "------------------------------------------"
Print #1, "ITEM DESCRIPTION COST"
Print #1, "------------------------------------------"
Call ProdItems
Print #1, "------------------------------------------"
Print #1, "Sub Total : " & Space(22) & Label9.Caption & vbCrLf
Print #1, "VAT (12%) : " & Space(23) & Label7.Caption
Print #1, "Discount : " & Space(25) & Label8.Caption
Print #1, "TOTAL : " & Space(26) & Label10.Caption
Print #1, "------------------------------------------" & vbCrLf
Print #1, "Cash : " & Space(27) & Label14.Caption
Print #1, "Change: " & Space(26) & Label11.Caption & vbCrLf & vbCrLf
Print #1, "Date: " & Date & Space(9) & "Time: " & Time & vbCrLf
Print #1, Space(9) & "THANK YOU! ENJOY YOUR MEAL"
Close #1
OpenExe = Shell("Notepad " + strPath, vbNormalFocus)
Frame5.Visible = False
End If
End Sub
Private Function ProdItems()
If chkSpag.Value = 1 Then
Print #1, menu(0) & Space(26) & Format((price(0)), "###,###0.00")
Else
price(0) = 0
End If
If chkBread.Value = 1 Then
Print #1, menu(1) & Space(30) & Format((price(1)), "###,###0.00")
Else
price(1) = 0
End If
If chkCarb.Value = 1 Then
Print #1, menu(2) & Space(25) & Format((price(2)), "###,###0.00")
Else
price(2) = 0
End If
If chkCake.Value = 1 Then
Print #1, menu(3) & Space(30) & Format((price(3)), "###,###0.00")
Else
price(3) = 0
End If
If chkValue.Value = 1 Then
Print #1, menu(4) & Space(25) & Format((price(4)), "###,###0.00")
Else
price(4) = 0
End If
If chkCoke.Value = 1 Then
Print #1, menu(5) & Space(31) & Format((price(5)), "###,###0.00")
Else
price(5) = 0
End If
If chkSprite.Value = 1 Then
Print #1, menu(6) & Space(29) & Format((price(6)), "###,###0.00")
Else
price(6) = 0
End If
If chkRoyal.Value = 1 Then
Print #1, menu(7) & Space(30) & Format((price(7)), "###,###0.00")
Else
price(7) = 0
End If
If chkC2.Value = 1 Then
Print #1, menu(8) & Space(33) & Format((price(8)), "###,###0.00")
Else
price(8) = 0
End If
If chktrop.Value = 1 Then
Print #1, menu(9) & Space(26) & Format((price(9)), "###,###0.00")
Else
price(9) = 0
End If
If chkMount.Value = 1 Then
Print #1, menu(10) & Space(23) & Format((price(10)), "###,###0.00")
Else
price(10) = 0
End If
If chkPepsi.Value = 1 Then
Print #1, menu(11) & Space(30) & Format((price(11)), "###,###0.00")
Else
price(11) = 0
End If
If chkSpark.Value = 1 Then
Print #1, menu(12) & Space(28) & Format((price(12)), "###,###0.00")
Else
price(12) = 0
End If
If chkA1.Value = 1 Then
Print #1, menu(0) & Space(26) & Format((prices(0)), "###,###0.00")
Print #1, menu(11) & Space(30) & Format((prices(11)), "###,###0.00")
Else
prices(0) = 0
prices(11) = 0
End If
If chkA2.Value = 1 Then
Print #1, menu(3) & Space(30) & Format((prices(3)), "###,###0.00")
Print #1, menu(9) & Space(26) & Format((prices(9)), "###,###0.00")
Else
prices(3) = 0
prices(9) = 0
End If
If chkA3.Value = 1 Then
Print #1, menu(4) & Space(25) & Format((prices(4)), "###,###0.00")
Print #1, menu(8) & Space(33) & Format((prices(8)), "###,###0.00")
Else
prices(4) = 0
prices(8) = 0
End If
If chkA4.Value = 1 Then
Print #1, menu(2) & Space(25) & Format((prices(2)), "###,###0.00")
Print #1, menu(7) & Space(30) & Format((prices(7)), "###,###0.00")
Else
prices(2) = 0
prices(7) = 0
End If
End Function
Private Sub Form_Load()
'lstOrder.Columns = "PRODUCT" & Space(35) & "PRICE"
cmdAdd.Enabled = False
cmdClose.Enabled = False
cmdCancel.Enabled = False
Call lockcontrol
Frame5.Visible = False
cmdPay.Enabled = False
End Sub
Public Sub Clear()
chkSpag.Value = 0
chkBread.Value = 0
chkCarb.Value = 0
chkCake.Value = 0
chkValue.Value = 0
chkA1.Value = 0
chkA2.Value = 0
chkA3.Value = 0
chkA4.Value = 0
chkCoke.Value = 0
chkSprite.Value = 0
chkRoyal.Value = 0
chkC2.Value = 0
chktrop.Value = 0
chkMount.Value = 0
chkPepsi.Value = 0
chkSpark.Value = 0
optStud.Value = False
optSen.Value = False
optPwd.Value = False
optPro.Value = False
Label7.Caption = "0.00"
Label8.Caption = "0.00"
Label9.Caption = "0.00"
Label10.Caption = "0.00"
Label11.Caption = "0.00"
Label14.Caption = "0.00"
End Sub
Public Sub lockcontrol()
chkSpag.Enabled = False
chkBread.Enabled = False
chkCarb.Enabled = False
chkCake.Enabled = False
chkValue.Enabled = False
chkA1.Enabled = False
chkA2.Enabled = False
chkA3.Enabled = False
chkA4.Enabled = False
chkCoke.Enabled = False
chkSprite.Enabled = False
chkRoyal.Enabled = False
chkC2.Enabled = False
chktrop.Enabled = False
chkMount.Enabled = False
chkPepsi.Enabled = False
chkSpark.Enabled = False
optStud.Enabled = False
optSen.Enabled = False
optPwd.Enabled = False
optPro.Enabled = False
End Sub
Public Sub unlockcontrol()
chkSpag.Enabled = True
chkBread.Enabled = True
chkCarb.Enabled = True
chkCake.Enabled = True
chkValue.Enabled = True
chkA1.Enabled = True
chkA2.Enabled = True
chkA3.Enabled = True
chkA4.Enabled = True
chkCoke.Enabled = True
chkSprite.Enabled = True
chkRoyal.Enabled = True
chkC2.Enabled = True
chktrop.Enabled = True
chkMount.Enabled = True
chkPepsi.Enabled = True
chkSpark.Enabled = True
optStud.Enabled = True
optSen.Enabled = True
optPwd.Enabled = True
optPro.Enabled = True
End Sub
Private Sub optPro_Click()
Label8.Caption = "0.02"
End Sub
Private Sub optPwd_Click()
Label8.Caption = "0.15"
End Sub
Private Sub optSen_Click()
Label8.Caption = "0.10"
End Sub
Private Sub optStud_Click()
Label8.Caption = "0.05"
End Sub
Private Sub txtCash_Change()
On Error Resume Next
txtChange.Text = Format((txtCash.Text) - (Label10.Caption), "###,###0.00")
Label14.Caption = Format((txtCash.Text), "###,###0.00")
End Sub
Private Sub txtCash_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Call cmdProcess_Click
End If
End Sub - Tekan F5 atau RUN untu menjalankan aplikasinya.
- Selamat mencoba
Demikian panduan Cara Membuat Aplikasi Pemesanan Barang Di VB 06 semoga dapat bermanfaat bagi anda dan dapat digunakan sebagaimana mestinya, untuk download sourcecode aplikasinya silahkan download di Link berikut ini.
0 Comments