Minggu, 02 Oktober 2011

MEMBUAT PROGRAM TOKO BUKU KOMIK MENGGUNAKAN VISUAL BASIC


MEMBUAT PROGRAM TOKO BUKU KOMIK



Latar Belakang
            Komik Saat ini telah menjadi kebutuhan untuk para kalangan anak hingga orang dewasa, salah satunya adalah komik buatan Marvel. Mulai dari sini saya coba untuk membuat program took buku komik. Sederhana memang namun saya harap dapat bermanfaat untuk kita semua.

Klik Disini Tentang Program Toko Komik ini
Membuat Database
Buatlah database Dengan Menggunakan Ms Acces dengan format seperti ini.

Field Name
Data Type
Field Size
Kode_Transaksi
Text
20
Tanggal_Transaksi
Date/time

Kode_Barang
Text
20
Nama_Barang
Text
30
Harga_Barang
Curency

Jumlah Beli
Number

Total
Currency


Buatlah Desain Login Seperti Di Bawah ini.

Object
Properti
Setting
Form1
Caption
Form Login
Picture1
Picture
Pilih
Frame1


Label1
Caption
Ussername
Label2
Caption
Password
Command1
Caption
Masuk
Command2
Caption
Keluar
Label3
Caption
Date
Label4
Caption
Time
Timer1
Interval
200


Pertama Buatlah Menu Editor seperti gambar di bawah ini.


















Caption
Name
Shortcut
Level1
Level2


Login
Mnlogin

Exit
Mnexit



Untuk Desain Form Login Dapat  di Lihat Pada Gambar Di Bawah ini.
Form login























Kode Program Login

Public conn As New ADODB.Connection
Public RS As New ADODB.Recordset

Private Sub Command1_Click()
Frame1.Visible = False

End Sub

Private Sub cmdKeluar_Click()
Frame1.Visible = False
End Sub

Private Sub Command2_Click()
Private Sub cmdLogin_Click()
   If conn.State = 1 Then conn.Close
   conn.Open "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\login.mdb"
     
      If RS.State = 1 Then RS.Close
      RS.Open "select * from login where user= '" & txtUser.Text & "' And pass = '" & txtPass.Text & "'", conn, 3, 3
           
            If Not RS.EOF Then
                  MsgBox "BERHASIL"
                  LOADING.Show
                  LOGIN.Hide
                  txtUser.Text = ""
                  txtPass.Text = ""
                 
               Else
                  MsgBox "Data Salah", vbCritical, "L O G I N"
                  txtUser.Text = ""
                  txtPass.Text = ""
                  txtUser.SetFocus
             End If
End Sub

Private Sub MNEXIT_Click()
p = MsgBox("Yakin ingin Keluar Dari Program ini", vbQuestion + vbOKCancel, "Info")
If p = vbOK Then


cepat = 10
While Left + Width < Screen.Width
DoEvents
Left = Left + cepat
Wend
While Top - Height < Screen.Height
DoEvents
Top = Top + cepat
Wend
End

Else
MsgBox "Kembali Ke Program", 0, "Batal"

End If
End Sub

Private Sub MNLOGIN_Click()

Picture1.Visible = True
Frame1.Visible = True
txtUser.SetFocus
End Sub

Private Sub Timer1_Timer()
Label1.Caption = Format(Date, "dd,mmm,yyyy")
Label2.Caption = Time
End Sub



Program Login Setelah Running adalah seperti ini
Setelah Di Running maka ussername dan pasword muncul






















Membuat Form Loading

Ketika Masuk ke dalam form login maka Program loading untuk memasuki program utama.
Design Form Loading


Object
Properti
Setting
Form1
Caption
Loading…..!!!

Border style
4. Fixed tool\Window
Progress Barr


Label1
Caption
Opening Program Please Wait…!!!
Timer1
Interval
200
Timer2
Interval
200

Desain Form Loading
Desain Form Loading














Koding Program Loading

Private Sub Timer1_Timer()
If Label1.ForeColor = vbRed Then
Label1.ForeColor = vbBlue
ElseIf Label1.ForeColor = vbBlue Then
Label1.ForeColor = vbMagenta
ElseIf Label1.ForeColor = vbGreen Then
Else
Label1.ForeColor = vbRed
End If

End Sub




Private Sub Timer2_Timer()
If ProgressBar1.Value >= 100 Then
Unload Me
transaksi.Show
Else
ProgressBar1.Value = ProgressBar1.Value + 10
End If

End Sub


