Pasang Iklan Atas 1

Down Menu

Drop Down MenusCSS Drop Down MenuPure CSS Dropdown Menu

Tuesday, October 20, 2015

Aplikasi Toko Gamindo “Menjual Alat Komputer dan Game”


Abyan Juang Kecci – 1406629780

Penjelasan:
Aplikasi ini untuk mencatat segala aktifitas penjualan dan pencatatan inventory Ke dalam Database (disini saya menggunakan Access 2007), juga dapat membuat Laporan Stock Baranag, dan Laporan Penjualan. ada fungsi Tambah, Delete, Update. Daripada susah2 nyatetin satu2 di kertas, buang2 kertas, mendingan ini akan jadi solusi anda kalo mau lebih murah dan nyaman, didalemnya ditulis juga COGS/Biaya Barang dan Harga Jual (25%) Jadi ketauan tuh untungnya 25% heheh, trus kita bisa lihat Total Biaya yang kita keluarin dan Keuntungan yang bakal kita dapet, Jadi kita tau barang2 apa saja yang kita jual dan kita bisa mengestimasikannya siapa yang paling Untung! Waw Waw siapa coba yang ga mau untung?

Berikut Screenshootnya:













Aplikasi ini Memiliki 5 Form yaitu:
1.  Form Login
2. Form Password
3. Form Menu
4. Form Inventory
5. Form Penjualan

Memiliki Database Access:
DBPenjualan
Memiliki 2 Tabel:
  1. TableInventory
  2. TablePenjualan


Source Code:
  1. Form Login
1.  Public Class FormLogin
2.   
3.      Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
4.          If txtUsername.Text = FormPassword.TextBox1.Text And txtPassword.Text = FormPassword.TextBox2.Text Then
5.              FormMenu.Show()
6.              FormPassword.Hide()
7.              Me.Hide()
8.              MsgBox("Welcome")
9.          Else
10.             MsgBox("Harap Masukan Password Dengan Benar", MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "Perhatian")
11.             txtPassword.Text = ""
12.             txtUsername.Text = ""
13.         End If
14.     End Sub
15.  
16.     Private Sub LinkLabel1_LinkClicked(sender As Object, e As LinkLabelLinkClickedEventArgs) Handles LinkLabel1.LinkClicked
17.         FormPassword.Show()
18.     End Sub
19. End Class

  1. Form Password
1.  Public Class FormPassword
2.   
3.      Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
4.          FormLogin.txtUsername.Text = Me.TextBox1.Text
5.          FormLogin.txtPassword.Text = Me.TextBox2.Text
6.          Me.Hide()
7.      End Sub
8.  End Class

  1. Form Menu
1.  Public Class FormMenu
2.      Private Sub InventoryToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles InventoryToolStripMenuItem.Click
3.          Dim frmInventory As New FormInventory
4.          frmInventory.MdiParent = Me
5.          frmInventory.Show()
6.          frmInventory.txtIDBarang.Focus()
7.      End Sub
8.   
9.      Private Sub CashierToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CashierToolStripMenuItem.Click
10.         Dim frmPenjualan As New FormPenjualan
11.         frmPenjualan.MdiParent = Me
12.         frmPenjualan.Show()
13.         frmPenjualan.txtIDBarang.Focus()
14.     End Sub
15.  
16.     Private Sub AboutToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles AboutToolStripMenuItem.Click
17.         Dim frmAbout As New FormAbout
18.         frmAbout.MdiParent = Me
19.         frmAbout.Show()
20.  
21.     End Sub
  1. End Class

  1. Form Inventory
