-->

Program Kasir Sederhana "Bread Talk" Dengan Visual Basic 6.0

Kali ini saya ingin berbagi tentang membuat program sederhana menggunakan Visual Basic 6.0.
Sebenernya ini materi yang ada di matakuliah, mudah-mudahan bermanfaat buat yang sedang mempelajari bahasa pemprograman VB 6.0 . hehe
Program Kasir Sederhana "Bread Talk" Dengan Visual Basic 6.0

Gambar di atas, adalah tampilan hasilnya. hehe kerenkan meskipun saya masih newbie  ^.^
Agar menarik seperti itu pakai ActiveSkin, yaa seperti di postingan sebelumnya membahas tentang ActiveSkin, info lengkap tentang ActiveSkin klik Disini.

Baca terus kebawah, masih panjaaaaaaaaang .

Logika soal Programnya adalah ketika kita run, form tidak aktiv. Yang aktiv hanya tanggal dan command button aja.
Lalu saat tombol Input di klik, Form menjadi Aktiv.
Kemudian, jika di klik tombol Batal , data jadi kosong dan setfocus di no.pesan.
Saat tombol Keluar di Klik, akan muncul peringatan.

Pertama kalian desain formnya dulu seperti gambar dibawah ini.
Program Kasir Sederhana "Bread Talk" Dengan Visual Basic 6.0

Kenapa saya pakai 4 timer? 
Timer ke-1 untuk tanggal dan Jam.
Timer ke-2 untuk label "Bread Talk" Bergerak.
Timer ke-3 untuk tampilan membuka form jadi lebih menarik.
Timer ke-4 untuk nama "Heri Septian Nugraha" berkedip.

Kalau udah di desain, listing nya ada dibawah ini.
Dim nama As String
Dim i As Integer


Private Sub Command1_Click()
Text1.Enabled = True
Text2.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
Text10.Enabled = True
Text11.Enabled = True
Text12.Enabled = True
Option1.Enabled = True
Option2.Enabled = True
SkinLabel13.Enabled = False
Text1.SetFocus
End Sub


Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text10 = ""
Text11 = ""
Text12 = ""
Option1 = False
Option2 = False
Text1.SetFocus
End Sub

Private Sub Command3_Click()
p = MsgBox("Tutup Aplikasi Ini ? ", vbInformation + vbOKCancel, "Keluar")
If p = vbOK Then

On Error Resume Next
Dim fHeight As Long
Dim fWidth As Long

For fHeight = Me.Height To 1000 Step -50
 Me.Height = fHeight
 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
Next fHeight

If Me.Height = 1000 Then
 For fWidth = Me.Width To 1000 Step -50
 Move (Screen.Width - Width) / 2, (Screen.Height - Height) / 2
 Me.Width = fWidth
Next fWidth
End If
 Unload Me
End
End If
End Sub


Private Sub Form_Activate()
Text1.Enabled = False
Text2.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
Text11.Enabled = False
Text12.Enabled = False
Option1.Enabled = False
Option2.Enabled = False
Command1.SetFocus
End Sub


Private Sub Form_Load()
Skin1.ApplySkin Me.hWnd 'activeskin
Text3.Locked = True
Text5.Locked = True
Text6.Locked = True
Text8.Locked = True
Text9.Locked = True
Text11.Locked = True
Me.Height = 10 'buat buka form
Me.Width = 10 'buat buka form
End Sub

Private Sub Option1_Click()
Option1.Value = True
Option2.Value = False
Text8 = 0
End Sub

Private Sub Option2_Click()
Option1.Value = False
Option2.Value = True
Text8 = 5000
End Sub


Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
 Text2.SetFocus
End If
End Sub

Private Sub Text10_Change()
Text10 = Format(Text10, "#,###")
Text10.SelStart = Len(Text10)
End Sub

Private Sub Text10_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 13 And KeyAscii <> 8 Then KeyAscii = 0
  If KeyAscii = 13 Then
  If Format(Text10.Text) < Format(Text9.Text) Then
  MsgBox "Maaf, Uang Bayar Kurang", vbCritical
  Text10.Text = ""
  Text11.Text = ""
  Text10.SetFocus
  Else
  Text11 = Format(Text10.Text) - Format(Text9.Text)
  Text11.SetFocus
  Text11.Locked = True
  End If
End If
End Sub