Membuat Desain Form Utama (Form Transaksi)
Object
Properti
Setting
Form1
Caption
Form Transaksi
Label1
Caption
Kode Transaksi
Label2
Caption
Kode Barang
Label3
Caption
Nama Barang
Label4
Caption
Harga barang
Label5
Caption
Jumlah Beli
Label6
Caption
Total
Label7
Caption
Tanggal Transaksi
Textbox1

Use As Kode_Transaksi
Textbox2

Use As Nama_Barang
Textbox3

Use As Jumlah_beli
Textbox4

Use As Tanggal
Textbox5

Use As Total
Textbox6

Use as Harga_Barang
Combo1


Timer1
Interval
200
Desain Form Transaksi
Desain Form transaksi









































Koding Program Transaksi

Private Sub bersih()
Text1.Text = " "
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
Text6.Text = " "
Combo1.Text = " "
End Sub

Private Sub Calendar1_Click()
 Text4.Text = Calendar1
Text4.BackColor = &HFFFFFF

End Sub

Private Sub Combo1_Click()
'Combo1.AddItem "BNMV01"
'Combo1.AddItem "BNMV02"
'Combo1.AddItem "BNMV03"
If Combo1.Text = "MVHLK" Then
Text2.Text = "KOMIK MARVEL HULK"
Text6.Text = 25000
Else

If Combo1.Text = "MVSPD" Then
Text2.Text = "KOMIK MARVEL SPIDERMAN"
Text6.Text = 30000
Else

If Combo1.Text = "MVCPD" Then
Text2.Text = "KOMIK MARVEL CAPTAIN AMERIKA"
Text6.Text = 35000
Else

If Combo1.Text = "MVIRM" Then
Text2.Text = "KOMIK MARVEL IRONMAN"
Text6.Text = 25000
Else

If Combo1.Text = "BNMV01" Then
Text2.Text = "BONEKA MARVEL UKURAN KECIL"
Text6.Text = 50000
Else

If Combo1.Text = "BNMV02" Then
Text2.Text = "BONEKA MARVEL UKURAN SEDANG"
Text6.Text = 750000
Else

Text2.Text = "BONEKA MARVEL UKURAN BESAR"
Text6.Text = 150000

End If
End If
End If
End If
End If
End If
End Sub

Private Sub Command1_Click()
If Text1.Text = " " Then
MsgBox "Kode transaksi Masih kosong", 0, ".::Info::."
Else

If Text2.Text = " " Then
MsgBox "Nama Barang Masih Kosong", 0, ".::Info::."
Else

If Text6.Text = " " Then
MsgBox "Harga Barang Masih kosong", 0, ".::Info::."
Else

If Text3.Text = " " Then
MsgBox "Jumlah Beli Masih kosong", 0, ".::Info::."
Else

If Text4.Text = " " Then
MsgBox "Tanggal Masih kosong", 0, ".::Info::."
Else

p = MsgBox("Yakin Data Sudah Terisi Semua", vbOKCancel + vbQuestion, ".::Info::.")
If p = vbCancel Then
transaksi.Show
Else
On Error Resume Next
With Adodc1.Recordset
.AddNew
!Kode_Transaksi = Text1.Text
!Kode_Barang = Combo1.Text
!Nama_Barang = Text2.Text
!Harga_Barang = Text6.Text
!Jumlah_Beli = Text3.Text
!Total = Text5.Text
!Tanggal_Transaksi = Text4.Text
Call bersih
.Update
End With
On Error GoTo 0
End If
End If
End If
End If
End If
End If
End Sub

Private Sub Command2_Click()
p = MsgBox("YAKIN MAU DI HAPUS", vbQuestion + vbOKCancel, "::INFO::")
If p = vbOK Then
On Error Resume Next
Adodc1.Recordset.Delete
Adodc1.Recordset.MovePrevious
On Error GoTo 0
Call bersih
Else
MsgBox "PENGHAPUSAN BATAL!!!", 0, "INFO"
End If
End Sub

Private Sub Command3_Click()
Call bersih
End Sub

Private Sub Command4_Click()
p = MsgBox("Yakin ingin Keluar Dari Program ini", vbQuestion + vbOKCancel, "Info")
If p = vbOK Then


cepat = 10
While Left + Width < Screen.Width
DoEvents
Left = Left + cepat
Wend
While Top - Height < Screen.Height
DoEvents
Top = Top + cepat
Wend
End

Else
MsgBox "Kembali Ke Program", 0, "Batal"

End If
End Sub

Private Sub Command5_Click()
Call bersih
On Error Resume Next
With Adodc1.Recordset
If .BOF And .EOF Then
Text1.Text = "KTS" + Format(Date, "MM") & Format(Date, "YYYY") & "001"
Else
.MoveLast
Text1.Text = "KTS" + Format(Date, "MM") & Format(Date, "YYYY") & Right(Str(Val(Right(!Kode_Transaksi, 3)) + 1001), 3)
End If
End With
On Error GoTo 0
Text1.SetFocus
End Sub