1.  Imports System.Data
2.  Imports System.Data.OleDb
3.  Imports System.Data.SqlClient
4.  Imports Excel = Microsoft.Office.Interop.Excel
5.  Imports Word = Microsoft.Office.Interop.Word
6.  Public Class FormInventory
7.      Dim koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=G:\Semester 3\1. UTS\Lab PB 2\UTS\AplikasiPenjualan\AplikasiPenjualan\DBPenjualan.accdb"
8.      Dim objkoneksi As New OleDb.OleDbConnection(koneksi)
9.      Dim Conn As OleDbConnection
10.     Dim da As OleDbDataAdapter
11.     Dim ds As DataSet
12.     Dim LokasiDB As String
13.     Sub KoneksiDatabase()
14.         LokasiDB = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=G:\Semester 3\1. UTS\Lab PB 2\UTS\AplikasiPenjualan\AplikasiPenjualan\DBPenjualan.accdb"
15.         Conn = New OleDbConnection(LokasiDB)
16.         If Conn.State = ConnectionState.Closed Then
17.             Conn.Open()
18.         End If
19.     End Sub
20.     Sub UpdateTabel()
21.         da = New OleDbDataAdapter("Select * from TableInventory", Conn)
22.         ds = New DataSet
23.         ds.Clear()
24.         da.Fill(ds, "TableInventory")
25.         DataGridView1.DataSource = (ds.Tables("TableInventory"))
26.     End Sub
27.     Sub InsertToDatabase()
28.         Dim tambah As String = "INSERT INTO TableInventory values('" & txtIDBarang.Text & "', '" & txtNamaBarang.Text & "', '" & txtCostBarang.Text & "', '" & txtKuantitas.Text & "','" & txtHargaJual.Text & "', '" & txtTotalInventory.Text & "', '" & txtKeuntungan.Text & "' )"
29.         Dim oCmd = New OleDbCommand(tambah, objkoneksi)
30.         If txtKeuntungan.Text = "" Or txtKuantitas.Text = "" Then
31.             MsgBox("Mohon Isi Data dengan Lengkap", MsgBoxStyle.Exclamation, "Konfirmasi")
32.         Else
33.             oCmd.ExecuteNonQuery()
34.             MsgBox("success")
35.         End If
36.     End Sub
37.     Sub Hapus()
38.  
39.         Dim HapusRow As String = "Delete from TableInventory where IDBarang ='" & txtIDBarang.Text & "'"
40.         Dim oCmd As New OleDbCommand(HapusRow, objkoneksi)
41.         oCmd.ExecuteNonQuery()
42.         
43.     End Sub
44.     Sub bersih()
45.         txtCostBarang.Text = ""
46.         txtHargaJual.Text = ""
47.         txtIDBarang.Text = ""
48.         txtKeuntungan.Text = ""
49.         txtKuantitas.Text = ""
50.         txtNamaBarang.Text = ""
51.         txtTotalInventory.Text = ""
52.         txtIDBarang.Focus()
53.     End Sub
54.     Private Sub Button1_Click(sender As Object, e As EventArgs)
55.         objkoneksi.Open()
56.         InsertToDatabase()
57.         KoneksiDatabase()
58.         UpdateTabel()
59.         objkoneksi.Close()
60.     End Sub
61.     Private Sub FormInventory_Load(sender As Object, e As EventArgs) Handles MyBase.Load
62.         KoneksiDatabase()
63.         UpdateTabel()
64.     End Sub
65.  
66.     Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
67.         txtHargaJual.Text = Val(txtCostBarang.Text) * 1.25
68.         txtTotalInventory.Text = Val(txtCostBarang.Text) * Val(txtKuantitas.Text)
69.         txtKeuntungan.Text = (Val(txtHargaJual.Text) - Val(txtCostBarang.Text)) * Val(txtKuantitas.Text)
70.  
71.         objkoneksi.Open()
72.         InsertToDatabase()
73.         KoneksiDatabase()
74.         UpdateTabel()
75.         objkoneksi.Close()
76.     End Sub
77.  
78.     Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
79.         If DataGridView1.CurrentRow.Index <> DataGridView1.NewRowIndex Then
80.             objkoneksi.Open()
81.             Hapus()
82.             UpdateTabel()
83.             objkoneksi.Close()
84.         Else
85.             MsgBox("Data belum terisi", MsgBoxStyle.Information, "Konfirmasi")
86.         End If
87.         KoneksiDatabase()
88.         UpdateTabel()
89.     End Sub
90.  
91.     Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
92.         End
93.     End Sub
94.  
95.     Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
96.         KoneksiDatabase()
97.         UpdateTabel()
98.     End Sub
99.  
100.             Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
101.                 If DataGridView1.CurrentRow.Index <> DataGridView1.NewRowIndex Then
102.                     Dim Ubah As Integer = Nothing
103.                     Ubah = DataGridView1.CurrentRow.Index
104.                     With DataGridView1
105.                         txtIDBarang.Text = .Item(0, Ubah).Value
106.                         txtNamaBarang.Text = .Item(1, Ubah).Value
107.                         txtCostBarang.Text = .Item(2, Ubah).Value
108.                         txtKuantitas.Text = .Item(3, Ubah).Value
109.                         txtHargaJual.Text = .Item(4, Ubah).Value
110.                         txtTotalInventory.Text = .Item(5, Ubah).Value
111.                         txtKeuntungan.Text = .Item(6, Ubah).Value
112.                     End With
113.                 Else
114.                     MsgBox("Silahkan Isi Data", MsgBoxStyle.Information, "Konfirmasi")
115.                     bersih()
116.                 End If
117.             End Sub
118.          
119.             Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
120.                 Try
121.                     Dim xlApp As Microsoft.Office.Interop.Excel.Application
122.                     Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook
123.                     Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
124.                     Dim misValue As Object = System.Reflection.Missing.Value
125.                     Dim i As Integer
126.                     Dim j As Integer
127.          
128.                     xlApp = New Microsoft.Office.Interop.Excel.Application
129.                     xlWorkBook = xlApp.Workbooks.Add(misValue)
130.                     xlWorkSheet = xlWorkBook.Sheets("sheet1")
131.          
132.          
133.                     For i = 0 To DataGridView1.RowCount - 2
134.                         For j = 0 To DataGridView1.ColumnCount - 1
135.                             For k As Integer = 1 To DataGridView1.Columns.Count
136.                                 xlWorkSheet.Cells(1, k) = DataGridView1.Columns(k - 1).HeaderText
137.                                 xlWorkSheet.Cells(i + 2, j + 1) = DataGridView1(j, i).Value.ToString()
138.                             Next
139.                         Next
140.                     Next
141.          
142.                     xlWorkSheet.SaveAs("D:\Inventory.xls")
143.                     xlWorkBook.Close()
144.                     xlApp.Quit()
145.          
146.                     releaseObject(xlApp)
147.                     releaseObject(xlWorkBook)
148.                     releaseObject(xlWorkSheet)
149.          
150.                     MsgBox("Hasil export tersimpan di D:\Inventory.xls")
151.                 Catch ex As Exception
152.          
153.                 End Try
154.             End Sub
155.          
156.             Private Sub releaseObject(ByVal obj As Object)
157.                 Try
158.                     System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
159.                     obj = Nothing
160.                 Catch ex As Exception
161.                     obj = Nothing
162.                 Finally
163.                     GC.Collect()
164.                 End Try
165.          
166.             End Sub
167.         End Class


  1. Form Penjualan