Private Sub Text11_Change()
Text11 = Format(Text11, "#,###")
Text11.SelStart = Len(Text11)
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
 Text4.SetFocus
End If
End Sub

Private Sub Text4_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
 If Text4.Text = "B01" Then
 Text5.Text = "Manggo Bread"
 Text6.Text = "8000"
ElseIf Text4.Text = "B02" Then
 Text5.Text = "Orange Bread"
 Text6.Text = "10000"
ElseIf Text4.Text = "B03" Then
 Text5.Text = "Apple Bread"
 Text6.Text = "5000"
 Text7.SetFocus
Else
 MsgBox "ERORR", vbCritical
 Text4 = ""
 Text4.SetFocus
End If
End If
End Sub

Private Sub Text6_Change()
Text6 = Format(Text6, "#,###")
Text6.SelStart = Len(Text6)
End Sub

Private Sub Text7_KeyPress(KeyAscii As Integer)
If Not IsNumeric(Chr(KeyAscii)) And KeyAscii <> 13 And KeyAscii <> 8 Then KeyAscii = 0
 If KeyAscii = 13 Then
 Text9 = Format(Text6) * Format(Text7) + Format(Text8)
 Text10.SetFocus
End If
End Sub

Private Sub Text8_Change()
Text8 = Format(Text8, "#,###")
Text8.SelStart = Len(Text8)
End Sub

Private Sub Text9_Change()
Text9 = Format(Text9, "#,###")
End Sub

Private Sub Timer1_Timer()
Text3 = Format(Date, " dd / mm / yyyy")
End Sub


Private Sub Timer2_Timer()
Timer2.Interval = 300
nama = "Bread Talk"
If i <= Len(nama) Then
  i = i + 1
  SkinLabel1.Caption = Left(nama, i)
End If
End Sub


Private Sub Timer3_Timer()
Me.Height = Me.Height + 100
Tengah
If Me.Height >= 9200 Then
   Timer3.Enabled = False
   Tengah
End If

Me.Width = Me.Width + 100
Tengah
If Me.Width >= 10000 Then
  Timer3.Enabled = False
  Tengah
End If
End Sub

Public Sub Tengah()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub

Private Sub Timer4_Timer()
If SkinLabel13.Visible = True Then
SkinLabel13.Visible = False
ElseIf SkinLabel13.Visible = False Then
SkinLabel13.Visible = True
End If
End Sub
Ini Penjelasan tentang listingnya, dibaca baik-baik yaa. hehehe...
  1. Yang berwarna hijau, agar label "Bread Talk" bergerak satu persatu.
  2. Yang berwarna merah,  Saat tombol Input di klik ,form menjadi aktiv dan tulisan "Heri Septian Nugraha" menjadi tidak aktiv, tapi masih berkedip..
  3. Yang berwarna biru, agar data yang telah di isi di form menjadi kosong saat tombol Batal di klik.
  4. Yang berwarna orange, agar tampilan saat keluar form jadi mengecil saat tombol Keluar di klik.
  5. Yang berwarna kuning, agar saat dijalankan/running form menjadi tidak aktiv.
  6. Yang berwarna pink, ada yang buat aktivin ActivSkin (yang di Bold), lalu buat mengunci agar tidak bisa di otak-atik, dan ada bagian listing untuk membuka layar.
  7. Yang berwarna biru muda , untuk option di jenis pembelian.
  8. Yang berwarna hitam, untuk sebagian logika dari soal itu , untuk format angka, rumus pembelian dll.
  9. Yang berwarna merah dan Italic , untuk tanggal dan jam.
  10. Yang Background berwarna pink muda, agar membuka form melebar saat dijalannkan/running.
  11.  Yang Background berwarna orange muda, untuk label "Heri Septian Nugraha" Berkedip.
Nah, cukup sekian saya memberi penjelasannya. Mudah-mudahan bermanfaat buat kalian semua. Terima Kasih ^^

4 comments:

  1. gan kirimin ke email donk data vb nya trz di jadikan rar terimakasih..

    ReplyDelete
  2. gan kirimin program yang udah ji ke email saya

    ReplyDelete
  3. Saran,jangan kasih tulisan bergerak dong di cursor itu sangat menggangu

    ReplyDelete

Kritik dan Saran lebih baik dibanding menjelek-jelekan.