Private Sub Command6_Click()
p = MsgBox("Cetak Berdasarkan No Transaksi", vbYesNo + vbQuestion, ".::Konfirmasi::.")
If p = vbYes Then
cetak.Show
Else
DataReport1.Show
End If
End Sub

Private Sub Form_Activate()
Call bersih
End Sub

Private Sub Form_Load()
Combo1.AddItem "MVHLK"
Combo1.AddItem "MVSPD"
Combo1.AddItem "MVCPT"
Combo1.AddItem "MVIRM"
Combo1.AddItem "BNMV01"
Combo1.AddItem "BNMV02"
Combo1.AddItem "BNMV03"

End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Text5.Text = Val(Text6.Text) * Val(Text3.Text)
End If
End Sub

Private Sub Text8_KeyPress(KeyAscii As Integer)
Text8.Text = Val(Text7.Text) - Val(Text5.Text)
End If
End Sub

Private Sub Timer1_Timer()
If Label1.ForeColor = vbRed Then
Label1.ForeColor = vbBlue
ElseIf Label1.ForeColor = vbBlue Then
Label1.ForeColor = vbMagenta
ElseIf Label1.ForeColor = vbGreen Then
Else
Label1.ForeColor = vbRed
End If

If Label2.ForeColor = vbRed Then
Label2.ForeColor = vbBlue
ElseIf Label2.ForeColor = vbBlue Then
Label2.ForeColor = vbMagenta
ElseIf Label2.ForeColor = vbGreen Then
Else
Label2.ForeColor = vbRed
End If


If Label3.ForeColor = vbRed Then
Label3.ForeColor = vbBlue
ElseIf Label3.ForeColor = vbBlue Then
Label3.ForeColor = vbMagenta
ElseIf Label3.ForeColor = vbGreen Then
Else
Label3.ForeColor = vbRed
End If


If Label4.ForeColor = vbRed Then
Label4.ForeColor = vbBlue
ElseIf Label4.ForeColor = vbBlue Then
Label4.ForeColor = vbMagenta
ElseIf Label4.ForeColor = vbGreen Then
Else
Label4.ForeColor = vbRed
End If

If Label5.ForeColor = vbRed Then
Label5.ForeColor = vbBlue
ElseIf Label5.ForeColor = vbBlue Then
Label5.ForeColor = vbMagenta
ElseIf Label5.ForeColor = vbGreen Then
Else
Label5.ForeColor = vbRed
End If

If Label6.ForeColor = vbRed Then
Label6.ForeColor = vbBlue
ElseIf Label6.ForeColor = vbBlue Then
Label6.ForeColor = vbMagenta
ElseIf Label6.ForeColor = vbGreen Then
Else
Label6.ForeColor = vbRed
End If

If Label7.ForeColor = vbRed Then
Label7.ForeColor = vbBlue
ElseIf Label7.ForeColor = vbBlue Then
Label7.ForeColor = vbMagenta
ElseIf Label7.ForeColor = vbGreen Then
Else
Label7.ForeColor = vbRed
End If
End Sub

Membuat Form Cetak
Seperti Diatas Buatlah desain Terlebih Dahulu Form Cetak Seperti Di bawah ini

Object
Properti
Setting
Form1
Caption
Form Cetak
Label1
Caption
Kode Transaksi
Label2
Caption
Kode Barang
Label3
Caption
Nama Barang
Label4
Caption
Harga barang
Label5
Caption
Jumlah Beli
Label6
Caption
Total
Label7
Caption
Tanggal Transaksi
Datacombo1

Use As Kode_Transaksi
Textbox2

Use As Nama_Barang
Textbox3

Use As Jumlah_beli
Textbox4

Use As Tanggal
Textbox5

Use As Total
Textbox6

Use as Harga_Barang
Combo1


Timer1
Interval
200
Adodc1
Connection String
Cari Dimana Database Berada
CrystalReport1
ReportFilename
Cari Dimana Database Berada

Desain Form Cetak
Desain Form Cetak

















Hasil Cetakan Menggunakan Crystal report
Hasil Cetakan Crstal Report

















Hasil Cetakan Menggunakan Data report
Hasil Cetakan Data Report
















Koding Program Form Cetak

Private Sub bersih()
Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "
DataCombo1.Text = " "
End Sub
Private Sub Command1_Click()
CrystalReport1.SelectionFormula = "{transaksi.Kode_Transaksi}='" & DataCombo1 & "'"
CrystalReport1.WindowState = crptMaximized
CrystalReport1.RetrieveDataFiles
CrystalReport1.Action = 1
DataCombo1.Text = " "