1.  Imports System.Data
2.  Imports System.Data.OleDb
3.  Imports System.Data.SqlClient
4.  Public Class FormPenjualan
5.      Dim koneksi As String = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=G:\Semester 3\1. UTS\Lab PB 2\UTS\AplikasiPenjualan\AplikasiPenjualan\DBPenjualan.accdb"
6.      Dim objkoneksi As New OleDb.OleDbConnection(koneksi)
7.      Dim Conn As OleDbConnection
8.      Dim da As OleDbDataAdapter
9.      Dim ds As DataSet
10.     Dim LokasiDB As String
11.     Sub KoneksiDatabase()
12.         LokasiDB = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=G:\Semester 3\1. UTS\Lab PB 2\UTS\AplikasiPenjualan\AplikasiPenjualan\DBPenjualan.accdb"
13.         Conn = New OleDbConnection(LokasiDB)
14.         If Conn.State = ConnectionState.Closed Then
15.             Conn.Open()
16.         End If
17.     End Sub
18.     Sub UpdateTabel()
19.         da = New OleDbDataAdapter("Select * from TablePenjualan", Conn)
20.         ds = New DataSet
21.         ds.Clear()
22.         da.Fill(ds, "TablePenjualan")
23.         DataGridView1.DataSource = (ds.Tables("TablePenjualan"))
24.     End Sub
25.     Sub InsertToDatabase()
26.  
27.         Dim tambah As String = "INSERT INTO TablePenjualan values('" & txtIDBarang.Text & "', '" & txtNamaBarang.Text & "', '" & txtHargaJual.Text & "', '" & txtKuantitas.Text & "', '" & txtTotalBayar.Text & "' )"
28.         Dim oCmd = New OleDbCommand(tambah, objkoneksi)
29.         If txtTotalBayar.Text = "" Or txtKuantitas.Text = "" Then
30.             MsgBox("Mohon Isi Data dengan Lengkap", MsgBoxStyle.Exclamation, "Konfirmasi")
31.         Else
32.             oCmd.ExecuteNonQuery()
33.             MsgBox("success")
34.         End If
35.     End Sub
36.     Sub Hapus()
37.  
38.         Dim HapusRow As String = "Delete from TablePenjualan where IDBarang ='" & txtIDBarang.Text & "'"
39.         Dim oCmd As New OleDbCommand(HapusRow, objkoneksi)
40.         oCmd.ExecuteNonQuery()
41.  
42.     End Sub
43.     Sub bersih()
44.         txtHargaJual.Text = ""
45.         txtIDBarang.Text = ""
46.         txtKuantitas.Text = ""
47.         txtNamaBarang.Text = ""
48.         txtTotalBayar.Text = ""
49.         txtIDBarang.Focus()
50.     End Sub
51.     Sub ClearAll()
52.         DataGridView1.DataSource.Clear()
53.     End Sub
54.     Sub DBCombobox()
55.         Dim cmd As OleDbCommand
56.         Dim rdr As OleDbDataReader
57.         Dim Conn As OleDbConnection
58.  
59.         Conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=G:\Semester 3\1. UTS\Lab PB 2\UTS\AplikasiPenjualan\AplikasiPenjualan\DBPenjualan.accdb")
60.  
61.         Try
62.             Conn.Open()
63.             cmd = New OleDbCommand("SELECT NamaBarang FROM TableInventory", Conn)
64.             rdr = cmd.ExecuteReader()
65.  
66.             While rdr.Read()
67.                 txtNamaBarang.Items.Add(rdr("NamaBarang"))
68.             End While
69.  
70.         Catch ex As Exception
71.             MessageBox.Show("Koneksi Gagal !!!" & ex.Message)
72.         End Try
73.  
74.         txtNamaBarang.SelectedIndex = 0
75.     End Sub
76.     Private Function isian(ByVal oledb As String) As DataSet
77.         Dim ds As New DataSet
78.         Dim da As OleDbDataAdapter
79.         Using cn As New OleDbConnection(LokasiDB)
80.             Try
81.                 cn.Open()
82.                 da = New OleDbDataAdapter(oledb, cn)
83.                 da.Fill(ds)
84.             Catch ex As Exception
85.                 ds = Nothing
86.                 MsgBox(ex.Message)
87.             End Try
88.         End Using
89.         Return ds
90.     End Function
91.  
92.     Private Sub FormPenjualan_Load(sender As Object, e As EventArgs) Handles MyBase.Load
93.         DBCombobox()
94.  
95.         KoneksiDatabase()
96.         UpdateTabel()
97.         ClearAll()
98.     End Sub
99.     Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
100.     
101.            txtTotalBayar.Text = Val(txtHargaJual.Text) * Val(txtKuantitas.Text)
102.     
103.            objkoneksi.Open()
104.            InsertToDatabase()
105.            KoneksiDatabase()
106.            UpdateTabel()
107.            objkoneksi.Close()
108.        End Sub
109.     
110.        Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
111.            If DataGridView1.CurrentRow.Index <> DataGridView1.NewRowIndex Then
112.                objkoneksi.Open()
113.                Hapus()
114.                UpdateTabel()
115.                objkoneksi.Close()
116.            Else
117.                MsgBox("Data belum terisi", MsgBoxStyle.Information, "Konfirmasi")
118.            End If
119.            KoneksiDatabase()
120.            UpdateTabel()
121.        End Sub
122.     
123.        Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
124.            KoneksiDatabase()
125.            UpdateTabel()
126.        End Sub
127.     
128.        Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
129.            End
130.        End Sub
131.        Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
132.            If DataGridView1.CurrentRow.Index <> DataGridView1.NewRowIndex Then
133.                Try
134.                    Dim xlApp As Microsoft.Office.Interop.Excel.Application
135.                    Dim xlWorkBook As Microsoft.Office.Interop.Excel.Workbook
136.                    Dim xlWorkSheet As Microsoft.Office.Interop.Excel.Worksheet
137.                    Dim misValue As Object = System.Reflection.Missing.Value
138.                    Dim i As Integer
139.                    Dim j As Integer
140.     
141.                    xlApp = New Microsoft.Office.Interop.Excel.Application
142.                    xlWorkBook = xlApp.Workbooks.Add(misValue)
143.                    xlWorkSheet = xlWorkBook.Sheets("sheet1")
144.     
145.     
146.                    For i = 0 To DataGridView1.RowCount - 2
147.                        For j = 0 To DataGridView1.ColumnCount - 1
148.                            For k As Integer = 1 To DataGridView1.Columns.Count
149.                                xlWorkSheet.Cells(1, k) = DataGridView1.Columns(k - 1).HeaderText
150.                                xlWorkSheet.Cells(i + 2, j + 1) = DataGridView1(j, i).Value.ToString()
151.                            Next
152.                        Next
153.                    Next
154.     
155.                    xlWorkSheet.SaveAs("D:\Struk.xls")
156.                    xlWorkBook.Close()
157.                    xlApp.Quit()
158.     
159.                    releaseObject(xlApp)
160.                    releaseObject(xlWorkBook)
161.                    releaseObject(xlWorkSheet)
162.     
163.                    MsgBox("Hasil export tersimpan di D:\Struk.xls")
164.                Catch ex As Exception
165.     
166.                End Try
167.            Else
168.                MsgBox("Data belum terisi", MsgBoxStyle.Information, "Konfirmasi")
169.            End If
170.     
171.        End Sub
172.     
173.        Private Sub releaseObject(ByVal obj As Object)
174.            Try
175.                System.Runtime.InteropServices.Marshal.ReleaseComObject(obj)
176.                obj = Nothing
177.            Catch ex As Exception
178.                obj = Nothing
179.            Finally
180.                GC.Collect()
181.            End Try
182.     
183.        End Sub
184.     
185.        Private Sub DataGridView1_CellClick(sender As Object, e As DataGridViewCellEventArgs) Handles DataGridView1.CellClick
186.            If DataGridView1.CurrentRow.Index <> DataGridView1.NewRowIndex Then
187.                Dim Ubah As Integer = Nothing
188.                Ubah = DataGridView1.CurrentRow.Index
189.                With DataGridView1
190.                    txtIDBarang.Text = .Item(0, Ubah).Value
191.                    txtNamaBarang.SelectedItem = .Item(1, Ubah).Value
192.                    txtHargaJual.Text = .Item(2, Ubah).Value
193.                    txtKuantitas.Text = .Item(3, Ubah).Value
194.                    txtTotalBayar.Text = .Item(4, Ubah).Value
195.                End With
196.            Else
197.                MsgBox("Silahkan Isi Data", MsgBoxStyle.Information, "Konfirmasi")
198.                bersih()
199.            End If
200.        End Sub
201.            End Class

Jika Anda menginginkan Project ini Silahkan Download Disini

Terimakasih.