Public Class LATIHAN039012 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source="& Application.StartupPath &"\DATAMAJEMUK.accdb;jetOLEDB:databasepassword=280765") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub Latihan039012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView1.DataSource = DT Dim dcp(1) As DataColumn dcp(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dcp DT.Columns("UNIT").DefaultValue = 0 DT.Columns("HARGA").DefaultValue = 0 DT.Columns("JUMLAH").DefaultValue = 0 End Sub
lanjutan Private Sub hitung() Dim manis As Integer For Each r As DataGridViewRow In DataGridView1. Rows manis = manis + r.Cells("JUMLAH").Value Next Tot.Text = manis End Sub Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit If e.ColumnIndex = 0 Then cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT) If cari.JumlanBaris > 0 Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView1.CurrentRow.Cells("NAMABARANG").Value =cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If LATIHAN3839.ShowDialog = Windows.Forms. DialogResult.OK Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value=LATIHAN3839.DataGridView1.CurrentRow.Cells("KodeBarang").Value DataGridView1.CurrentRow.Cells("NAMABARANG").Value=LATIHAN3839.DataGridView1.CurrentRow.Cells("namabarang").Value DataGridView1.CurrentRow.Cells("HARGA").Value = LATIHAN3839.DataGridView1.CurrentRow.Cells("harga").Value Else DataGridView1.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView1.CurrentRow.Cells("NAMABARANG").Value = "" End If End If End If If e.ColumnIndex = 2 Or e.ColumnIndex=3Then DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value End If hitung() End Sub
lanjutan Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox1.Text.Length = 0 Then MsgBox("no transaksi belum terisi") Exit Sub End If If jt.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub End If If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1.Text, 1, CONECT) If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & jt.Text & "')", CONECT) CONECT.Open() com.ExecuteNonQuery() CONECT.Close() For Each r As DataRow In DT.Rows com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox1.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT) CONECT.Open() com.ExecuteNonQuery() CONECT.Close() com.Dispose() Next TextBox1.Text = "" jt.Text = "" Tot.Text = "" DT.Rows.Clear() hitung() End Sub End Class
Public Class Latih39_36109034 'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=miss") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latih39_36109034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView1.DataSource = DT 'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji Dim dcp(1) As DataColumn dcp(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dcp
End Sub Private Sub hitung() Dim nhunoe As Integer For Each r As DataGridViewRow In DataGridView1.Rows nhunoe = nhunoe + r.Cells("JUMLAH").Value Next Tot_36109034.Text = nhunoe
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit If e.ColumnIndex = 0 Then 'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf If cari.JumlanBaris > 0 Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView1.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If Latih3839_36109034.ShowDialog = Windows.Forms.DialogResult.OK Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = Latih3839_36109034.DataGridView1.CurrentRow.Cells("KodeBarang").Value DataGridView1.CurrentRow.Cells("NAMABARANG").Value = Latih3839_36109034.DataGridView1.CurrentRow.Cells("namabarang").Value DataGridView1.CurrentRow.Cells("HARGA").Value = Latih3839_36109034.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value Else DataGridView1.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView1.CurrentRow.Cells("NAMABARANG").Value = "" End If End If End If If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If TextBox1_36109034.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("no transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If jt_36109034.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("jenis transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1_36109034.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
'untuk memasukkan data dari visual basc ke dlm acces Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1_36109034.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(jt_36109034.Text) & ")", CONECT)
Public Class Latih3839_36109034 'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=miss") 'deklarasi data tabel Dim DT As New DataTable Dim BARIS As DataRow Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latih3839_36109034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'deklarasi adapter Dim nhunoe As New OleDb.OleDbDataAdapter nhunoe = New OleDb.OleDbDataAdapter("select KODEBARANG, NAMABARANG FROM BARANG ", CONECT) 'memunculkan semua data dari tabel barang dlm acces DT.Rows.Clear() 'membersihkan data table nhunoe.Fill(DT) 'mengisi database ke dlm data table DataGridView1.DataSource = DT 'memunculkan dlm datagridview nhunoe.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BARIS = DT.DefaultView(BindingContext(DT).Position).Row Latih38_36109034.nb_36109034.Text = BARIS("NAMABARANG") End Sub End Class
Public Class LATIHAN_039_36109056 'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=2422") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan039012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView1.DataSource = DT 'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji Dim dcp(1) As DataColumn dcp(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dcp
End Sub Private Sub hitung() Dim biya As Integer For Each r As DataGridViewRow In DataGridView1.Rows biya = biya + r.Cells("JUMLAH").Value Next Tot_36109056.Text = biya
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit If e.ColumnIndex = 0 Then 'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf If cari.JumlanBaris > 0 Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView1.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If LATIHAN3839_36109056.ShowDialog = Windows.Forms.DialogResult.OK Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = LATIHAN3839_36109056.DataGridView1.CurrentRow.Cells("KodeBarang").Value DataGridView1.CurrentRow.Cells("NAMABARANG").Value = LATIHAN3839_36109056.DataGridView1.CurrentRow.Cells("namabarang").Value DataGridView1.CurrentRow.Cells("HARGA").Value = LATIHAN3839_36109056.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value Else DataGridView1.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView1.CurrentRow.Cells("NAMABARANG").Value = "" End If End If End If If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If TextBox1_36109056.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("no transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If jt_36109056.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("jenis transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1_36109056.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
'untuk memasukkan data dari visual basc ke dlm acces Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1_36109056.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(jt_36109056.Text) & ")", CONECT)
Public Class Form3936109040 'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=150991") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latih3936109040_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView1.DataSource = DT 'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji Dim dcp(1) As DataColumn dcp(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dcp
End Sub Private Sub hitung() Dim mytha As Integer For Each r As DataGridViewRow In DataGridView1.Rows mytha = mytha + r.Cells("JUMLAH").Value Next Tot36109040.Text = mytha
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit If e.ColumnIndex = 0 Then 'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf If cari.JumlanBaris > 0 Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView1.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If Latih383936109040.ShowDialog = Windows.Forms.DialogResult.OK Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = Latih3839_36109040.DataGridView1.CurrentRow.Cells("KodeBarang").Value DataGridView1.CurrentRow.Cells("NAMABARANG").Value = Latih3839_36109040.DataGridView1.CurrentRow.Cells("namabarang").Value DataGridView1.CurrentRow.Cells("HARGA").Value = Latih3839_36109040.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value Else DataGridView1.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView1.CurrentRow.Cells("NAMABARANG").Value = "" End If End If End If If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
Public Class LATIHAN039_36109049 'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=wirda") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan039_36109049_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DGV1_36109049.DataSource = DT 'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji Dim dcp(1) As DataColumn dcp(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dcp
End Sub Private Sub hitung() Dim wirda As Integer For Each r As DataGridViewRow In DGV1_36109049.Rows wirda = wirda + r.Cells("JUMLAH").Value Next Tot1_36109049.Text = wirda
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV1_36109049.CellEndEdit If e.ColumnIndex = 0 Then 'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("BARANG", "kodebarang", DGV1_36109049.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf If cari.JumlanBaris > 0 Then DGV1_36109049.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DGV1_36109049.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If LATIHAN3839_36109049.ShowDialog = Windows.Forms.DialogResult.OK Then DGV1_36109049.CurrentRow.Cells("KODEBARANG").Value = LATIHAN3839_36109049.DataGridView1.CurrentRow.Cells("KodeBarang").Value DGV1_36109049.CurrentRow.Cells("NAMABARANG").Value = LATIHAN3839_36109049.DataGridView1.CurrentRow.Cells("namabarang").Value DGV1_36109049.CurrentRow.Cells("HARGA").Value = LATIHAN3839_36109049.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value Else DGV1_36109049.CurrentRow.Cells("KODEBARANG").Value = "" DGV1_36109049.CurrentRow.Cells("NAMABARANG").Value = "" End If End If
End If If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then DGV1_36109049.CurrentRow.Cells("JUMLAH").Value = DGV1_36109049.CurrentRow.Cells("UNIT").Value * DGV1_36109049.CurrentRow.Cells("HARGA").Value
End If
hitung() End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If TextBox1_36109049.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("no transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If TextBox2_36109049.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("jenis transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1_36109049.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
'untuk memasukkan data dari visual basc ke dlm acces Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1_36109049.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(TextBox2_36109049.Text) & ")", CONECT)
Public Class LATIHAN03936109038 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=icha") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN03936109038_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView136109038.DataSource = DT
Dim dcp(1) As DataColumn dcp(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0 DT.Columns("HARGA").DefaultValue = 0 DT.Columns("JUMLAH").DefaultValue = 0 End Sub Private Sub hitung() Dim cantik As Integer For Each r As DataGridViewRow In DataGridView136109038.Rows cantik = cantik + r.Cells("JUMLAH").Value Next Tot36109038.Text = cantik End Sub
Private Sub DataGridView136109038_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView136109038.CellEndEdit If e.ColumnIndex = 0 Then cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView136109038.CurrentRow.Cells("kodebarang").Value, 1, CONECT) If cari.JumlanBaris > 0 Then DataGridView136109038.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView136109038.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If LATIHAN03836109038.ShowDialog = Windows.Forms.DialogResult.OK Then DataGridView136109038.CurrentRow.Cells("KODEBARANG").Value = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("KodeBarang").Value DataGridView136109038.CurrentRow.Cells("NAMABARANG").Value = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("namabarang").Value DataGridView136109038.CurrentRow.Cells("HARGA").Value = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("HARGAJUAL").Value() Else DataGridView136109038.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView136109038.CurrentRow.Cells("NAMABARANG").Value = "" End If End If End If If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then DataGridView136109038.CurrentRow.Cells("JUMLAH").Value = DataGridView136109038.CurrentRow.Cells("UNIT").Value * DataGridView136109038.CurrentRow.Cells("HARGA").Value
Private Sub Button236109038_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button236109038.Click If TextBox136109038.Text.Length = 0 Then MsgBox("no transaksi belum terisi") Exit Sub End If
If jt36109038.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109038.Text & "',#" & DateTimePicker136109038.Value.Date & "#," & Val(jt36109038.Text) & ")", CONECT)
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt36109041.Text & "',#" & DateTimePicker136109041.Value.Date & "#,'" & jt36109041.Text & "')", CONECT)
Public Class LATIHAN03936109033 'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=tahir") Dim Data As New DataTable Dim browse As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN03936109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Data.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka Data.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka Data.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka Data.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka Data.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView1.DataSource = Data 'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji Dim dcp(1) As DataColumn dcp(0) = Data.Columns("KODEBARANG") Data.PrimaryKey = dcp
Data.Columns("UNIT").DefaultValue = 0 Data.Columns("HARGA").DefaultValue = 0 Data.Columns("JUMLAH").DefaultValue = 0 End Sub
Private Sub HITUNG() Dim akuntansi As Integer For Each t As DataGridViewRow In DataGridView1.Rows akuntansi = akuntansi + t.Cells("JUMLAH").Value Next Tot36109033.Text = akuntansi End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value End If HITUNG() End Sub
Private Sub Button236109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109033.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If TextBox136109033.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("no transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If jt36109033.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("jenis transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Data.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada browse.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109033.Text, 1, CONECT)
If browse.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
'untuk memasukkan data dari visual basc ke dlm acces Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109033.Text & "',#" & DateTimePicker136109033.Value.Date & "#," & Val(jt36109033.Text) & ")", CONECT)
Public Class LATIHAN3839_36109033 'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=tahir") 'deklarasi data tabel Dim Data As New DataTable Dim row As DataRow Dim browse As New ByIskandar.CariKeDataBaseByIskandar Private Sub LATIHAN3839_36109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'deklarasi adapter Dim tiwi As New OleDb.OleDbDataAdapter tiwi = New OleDb.OleDbDataAdapter("select KODEBARANG, NAMABARANG FROM BARANG ", CONECT) 'memunculkan semua data dari tabel barang dlm acces Data.Rows.Clear() 'membersihkan data table tiwi.Fill(Data) 'mengisi database ke dlm data table DataGridView1.DataSource = Data 'memunculkan dlm datagridview
tiwi.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click row = Data.DefaultView(BindingContext(Data).Position).Row LATIHAN03836109033.nb36109033.Text = row("NAMABARANG") End Sub End Class
Public Class LATIHAN_3936109056 'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=2312") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan_3936109055_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView136109055.DataSource = DT 'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji Dim dcp(1) As DataColumn dcp(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dcp
End Sub Private Sub hitung() Dim falah As Integer For Each r As DataGridViewRow In DataGridView1.Rows falah= falah + r.Cells("JUMLAH").Value Next Tot36109055.Text = falah
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit If e.ColumnIndex = 0 Then 'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView136109055.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf If cari.JumlanBaris > 0 Then DataGridView136109055.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView136109055.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If LATIHAN3839_36109055.ShowDialog = Windows.Forms.DialogResult.OK Then DataGridView136109055.CurrentRow.Cells("KODEBARANG").Value = LATIHAN3839_36109055.DataGridView1.CurrentRow.Cells("KodeBarang").Value DataGridView136109055.CurrentRow.Cells("NAMABARANG").Value = LATIHAN3839_36109055.DataGridView1.CurrentRow.Cells("namabarang").Value DataGridView136109055.CurrentRow.Cells("HARGA").Value = LATIHAN3839_36109055.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value Else DataGridView136109055.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView136109055.CurrentRow.Cells("NAMABARANG").Value = "" End If End If End If If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then DataGridView136109055.CurrentRow.Cells("JUMLAH").Value = DataGridView136109055.CurrentRow.Cells("UNIT").Value * DataGridView136109055.CurrentRow.Cells("HARGA").Value
End If
hitung() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If TextBox136109055.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("no transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If jt36109055.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("jenis transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109055.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
'untuk memasukkan data dari visual basc ke dlm acces Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109055.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(jt36109055.Text) & ")", CONECT)
Public Class LATIHAN039_36109053 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source="& Application.StartupPath &"\DATAMAJEMUK.accdb;jetOLEDB:databasepassword=kondolele") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub Latihan039_36109053_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView1.DataSource = DT Dim dcp(1) As DataColumn dcp(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dcp DT.Columns("UNIT").DefaultValue = 0 DT.Columns("HARGA").DefaultValue = 0 DT.Columns("JUMLAH").DefaultValue = 0 End Sub
Private Sub hitung() Dim dede As Integer For Each r As DataGridViewRow In DataGridView1. Rows dede = dede + r.Cells("JUMLAH").Value Next Tot.Text = dede End Sub Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit If e.ColumnIndex = 0 Then cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT) If cari.JumlanBaris > 0 Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView1.CurrentRow.Cells("NAMABARANG").Value =cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If LATIHAN38_36109053.ShowDialog = Windows.Forms. DialogResult.OK Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value=LATIHAN38_36109053.DataGridView1.CurrentRow.Cells("KodeBarang").Value DataGridView1.CurrentRow.Cells("NAMABARANG").Value=LATIHAN38_36109053.DataGridView1.CurrentRow.Cells("namabarang").Value DataGridView1.CurrentRow.Cells("HARGA").Value = LATIHAN38_36109053.DataGridView1.CurrentRow.Cells("harga").Value Else DataGridView1.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView1.CurrentRow.Cells("NAMABARANG").Value = "" End If End If End If If e.ColumnIndex = 2 Or e.ColumnIndex=3Then DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value End If hitung() End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox1.Text.Length = 0 Then MsgBox("no transaksi belum terisi") Exit Sub End If If jt.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub End If If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1.Text, 1, CONECT) If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & jt.Text & "')", CONECT) CONECT.Open() com.ExecuteNonQuery() CONECT.Close() For Each r As DataRow In DT.Rows com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox1.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT) CONECT.Open() com.ExecuteNonQuery() CONECT.Close() com.Dispose() Next TextBox1.Text = "" jt.Text = "" Tot.Text = "" DT.Rows.Clear() hitung() End Sub End Class
Public Class Form3936109050 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=nideria") Dim data As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Form3936109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load data.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) data.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) data.Columns.Add(New DataColumn("UNIT", GetType(Double))) data.Columns.Add(New DataColumn("HARGA", GetType(Integer))) data.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView1.DataSource = data
Dim dcp(1) As DataColumn dcp(0) = data.Columns("KODEBARANG") data.PrimaryKey = dcp data.Columns("UNIT").DefaultValue = 0 data.Columns("HARGA").DefaultValue = 0 data.Columns("JUMLAH").DefaultValue = 0 End Sub Private Sub hitung() Dim intr As Integer For Each r As DataGridViewRow In DataGridView1.Rows intr = intr + r.Cells("JUMLAH").Value Next Tot.Text = intr End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit If e.ColumnIndex = 0 Then cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf If cari.JumlanBaris > 0 Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView1.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If Form38394036109050.ShowDialog = Windows.Forms.DialogResult.OK Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = Form38394036109050.DataGridView1.CurrentRow.Cells("KodeBarang").Value DataGridView1.CurrentRow.Cells("NAMABARANG").Value = Form38394036109050.DataGridView1.CurrentRow.Cells("namabarang").Value DataGridView1.CurrentRow.Cells("HARGA").Value = Form38394036109050.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value Else DataGridView1.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView1.CurrentRow.Cells("NAMABARANG").Value = "" End If End If End If If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value End If
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If TextBox1.Text.Length = 0 Then MsgBox("no transaksi belum terisi") Exit Sub End If
If jt.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub End If
If data.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1.Text, 1, CONECT) If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(jt.Text) & ")", CONECT) CONECT.Open() com.ExecuteNonQuery() CONECT.Close()
For Each r As DataRow In data.Rows com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox1.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT) CONECT.Open() com.ExecuteNonQuery() CONECT.Close() com.Dispose() Next
TextBox1.Text = "" jt.Text = "" Tot.Text = "" data.Rows.Clear() hitung() End Sub End Class
'DEKLARASI CONECTION Dim CONNECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet oledb:database password = hapsari") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan03936109029_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView1.DataSource = DT 'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji Dim dcp(1) As DataColumn dcp(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dcp
End Sub Private Sub hitung() Dim indah As Integer For Each r As DataGridViewRow In DataGridView1.Rows indah = indah + r.Cells("JUMLAH").Value Next Tot36109029.Text = indah End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit If e.ColumnIndex = 0 Then 'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONNECT) '1 untuk huruf If cari.JumlanBaris > 0 Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView1.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If Latihan38029.ShowDialog = Windows.Forms.DialogResult.OK Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = Latihan38029.DataGridView1.CurrentRow.Cells("KodeBarang").Value DataGridView1.CurrentRow.Cells("NAMABARANG").Value = Latihan38029.DataGridView1.CurrentRow.Cells("namabarang").Value DataGridView1.CurrentRow.Cells("HARGA").Value = Latihan38029.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value Else DataGridView1.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView1.CurrentRow.Cells("NAMABARANG").Value = "" End If End If End If If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
Private Sub Button236109029_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109029.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If TextBox136109029.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("no transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If jt36109029.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("jenis transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109029.Text, 1, CONNECT)
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
'untuk memasukkan data dari visual basc ke dlm acces Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109029.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(jt36109029.Text) & ")", CONNECT)
Dim toshiba As New DataTable Dim flash As New OleDb.OleDbCommand Dim nokia As New ByIskandar.CariKeDataBaseByIskandar Dim sambung As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=jayapura")
Private Sub LATIHAN03936109032_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim laptop As New OleDb.OleDbDataAdapter laptop = New OleDb.OleDbDataAdapter("SELECT BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETAILTRANSAKSI ON BARANG.KODEBARANG = DETAILTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & NT.Text & "'", sambung) laptop.Fill(toshiba) laptop.Dispose()
Dim dc(1) As DataColumn dc(0) = toshiba.Columns("kodebarang") toshiba.PrimaryKey = dc
DataGridView1.DataSource = toshiba End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit If DataGridView1.Columns(e.ColumnIndex).Name = "KODEBARANG" Then 'If dgv.CurrentRow.Cells(0) = "KODEBARANG" Then (rumus lain)
'untuk mencari nama barang DataGridView1.CurrentRow.Cells("NAMABARANG").Value = "" DataGridView1.CurrentRow.Cells("UNIT").Value = 0 DataGridView1.CurrentRow.Cells("HARGA").Value = 0 DataGridView1.CurrentRow.Cells("JUMLAH").Value = 0
nokia.AturPencarianDataBase("barang", "kodebarang", DataGridView1.CurrentRow.Cells("KODEBARANG").Value, 1, sambung) If nokia.JumlanBaris > 0 Then '(menampilkan nama barang jika kolom kode barang ditemukan oleh proses di atas DataGridView1.CurrentRow.Cells("NAMABARANG").Value = nokia.DataTablenya.Rows(0).Item("NAMABARANG") Else DataGridView1.CurrentRow.Cells("NAMABARANG").Value = "" If LATIHAN03836109032.ShowDialog = Windows.Forms.DialogResult.OK Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = LATIHAN03836109032.DataGridView1.CurrentRow.Cells("KODEBARANG").Value DataGridView1.CurrentRow.Cells("NAMABARANG").Value = LATIHAN03836109032.DataGridView1.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf DataGridView1.Columns(e.ColumnIndex).Name = "UNIT" Or DataGridView1.Columns(e.ColumnIndex).Name = "HARGA" Then DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value dogdog()
Private Sub dogdog() Dim dogdog1 As Integer = 0 For Each dogdog2 As DataRow In toshiba.Rows dogdog1 += dogdog2("JUMLAH") Next TOT.Text = dogdog1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If NT.Text.Length = 0 Then MsgBox("Isi rong itu No Transaksinya") Exit Sub End If
If JT.Text.Length = 0 Then MsgBox("Isi rong itu Jenis Transaksinya") Exit Sub End If
If toshiba.Rows.Count = 0 Then MsgBox("Isi rong itu datatable k") Exit Sub End If
nokia.AturPencarianDataBase("mastertransaksi", "notrans", NT.Text, 1, sambung) If nokia.JumlanBaris > 0 Then MsgBox("Adami notrans seperti itu") Exit Sub End If
For Each x As DataRow In toshiba.Rows flash = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", sambung) sambung.Open() flash.ExecuteNonQuery() sambung.Close() Next
Public Class LATIHAN03936109036 'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=100191") Dim Data As New DataTable Dim browse As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN03936109036_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Data.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka Data.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka Data.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka Data.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka Data.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView1.DataSource = Data 'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji Dim dcp(1) As DataColumn dcp(0) = Data.Columns("KODEBARANG") Data.PrimaryKey = dcp
Data.Columns("UNIT").DefaultValue = 0 Data.Columns("HARGA").DefaultValue = 0 Data.Columns("JUMLAH").DefaultValue = 0 End Sub
Private Sub HITUNG() Dim akuntansi As Integer For Each t As DataGridViewRow In DataGridView1.Rows akuntansi = akuntansi + t.Cells("JUMLAH").Value Next Tot36109036.Text = akuntansi End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value End If HITUNG() End Sub
Private Sub Button236109036_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109036.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If TextBox136109036.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("no transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If jt36109036.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("jenis transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Data.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada browse.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109036.Text, 1, CONECT)
If browse.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
'untuk memasukkan data dari visual basc ke dlm acces Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109036.Text & "',#" & DateTimePicker136109036.Value.Date & "#," & Val(jt36109036.Text) & ")", CONECT)
'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= D:\berbagi\LATIHAN 35-40 DATA MAJEMUK\DataMajemuk.accdb;Jet OLEDB:Database Password=salam") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan039012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) DataGridView136109054.DataSource = DT 'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji Dim dcp(1) As DataColumn dcp(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dcp
End Sub Private Sub hitung() Dim manis As Integer For Each r As DataGridViewRow In DataGridView136109054.Rows manis = manis + r.Cells("JUMLAH").Value Next Tot36109054.Text = manis
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView136109054.CellEndEdit If e.ColumnIndex = 0 Then 'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView136109054.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf If cari.JumlanBaris > 0 Then DataGridView136109054.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView136109054.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If Latihan383940012.ShowDialog = Windows.Forms.DialogResult.OK Then DataGridView136109054.CurrentRow.Cells("KODEBARANG").Value = Latihan383940012.DataGridView1.CurrentRow.Cells("KodeBarang").Value DataGridView136109054.CurrentRow.Cells("NAMABARANG").Value = Latihan383940012.DataGridView1.CurrentRow.Cells("namabarang").Value DataGridView136109054.CurrentRow.Cells("HARGA").Value = Latihan383940012.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value Else DataGridView136109054.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView136109054.CurrentRow.Cells("NAMABARANG").Value = "" End If End If End If If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then DataGridView136109054.CurrentRow.Cells("JUMLAH").Value = DataGridView136109054.CurrentRow.Cells("UNIT").Value * DataGridView136109054.CurrentRow.Cells("HARGA").Value
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109054.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If TextBox136109054.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("no transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If jt36109054.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("jenis transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109054.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
'untuk memasukkan data dari visual basc ke dlm acces Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109054.Text & "',#" & DateTimePicker136109054.Value.Date & "#," & Val(jt36109054.Text) & ")", CONECT)
Public Class Form3936108001 Dim INCE As New OleDb.OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DataMajemuk.accdb;Jet OLEDB:Database Password=36108001") Dim LOVE As New DataTable Dim AYI As New ByIskandar.CariKeDataBaseByIskandar Public Sub TOT() Dim LO As Integer For Each VE As DataRow In LOVE.Rows LO = LO + VE("Jumlah") Next T836108001.Text = LO End Sub Private Sub Form3936108001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim YNK As New OleDb.OleDbDataAdapter YNK = New OleDb.OleDbDataAdapter("Select BARANG.KodeBarang, BARANG.NamaBarang, DETAILTRANSAKSI.unit, DETAILTRANSAKSI.Harga, DETAILTRANSAKSI.Unit * DETAILTRANSAKSI.harga AS Jumlah FROM BARANG INNER JOIN detailtransaksi ON BARANG.KODEBARANG=DETAILTRANSAKSI.KODEBARANG Where notrans='" & T136108001.Text & "' ", INCE) LOVE.Rows.Clear() YNK.Fill(LOVE) YNK.Dispose()
DGV36108001.DataSource = LOVE End Sub Private Sub DGV36108001_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV36108001.CellEndEdit If e.ColumnIndex = 0 Then Dim IA As New ByIskandar.CariKeDataBaseByIskandar IA.AturPencarianDataBase("barang", "kodebarang", DGV36108001.CurrentRow.Cells("KodeBarang").Value, 1, INCE) If IA.JumlanBaris > 0 Then DGV36108001.CurrentRow.Cells("KodeBarang").Value = IA.DataTablenya.Rows(0).Item("KodeBarang") DGV36108001.CurrentRow.Cells("NamaBarang").Value = IA.DataTablenya.Rows(0).Item("NamaBarang") DGV36108001.CurrentRow.Cells("Harga").Value = IA.DataTablenya.Rows(0).Item("HargaJual") Else MsgBox("Kode barang tersbut tidak ada") If Form38394036108001.ShowDialog = Windows.Forms.DialogResult.OK Then DGV36108001.CurrentRow.Cells("KodeBarang").Value = Form38394036108001.DGV36108001.CurrentRow.Cells("KodeBarang").Value DGV36108001.CurrentRow.Cells("NamaBarang").Value = Form38394036108001.DGV36108001.CurrentRow.Cells("NamaBarang").Value DGV36108001.CurrentRow.Cells("Harga").Value = Form38394036108001.DGV36108001.CurrentRow.Cells("HargaJual").Value Else DGV36108001.CurrentRow.Cells("KodeBarang").Value = "" DGV36108001.CurrentRow.Cells("NamaBarang").Value = "" DGV36108001.CurrentRow.Cells("Harga").Value = "" End If End If ElseIf e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then DGV36108001.CurrentRow.Cells("Jumlah").Value = DGV36108001.CurrentRow.Cells("Unit").Value * DGV36108001.CurrentRow.Cells("Harga").Value TOT() End If End Sub
Private Sub B236108001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B236108001.Click If T136108001.Text.Length = 0 Then MsgBox("Nomor transaksi belum terisi") Exit Sub End If
If T236108001.Text.Length = 0 Then MsgBox("Jenis transaksi belum terisi") Exit Sub End If
If LOVE.Rows.Count = 0 Then MsgBox("Data tidak terisi") Exit Sub End If
If AYI.JumlanBaris > 0 Then MsgBox("Nomor transaksi tersebut sudah ada") Exit Sub End If
Dim AKBAR As New OleDb.OleDbCommand Dim VENUS As String VENUS = "INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & T136108001.Text & "', #" & DTP36108001.Value.Date & "#, '" & T236108001.Text & "');" AKBAR = New OleDb.OleDbCommand(VENUS, INCE) INCE.Open() AKBAR.ExecuteNonQuery() INCE.Close()
For Each ARHY As DataRow In LOVE.Rows Dim EGIET As String EGIET = "INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & T136108001.Text & "', '" & ARHY("KODEBARANG") & "', '" & ARHY("UNIT") & "', '" & ARHY("HARGA") & "');" AKBAR = New OleDb.OleDbCommand(EGIET, INCE) INCE.Open() AKBAR.ExecuteNonQuery() INCE.Close() Next AKBAR.Dispose()
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT36109044.Text & "',#" & DateTimePicker136109044.Value.Date & "#," & Val(JT36109044.Text) & ")", CONECT)
Public Class LATIHAN039012
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source="& Application.StartupPath &"\DATAMAJEMUK.accdb;jetOLEDB:databasepassword=280765")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan039012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String)))
DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String)))
DT.Columns.Add(New DataColumn("UNIT", GetType(Double)))
DT.Columns.Add(New DataColumn("HARGA", GetType(Integer)))
DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView1.DataSource = DT
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0
DT.Columns("HARGA").DefaultValue = 0
DT.Columns("JUMLAH").DefaultValue = 0
End Sub
lanjutan
BalasHapusPrivate Sub hitung()
Dim manis As Integer
For Each r As DataGridViewRow In DataGridView1. Rows
manis = manis + r.Cells("JUMLAH").Value
Next
Tot.Text = manis
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
If e.ColumnIndex = 0 Then
cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT)
If cari.JumlanBaris > 0 Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView1.CurrentRow.Cells("NAMABARANG").Value =cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If LATIHAN3839.ShowDialog = Windows.Forms. DialogResult.OK Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value=LATIHAN3839.DataGridView1.CurrentRow.Cells("KodeBarang").Value DataGridView1.CurrentRow.Cells("NAMABARANG").Value=LATIHAN3839.DataGridView1.CurrentRow.Cells("namabarang").Value DataGridView1.CurrentRow.Cells("HARGA").Value = LATIHAN3839.DataGridView1.CurrentRow.Cells("harga").Value
Else DataGridView1.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView1.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
End If
If e.ColumnIndex = 2 Or e.ColumnIndex=3Then DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
End If
hitung()
End Sub
lanjutan
BalasHapusPrivate Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If TextBox1.Text.Length = 0 Then
MsgBox("no transaksi belum terisi")
Exit Sub
End If
If jt.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & jt.Text & "')", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox1.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox1.Text = ""
jt.Text = ""
Tot.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
Public Class Latih39_36109034
BalasHapus'DEKLARASI CONECTION
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=miss")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latih39_36109034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka
DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka
DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView1.DataSource = DT
'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0
DT.Columns("HARGA").DefaultValue = 0
DT.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
Dim nhunoe As Integer
For Each r As DataGridViewRow In DataGridView1.Rows
nhunoe = nhunoe + r.Cells("JUMLAH").Value
Next
Tot_36109034.Text = nhunoe
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
If e.ColumnIndex = 0 Then
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If Latih3839_36109034.ShowDialog = Windows.Forms.DialogResult.OK Then
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = Latih3839_36109034.DataGridView1.CurrentRow.Cells("KodeBarang").Value
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = Latih3839_36109034.DataGridView1.CurrentRow.Cells("namabarang").Value
DataGridView1.CurrentRow.Cells("HARGA").Value = Latih3839_36109034.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value
Else
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = ""
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
End If
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
End If
hitung()
End Sub
'Lanjutan
BalasHapusPrivate Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If TextBox1_36109034.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("no transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If jt_36109034.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("jenis transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1_36109034.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
'untuk memasukkan data dari visual basc ke dlm acces
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1_36109034.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(jt_36109034.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox1_36109034.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox1_36109034.Text = ""
jt_36109034.Text = ""
Tot_36109034.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
Public Class Latih3839_36109034
BalasHapus'DEKLARASI CONECTION
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=miss")
'deklarasi data tabel
Dim DT As New DataTable
Dim BARIS As DataRow
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latih3839_36109034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'deklarasi adapter
Dim nhunoe As New OleDb.OleDbDataAdapter
nhunoe = New OleDb.OleDbDataAdapter("select KODEBARANG, NAMABARANG FROM BARANG ", CONECT) 'memunculkan semua data dari tabel barang dlm acces
DT.Rows.Clear() 'membersihkan data table
nhunoe.Fill(DT) 'mengisi database ke dlm data table
DataGridView1.DataSource = DT 'memunculkan dlm datagridview
nhunoe.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
BARIS = DT.DefaultView(BindingContext(DT).Position).Row
Latih38_36109034.nb_36109034.Text = BARIS("NAMABARANG")
End Sub
End Class
Public Class LATIHAN_039_36109056
BalasHapus'DEKLARASI CONECTION
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=2422")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan039012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka
DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka
DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView1.DataSource = DT
'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0
DT.Columns("HARGA").DefaultValue = 0
DT.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
Dim biya As Integer
For Each r As DataGridViewRow In DataGridView1.Rows
biya = biya + r.Cells("JUMLAH").Value
Next
Tot_36109056.Text = biya
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
If e.ColumnIndex = 0 Then
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If LATIHAN3839_36109056.ShowDialog = Windows.Forms.DialogResult.OK Then
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = LATIHAN3839_36109056.DataGridView1.CurrentRow.Cells("KodeBarang").Value
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = LATIHAN3839_36109056.DataGridView1.CurrentRow.Cells("namabarang").Value
DataGridView1.CurrentRow.Cells("HARGA").Value = LATIHAN3839_36109056.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value
Else
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = ""
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
End If
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
End If
hitung()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
BalasHapus'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If TextBox1_36109056.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("no transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If jt_36109056.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("jenis transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1_36109056.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
'untuk memasukkan data dari visual basc ke dlm acces
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1_36109056.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(jt_36109056.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox1_36109056.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox1_36109056.Text = ""
jt_36109056.Text = ""
Tot_36109056.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
Public Class Form3936109040
BalasHapus'DEKLARASI CONECTION
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=150991")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latih3936109040_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka
DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka
DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView1.DataSource = DT
'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0
DT.Columns("HARGA").DefaultValue = 0
DT.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
Dim mytha As Integer
For Each r As DataGridViewRow In DataGridView1.Rows
mytha = mytha + r.Cells("JUMLAH").Value
Next
Tot36109040.Text = mytha
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
If e.ColumnIndex = 0 Then
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If Latih383936109040.ShowDialog = Windows.Forms.DialogResult.OK Then
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = Latih3839_36109040.DataGridView1.CurrentRow.Cells("KodeBarang").Value
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = Latih3839_36109040.DataGridView1.CurrentRow.Cells("namabarang").Value
DataGridView1.CurrentRow.Cells("HARGA").Value = Latih3839_36109040.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value
Else
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = ""
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
End If
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
End If
hitung()
End Sub
End Class
Public Class LATIHAN039_36109049
BalasHapus'DEKLARASI CONECTION
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=wirda")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan039_36109049_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka
DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka
DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DGV1_36109049.DataSource = DT
'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0
DT.Columns("HARGA").DefaultValue = 0
DT.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
Dim wirda As Integer
For Each r As DataGridViewRow In DGV1_36109049.Rows
wirda = wirda + r.Cells("JUMLAH").Value
Next
Tot1_36109049.Text = wirda
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV1_36109049.CellEndEdit
If e.ColumnIndex = 0 Then
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("BARANG", "kodebarang", DGV1_36109049.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then
DGV1_36109049.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
DGV1_36109049.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If LATIHAN3839_36109049.ShowDialog = Windows.Forms.DialogResult.OK Then
DGV1_36109049.CurrentRow.Cells("KODEBARANG").Value = LATIHAN3839_36109049.DataGridView1.CurrentRow.Cells("KodeBarang").Value
DGV1_36109049.CurrentRow.Cells("NAMABARANG").Value = LATIHAN3839_36109049.DataGridView1.CurrentRow.Cells("namabarang").Value
DGV1_36109049.CurrentRow.Cells("HARGA").Value = LATIHAN3839_36109049.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value
Else
DGV1_36109049.CurrentRow.Cells("KODEBARANG").Value = ""
DGV1_36109049.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
Lanjutan 39
BalasHapusEnd If
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DGV1_36109049.CurrentRow.Cells("JUMLAH").Value = DGV1_36109049.CurrentRow.Cells("UNIT").Value * DGV1_36109049.CurrentRow.Cells("HARGA").Value
End If
hitung()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If TextBox1_36109049.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("no transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If TextBox2_36109049.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("jenis transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1_36109049.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
'untuk memasukkan data dari visual basc ke dlm acces
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1_36109049.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(TextBox2_36109049.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox1_36109049.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox1_36109049.Text = ""
TextBox2_36109049.Text = ""
Tot1_36109049.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
Public Class LATIHAN03936109038
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=icha")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN03936109038_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load
DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String)))
DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String)))
DT.Columns.Add(New DataColumn("UNIT", GetType(Double)))
DT.Columns.Add(New DataColumn("HARGA", GetType(Integer)))
DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView136109038.DataSource = DT
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0
DT.Columns("HARGA").DefaultValue = 0
DT.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
Dim cantik As Integer
For Each r As DataGridViewRow In DataGridView136109038.Rows
cantik = cantik + r.Cells("JUMLAH").Value
Next
Tot36109038.Text = cantik
End Sub
Private Sub DataGridView136109038_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView136109038.CellEndEdit
If e.ColumnIndex = 0 Then
cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView136109038.CurrentRow.Cells("kodebarang").Value, 1, CONECT)
If cari.JumlanBaris > 0 Then
DataGridView136109038.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
DataGridView136109038.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If LATIHAN03836109038.ShowDialog = Windows.Forms.DialogResult.OK Then
DataGridView136109038.CurrentRow.Cells("KODEBARANG").Value = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("KodeBarang").Value
DataGridView136109038.CurrentRow.Cells("NAMABARANG").Value = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("namabarang").Value
DataGridView136109038.CurrentRow.Cells("HARGA").Value = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("HARGAJUAL").Value()
Else
DataGridView136109038.CurrentRow.Cells("KODEBARANG").Value = ""
DataGridView136109038.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
End If
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DataGridView136109038.CurrentRow.Cells("JUMLAH").Value = DataGridView136109038.CurrentRow.Cells("UNIT").Value * DataGridView136109038.CurrentRow.Cells("HARGA").Value
End If
hitung()
End Sub
Private Sub Button236109038_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button236109038.Click
BalasHapusIf TextBox136109038.Text.Length = 0 Then
MsgBox("no transaksi belum terisi")
Exit Sub
End If
If jt36109038.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109038.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109038.Text & "',#" & DateTimePicker136109038.Value.Date & "#," & Val(jt36109038.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox136109038.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox136109038.Text = ""
jt36109038.Text = ""
Tot36109038.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
lanjutan 39
BalasHapusPrivate Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109041.Click
If nt36109041.Text.Length = 0 Then
MsgBox("no transaksi belum terisi")
Exit Sub
End If
If jt36109041.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", nt36109041.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt36109041.Text & "',#" & DateTimePicker136109041.Value.Date & "#,'" & jt36109041.Text & "')", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & nt36109041.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
nt36109041.Text = ""
jt36109041.Text = ""
Tot36109041.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
Public Class LATIHAN03936109033
BalasHapus'DEKLARASI CONECTION
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=tahir")
Dim Data As New DataTable
Dim browse As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN03936109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Data.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka
Data.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka
Data.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka
Data.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka
Data.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView1.DataSource = Data
'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji
Dim dcp(1) As DataColumn
dcp(0) = Data.Columns("KODEBARANG")
Data.PrimaryKey = dcp
Data.Columns("UNIT").DefaultValue = 0
Data.Columns("HARGA").DefaultValue = 0
Data.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub HITUNG()
Dim akuntansi As Integer
For Each t As DataGridViewRow In DataGridView1.Rows
akuntansi = akuntansi + t.Cells("JUMLAH").Value
Next
Tot36109033.Text = akuntansi
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
End If
HITUNG()
End Sub
Private Sub Button236109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109033.Click
BalasHapus'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If TextBox136109033.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("no transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If jt36109033.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("jenis transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Data.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
browse.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109033.Text, 1, CONECT)
If browse.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
'untuk memasukkan data dari visual basc ke dlm acces
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109033.Text & "',#" & DateTimePicker136109033.Value.Date & "#," & Val(jt36109033.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each t As DataRow In Data.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox136109033.Text & "','" & t("kodebarang") & "'," & t("unit") & "," & t("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox136109033.Text = ""
jt36109033.Text = ""
Tot36109033.Text = ""
Data.Rows.Clear()
HITUNG()
End Sub
End Class
Public Class LATIHAN3839_36109033
BalasHapus'DEKLARASI CONECTION
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=tahir")
'deklarasi data tabel
Dim Data As New DataTable
Dim row As DataRow
Dim browse As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN3839_36109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'deklarasi adapter
Dim tiwi As New OleDb.OleDbDataAdapter
tiwi = New OleDb.OleDbDataAdapter("select KODEBARANG, NAMABARANG FROM BARANG ", CONECT) 'memunculkan semua data dari tabel barang dlm acces
Data.Rows.Clear() 'membersihkan data table
tiwi.Fill(Data) 'mengisi database ke dlm data table
DataGridView1.DataSource = Data 'memunculkan dlm datagridview
tiwi.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
row = Data.DefaultView(BindingContext(Data).Position).Row
LATIHAN03836109033.nb36109033.Text = row("NAMABARANG")
End Sub
End Class
Public Class LATIHAN_3936109056
BalasHapus'DEKLARASI CONECTION
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=2312")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan_3936109055_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka
DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka
DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView136109055.DataSource = DT
'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0
DT.Columns("HARGA").DefaultValue = 0
DT.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
Dim falah As Integer
For Each r As DataGridViewRow In DataGridView1.Rows
falah= falah + r.Cells("JUMLAH").Value
Next
Tot36109055.Text = falah
End Sub
lanjutan
BalasHapusPrivate Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
If e.ColumnIndex = 0 Then
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView136109055.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then
DataGridView136109055.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
DataGridView136109055.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If LATIHAN3839_36109055.ShowDialog = Windows.Forms.DialogResult.OK Then
DataGridView136109055.CurrentRow.Cells("KODEBARANG").Value = LATIHAN3839_36109055.DataGridView1.CurrentRow.Cells("KodeBarang").Value
DataGridView136109055.CurrentRow.Cells("NAMABARANG").Value = LATIHAN3839_36109055.DataGridView1.CurrentRow.Cells("namabarang").Value
DataGridView136109055.CurrentRow.Cells("HARGA").Value = LATIHAN3839_36109055.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value
Else
DataGridView136109055.CurrentRow.Cells("KODEBARANG").Value = ""
DataGridView136109055.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
End If
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DataGridView136109055.CurrentRow.Cells("JUMLAH").Value = DataGridView136109055.CurrentRow.Cells("UNIT").Value * DataGridView136109055.CurrentRow.Cells("HARGA").Value
End If
hitung()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If TextBox136109055.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("no transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If jt36109055.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("jenis transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109055.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
'untuk memasukkan data dari visual basc ke dlm acces
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109055.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(jt36109055.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox136109055.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox136109055.Text = ""
jt36109055.Text = ""
Tot36109055.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
Public Class LATIHAN039_36109053
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source="& Application.StartupPath &"\DATAMAJEMUK.accdb;jetOLEDB:databasepassword=kondolele")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan039_36109053_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String)))
DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String)))
DT.Columns.Add(New DataColumn("UNIT", GetType(Double)))
DT.Columns.Add(New DataColumn("HARGA", GetType(Integer)))
DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView1.DataSource = DT
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0
DT.Columns("HARGA").DefaultValue = 0
DT.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
BalasHapusDim dede As Integer
For Each r As DataGridViewRow In DataGridView1. Rows
dede = dede + r.Cells("JUMLAH").Value
Next
Tot.Text = dede
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
If e.ColumnIndex = 0 Then
cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT)
If cari.JumlanBaris > 0 Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") DataGridView1.CurrentRow.Cells("NAMABARANG").Value =cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If LATIHAN38_36109053.ShowDialog = Windows.Forms. DialogResult.OK Then DataGridView1.CurrentRow.Cells("KODEBARANG").Value=LATIHAN38_36109053.DataGridView1.CurrentRow.Cells("KodeBarang").Value DataGridView1.CurrentRow.Cells("NAMABARANG").Value=LATIHAN38_36109053.DataGridView1.CurrentRow.Cells("namabarang").Value DataGridView1.CurrentRow.Cells("HARGA").Value = LATIHAN38_36109053.DataGridView1.CurrentRow.Cells("harga").Value
Else DataGridView1.CurrentRow.Cells("KODEBARANG").Value = "" DataGridView1.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
End If
If e.ColumnIndex = 2 Or e.ColumnIndex=3Then DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
End If
hitung()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
BalasHapusIf TextBox1.Text.Length = 0 Then
MsgBox("no transaksi belum terisi")
Exit Sub
End If
If jt.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & jt.Text & "')", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox1.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox1.Text = ""
jt.Text = ""
Tot.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
Public Class Form3936109050
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=nideria")
Dim data As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Form3936109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
data.Columns.Add(New DataColumn("KODEBARANG", GetType(String)))
data.Columns.Add(New DataColumn("NAMABARANG", GetType(String)))
data.Columns.Add(New DataColumn("UNIT", GetType(Double)))
data.Columns.Add(New DataColumn("HARGA", GetType(Integer)))
data.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView1.DataSource = data
Dim dcp(1) As DataColumn
dcp(0) = data.Columns("KODEBARANG")
data.PrimaryKey = dcp
data.Columns("UNIT").DefaultValue = 0
data.Columns("HARGA").DefaultValue = 0
data.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
Dim intr As Integer
For Each r As DataGridViewRow In DataGridView1.Rows
intr = intr + r.Cells("JUMLAH").Value
Next
Tot.Text = intr
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
If e.ColumnIndex = 0 Then
cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If Form38394036109050.ShowDialog = Windows.Forms.DialogResult.OK Then
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = Form38394036109050.DataGridView1.CurrentRow.Cells("KodeBarang").Value
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = Form38394036109050.DataGridView1.CurrentRow.Cells("namabarang").Value
DataGridView1.CurrentRow.Cells("HARGA").Value = Form38394036109050.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value
Else
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = ""
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
End If
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
End If
hitung()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
BalasHapusIf TextBox1.Text.Length = 0 Then
MsgBox("no transaksi belum terisi")
Exit Sub
End If
If jt.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
If data.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox1.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(jt.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In data.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox1.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox1.Text = ""
jt.Text = ""
Tot.Text = ""
data.Rows.Clear()
hitung()
End Sub
End Class
Public Class LATIHAN03936109029
BalasHapus'DEKLARASI CONECTION
Dim CONNECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet oledb:database password = hapsari")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan03936109029_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka
DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka
DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView1.DataSource = DT
'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0
DT.Columns("HARGA").DefaultValue = 0
DT.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
Dim indah As Integer
For Each r As DataGridViewRow In DataGridView1.Rows
indah = indah + r.Cells("JUMLAH").Value
Next
Tot36109029.Text = indah
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
If e.ColumnIndex = 0 Then
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView1.CurrentRow.Cells("kodebarang").Value, 1, CONNECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If Latihan38029.ShowDialog = Windows.Forms.DialogResult.OK Then
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = Latihan38029.DataGridView1.CurrentRow.Cells("KodeBarang").Value
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = Latihan38029.DataGridView1.CurrentRow.Cells("namabarang").Value
DataGridView1.CurrentRow.Cells("HARGA").Value = Latihan38029.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value
Else
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = ""
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
End If
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
BalasHapusEnd If
hitung()
End Sub
Private Sub Button236109029_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109029.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If TextBox136109029.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("no transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If jt36109029.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("jenis transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109029.Text, 1, CONNECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
'untuk memasukkan data dari visual basc ke dlm acces
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109029.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(jt36109029.Text) & ")", CONNECT)
CONNECT.Open()
com.ExecuteNonQuery()
CONNECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox136109029.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONNECT)
CONNECT.Open()
com.ExecuteNonQuery()
CONNECT.Close()
com.Dispose()
Next
TextBox136109029.Text = ""
jt36109029.Text = ""
Tot36109029.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
Public Class LATIHAN03936109032
BalasHapusDim toshiba As New DataTable
Dim flash As New OleDb.OleDbCommand
Dim nokia As New ByIskandar.CariKeDataBaseByIskandar
Dim sambung As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=jayapura")
Private Sub LATIHAN03936109032_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim laptop As New OleDb.OleDbDataAdapter
laptop = New OleDb.OleDbDataAdapter("SELECT BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETAILTRANSAKSI ON BARANG.KODEBARANG = DETAILTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & NT.Text & "'", sambung)
laptop.Fill(toshiba)
laptop.Dispose()
Dim dc(1) As DataColumn
dc(0) = toshiba.Columns("kodebarang")
toshiba.PrimaryKey = dc
DataGridView1.DataSource = toshiba
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEndEdit
If DataGridView1.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
'If dgv.CurrentRow.Cells(0) = "KODEBARANG" Then (rumus lain)
'untuk mencari nama barang
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = ""
DataGridView1.CurrentRow.Cells("UNIT").Value = 0
DataGridView1.CurrentRow.Cells("HARGA").Value = 0
DataGridView1.CurrentRow.Cells("JUMLAH").Value = 0
nokia.AturPencarianDataBase("barang", "kodebarang", DataGridView1.CurrentRow.Cells("KODEBARANG").Value, 1, sambung)
If nokia.JumlanBaris > 0 Then '(menampilkan nama barang jika kolom kode barang ditemukan oleh proses di atas
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = nokia.DataTablenya.Rows(0).Item("NAMABARANG")
Else
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = ""
If LATIHAN03836109032.ShowDialog = Windows.Forms.DialogResult.OK Then
DataGridView1.CurrentRow.Cells("KODEBARANG").Value = LATIHAN03836109032.DataGridView1.CurrentRow.Cells("KODEBARANG").Value
DataGridView1.CurrentRow.Cells("NAMABARANG").Value = LATIHAN03836109032.DataGridView1.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf DataGridView1.Columns(e.ColumnIndex).Name = "UNIT" Or DataGridView1.Columns(e.ColumnIndex).Name = "HARGA" Then
DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
dogdog()
End If
End Sub
lanjutan..
BalasHapusPrivate Sub dogdog()
Dim dogdog1 As Integer = 0
For Each dogdog2 As DataRow In toshiba.Rows
dogdog1 += dogdog2("JUMLAH")
Next
TOT.Text = dogdog1
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If NT.Text.Length = 0 Then
MsgBox("Isi rong itu No Transaksinya")
Exit Sub
End If
If JT.Text.Length = 0 Then
MsgBox("Isi rong itu Jenis Transaksinya")
Exit Sub
End If
If toshiba.Rows.Count = 0 Then
MsgBox("Isi rong itu datatable k")
Exit Sub
End If
nokia.AturPencarianDataBase("mastertransaksi", "notrans", NT.Text, 1, sambung)
If nokia.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu")
Exit Sub
End If
flash = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT.Text & "',#" & DateTimePicker1.Value.Month & "/" & DateTimePicker1.Value.Day & "/" & DateTimePicker1.Value.Year & "#,'" & JT.Text & "')", sambung)
sambung.Open()
flash.ExecuteNonQuery()
sambung.Close()
For Each x As DataRow In toshiba.Rows
flash = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", sambung)
sambung.Open()
flash.ExecuteNonQuery()
sambung.Close()
Next
flash.Dispose()
NT.Text = ""
JT.Text = ""
TOT.Text = ""
toshiba.Rows.Clear()
dogdog()
End Sub
End Class
Public Class LATIHAN03936109036
BalasHapus'DEKLARASI CONECTION
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=100191")
Dim Data As New DataTable
Dim browse As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN03936109036_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Data.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka
Data.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka
Data.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka
Data.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka
Data.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView1.DataSource = Data
'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji
Dim dcp(1) As DataColumn
dcp(0) = Data.Columns("KODEBARANG")
Data.PrimaryKey = dcp
Data.Columns("UNIT").DefaultValue = 0
Data.Columns("HARGA").DefaultValue = 0
Data.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub HITUNG()
Dim akuntansi As Integer
For Each t As DataGridViewRow In DataGridView1.Rows
akuntansi = akuntansi + t.Cells("JUMLAH").Value
Next
Tot36109036.Text = akuntansi
End Sub
Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
BalasHapusIf e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DataGridView1.CurrentRow.Cells("JUMLAH").Value = DataGridView1.CurrentRow.Cells("UNIT").Value * DataGridView1.CurrentRow.Cells("HARGA").Value
End If
HITUNG()
End Sub
Private Sub Button236109036_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109036.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If TextBox136109036.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("no transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If jt36109036.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("jenis transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Data.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
browse.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109036.Text, 1, CONECT)
If browse.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
'untuk memasukkan data dari visual basc ke dlm acces
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109036.Text & "',#" & DateTimePicker136109036.Value.Date & "#," & Val(jt36109036.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each t As DataRow In Data.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox136109036.Text & "','" & t("kodebarang") & "'," & t("unit") & "," & t("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox136109036.Text = ""
jt36109036.Text = ""
Tot36109036.Text = ""
Data.Rows.Clear()
HITUNG()
End Sub
End Class
Public Class LATIHAN03936109054
BalasHapus'DEKLARASI CONECTION
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= D:\berbagi\LATIHAN 35-40 DATA MAJEMUK\DataMajemuk.accdb;Jet OLEDB:Database Password=salam")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan039012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) 'untuk angka
DT.Columns.Add(New DataColumn("UNIT", GetType(Double))) 'untuk angka
DT.Columns.Add(New DataColumn("HARGA", GetType(Integer))) 'untuk angka
DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
DataGridView136109054.DataSource = DT
'datagridwiew digunakan untuk menampilkan tabel yg sdh dibuat jika tdk maka tabel tdk akn muncul
'rumus dibwh ini untuk membuat primary key dimana dcp adalah nama sembarangji
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0
DT.Columns("HARGA").DefaultValue = 0
DT.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
Dim manis As Integer
For Each r As DataGridViewRow In DataGridView136109054.Rows
manis = manis + r.Cells("JUMLAH").Value
Next
Tot36109054.Text = manis
End Sub
Private Sub DataGridView1_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView136109054.CellEndEdit
If e.ColumnIndex = 0 Then
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("BARANG", "kodebarang", DataGridView136109054.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then
DataGridView136109054.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
DataGridView136109054.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If Latihan383940012.ShowDialog = Windows.Forms.DialogResult.OK Then
DataGridView136109054.CurrentRow.Cells("KODEBARANG").Value = Latihan383940012.DataGridView1.CurrentRow.Cells("KodeBarang").Value
DataGridView136109054.CurrentRow.Cells("NAMABARANG").Value = Latihan383940012.DataGridView1.CurrentRow.Cells("namabarang").Value
DataGridView136109054.CurrentRow.Cells("HARGA").Value = Latihan383940012.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value
Else
DataGridView136109054.CurrentRow.Cells("KODEBARANG").Value = ""
DataGridView136109054.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
End If
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DataGridView136109054.CurrentRow.Cells("JUMLAH").Value = DataGridView136109054.CurrentRow.Cells("UNIT").Value * DataGridView136109054.CurrentRow.Cells("HARGA").Value
End If
hitung()
BalasHapusEnd Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109054.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If TextBox136109054.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("no transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If jt36109054.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("jenis transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109054.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
'untuk memasukkan data dari visual basc ke dlm acces
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & TextBox136109054.Text & "',#" & DateTimePicker136109054.Value.Date & "#," & Val(jt36109054.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox136109054.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox136109054.Text = ""
jt36109054.Text = ""
Tot36109054.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
pembaharuan
BalasHapusPublic Class Form3936108001
Dim INCE As New OleDb.OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DataMajemuk.accdb;Jet OLEDB:Database Password=36108001")
Dim LOVE As New DataTable
Dim AYI As New ByIskandar.CariKeDataBaseByIskandar
Public Sub TOT()
Dim LO As Integer
For Each VE As DataRow In LOVE.Rows
LO = LO + VE("Jumlah")
Next
T836108001.Text = LO
End Sub
Private Sub Form3936108001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim YNK As New OleDb.OleDbDataAdapter
YNK = New OleDb.OleDbDataAdapter("Select BARANG.KodeBarang, BARANG.NamaBarang, DETAILTRANSAKSI.unit, DETAILTRANSAKSI.Harga, DETAILTRANSAKSI.Unit * DETAILTRANSAKSI.harga AS Jumlah FROM BARANG INNER JOIN detailtransaksi ON BARANG.KODEBARANG=DETAILTRANSAKSI.KODEBARANG Where notrans='" & T136108001.Text & "' ", INCE)
LOVE.Rows.Clear()
YNK.Fill(LOVE)
YNK.Dispose()
LOVE.Columns("Unit").DefaultValue = 0
LOVE.Columns("Harga").DefaultValue = 0
LOVE.Columns("Jumlah").DefaultValue = 0
DGV36108001.DataSource = LOVE
End Sub
Private Sub DGV36108001_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV36108001.CellEndEdit
If e.ColumnIndex = 0 Then
Dim IA As New ByIskandar.CariKeDataBaseByIskandar
IA.AturPencarianDataBase("barang", "kodebarang", DGV36108001.CurrentRow.Cells("KodeBarang").Value, 1, INCE)
If IA.JumlanBaris > 0 Then
DGV36108001.CurrentRow.Cells("KodeBarang").Value = IA.DataTablenya.Rows(0).Item("KodeBarang")
DGV36108001.CurrentRow.Cells("NamaBarang").Value = IA.DataTablenya.Rows(0).Item("NamaBarang")
DGV36108001.CurrentRow.Cells("Harga").Value = IA.DataTablenya.Rows(0).Item("HargaJual")
Else
MsgBox("Kode barang tersbut tidak ada")
If Form38394036108001.ShowDialog = Windows.Forms.DialogResult.OK Then
DGV36108001.CurrentRow.Cells("KodeBarang").Value = Form38394036108001.DGV36108001.CurrentRow.Cells("KodeBarang").Value
DGV36108001.CurrentRow.Cells("NamaBarang").Value = Form38394036108001.DGV36108001.CurrentRow.Cells("NamaBarang").Value
DGV36108001.CurrentRow.Cells("Harga").Value = Form38394036108001.DGV36108001.CurrentRow.Cells("HargaJual").Value
Else
DGV36108001.CurrentRow.Cells("KodeBarang").Value = ""
DGV36108001.CurrentRow.Cells("NamaBarang").Value = ""
DGV36108001.CurrentRow.Cells("Harga").Value = ""
End If
End If
ElseIf e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
DGV36108001.CurrentRow.Cells("Jumlah").Value = DGV36108001.CurrentRow.Cells("Unit").Value * DGV36108001.CurrentRow.Cells("Harga").Value
TOT()
End If
End Sub
lanjutan pembaharuan
BalasHapusPrivate Sub B236108001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B236108001.Click
If T136108001.Text.Length = 0 Then
MsgBox("Nomor transaksi belum terisi")
Exit Sub
End If
If T236108001.Text.Length = 0 Then
MsgBox("Jenis transaksi belum terisi")
Exit Sub
End If
If LOVE.Rows.Count = 0 Then
MsgBox("Data tidak terisi")
Exit Sub
End If
AYI.AturPencarianDataBase("mastertransaksi", "NOTRANS", T136108001.Text, 1, INCE)
If AYI.JumlanBaris > 0 Then
MsgBox("Nomor transaksi tersebut sudah ada")
Exit Sub
End If
Dim AKBAR As New OleDb.OleDbCommand
Dim VENUS As String
VENUS = "INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & T136108001.Text & "', #" & DTP36108001.Value.Date & "#, '" & T236108001.Text & "');"
AKBAR = New OleDb.OleDbCommand(VENUS, INCE)
INCE.Open()
AKBAR.ExecuteNonQuery()
INCE.Close()
For Each ARHY As DataRow In LOVE.Rows
Dim EGIET As String
EGIET = "INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & T136108001.Text & "', '" & ARHY("KODEBARANG") & "', '" & ARHY("UNIT") & "', '" & ARHY("HARGA") & "');"
AKBAR = New OleDb.OleDbCommand(EGIET, INCE)
INCE.Open()
AKBAR.ExecuteNonQuery()
INCE.Close()
Next
AKBAR.Dispose()
T136108001.Text = ""
T236108001.Text = ""
T836108001.Text = ""
LOVE.Rows.Clear()
TOT()
End Sub
End Class
lanjutan
BalasHapuscari.AturPencarianDataBase("mastertransaksi", "notrans", NT36109044.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT36109044.Text & "',#" & DateTimePicker136109044.Value.Date & "#," & Val(JT36109044.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & NT36109044.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
NT36109044.Text = ""
JT36109044.Text = ""
Tot36109044.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
http://hilariusmariotonapa.blogspot.com/2012/10/prosedur-penyelesaian-latihan3936110048.html
BalasHapushttp://hilariusmariotonapa.blogspot.com/2012/10/deskripsi-latihan3936110048.html
http://tiya-sri.blogspot.com/2012/10/latihan3936110044-aplikasi-komputer-4.html
BalasHapushttp://eminaomi.blogspot.com/2012/10/latihan3936110049.html
BalasHapushttp://nurrahmahrasyid2.blogspot.com/2012/10/latihan3936110042.html
BalasHapushttp://03melisa.blogspot.com/2012/10/latihan-39-36110051-apkom-4-d3b.html
BalasHapushttp://reskypurwono.blogspot.com/2012/10/prosedur-penyelesaian-latihan3936110037.html
BalasHapushttp://benhilll.blogspot.com/2012/10/deskripsi-dan-prosedur-latihan3936110039.html
BalasHapushttp://rosyanausman.blogspot.com/2012/10/latihan3936110036.html
BalasHapushttp://hasfiahzain.blogspot.com/2012/10/latihan3936110052.html
BalasHapushttp://ilhaazzahra.blogspot.com/2012/10/latihan3936110033.html
BalasHapushttp://ias-anakbola.blogspot.com/2012/10/latihan3936110056.html
BalasHapushttp://rainaagrippinaa.blogspot.com/2012/10/latihan3936110032.html
BalasHapushttp://rahmisuryatama05.blogspot.com/2012/10/latihan3936110040_28.html
BalasHapushttp://sriayu-36110030.blogspot.com/2012/10/diskripsi-prosedur-latihan-382940_28.html
BalasHapushttp://dewiwahyuni91.blogspot.com/2012/10/latihan3936110038.html
BalasHapushttp://andiniwarakusuma.blogspot.com/2012/10/latihan3936110034.html
BalasHapushttp://zulkiflitryputra.blogspot.com/2012/10/latihan3936110046.html
BalasHapushttp://sukadriady.blogspot.com/2012/10/latihan3936110043.html
BalasHapushttp://audryasharii.blogspot.com/2012/10/latihan3936110031.html
BalasHapushttp://burhankhang58.blogspot.com/2012/10/latihan3936110047.html
BalasHapushttp://rizka-azisah.blogspot.com/2012/11/deskripsi-penyelesaian-latihan393611004.html
BalasHapus