Text2.Text = " "
Text3.Text = " "
Text4.Text = " "
Text5.Text = " "

End Sub

Private Sub Command2_Click()
cetak.Hide
transaksi.Show
End Sub

Private Sub DataCombo1_Click(Area As Integer)
With Adodc1.Recordset
sy = "Kode_Transaksi='" & DataCombo1 & "'"
Adodc1.Recordset.Find sy, , adSearchForward, 1
If Not Adodc1.Recordset.EOF Then
.Update
Text2.Text = Adodc1.Recordset!Nama_Barang
Text3.Text = Adodc1.Recordset!Harga_Barang
Text4.Text = Adodc1.Recordset!Jumlah_Beli
Text5.Text = Adodc1.Recordset!Tanggal_Transaksi
End If
On Error GoTo 0
End With
End Sub

Private Sub Form_Activate()
Call bersih
End Sub

Private Sub Timer1_Timer()
If Label1.ForeColor = vbRed Then
Label1.ForeColor = vbBlue
ElseIf Label1.ForeColor = vbBlue Then
Label1.ForeColor = vbMagenta
ElseIf Label1.ForeColor = vbGreen Then
Else
Label1.ForeColor = vbRed
End If

If Label2.ForeColor = vbRed Then
Label2.ForeColor = vbBlue
ElseIf Label2.ForeColor = vbBlue Then
Label2.ForeColor = vbMagenta
ElseIf Label2.ForeColor = vbGreen Then
Else
Label2.ForeColor = vbRed
End If


If Label3.ForeColor = vbRed Then
Label3.ForeColor = vbBlue
ElseIf Label3.ForeColor = vbBlue Then
Label3.ForeColor = vbMagenta
ElseIf Label3.ForeColor = vbGreen Then
Else
Label3.ForeColor = vbRed
End If


If Label4.ForeColor = vbRed Then
Label4.ForeColor = vbBlue
ElseIf Label4.ForeColor = vbBlue Then
Label4.ForeColor = vbMagenta
ElseIf Label4.ForeColor = vbGreen Then
Else
Label4.ForeColor = vbRed
End If
End Sub

Membuat Form awalan Masuk

Object
Properti
Setting
Form1
Caption

Label1
Caption
SELAMAT DATANG PADA PROGRAM TOKO BUKU KOMIK ELIANA PERMANA
Label2
Caption

Label3
Caption

Command1
Caption
Masuk Form Login
Command2
Caption
Klik Disini Untuk keluar
Timer1
Interval
200


Desain Form Awalan

Desain Form Awalan

















Koding Program Awalan

Private Sub Command1_Click()
LOGIN.Show
AWALAN.Hide
End Sub

Private Sub Command2_Click()
p = MsgBox("Yakin ingin Keluar Dari Program ini", vbQuestion + vbOKCancel, "Info")
If p = vbOK Then


cepat = 10
While Left + Width < Screen.Width
DoEvents
Left = Left + cepat
Wend
While Top - Height < Screen.Height
DoEvents
Top = Top + cepat
Wend
End

Else
MsgBox "Kembali Ke Program", 0, "Batal"

End If
End Sub

Private Sub Timer1_Timer()
If Label1.ForeColor = vbRed Then
Label1.ForeColor = vbBlue
ElseIf Label1.ForeColor = vbBlue Then
Label1.ForeColor = vbMagenta
ElseIf Label1.ForeColor = vbGreen Then
Else
Label1.ForeColor = vbRed
End If

If Label2.ForeColor = vbRed Then
Label2.ForeColor = vbBlue
ElseIf Label2.ForeColor = vbBlue Then
Label2.ForeColor = vbMagenta
ElseIf Label2.ForeColor = vbGreen Then
Else
Label2.ForeColor = vbRed
End If


If Label3.ForeColor = vbRed Then
Label3.ForeColor = vbBlue
ElseIf Label3.ForeColor = vbBlue Then
Label3.ForeColor = vbMagenta
ElseIf Label3.ForeColor = vbGreen Then
Else
Label3.ForeColor = vbRed
End If
End Sub

Private Sub Timer2_Timer()
Label2.Caption = Format(Date, "DD,MMM,YYYY")
Label3.Caption = Time
End Sub




Oke...? sampai disini dulu ya, Tapi Buat Kalian Yang Tertarik sama program yang saya buat, ini saya kasih makalah program yang saya buat, Download Disini

1 komentar:

Wim Fanggi mengatakan...

bro bisa kirimin makalah program toko komik dengan vb, ke alamat email sya...? wimfanggi@yahoo.com
trims bnyak bro..

Poskan Komentar