Private Sub LATIHAN036_36109037_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim poltek As New OleDb.OleDbDataAdapter poltek = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb36109037.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces DT.Rows.Clear() 'membersihkan data table poltek.Fill(DT) 'mengisi database ke dlm data table DataGridView1.DataSource = DT 'memunculkan dlm datagridview
poltek.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109037.TextChanged, hr36109037.TextChanged jm36109037.Text = Val(un36109037.Text) * Val(hr36109037.Text) End Sub Public Sub Juniati() Dim total As Double For Each x As DataRow In DT.Rows total = total + x("jumlah") Next Tot36109037.Text = total End Sub Private Sub NB_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb36109037.Click cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb36109037.Text, 1, CONECT) If cari.JumlanBaris > 0 Then If LATIHAN3839_36109037.Visible = False Then LATIHAN3839_36109037.Show() Else LATIHAN3839_36109037.Activate() End If Else MsgBox("Kode barang baru") nb36109037.ReadOnly = False Exit Sub End If End Sub
lanjutan Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If nt.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 cari.AturPencarianDataBase("mastertransaksi", "notrans", nt.Text, 1, CONECT) If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt.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 ('" & nt.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT) CONECT.Open() com.ExecuteNonQuery() CONECT.Close() com.Dispose() Next DT.Rows.Clear() nt.Text = "" jt.Text = "" khaeril() End Sub
Public Class LATIHAN038012 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=280765") Dim DT As New DataTable Dim kolom(3) As DataColumn Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click kolom(0) = DT.Columns("kodebarang") DT.PrimaryKey = kolom Dim drzany As DataRow drzany = DT.Rows.Find(kb.Text) If drzany Is Nothing Then drzany = DT.NewRow drzany("KODEBARANG") = kb.Text drzany("NAMABARANG") = nb.Text drzany("UNIT") = un.Text drzany("HARGA") = hr.Text drzany("JUMLAH") = jm.Text DT.Rows.Add(drzany)
lanjutan Else MsgBox("baris sudah ada") kb.Text = "" End If If kb.Text.Length = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If If Val(un.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If If Val(hr.Text) = 0 Then MsgBox("HARGA belum terisi") Exit Sub End If kb.Text = "" un.Text = "" hr.Text = "" nb.Text = "" jm.Text = "" khaeril() End Sub
lanjutan Private Sub LATIHAN036012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim nisa As New OleDb.OleDbDataAdapter nisa = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang =barang.kodebarang WHERE detailtransaksi. NOTRANS='" & kb.Text & "'", CONECT) DT.Rows.Clear() nisa.Fill(DT) DataGridView1.DataSource = DT nisa.Dispose() End Sub Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un.TextChanged, hr.TextChanged jm.Text = Val(un.Text) * Val(hr.Text) End Sub
lanjutan Public Sub khaeril() Dim total As Double For Each x As DataRow In DT.Rows total = total + x("jumlah") Next Tot.Text = total End Sub Private Sub NB_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb.Click cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb.Text, 1, CONECT) If cari.JumlanBaris > 0 Then If LATIHAN3839.Visible = False Then LATIHAN3839.Show() Else LATIHAN3839.Activate() End If Else MsgBox("Kode barang baru") nb.ReadOnly = False Exit Sub End If End Sub End Class
Public Class LATIHAN3839 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=280765") Dim DT As New DataTable Dim BARIS As DataRow Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub LATIHAN035012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim nisa As New OleDb.OleDbDataAdapter nisa = New OleDb.OleDbDataAdapter("select KODEBARANG, NAMABARANG FROM BARANG ", CONECT) DT.Rows.Clear() nisa.Fill(DT) DataGridView1.DataSource = DT nisa.Dispose() End Sub
lanjutan Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click BARIS = DT.DefaultView(BindingContext(DT). Position).Row LATIHAN038012.nb.Text = BARIS("NAMABARANG") End Sub End Class
Public Class Latih38_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 kolom(3) As DataColumn Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click kolom(0) = DT.Columns("kodebarang") DT.PrimaryKey = kolom Dim nhunoe As DataRow nhunoe = DT.Rows.Find(kb_36109034.Text) If nhunoe Is Nothing Then nhunoe = DT.NewRow ' menambah baris nhunoe("KODEBARANG") = kb_36109034.Text nhunoe("NAMABARANG") = nb_36109034.Text nhunoe("UNIT") = un_36109034.Text nhunoe("HARGA") = hr_36109034.Text nhunoe("JUMLAH") = jm_36109034.Text DT.Rows.Add(nhunoe)
Else MsgBox("baris sudah ada") kb_36109034.Text = "" End If If kb_36109034.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(un_36109034.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("UNIT belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(hr_36109034.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("HARGA belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If kb_36109034.Text = "" un_36109034.Text = "" hr_36109034.Text = "" nb_36109034.Text = "" jm_36109034.Text = "" noe() 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 nt_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
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109034.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") 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 ('" & nt_36109034.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & jt_36109034.Text & "')", CONECT)
Private Sub Latih38_36109034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim nur As New OleDb.OleDbDataAdapter nur = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb_36109034.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces DT.Rows.Clear() 'membersihkan data table nur.Fill(DT) 'mengisi database ke dlm data table DataGridView1.DataSource = DT 'memunculkan dlm datagridview
nur.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_36109034.TextChanged, hr_36109034.TextChanged jm_36109034.Text = Val(un_36109034.Text) * Val(hr_36109034.Text) End Sub Public Sub noe() Dim total As Double For Each x As DataRow In DT.Rows total = total + x("jumlah") Next Tot_36109034.Text = total End Sub
Private Sub nb_36109034_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb_36109034.Click cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_36109034.Text, 1, CONECT) If cari.JumlanBaris > 0 Then If Latih3839_36109034.Visible = False Then Latih3839_36109034.Show() Else Latih3839_36109034.Activate() End If Else MsgBox("Kode barang baru") nb_36109034.ReadOnly = False Exit Sub End If End Sub End Class
Public Class LATIHAN_038_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") 'deklarasi data tabel Dim DT As New DataTable Dim kolom(3) As DataColumn Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1_36109056.Click kolom(0) = DT.Columns("kodebarang") DT.PrimaryKey = kolom Dim bhie As DataRow bhie = DT.Rows.Find(kb_36109056.Text) If bhie Is Nothing Then bhie = DT.NewRow ' menambah baris bhie("KODEBARANG") = kb_36109056.Text bhie("NAMABARANG") = nb_36109056.Text bhie("UNIT") = un_36109056.Text bhie("HARGA") = hr_36109056.Text bhie("JUMLAH") = jm_36109056.Text DT.Rows.Add(bhie)
Else MsgBox("baris sudah ada") kb_36109056.Text = "" End If If kb_36109056.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(un_36109056.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("UNIT belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(hr_36109056.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("HARGA belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If kb_36109056.Text = "" un_36109056.Text = "" hr_36109056.Text = "" nb_36109056.Text = "" jm_36109056.Text = "" hasbiya() End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2_36109056.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
'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("NO.TRANS sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") 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 & "#,'" & jt_36109056.Text & "')", CONECT)
Private Sub LATIHAN_038_36109056_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim poltek As New OleDb.OleDbDataAdapter poltek = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb_36109056.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces DT.Rows.Clear() 'membersihkan data table poltek.Fill(DT) 'mengisi database ke dlm data table DataGridView1.DataSource = DT 'memunculkan dlm datagridview
poltek.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_36109056.TextChanged, hr_36109056.TextChanged jm_36109056.Text = Val(un_36109056.Text) * Val(hr_36109056.Text) End Sub Public Sub hasbiya() Dim total As Double For Each x As DataRow In DT.Rows total = total + x("jumlah") Next Tot_36109056.Text = total End Sub Private Sub NB_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb_36109056.Click cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_36109056.Text, 1, CONECT) If cari.JumlanBaris > 0 Then If LATIHAN3839_36109056.Visible = False Then LATIHAN3839_36109056.Show() Else LATIHAN3839_36109056.Activate() End If Else MsgBox("Kode barang baru") nb_36109056.ReadOnly = False Exit Sub End If End Sub
'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=florista") 'deklarasi data tabel Dim Data As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Form3836109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'deklarasi adapter Dim adapt As New OleDb.OleDbDataAdapter adapt = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & kb36109045.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces Data.Rows.Clear() 'membersihkan data table adapt.Fill(Data) 'mengisi database ke dlm data table
adapt.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
'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
DataGridView1.DataSource = Data 'memunculkan dlm datagridview End Sub
Private Sub hitung() Dim hitng As Integer For Each r As DataRow In Data.Rows hitng = hitng + r("JUMLAH") Next Tot36109045.Text = hitng
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109045.TextChanged, hr36109045.TextChanged jm36109045.Text = Val(un36109045.Text) * Val(hr36109045.Text) End Sub
Private Sub kb_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb36109045.TextChanged nb36109045.Text = "" un36109045.Text = "" hr36109045.Text = ""
End Sub 'moment mencari saat kursor meninggalkan texbox Private Sub kb_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb36109045.Leave If kb36109045.Text.Length = 0 Then 'jika kodebarang tidak diisi jgn lanjutkan perintah selanjutnya Exit Sub End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("barang", "kodebarang", kb36109045.Text, 1, CONECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then 'jika barang yg kita cari ada dlm table kb36109045.Text = cari.DataTablenya.Rows(0).Item("KodeBarang") nb36109045.Text = cari.DataTablenya.Rows(0).Item("namabarang") Else MsgBox("Kode barang tersebut tidak ada") If Latihan_383940_36109045.ShowDialog = Windows.Forms.DialogResult.OK Then kb36109045.Text = Latihan_383940_36109045.DataGridView1.CurrentRow.Cells("KodeBarang").Value nb36109045.Text = Latihan_383940_36109045.DataGridView1.CurrentRow.Cells("namabarang").Value hr36109045.Text = Latihan_383940_36109045.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value Else kb36109045.Text = "" End If End If End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109045.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If kb36109045.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(un36109045.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("UNIT belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(hr36109045.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("HARGA belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
'UNTUK MENYMPAN DATA YG DIMASUKKAN KE DALAM DATAGRIDVIEW Dim simpan As DataRow simpan = Data.Rows.Find(kb36109045.Text) 'untuk mencari apakah ada no.pembelian sdh ada agar tdak double If simpan Is Nothing Then 'jika tidak ad ji maka lanjutkan penyimpanan
simpan = Data.NewRow ' menambah baris simpan("kodebarang") = kb36109045.Text simpan("namabarang") = nb36109045.Text simpan("unit") = un36109045.Text simpan("harga") = hr36109045.Text simpan("jumlah") = jm36109045.Text Data.Rows.Add(simpan) Else MsgBox("nomor sudah ada") End If
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109045.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If TextBox136109045.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("no transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If jt36109045.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 cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109045.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS 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('" & nt36109045.Text & "',#" & DateTimePicker136109045.Value.Date & "#," & Val(jt36109045.Text) & ")", CONECT)
Public Class Form3836109040 '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") 'deklarasi data tabel Dim DT As New DataTable Dim kolom(3) As DataColumn Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click kolom(0) = DT.Columns("kodebarang") DT.PrimaryKey = kolom Dim mytha As DataRow mytha = DT.Rows.Find(kb_36109040.Text) If mytha Is Nothing Then mytha = DT.NewRow ' menambah baris mytha("KODEBARANG") = kb_36109040.Text mytha("NAMABARANG") = nb_36109040.Text mytha("UNIT") = un_36109040.Text mytha("HARGA") = hr_36109040.Text mytha("JUMLAH") = jm_36109040.Text DT.Rows.Add(mytha)
Else MsgBox("baris sudah ada") kb_36109040.Text = "" End If If kb_36109040.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(un_36109040.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("UNIT belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(hr_36109040.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("HARGA belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If kb_36109040.Text = "" un_36109040.Text = "" hr_36109040.Text = "" nb_36109040.Text = "" jm_36109040.Text = "" mie() 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 nt_36109040.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_36109040.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("jenis transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109040.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") 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 ('" & nt_36109034.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & jt_36109034.Text & "')", CONECT)
nt_36109040.Text = "" jt_36109040.Text = "" mie() End Sub Private Sub Latih38_36109040_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim armi As New OleDb.OleDbDataAdapter armi = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb_36109040.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces DT.Rows.Clear() 'membersihkan data table armi.Fill(DT) 'mengisi database ke dlm data table DataGridView1.DataSource = DT 'memunculkan dlm datagridview
armi.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_36109040.TextChanged, hr_36109040.TextChanged jm_36109040.Text = Val(un_36109040.Text) * Val(hr_36109040.Text) End Sub Public Sub mie() Dim total As Double For Each x As DataRow In DT.Rows total = total + x("jumlah") Next Tot_36109034.Text = total End Sub
Private Sub nb_36109040_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb_36109034.Click cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_36109040.Text, 1, CONECT) If cari.JumlanBaris > 0 Then If Latih3839_36109040.Visible = False Then Latih3839_36109040.Show() Else Latih3839_36109040.Activate() End If Else MsgBox("Kode barang baru") nb_36109040.ReadOnly = False Exit Sub End If End Sub End Class
Public Class LATIHAN038035 Dim Jalan As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\Datamajemuk.ACCDB") Dim gitik As New DataTable Private Sub botto() Dim ttotal As Integer For Each hasil As DataRow In gitik.Rows ttotal += hasil("Jumlah") Next Tot035.Text = ttotal End Sub Private Sub Latihan038035_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'mendeklarasikan kendaraan Dim bojel As New OleDb.OleDbDataAdapter
'Mengatur data yang akan di angkut bojel = New OleDb.OleDbDataAdapter("SELECT detailtransaksi.kodebarang,barang.namabarang,detailtransaksi.unit,detailtransaksi.harga, detailtransaksi.unit * detailtransaksi.harga as jumlah FROM DETAILTRANSAKSI inner join barang on detailtransaksi.kodebarang=barang.kodebarang where detailtransaksi.notrans='" & nt035.Text & "'", Jalan)
'bersihkan data gitik.Rows.Clear()
'untuk memasukkan data yg telah di angkut ke dalam datatable bojel.Fill(gitik)
'untuk menampilkan isi datatable ke data grid view bojel.Dispose() DataGridView1035.DataSource = gitik
'perintah primarykey Dim kabotcibay(2) As DataColumn kabotcibay(0) = gitik.Columns("Kodebarang") gitik.PrimaryKey = kabotcibay End Sub Private Sub kb035_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb035.Leave If kb035.Text.Length = 0 Then Exit Sub End If
'mencari data yang ada di tabel Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("barang", "kodebarang", kb035.Text, 1, Jalan) If Pencari.JumlanBaris > 0 Then nb035.Text = Pencari.DataTablenya.Rows(0).Item(1) Else MsgBox("the data is not exist, please choose from the this list") If Latihan383940035.ShowDialog = Windows.Forms.DialogResult.OK Then kb035.Text = Latihan383940035.view.CurrentRow.Cells("KodeBarang").Value nb035.Text = Latihan383940035.view.CurrentRow.Cells("namabarang").Value hr035.Text = Latihan383940035.view.CurrentRow.Cells("hargajual").Value Else kb035.Text = "" nb035.Text = "" End If End If
Private Sub Button1035_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1035.Click 'Memeriksa isi textbox If kb035.Text.Length = 0 Then MsgBox("Please, insert the code of goods") Exit Sub End If
If un035.Text.Length = 0 Then MsgBox("Please, insert the unit of goods") Exit Sub End If
If hr035.Text.Length = 0 Then MsgBox("Please, insert the cost of goods") Exit Sub End If
'perintah pencarian data Dim dr As DataRow dr = gitik.Rows.Find(kb035.Text) If Not dr Is Nothing Then MsgBox("Sorry, the data has been exist!!! Please insert new data") Exit Sub End If
'penyimpanan data ke datatable gitik.Rows.Add(kb035.Text, nb035.Text, Val(un035.Text), Val(hr035.Text), jm035.Text)
botto()
'mengosongkan textbox kb035.Text = "" nb035.Text = "" un035.Text = "" hr035.Text = "" jm035.Text = "" End Sub Private Sub un035_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un035.TextChanged, hr035.TextChanged jm035.Text = Val(un035.Text) * Val(hr035.Text) End Sub Private Sub Button2035_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2035.Click 'Memeriksa isi textbox If nt035.Text.Length = 0 Then MsgBox("Please, insert the Number of the transaction") Exit Sub End If
If jt035.Text.Length = 0 Then MsgBox("Please, insert the type of the transaction") Exit Sub End If
If gitik.Rows.Count = 0 Then MsgBox("the data is none") Exit Sub End If
'Memeriksa nomor transaksi pd master transaksi Dim search As New ByIskandar.CariKeDataBaseByIskandar search.AturPencarianDataBase("mastertransaksi", "notrans", nt035.Text, 1, Jalan) If search.JumlanBaris > 0 Then MsgBox("the code has been exist") Exit Sub End If
'Proses Penyimpanan ke tabel master transaksi Dim kacci As New OleDb.OleDbCommand kacci = New OleDb.OleDbCommand("insert into mastertransaksi (notrans,tanggaltransaksi,jenistransaksi) values ('" & nt035.Text & "',#" & DateTimePicker1035.Value.Month & "/" & DateTimePicker1035.Value.Day & "/" & DateTimePicker1035.Value.Year & "#,'" & jt035.Text & "')", Jalan) Jalan.Open() kacci.ExecuteNonQuery() Jalan.Close()
'penyimpanan isi datatable ke detail transaksi For Each nhana As DataRow In gitik.Rows kacci = New OleDb.OleDbCommand("insert into detailtransaksi (notrans,kodebarang,unit,harga) values ('" & nt035.Text & "','" & nhana("kodebarang") & "'," & nhana("unit") & "," & nhana("harga") & ")", Jalan) Jalan.Open() kacci.ExecuteNonQuery() Jalan.Close()
Next kacci.Dispose()
'Mengosongkan isi text box nt035.Text = "" jt035.Text = ""
Public Class LATIHAN038_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") 'deklarasi data tabel Dim DT As New DataTable Dim kolom(3) As DataColumn Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click kolom(0) = DT.Columns("kodebarang") DT.PrimaryKey = kolom Dim wirda As DataRow wirda = DT.Rows.Find(kb_36109049.Text) If wirda Is Nothing Then wirda = DT.NewRow ' menambah baris wirda("KODEBARANG") = kb_36109049.Text wirda("NAMABARANG") = nb_36109049.Text wirda("UNIT") = un_36109049.Text wirda("HARGA") = hr_36109049.Text wirda("JUMLAH") = jm_36109049.Text DT.Rows.Add(wirda)
Else MsgBox("baris sudah ada") kb_36109049.Text = "" End If If kb_36109049.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(un_36109049.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("UNIT belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(hr_36109049.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("HARGA belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If kb_36109049.Text = "" un_36109049.Text = "" hr_36109049.Text = "" nb_36109049.Text = "" jm_36109049.Text = "" wirdapaulus() 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
'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("NO.TRANS sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") 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 & "#,'" & TextBox2_36109049.Text & "')", CONECT)
Private Sub LATIHAN038_36109049_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim poltek As New OleDb.OleDbDataAdapter poltek = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb_36109049.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces DT.Rows.Clear() 'membersihkan data table poltek.Fill(DT) 'mengisi database ke dlm data table DataGridView1.DataSource = DT 'memunculkan dlm datagridview
poltek.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_36109049.TextChanged, hr_36109049.TextChanged jm_36109049.Text = Val(un_36109049.Text) * Val(hr_36109049.Text) End Sub Public Sub wirdapaulus() Dim total As Double For Each x As DataRow In DT.Rows total = total + x("jumlah") Next Tot1_36109049.Text = total End Sub Private Sub NB_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb_36109049.Click cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_36109049.Text, 1, CONECT) If cari.JumlanBaris > 0 Then If LATIHAN3839_36109049.Visible = False Then LATIHAN3839_36109049.Show() Else LATIHAN3839_36109049.Activate() End If Else MsgBox("Kode barang baru") nb_36109049.ReadOnly = False Exit Sub End If End Sub
Public Class LATIHAN03836109038 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 LATIHAN03836109038_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim Azizah As New OleDb.OleDbDataAdapter Azizah = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & KB36109038.Text & "'", CONECT) DT.Rows.Clear() Azizah.Fill(DT)
Azizah.Dispose()
Dim dcp(1) As DataColumn dcp(0) = DT.Columns("kodebarang") DT.PrimaryKey = dcp
DataGridView136109038.DataSource = DT End Sub Private Sub hitung() Dim cantik As Integer For Each r As DataRow In DT.Rows cantik = cantik + r("JUMLAH") Next Tot36109038.Text = cantik
End Sub
Private Sub UN36109038_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles UN36109038.TextChanged, HR36109038.TextChanged JM36109038.Text = Val(UN36109038.Text) * Val(HR36109038.Text) End Sub
Private Sub KB36109038_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB36109038.TextChanged NB36109038.Text = "" UN36109038.Text = "" HR36109038.Text = "" End Sub
Private Sub KB36109038_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB36109038.Leave If KB36109038.Text.Length = 0 Then Exit Sub End If
If cari.JumlanBaris > 0 Then KB36109038.Text = cari.DataTablenya.Rows(0).Item("KodeBarang") NB36109038.Text = cari.DataTablenya.Rows(0).Item("namabarang") Else MsgBox("Kode barang tersebut tidak ada") If Latihan03803904036109038.ShowDialog = Windows.Forms.DialogResult.OK Then KB36109038.Text = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("KodeBarang").Value NB36109038.Text = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("namabarang").Value HR36109038.Text = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("HARGAJUAL").Value Else KB36109038.Text = "" End If End If End Sub
Private Sub Button136109038_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button136109038.Click If KB36109038.Text.Length = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If
If Val(UN36109038.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If
If Val(HR36109038.Text) = 0 Then MsgBox("HARGA belum terisi") Exit Sub End If
Dim Reza As DataRow Reza = DT.Rows.Find(KB36109038.Text) If Reza Is Nothing Then
Reza = DT.NewRow Reza("kodebarang") = KB36109038.Text Reza("namabarang") = NB36109038.Text Reza("unit") = UN36109038.Text Reza("harga") = HR36109038.Text Reza("jumlah") = JM36109038.Text DT.Rows.Add(Reza) Else MsgBox("nomor sudah ada") End If
Private Sub Button236109038_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button236109038.Click If NT36109038.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("NO.TRANS 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('" & NT36109038.Text & "',#" & DateTimePicker136109038.Value.Date & "#," & Val(JT36109038.Text) & ")", CONECT)
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=12")
Dim DT As New DataTable Dim kolom(3) As DataColumn Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109041.Click kolom(0) = DT.Columns("kodebarang") DT.PrimaryKey = kolom Dim drzany As DataRow drzany = DT.Rows.Find(kb36109041.Text) If drzany Is Nothing Then drzany = DT.NewRow ' menambah baris drzany("KODEBARANG") = kb36109041.Text drzany("NAMABARANG") = nb36109041.Text drzany("UNIT") = un36109041.Text drzany("HARGA") = hr36109041.Text drzany("JUMLAH") = jm36109041.Text DT.Rows.Add(drzany)
Else MsgBox("baris sudah ada") kb36109041.Text = "" End If If kb36109041.Text.Length = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If
If Val(un36109041.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If
If Val(hr36109041.Text) = 0 Then MsgBox("HARGA belum terisi") Exit Sub End If kb36109041.Text = "" un36109041.Text = "" hr36109041.Text = "" nb36109041.Text = "" jm36109041.Text = "" farid() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109041.Click
If nt.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
lanjutan 38 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)
nt36109041.Text = "" jt36109041.Text = "" farid() End Sub Private Sub LATIHAN036012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim nisa As New OleDb.OleDbDataAdapter nisa = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb36109041.Text & "'", CONECT) DT.Rows.Clear() nisa.Fill(DT) DataGridView136109041.DataSource = DT
nisa.Dispose() End Sub Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109041.TextChanged, hr36109041.TextChanged jm36109041.Text = Val(un36109041.Text) * Val(hr36109041.Text) End Sub Public Sub farid() Dim total As Double For Each x As DataRow In DT.Rows total = total + x("jumlah") Next Tot36109041.Text = total End Sub Private Sub NB_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb36109041.Click cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb36109041.Text, 1, CONECT) If cari.JumlanBaris > 0 Then If LATIHAN3839.Visible = False Then LATIHAN3839.Show() Else LATIHAN3839.Activate() End If Else MsgBox("Kode barang baru") nb36109041.ReadOnly = False Exit Sub End If End Sub End Class
Public Class LATIHAN03836109033 '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 colom(3) As DataColumn Dim browse As New ByIskandar.CariKeDataBaseByIskandar Private Sub LATIHAN03836109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim tiwi As New OleDb.OleDbDataAdapter tiwi = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb36109033.Text & "'", 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 TOTALJUMLAH() Dim total As Double For Each t As DataRow In Data.Rows total = total + t("jumlah") Next Tot36109033.Text = total End Sub
Private Sub un36109033_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109033.TextChanged, hr36109033.TextChanged jm36109033.Text = Val(un36109033.Text) * Val(hr36109033.Text) End Sub
Private Sub button136109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button136109033.Click colom(0) = Data.Columns("kodebarang") Data.PrimaryKey = colom Dim pratiwi As DataRow pratiwi = Data.Rows.Find(kb36109033.Text) If pratiwi Is Nothing Then pratiwi = Data.NewRow ' menambah baris pratiwi("KODEBARANG") = kb36109033.Text pratiwi("NAMABARANG") = nb36109033.Text pratiwi("UNIT") = un36109033.Text pratiwi("HARGA") = hr36109033.Text pratiwi("JUMLAH") = jm36109033.Text Data.Rows.Add(pratiwi)
Else MsgBox("baris sudah ada") kb36109033.Text = "" End If If kb36109033.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(un36109033.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("UNIT belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(hr36109033.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("HARGA belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If kb36109033.Text = "" un36109033.Text = "" hr36109033.Text = "" nb36109033.Text = "" jm36109033.Text = "" TOTALJUMLAH()
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
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada browse.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109033.Text, 1, CONECT)
If browse.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If Data.Rows.Count = 0 Then MsgBox("data tidak tersedia") 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 & "#,'" & jt36109033.Text & "')", CONECT)
Private Sub nb36109033_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb36109033.Click
browse.AturPencarianDataBase("BARANG", "KODEBARANG", kb36109033.Text, 1, CONECT) If browse.JumlanBaris > 0 Then If LATIHAN3839.Visible = False Then LATIHAN3839.Show() Else LATIHAN3839.Activate() End If Else MsgBox("Kode barang baru") nb36109033.ReadOnly = False Exit Sub End If End Sub End Class
Public Class LATIHAN3839 '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 LATIHAN03536109033_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 LATIHAN03836109048 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=idunk") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN03836109048_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim Tries As New OleDb.OleDbDataAdapter Tries = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & KB36109048.Text & "'", CONECT) DT.Rows.Clear() triz.Fill(DT)
triz.Dispose()
Dim dcp(1) As DataColumn dcp(0) = DT.Columns("kodebarang") DT.PrimaryKey = dcp
DataGridView136109048.DataSource = DT End Sub Private Sub hitung() Dim anda As Integer For Each r As DataRow In DT.Rows anda = anda + r("JUMLAH") Next Tot36109048.Text = anda
End Sub
Private Sub UN36109048_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles UN36109048.TextChanged, HR36109048.TextChanged JM36109048.Text = Val(UN36109048.Text) * Val(HR36109048.Text) End Sub
Private Sub KB36109048_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB36109048.TextChanged NB36109048.Text = "" UN36109048.Text = "" HR36109048.Text = "" End Sub
Private Sub KB36109048_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB36109048.Leave If KB36109048.Text.Length = 0 Then Exit Sub End If
If cari.JumlanBaris > 0 Then KB36109048.Text = cari.DataTablenya.Rows(0).Item("KodeBarang") NB36109048.Text = cari.DataTablenya.Rows(0).Item("namabarang") Else MsgBox("Kode barang tersebut tidak ada") If Latihan03803904036109048.ShowDialog = Windows.Forms.DialogResult.OK Then KB36109048.Text = Latihan03803904036109048.DataGridView136109048.CurrentRow.Cells("KodeBarang").Value NB36109048.Text = Latihan03803904036109048.DataGridView136109048.CurrentRow.Cells("namabarang").Value HR36109048.Text = Latihan03803904036109048.DataGridView136109048.CurrentRow.Cells("HARGAJUAL").Value Else KB36109048.Text = "" End If End If End Sub
Public Class LATIHAN_3836109055 '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") 'deklarasi data tabel Dim DT As New DataTable Dim kolom(3) As DataColumn Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109055.Click kolom(0) = DT.Columns("kodebarang") DT.PrimaryKey = kolom Dim dr As DataRow dr = DT.Rows.Find(kb36109055.Text) If dr Is Nothing Then dr = DT.NewRow ' menambah baris dr("KODEBARANG") = kb36109055.Text dr("NAMABARANG") = nb36109055.Text dr("UNIT") = un36109055.Text dr("HARGA") = hr36109055.Text dr("JUMLAH") = jm36109055.Text DT.Rows.Add(dr)
Else MsgBox("baris sudah ada") kb36109055.Text = "" End If If kb36109055.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(un36109055.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("UNIT belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(hr36109055.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("HARGA belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If kb36109055.Text = "" un36109055.Text = "" hr36109056.Text = "" nb36109056.Text = "" jm36109056.Text = "" falah() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109055.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109055.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") 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 & "#,'" & jt36109055.Text & "')", CONECT)
Public Class Latih38_36109053 'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=kondolele") 'deklarasi data tabel Dim DT As New DataTable Dim kolom(3) As DataColumn Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click kolom(0) = DT.Columns("kodebarang") DT.PrimaryKey = kolom Dim dede As DataRow dede = DT.Rows.Find(kb_36109053.Text) If dede Is Nothing Then dede = DT.NewRow ' menambah baris dede("KODEBARANG") = kb_36109053.Text dede("NAMABARANG") = nb_36109053.Text dede("UNIT") = un_36109053.Text dede("HARGA") = hr_36109053.Text dede("JUMLAH") = jm_36109053.Text DT.Rows.Add(dede)
Else MsgBox("baris sudah ada") kb_36109053.Text = "" End If If kb_36109053.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(un_36109053.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("UNIT belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(hr_36109053.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("HARGA belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If kb_36109053.Text = "" un_36109053.Text = "" hr_36109053.Text = "" nb_36109053.Text = "" jm_36109053.Text = "" praditya() 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 nt_36109053.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_36109053.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("jenis transaksi belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109053.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
'untuk memasukkan data dari visual basic ke dlm acces Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_36109053.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & jt_36109053.Text & "')", CONECT)
Private Sub Latih38_36109053_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim nur As New OleDb.OleDbDataAdapter ded = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb_36109053.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces DT.Rows.Clear() 'membersihkan data table ded.Fill(DT) 'mengisi database ke dlm data table DataGridView1.DataSource = DT 'memunculkan dlm datagridview
ded.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_36109053.TextChanged, hr_36109053.TextChanged jm_36109053.Text = Val(un_36109053.Text) * Val(hr_36109053.Text) End Sub Public Sub praditya() Dim total As Double For Each x As DataRow In DT.Rows total = total + x("jumlah") Next Tot_36109053.Text = total End Sub
Private Sub nb_36109053_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb_36109053.Click cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_36109053.Text, 1, CONECT) If cari.JumlanBaris > 0 Then If Latih3839_36109053.Visible = False Then Latih3839_36109053.Show() Else Latih3839_36109053.Activate() End If Else MsgBox("Kode barang baru") nb_36109053.ReadOnly = False Exit Sub End If End Sub End Class
Public Class LATIHAN38_36109051 'DEKLARASI CONECTION Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=molnan") 'deklarasi data tabel Dim DT As New DataTable Dim BARIS As DataRow Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub LATIHAN035012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'deklarasi adapter Dim milan As New OleDb.OleDbDataAdapter milan = New OleDb.OleDbDataAdapter("select KODEBARANG, NAMABARANG FROM BARANG ", CONECT) 'memunculkan semua data dari tabel barang dlm acces DT.Rows.Clear() 'membersihkan data table milan.Fill(DT) 'mengisi database ke dlm data table DataGridView1.DataSource = DT 'memunculkan dlm datagridview
milan.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 LATIHAN038012.nb.Text = BARIS("NAMABARANG") End Sub End Class
Public Class Form3836109050 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 Form3836109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim adapt As New OleDb.OleDbDataAdapter adapt = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & kb.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces data.Rows.Clear() adapt.Fill(data) adapt.Dispose() Dim dcp(1) As DataColumn dcp(0) = data.Columns("kodebarang") data.PrimaryKey = dcp DataGridView1.DataSource = data End Sub
Private Sub hitung() Dim inter As Integer For Each r As DataRow In data.Rows inter = inter + r("JUMLAH") Next Tot.Text = inter End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un.TextChanged, hr.TextChanged jm.Text = Val(un.Text) * Val(hr.Text) End Sub
Private Sub kb_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb.TextChanged nb.Text = "" un.Text = "" hr.Text = "" End Sub
Private Sub kb_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb.Leave If kb.Text.Length = 0 Then 'jika kodebarang tidak diisi jgn lanjutkan perintah selanjutnya Exit Sub End If
cari.AturPencarianDataBase("barang", "kodebarang", kb.Text, 1, CONECT) If cari.JumlanBaris > 0 Then kb.Text = cari.DataTablenya.Rows(0).Item("KodeBarang") nb.Text = cari.DataTablenya.Rows(0).Item("namabarang") Else MsgBox("Kode barang tersebut tidak ada") If Form38394036109050.ShowDialog = Windows.Forms.DialogResult.OK Then kb.Text = Form38394036109050.DataGridView1.CurrentRow.Cells("KodeBarang").Value nb.Text = Form38394036109050.DataGridView1.CurrentRow.Cells("namabarang").Value hr.Text = Form38394036109050.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value Else kb.Text = "" End If End If End Sub
Sambungan form3836109050 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If kb.Text.Length = 0 Then MsgBox("kode barang belum terisi") Exit Sub End If
If Val(un.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If
If Val(hr.Text) = 0 Then MsgBox("HARGA belum terisi") Exit Sub End If
Dim simpan As DataRow simpan = data.Rows.Find(kb.Text) If simpan Is Nothing Then
simpan = data.NewRow simpan("kodebarang") = kb.Text simpan("namabarang") = nb.Text simpan("unit") = un.Text simpan("harga") = hr.Text simpan("jumlah") = jm.Text data.Rows.Add(simpan) Else MsgBox("nomor sudah ada") End If
kb.Text = "" un.Text = "" hr.Text = "" 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 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("NO.TRANS sudah ada") Exit Sub End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values('" & nt.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('" & nt.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT) CONECT.Open() com.ExecuteNonQuery() CONECT.Close() com.Dispose() Next
TextBox1.Text = "" jt.Text = "" jm.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") 'deklarasi data tabel Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN03836109029_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load 'deklarasi adapter Dim CUTE As New OleDb.OleDbDataAdapter CUTE = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & kb36109029.Text & "'", CONNECT) 'memunculkan semua data dari tabel barang dlm acces DT.Rows.Clear() 'membersihkan data table CUTE.Fill(DT) 'mengisi database ke dlm data table
CUTE.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
'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
DataGridView1.DataSource = DT 'memunculkan dlm datagridview End Sub
Private Sub hitung() Dim INDAH As Integer For Each r As DataRow In DT.Rows INDAH = INDAH + r("JUMLAH") Next Tot36109029.Text = INDAH
End Sub
Private Sub un36109029_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109029.TextChanged, hr36109029.TextChanged jm36109029.Text = Val(un36109029.Text) * Val(hr36109029.Text) End Sub
Private Sub kb36109029_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb36109029.TextChanged nb36109029.Text = "" un36109029.Text = "" hr36109029.Text = ""
End Sub 'moment mencari saat kursor meninggalkan texbox Private Sub kb36109029_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb36109029.Leave If kb36109029.Text.Length = 0 Then 'jika kodebarang tidak diisi jgn lanjutkan perintah selanjutnya Exit Sub End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("barang", "kodebarang", kb36109029.Text, 1, CONNECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then 'jika barang yg kita cari ada dlm table kb36109029.Text = cari.DataTablenya.Rows(0).Item("KodeBarang") nb36109029.Text = cari.DataTablenya.Rows(0).Item("namabarang") Else MsgBox("Kode barang tersebut tidak ada") If Latihan38029.ShowDialog = Windows.Forms.DialogResult.OK Then kb36109029.Text = Latihan38029.DataGridView1.CurrentRow.Cells("KodeBarang").Value nb36109029.Text = Latihan38029.DataGridView1.CurrentRow.Cells("namabarang").Value hr36109029.Text = Latihan38029.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value Else kb36109029.Text = "" End If End If End Sub
Private Sub Button136109029_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109029.Click 'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap If kb36109029.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(un36109029.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("UNIT belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(hr36109029.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("HARGA belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
'UNTUK MENYMPAN DATA YG DIMASUKKAN KE DALAM DATAGRIDVIEW Dim INDAH As DataRow INDAH = DT.Rows.Find(kb36109029.Text) 'untuk mencari apakah ada no.pembelian sdh ada agar tdak double If INDAH Is Nothing Then 'jika tidak ad ji maka lanjutkan penyimpanan
INDAH = DT.NewRow ' menambah baris INDAH("kodebarang") = kb36109029.Text INDAH("namabarang") = nb36109029.Text INDAH("unit") = un36109029.Text INDAH("harga") = hr36109029.Text INDAH("jumlah") = jm36109029.Text DT.Rows.Add(INDAH) Else MsgBox("nomor sudah ada") End If
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("NO.TRANS 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('" & nt.Text & "',#" & DateTimePicker1.Value.Date & "#," & Val(jt36109029.Text) & ")", CONNECT)
'DEKLARASI CONECTION Dim sambung As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=jayapura") 'deklarasi data tabel Dim toshiba As New DataTable Dim kolom(3) As DataColumn Dim nokia As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click kolom(0) = toshiba.Columns("kodebarang") toshiba.PrimaryKey = kolom Dim key As DataRow key = toshiba.Rows.Find(KB.Text) If key Is Nothing Then key = toshiba.NewRow ' menambah baris key("KODEBARANG") = KB.Text key("NAMABARANG") = NB.Text key("UNIT") = UN.Text key("HARGA") = HR.Text key("JUMLAH") = JM.Text toshiba.Rows.Add(key)
Else MsgBox("baris sudah ada") KB.Text = "" End If
If KB.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(UN.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("UNIT belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(HR.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("HARGA belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If KB.Text = "" UN.Text = "" HR.Text = "" NB.Text = "" JM.Text = ""
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
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada nokia.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1.Text, 1, sambung)
If nokia.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If toshiba.Rows.Count = 0 Then MsgBox("data tidak tersedia") 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.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & JT.Text & "')", sambung)
toshiba.Rows.Clear() TextBox1.Text = "" JT.Text = "" apkom() End Sub
Private Sub LATIHAN03836109032_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim akun As New OleDb.OleDbDataAdapter akun = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & KB.Text & "'", sambung) 'memunculkan semua data dari tabel barang dlm acces toshiba.Rows.Clear() 'membersihkan data table akun.Fill(toshiba) 'mengisi database ke dlm data table DataGridView1.DataSource = toshiba 'memunculkan dlm datagridview
akun.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub UN_(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UN.TextChanged, HR.TextChanged JM.Text = Val(UN.Text) * Val(HR.Text) End Sub
Public Sub apkom() Dim total As Double For Each x As DataRow In toshiba.Rows total = total + x("jumlah") Next TOT.Text = total End Sub
Private Sub NB_(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NB.Click nokia.AturPencarianDataBase("BARANG", "KODEBARANG", KB.Text, 1, sambung) If nokia.JumlanBaris > 0 Then If LATIHAN038039.Visible = False Then LATIHAN038039.Show() Else LATIHAN038039.Activate() End If Else MsgBox("Kode barang baru") NB.ReadOnly = False Exit Sub End If End Sub
'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") 'deklarasi data tabel Dim DT As New DataTable Dim kolom(3) As DataColumn Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109054.Click kolom(0) = DT.Columns("kodebarang") DT.PrimaryKey = kolom Dim drzany As DataRow drzany = DT.Rows.Find(kb36109054.Text) If drzany Is Nothing Then drzany = DT.NewRow ' menambah baris drzany("KODEBARANG") = kb36109054.Text drzany("NAMABARANG") = nb36109054.Text drzany("UNIT") = un36109054.Text drzany("HARGA") = hr36109054.Text drzany("JUMLAH") = jm36109054.Text DT.Rows.Add(drzany)
Else MsgBox("baris sudah ada") kb36109054.Text = "" End If If kb36109054.Text.Length = 0 Then 'untuk pencarian yang bersifat angka MsgBox("kode barang belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(un36109054.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("UNIT belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If
If Val(hr36109054.Text) = 0 Then 'untuk pencarian yang bersifat angka MsgBox("HARGA belum terisi") Exit Sub 'jgn lanjut ke proses berikutnya End If kb36109054.Text = "" un36109054.Text = "" hr36109054.Text = "" nb36109054.Text = "" jm36109054.Text = "" wawan() End 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 nt.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
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada cari.AturPencarianDataBase("mastertransaksi", "notrans", nt.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then MsgBox("NO.TRANS sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("data tidak tersedia") 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 ('" & nt.Text & "',#" & DTP136109054.Value.Date & "#,'" & jt36109054.Text & "')", CONECT)
nt.Text = "" jt36109054.Text = "" wawan() End Sub Private Sub LATIHAN036012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim nisa As New OleDb.OleDbDataAdapter nisa = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb36109054.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces DT.Rows.Clear() 'membersihkan data table nisa.Fill(DT) 'mengisi database ke dlm data table DGV136109054.DataSource = DT 'memunculkan dlm datagridview
nisa.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109054.TextChanged, hr36109054.TextChanged jm36109054.Text = Val(un36109054.Text) * Val(hr36109054.Text) End Sub Public Sub wawan() Dim total As Double For Each x As DataRow In DT.Rows total = total + x("jumlah") Next Tot36109054.Text = total End Sub Private Sub label4_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb36109054.Text, 1, CONECT) If cari.JumlanBaris > 0 Then If Latihan383940012.Visible = False Then Latihan383940012.Show() Else Latihan383940012.Activate() End If Else MsgBox("Kode barang baru") nb36109054.ReadOnly = False Exit Sub End If End Sub
Public Class Form38394036108001 Dim INCE As New OleDb.OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DataMajemuk.accdb;Jet OLEDB:Database Password=36108001") Dim ANHYE As New DataTable Private Sub Form38394036108001_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 * FROM BARANG", INCE) ANHYE.Rows.Clear() YNK.Fill(ANHYE) YNK.Dispose()
Public Class Form3836108001 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 Private Sub AI() 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 Form3836108001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AI() Dim PK(1) As DataColumn PK(0) = LOVE.Columns("KODEBARANG") LOVE.PrimaryKey = PK End Sub Private Sub TOTAL() Dim LO As Integer For Each VE As DataRow In LOVE.Rows LO = LO + VE("Jumlah") Next T836108001.Text = LO End Sub Private Sub T536108001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T536108001.TextChanged, T636108001.TextChanged T736108001.Text = Val(T536108001.Text) * Val(T636108001.Text) End Sub Private Sub T336108001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T336108001.TextChanged T436108001.Text = "" T536108001.Text = "" T636108001.Text = "" End Sub Private Sub T336108001_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T336108001.Leave If T336108001.Text.Length = 0 Then Exit Sub End If Dim IA As New ByIskandar.CariKeDataBaseByIskandar IA.AturPencarianDataBase("barang", "kodebarang", T336108001.Text, 1, INCE) If IA.JumlanBaris > 0 Then T336108001.Text = IA.DataTablenya.Rows(0).Item("KodeBarang") T436108001.Text = IA.DataTablenya.Rows(0).Item("NamaBarang") T636108001.Text = IA.DataTablenya.Rows(0).Item("HargaJual") Else MsgBox("Kode barang tersbut tidak ada") If Form38394036108001.ShowDialog = Windows.Forms.DialogResult.OK Then T336108001.Text = Form38394036108001.DGV36108001.CurrentRow.Cells("KodeBarang").Value T436108001.Text = Form38394036108001.DGV36108001.CurrentRow.Cells("NamaBarang").Value T636108001.Text = Form38394036108001.DGV36108001.CurrentRow.Cells("HargaJual").Value Else T336108001.Text = "" End If End If End Sub
Private Sub B136108001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B136108001.Click If T336108001.Text.Length = 0 Then MsgBox("Kode Barang belum terisi") Exit Sub End If
If Val(T536108001.Text) = 0 Then MsgBox("Unit belum terisi") Exit Sub End If
If Val(T636108001.Text) = 0 Then MsgBox("Harga belum terisi") Exit Sub End If
If LOVE.Rows.Find(T336108001.Text) Is Nothing Then LOVE.Rows.Add(T336108001.Text, T436108001.Text, Val(T536108001.Text), Val(T636108001.Text), Val(T736108001.Text)) Else MsgBox("Kode barang sudah ada") End If
T336108001.Text = "" T536108001.Text = "" T636108001.Text = "" TOTAL() 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
Public Class LATIHAN3836109044 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb") Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN3836109044_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Magfirah As New OleDb.OleDbDataAdapter Magfirah = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & KB36109044.Text & "'", CONECT) DT.Rows.Clear() Magfirah.Fill(DT)
Magfirah.Dispose()
Dim dcp(1) As DataColumn dcp(0) = DT.Columns("kodebarang") DT.PrimaryKey = dcp
DataGridView136109044.DataSource = DT End Sub Private Sub hitung() Dim kyu As Integer For Each r As DataRow In DT.Rows kyu = kyu + r("JUMLAH") Next Tot36109044.Text = kyu
End Sub
Private Sub UN36109044_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UN36109044.TextChanged JM36109044.Text = Val(UN36109044.Text) * Val(HR36109044.Text) End Sub
Private Sub KB36109044_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB36109044.TextChanged NB36109044.Text = "" UN36109044.Text = "" HR36109044.Text = ""
End Sub Private Sub KB36109044_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB36109044.Leave If KB36109044.Text.Length = 0 Then Exit Sub End If
If cari.JumlanBaris > 0 Then KB36109044.Text = cari.DataTablenya.Rows(0).Item("KodeBarang") NB36109044.Text = cari.DataTablenya.Rows(0).Item("namabarang") Else MsgBox("Kode barang tersebut tidak ada") If Latihan03803904036109044.ShowDialog = Windows.Forms.DialogResult.OK Then KB36109044.Text = LATIHAN03803904036109044.DataGridView136109044.CurrentRow.Cells("KodeBarang").Value NB36109044.Text = LATIHAN03803904036109044.DataGridView136109044.CurrentRow.Cells("namabarang").Value HR36109044.Text = LATIHAN03803904036109044.DataGridView136109044.CurrentRow.Cells("HARGAJUAL").Value Else KB36109044.Text = "" End If End If End Sub
SAMBUNGA LATIHAN 38
BalasHapusPrivate Sub LATIHAN036_36109037_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim poltek As New OleDb.OleDbDataAdapter
poltek = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb36109037.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces
DT.Rows.Clear() 'membersihkan data table
poltek.Fill(DT) 'mengisi database ke dlm data table
DataGridView1.DataSource = DT 'memunculkan dlm datagridview
poltek.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109037.TextChanged, hr36109037.TextChanged
jm36109037.Text = Val(un36109037.Text) * Val(hr36109037.Text)
End Sub
Public Sub Juniati()
Dim total As Double
For Each x As DataRow In DT.Rows
total = total + x("jumlah")
Next
Tot36109037.Text = total
End Sub
Private Sub NB_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb36109037.Click
cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb36109037.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
If LATIHAN3839_36109037.Visible = False Then
LATIHAN3839_36109037.Show()
Else
LATIHAN3839_36109037.Activate()
End If
Else
MsgBox("Kode barang baru")
nb36109037.ReadOnly = False
Exit Sub
End If
End Sub
End Class
lanjutan
BalasHapusPrivate Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If nt.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 cari.AturPencarianDataBase("mastertransaksi", "notrans", nt.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt.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 ('" & nt.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
DT.Rows.Clear()
nt.Text = ""
jt.Text = ""
khaeril()
End Sub
Public Class LATIHAN038012
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=280765")
Dim DT As New DataTable
Dim kolom(3) As DataColumn
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
kolom(0) = DT.Columns("kodebarang")
DT.PrimaryKey = kolom
Dim drzany As DataRow
drzany = DT.Rows.Find(kb.Text)
If drzany Is Nothing Then
drzany = DT.NewRow
drzany("KODEBARANG") = kb.Text
drzany("NAMABARANG") = nb.Text
drzany("UNIT") = un.Text
drzany("HARGA") = hr.Text
drzany("JUMLAH") = jm.Text
DT.Rows.Add(drzany)
lanjutan
BalasHapusElse
MsgBox("baris sudah ada")
kb.Text = ""
End If
If kb.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(un.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(hr.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
kb.Text = ""
un.Text = ""
hr.Text = ""
nb.Text = ""
jm.Text = ""
khaeril()
End Sub
lanjutan
BalasHapusPrivate Sub LATIHAN036012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim nisa As New OleDb.OleDbDataAdapter
nisa = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang =barang.kodebarang WHERE detailtransaksi. NOTRANS='" & kb.Text & "'", CONECT)
DT.Rows.Clear()
nisa.Fill(DT)
DataGridView1.DataSource = DT
nisa.Dispose()
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un.TextChanged, hr.TextChanged
jm.Text = Val(un.Text) * Val(hr.Text)
End Sub
lanjutan
BalasHapusPublic Sub khaeril()
Dim total As Double
For Each x As DataRow In DT.Rows
total = total + x("jumlah")
Next
Tot.Text = total
End Sub
Private Sub NB_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb.Click
cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
If LATIHAN3839.Visible = False Then
LATIHAN3839.Show()
Else
LATIHAN3839.Activate()
End If
Else
MsgBox("Kode barang baru")
nb.ReadOnly = False
Exit Sub
End If
End Sub
End Class
Public Class LATIHAN3839
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=280765")
Dim DT As New DataTable
Dim BARIS As DataRow
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN035012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim nisa As New OleDb.OleDbDataAdapter
nisa = New OleDb.OleDbDataAdapter("select KODEBARANG, NAMABARANG FROM BARANG ", CONECT)
DT.Rows.Clear()
nisa.Fill(DT)
DataGridView1.DataSource = DT
nisa.Dispose()
End Sub
lanjutan
BalasHapusPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
BARIS = DT.DefaultView(BindingContext(DT). Position).Row
LATIHAN038012.nb.Text = BARIS("NAMABARANG")
End Sub
End Class
Public Class Latih38_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 kolom(3) As DataColumn
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
kolom(0) = DT.Columns("kodebarang")
DT.PrimaryKey = kolom
Dim nhunoe As DataRow
nhunoe = DT.Rows.Find(kb_36109034.Text)
If nhunoe Is Nothing Then
nhunoe = DT.NewRow ' menambah baris
nhunoe("KODEBARANG") = kb_36109034.Text
nhunoe("NAMABARANG") = nb_36109034.Text
nhunoe("UNIT") = un_36109034.Text
nhunoe("HARGA") = hr_36109034.Text
nhunoe("JUMLAH") = jm_36109034.Text
DT.Rows.Add(nhunoe)
Else
MsgBox("baris sudah ada")
kb_36109034.Text = ""
End If
If kb_36109034.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(un_36109034.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("UNIT belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(hr_36109034.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("HARGA belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
kb_36109034.Text = ""
un_36109034.Text = ""
hr_36109034.Text = ""
nb_36109034.Text = ""
jm_36109034.Text = ""
noe()
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 nt_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
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109034.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
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 ('" & nt_36109034.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & 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 ('" & nt_36109034.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
DT.Rows.Clear()
nt_36109034.Text = ""
jt_36109034.Text = ""
noe()
End Sub
Private Sub Latih38_36109034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BalasHapusDim nur As New OleDb.OleDbDataAdapter
nur = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb_36109034.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces
DT.Rows.Clear() 'membersihkan data table
nur.Fill(DT) 'mengisi database ke dlm data table
DataGridView1.DataSource = DT 'memunculkan dlm datagridview
nur.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_36109034.TextChanged, hr_36109034.TextChanged
jm_36109034.Text = Val(un_36109034.Text) * Val(hr_36109034.Text)
End Sub
Public Sub noe()
Dim total As Double
For Each x As DataRow In DT.Rows
total = total + x("jumlah")
Next
Tot_36109034.Text = total
End Sub
Private Sub nb_36109034_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb_36109034.Click
cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_36109034.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
If Latih3839_36109034.Visible = False Then
Latih3839_36109034.Show()
Else
Latih3839_36109034.Activate()
End If
Else
MsgBox("Kode barang baru")
nb_36109034.ReadOnly = False
Exit Sub
End If
End Sub
End Class
Public Class LATIHAN_038_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")
'deklarasi data tabel
Dim DT As New DataTable
Dim kolom(3) As DataColumn
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1_36109056.Click
kolom(0) = DT.Columns("kodebarang")
DT.PrimaryKey = kolom
Dim bhie As DataRow
bhie = DT.Rows.Find(kb_36109056.Text)
If bhie Is Nothing Then
bhie = DT.NewRow ' menambah baris
bhie("KODEBARANG") = kb_36109056.Text
bhie("NAMABARANG") = nb_36109056.Text
bhie("UNIT") = un_36109056.Text
bhie("HARGA") = hr_36109056.Text
bhie("JUMLAH") = jm_36109056.Text
DT.Rows.Add(bhie)
Else
MsgBox("baris sudah ada")
kb_36109056.Text = ""
End If
If kb_36109056.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(un_36109056.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("UNIT belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(hr_36109056.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("HARGA belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
kb_36109056.Text = ""
un_36109056.Text = ""
hr_36109056.Text = ""
nb_36109056.Text = ""
jm_36109056.Text = ""
hasbiya()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2_36109056.Click
BalasHapus'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
'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("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
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 & "#,'" & 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
DT.Rows.Clear()
TextBox1_36109056.Text = ""
jt_36109056.Text = ""
hasbiya()
End Sub
Private Sub LATIHAN_038_36109056_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BalasHapusDim poltek As New OleDb.OleDbDataAdapter
poltek = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb_36109056.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces
DT.Rows.Clear() 'membersihkan data table
poltek.Fill(DT) 'mengisi database ke dlm data table
DataGridView1.DataSource = DT 'memunculkan dlm datagridview
poltek.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_36109056.TextChanged, hr_36109056.TextChanged
jm_36109056.Text = Val(un_36109056.Text) * Val(hr_36109056.Text)
End Sub
Public Sub hasbiya()
Dim total As Double
For Each x As DataRow In DT.Rows
total = total + x("jumlah")
Next
Tot_36109056.Text = total
End Sub
Private Sub NB_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb_36109056.Click
cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_36109056.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
If LATIHAN3839_36109056.Visible = False Then
LATIHAN3839_36109056.Show()
Else
LATIHAN3839_36109056.Activate()
End If
Else
MsgBox("Kode barang baru")
nb_36109056.ReadOnly = False
Exit Sub
End If
End Sub
End Class
Public Class Latihan_038_36109045
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=florista")
'deklarasi data tabel
Dim Data As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Form3836109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'deklarasi adapter
Dim adapt As New OleDb.OleDbDataAdapter
adapt = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & kb36109045.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces
Data.Rows.Clear() 'membersihkan data table
adapt.Fill(Data) 'mengisi database ke dlm data table
adapt.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
'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
DataGridView1.DataSource = Data 'memunculkan dlm datagridview
End Sub
Private Sub hitung()
Dim hitng As Integer
For Each r As DataRow In Data.Rows
hitng = hitng + r("JUMLAH")
Next
Tot36109045.Text = hitng
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109045.TextChanged, hr36109045.TextChanged
jm36109045.Text = Val(un36109045.Text) * Val(hr36109045.Text)
End Sub
Private Sub kb_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb36109045.TextChanged
nb36109045.Text = ""
un36109045.Text = ""
hr36109045.Text = ""
End Sub
'moment mencari saat kursor meninggalkan texbox
Private Sub kb_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb36109045.Leave
If kb36109045.Text.Length = 0 Then 'jika kodebarang tidak diisi jgn lanjutkan perintah selanjutnya
Exit Sub
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("barang", "kodebarang", kb36109045.Text, 1, CONECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then 'jika barang yg kita cari ada dlm table
kb36109045.Text = cari.DataTablenya.Rows(0).Item("KodeBarang")
nb36109045.Text = cari.DataTablenya.Rows(0).Item("namabarang")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan_383940_36109045.ShowDialog = Windows.Forms.DialogResult.OK Then
kb36109045.Text = Latihan_383940_36109045.DataGridView1.CurrentRow.Cells("KodeBarang").Value
nb36109045.Text = Latihan_383940_36109045.DataGridView1.CurrentRow.Cells("namabarang").Value
hr36109045.Text = Latihan_383940_36109045.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value
Else
kb36109045.Text = ""
End If
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109045.Click
BalasHapus'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If kb36109045.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(un36109045.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("UNIT belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(hr36109045.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("HARGA belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
'UNTUK MENYMPAN DATA YG DIMASUKKAN KE DALAM DATAGRIDVIEW
Dim simpan As DataRow
simpan = Data.Rows.Find(kb36109045.Text) 'untuk mencari apakah ada no.pembelian sdh ada agar tdak double
If simpan Is Nothing Then 'jika tidak ad ji maka lanjutkan penyimpanan
simpan = Data.NewRow ' menambah baris
simpan("kodebarang") = kb36109045.Text
simpan("namabarang") = nb36109045.Text
simpan("unit") = un36109045.Text
simpan("harga") = hr36109045.Text
simpan("jumlah") = jm36109045.Text
Data.Rows.Add(simpan)
Else
MsgBox("nomor sudah ada")
End If
kb36109045.Text = ""
un36109045.Text = ""
hr36109045.Text = ""
hitung()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109045.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If TextBox136109045.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("no transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If jt36109045.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
BalasHapusMsgBox("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
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109045.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS 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('" & nt36109045.Text & "',#" & DateTimePicker136109045.Value.Date & "#," & Val(jt36109045.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('" & nt36109045.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox136109045.Text = ""
jt36109045.Text = ""
jm36109045.Text = ""
Tot36109045.Text = ""
Data.Rows.Clear()
hitung()
End Sub
End Class
Public Class Form3836109040
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")
'deklarasi data tabel
Dim DT As New DataTable
Dim kolom(3) As DataColumn
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
kolom(0) = DT.Columns("kodebarang")
DT.PrimaryKey = kolom
Dim mytha As DataRow
mytha = DT.Rows.Find(kb_36109040.Text)
If mytha Is Nothing Then
mytha = DT.NewRow ' menambah baris
mytha("KODEBARANG") = kb_36109040.Text
mytha("NAMABARANG") = nb_36109040.Text
mytha("UNIT") = un_36109040.Text
mytha("HARGA") = hr_36109040.Text
mytha("JUMLAH") = jm_36109040.Text
DT.Rows.Add(mytha)
Else
MsgBox("baris sudah ada")
kb_36109040.Text = ""
End If
If kb_36109040.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(un_36109040.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("UNIT belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(hr_36109040.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("HARGA belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
kb_36109040.Text = ""
un_36109040.Text = ""
hr_36109040.Text = ""
nb_36109040.Text = ""
jm_36109040.Text = ""
mie()
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 nt_36109040.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_36109040.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("jenis transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109040.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
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 ('" & nt_36109034.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & 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 ('" & nt_36109034.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
DT.Rows.Clear()
nt_36109040.Text = ""
jt_36109040.Text = ""
mie()
End Sub
Private Sub Latih38_36109040_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim armi As New OleDb.OleDbDataAdapter
armi = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb_36109040.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces
DT.Rows.Clear() 'membersihkan data table
armi.Fill(DT) 'mengisi database ke dlm data table
DataGridView1.DataSource = DT 'memunculkan dlm datagridview
armi.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_36109040.TextChanged, hr_36109040.TextChanged
BalasHapusjm_36109040.Text = Val(un_36109040.Text) * Val(hr_36109040.Text)
End Sub
Public Sub mie()
Dim total As Double
For Each x As DataRow In DT.Rows
total = total + x("jumlah")
Next
Tot_36109034.Text = total
End Sub
Private Sub nb_36109040_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb_36109034.Click
cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_36109040.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
If Latih3839_36109040.Visible = False Then
Latih3839_36109040.Show()
Else
Latih3839_36109040.Activate()
End If
Else
MsgBox("Kode barang baru")
nb_36109040.ReadOnly = False
Exit Sub
End If
End Sub
End Class
Public Class LATIHAN038035
BalasHapusDim Jalan As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source =" & Application.StartupPath & "\Datamajemuk.ACCDB")
Dim gitik As New DataTable
Private Sub botto()
Dim ttotal As Integer
For Each hasil As DataRow In gitik.Rows
ttotal += hasil("Jumlah")
Next
Tot035.Text = ttotal
End Sub
Private Sub Latihan038035_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'mendeklarasikan kendaraan
Dim bojel As New OleDb.OleDbDataAdapter
'Mengatur data yang akan di angkut
bojel = New OleDb.OleDbDataAdapter("SELECT detailtransaksi.kodebarang,barang.namabarang,detailtransaksi.unit,detailtransaksi.harga, detailtransaksi.unit * detailtransaksi.harga as jumlah FROM DETAILTRANSAKSI inner join barang on detailtransaksi.kodebarang=barang.kodebarang where detailtransaksi.notrans='" & nt035.Text & "'", Jalan)
'bersihkan data
gitik.Rows.Clear()
'untuk memasukkan data yg telah di angkut ke dalam datatable
bojel.Fill(gitik)
'untuk menampilkan isi datatable ke data grid view
bojel.Dispose()
DataGridView1035.DataSource = gitik
'perintah primarykey
Dim kabotcibay(2) As DataColumn
kabotcibay(0) = gitik.Columns("Kodebarang")
gitik.PrimaryKey = kabotcibay
End Sub
Private Sub kb035_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb035.Leave
If kb035.Text.Length = 0 Then
Exit Sub
End If
'mencari data yang ada di tabel
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("barang", "kodebarang", kb035.Text, 1, Jalan)
If Pencari.JumlanBaris > 0 Then
nb035.Text = Pencari.DataTablenya.Rows(0).Item(1)
Else
MsgBox("the data is not exist, please choose from the this list")
If Latihan383940035.ShowDialog = Windows.Forms.DialogResult.OK Then
kb035.Text = Latihan383940035.view.CurrentRow.Cells("KodeBarang").Value
nb035.Text = Latihan383940035.view.CurrentRow.Cells("namabarang").Value
hr035.Text = Latihan383940035.view.CurrentRow.Cells("hargajual").Value
Else
kb035.Text = ""
nb035.Text = ""
End If
End If
End Sub
Private Sub Button1035_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1035.Click
BalasHapus'Memeriksa isi textbox
If kb035.Text.Length = 0 Then
MsgBox("Please, insert the code of goods")
Exit Sub
End If
If un035.Text.Length = 0 Then
MsgBox("Please, insert the unit of goods")
Exit Sub
End If
If hr035.Text.Length = 0 Then
MsgBox("Please, insert the cost of goods")
Exit Sub
End If
'perintah pencarian data
Dim dr As DataRow
dr = gitik.Rows.Find(kb035.Text)
If Not dr Is Nothing Then
MsgBox("Sorry, the data has been exist!!! Please insert new data")
Exit Sub
End If
'penyimpanan data ke datatable
gitik.Rows.Add(kb035.Text, nb035.Text, Val(un035.Text), Val(hr035.Text), jm035.Text)
botto()
'mengosongkan textbox
kb035.Text = ""
nb035.Text = ""
un035.Text = ""
hr035.Text = ""
jm035.Text = ""
End Sub
Private Sub un035_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un035.TextChanged, hr035.TextChanged
jm035.Text = Val(un035.Text) * Val(hr035.Text)
End Sub
Private Sub Button2035_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2035.Click
'Memeriksa isi textbox
If nt035.Text.Length = 0 Then
MsgBox("Please, insert the Number of the transaction")
Exit Sub
End If
If jt035.Text.Length = 0 Then
MsgBox("Please, insert the type of the transaction")
Exit Sub
End If
If gitik.Rows.Count = 0 Then
MsgBox("the data is none")
Exit Sub
End If
'Memeriksa nomor transaksi pd master transaksi
Dim search As New ByIskandar.CariKeDataBaseByIskandar
search.AturPencarianDataBase("mastertransaksi", "notrans", nt035.Text, 1, Jalan)
If search.JumlanBaris > 0 Then
MsgBox("the code has been exist")
Exit Sub
End If
'Proses Penyimpanan ke tabel master transaksi
Dim kacci As New OleDb.OleDbCommand
kacci = New OleDb.OleDbCommand("insert into mastertransaksi (notrans,tanggaltransaksi,jenistransaksi) values ('" & nt035.Text & "',#" & DateTimePicker1035.Value.Month & "/" & DateTimePicker1035.Value.Day & "/" & DateTimePicker1035.Value.Year & "#,'" & jt035.Text & "')", Jalan)
Jalan.Open()
kacci.ExecuteNonQuery()
Jalan.Close()
'penyimpanan isi datatable ke detail transaksi
For Each nhana As DataRow In gitik.Rows
kacci = New OleDb.OleDbCommand("insert into detailtransaksi (notrans,kodebarang,unit,harga) values ('" & nt035.Text & "','" & nhana("kodebarang") & "'," & nhana("unit") & "," & nhana("harga") & ")", Jalan)
Jalan.Open()
kacci.ExecuteNonQuery()
Jalan.Close()
Next
kacci.Dispose()
'Mengosongkan isi text box
nt035.Text = ""
jt035.Text = ""
'Mengosongkan baris datatable
gitik.Rows.Clear()
'menutup form
Me.Close()
End Sub
End Class
Public Class LATIHAN038_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")
'deklarasi data tabel
Dim DT As New DataTable
Dim kolom(3) As DataColumn
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
kolom(0) = DT.Columns("kodebarang")
DT.PrimaryKey = kolom
Dim wirda As DataRow
wirda = DT.Rows.Find(kb_36109049.Text)
If wirda Is Nothing Then
wirda = DT.NewRow ' menambah baris
wirda("KODEBARANG") = kb_36109049.Text
wirda("NAMABARANG") = nb_36109049.Text
wirda("UNIT") = un_36109049.Text
wirda("HARGA") = hr_36109049.Text
wirda("JUMLAH") = jm_36109049.Text
DT.Rows.Add(wirda)
Else
MsgBox("baris sudah ada")
kb_36109049.Text = ""
End If
If kb_36109049.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(un_36109049.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("UNIT belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(hr_36109049.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("HARGA belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
kb_36109049.Text = ""
un_36109049.Text = ""
hr_36109049.Text = ""
nb_36109049.Text = ""
jm_36109049.Text = ""
wirdapaulus()
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
'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("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
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 & "#,'" & 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 ('" & nt.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
DT.Rows.Clear()
TextBox1_36109049.Text = ""
TextBox2_36109049.Text = ""
wirdapaulus()
End Sub
Lanjutan 38
BalasHapusPrivate Sub LATIHAN038_36109049_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim poltek As New OleDb.OleDbDataAdapter
poltek = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb_36109049.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces
DT.Rows.Clear() 'membersihkan data table
poltek.Fill(DT) 'mengisi database ke dlm data table
DataGridView1.DataSource = DT 'memunculkan dlm datagridview
poltek.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_36109049.TextChanged, hr_36109049.TextChanged
jm_36109049.Text = Val(un_36109049.Text) * Val(hr_36109049.Text)
End Sub
Public Sub wirdapaulus()
Dim total As Double
For Each x As DataRow In DT.Rows
total = total + x("jumlah")
Next
Tot1_36109049.Text = total
End Sub
Private Sub NB_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb_36109049.Click
cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_36109049.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
If LATIHAN3839_36109049.Visible = False Then
LATIHAN3839_36109049.Show()
Else
LATIHAN3839_36109049.Activate()
End If
Else
MsgBox("Kode barang baru")
nb_36109049.ReadOnly = False
Exit Sub
End If
End Sub
End Class
Public Class LATIHAN03836109038
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 LATIHAN03836109038_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Azizah As New OleDb.OleDbDataAdapter
Azizah = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & KB36109038.Text & "'", CONECT)
DT.Rows.Clear()
Azizah.Fill(DT)
Azizah.Dispose()
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("kodebarang")
DT.PrimaryKey = dcp
DataGridView136109038.DataSource = DT
End Sub
Private Sub hitung()
Dim cantik As Integer
For Each r As DataRow In DT.Rows
cantik = cantik + r("JUMLAH")
Next
Tot36109038.Text = cantik
End Sub
Private Sub UN36109038_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles UN36109038.TextChanged, HR36109038.TextChanged
JM36109038.Text = Val(UN36109038.Text) * Val(HR36109038.Text)
End Sub
Private Sub KB36109038_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB36109038.TextChanged
NB36109038.Text = ""
UN36109038.Text = ""
HR36109038.Text = ""
End Sub
Private Sub KB36109038_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB36109038.Leave
If KB36109038.Text.Length = 0 Then
Exit Sub
End If
cari.AturPencarianDataBase("barang", "kodebarang", KB36109038.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
KB36109038.Text = cari.DataTablenya.Rows(0).Item("KodeBarang")
NB36109038.Text = cari.DataTablenya.Rows(0).Item("namabarang")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan03803904036109038.ShowDialog = Windows.Forms.DialogResult.OK Then
KB36109038.Text = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("KodeBarang").Value
NB36109038.Text = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("namabarang").Value
HR36109038.Text = Latihan03803904036109038.DataGridView136109038.CurrentRow.Cells("HARGAJUAL").Value
Else
KB36109038.Text = ""
End If
End If
End Sub
Private Sub Button136109038_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button136109038.Click
BalasHapusIf KB36109038.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(UN36109038.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(HR36109038.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
Dim Reza As DataRow
Reza = DT.Rows.Find(KB36109038.Text)
If Reza Is Nothing Then
Reza = DT.NewRow
Reza("kodebarang") = KB36109038.Text
Reza("namabarang") = NB36109038.Text
Reza("unit") = UN36109038.Text
Reza("harga") = HR36109038.Text
Reza("jumlah") = JM36109038.Text
DT.Rows.Add(Reza)
Else
MsgBox("nomor sudah ada")
End If
KB36109038.Text = ""
UN36109038.Text = ""
HR36109038.Text = ""
hitung()
End Sub
Private Sub Button236109038_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button236109038.Click
If NT36109038.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", NT36109038.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS 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('" & NT36109038.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('" & NT36109038.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
NT36109038.Text = ""
JT36109038.Text = ""
JM36109038.Text = ""
Tot36109038.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
Public Class LATIHAN038041
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=12")
Dim DT As New DataTable
Dim kolom(3) As DataColumn
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109041.Click
kolom(0) = DT.Columns("kodebarang")
DT.PrimaryKey = kolom
Dim drzany As DataRow
drzany = DT.Rows.Find(kb36109041.Text)
If drzany Is Nothing Then
drzany = DT.NewRow ' menambah baris
drzany("KODEBARANG") = kb36109041.Text
drzany("NAMABARANG") = nb36109041.Text
drzany("UNIT") = un36109041.Text
drzany("HARGA") = hr36109041.Text
drzany("JUMLAH") = jm36109041.Text
DT.Rows.Add(drzany)
Else
MsgBox("baris sudah ada")
kb36109041.Text = ""
End If
If kb36109041.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(un36109041.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(hr36109041.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
kb36109041.Text = ""
un36109041.Text = ""
hr36109041.Text = ""
nb36109041.Text = ""
jm36109041.Text = ""
farid()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109041.Click
If nt.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
cari.AturPencarianDataBase("mastertransaksi", "notrans", nt36109041.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
lanjutan 38
BalasHapusDim 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
DT.Rows.Clear()
nt36109041.Text = ""
jt36109041.Text = ""
farid()
End Sub
Private Sub LATIHAN036012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim nisa As New OleDb.OleDbDataAdapter
nisa = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb36109041.Text & "'", CONECT) DT.Rows.Clear()
nisa.Fill(DT)
DataGridView136109041.DataSource = DT
nisa.Dispose()
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109041.TextChanged, hr36109041.TextChanged
jm36109041.Text = Val(un36109041.Text) * Val(hr36109041.Text)
End Sub
Public Sub farid()
Dim total As Double
For Each x As DataRow In DT.Rows
total = total + x("jumlah")
Next
Tot36109041.Text = total
End Sub
Private Sub NB_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb36109041.Click
cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb36109041.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
If LATIHAN3839.Visible = False Then
LATIHAN3839.Show()
Else
LATIHAN3839.Activate()
End If
Else
MsgBox("Kode barang baru")
nb36109041.ReadOnly = False
Exit Sub
End If
End Sub
End Class
Public Class LATIHAN03836109033
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 colom(3) As DataColumn
Dim browse As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN03836109033_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim tiwi As New OleDb.OleDbDataAdapter
tiwi = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb36109033.Text & "'", 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 TOTALJUMLAH()
Dim total As Double
For Each t As DataRow In Data.Rows
total = total + t("jumlah")
Next
Tot36109033.Text = total
End Sub
Private Sub un36109033_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109033.TextChanged, hr36109033.TextChanged
jm36109033.Text = Val(un36109033.Text) * Val(hr36109033.Text)
End Sub
Private Sub button136109033_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button136109033.Click
colom(0) = Data.Columns("kodebarang")
Data.PrimaryKey = colom
Dim pratiwi As DataRow
pratiwi = Data.Rows.Find(kb36109033.Text)
If pratiwi Is Nothing Then
pratiwi = Data.NewRow ' menambah baris
pratiwi("KODEBARANG") = kb36109033.Text
pratiwi("NAMABARANG") = nb36109033.Text
pratiwi("UNIT") = un36109033.Text
pratiwi("HARGA") = hr36109033.Text
pratiwi("JUMLAH") = jm36109033.Text
Data.Rows.Add(pratiwi)
Else
MsgBox("baris sudah ada")
kb36109033.Text = ""
End If
If kb36109033.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(un36109033.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("UNIT belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(hr36109033.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("HARGA belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
kb36109033.Text = ""
un36109033.Text = ""
hr36109033.Text = ""
nb36109033.Text = ""
jm36109033.Text = ""
TOTALJUMLAH()
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
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
browse.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109033.Text, 1, CONECT)
If browse.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If Data.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
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 & "#,'" & 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
Data.Rows.Clear()
TextBox136109033.Text = ""
jt36109033.Text = ""
TOTALJUMLAH()
End Sub
Private Sub nb36109033_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb36109033.Click
browse.AturPencarianDataBase("BARANG", "KODEBARANG", kb36109033.Text, 1, CONECT)
If browse.JumlanBaris > 0 Then
If LATIHAN3839.Visible = False Then
LATIHAN3839.Show()
Else
LATIHAN3839.Activate()
End If
Else
MsgBox("Kode barang baru")
nb36109033.ReadOnly = False
Exit Sub
End If
End Sub
End Class
Public Class LATIHAN3839
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 LATIHAN03536109033_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 LATIHAN03836109048
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=idunk")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN03836109048_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim Tries As New OleDb.OleDbDataAdapter
Tries = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & KB36109048.Text & "'", CONECT)
DT.Rows.Clear()
triz.Fill(DT)
triz.Dispose()
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("kodebarang")
DT.PrimaryKey = dcp
DataGridView136109048.DataSource = DT
End Sub
Private Sub hitung()
Dim anda As Integer
For Each r As DataRow In DT.Rows
anda = anda + r("JUMLAH")
Next
Tot36109048.Text = anda
End Sub
Private Sub UN36109048_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles UN36109048.TextChanged, HR36109048.TextChanged
JM36109048.Text = Val(UN36109048.Text) * Val(HR36109048.Text)
End Sub
Private Sub KB36109048_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB36109048.TextChanged
NB36109048.Text = ""
UN36109048.Text = ""
HR36109048.Text = ""
End Sub
Private Sub KB36109048_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB36109048.Leave
If KB36109048.Text.Length = 0 Then
Exit Sub
End If
cari.AturPencarianDataBase("barang", "kodebarang", KB36109048.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
KB36109048.Text = cari.DataTablenya.Rows(0).Item("KodeBarang")
NB36109048.Text = cari.DataTablenya.Rows(0).Item("namabarang")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan03803904036109048.ShowDialog = Windows.Forms.DialogResult.OK Then
KB36109048.Text = Latihan03803904036109048.DataGridView136109048.CurrentRow.Cells("KodeBarang").Value
NB36109048.Text = Latihan03803904036109048.DataGridView136109048.CurrentRow.Cells("namabarang").Value
HR36109048.Text = Latihan03803904036109048.DataGridView136109048.CurrentRow.Cells("HARGAJUAL").Value
Else
KB36109048.Text = ""
End If
End If
End Sub
Public Class LATIHAN_3836109055
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")
'deklarasi data tabel
Dim DT As New DataTable
Dim kolom(3) As DataColumn
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109055.Click
kolom(0) = DT.Columns("kodebarang")
DT.PrimaryKey = kolom
Dim dr As DataRow
dr = DT.Rows.Find(kb36109055.Text)
If dr Is Nothing Then
dr = DT.NewRow ' menambah baris
dr("KODEBARANG") = kb36109055.Text
dr("NAMABARANG") = nb36109055.Text
dr("UNIT") = un36109055.Text
dr("HARGA") = hr36109055.Text
dr("JUMLAH") = jm36109055.Text
DT.Rows.Add(dr)
Else
MsgBox("baris sudah ada")
kb36109055.Text = ""
End If
If kb36109055.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(un36109055.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("UNIT belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(hr36109055.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("HARGA belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
kb36109055.Text = ""
un36109055.Text = ""
hr36109056.Text = ""
nb36109056.Text = ""
jm36109056.Text = ""
falah()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button236109055.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("mastertransaksi", "notrans", TextBox136109055.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
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 & "#,'" & 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
DT.Rows.Clear()
TextBox136109055.Text = ""
jt36109055.Text = ""
falah()
End Sub
end class
Public Class Latih38_36109053
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=kondolele")
'deklarasi data tabel
Dim DT As New DataTable
Dim kolom(3) As DataColumn
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
kolom(0) = DT.Columns("kodebarang")
DT.PrimaryKey = kolom
Dim dede As DataRow
dede = DT.Rows.Find(kb_36109053.Text)
If dede Is Nothing Then
dede = DT.NewRow ' menambah baris
dede("KODEBARANG") = kb_36109053.Text
dede("NAMABARANG") = nb_36109053.Text
dede("UNIT") = un_36109053.Text
dede("HARGA") = hr_36109053.Text
dede("JUMLAH") = jm_36109053.Text
DT.Rows.Add(dede)
Else
MsgBox("baris sudah ada")
kb_36109053.Text = ""
End If
If kb_36109053.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(un_36109053.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("UNIT belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(hr_36109053.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("HARGA belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
kb_36109053.Text = ""
un_36109053.Text = ""
hr_36109053.Text = ""
nb_36109053.Text = ""
jm_36109053.Text = ""
praditya()
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 nt_36109053.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_36109053.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("jenis transaksi belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109053.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
'untuk memasukkan data dari visual basic ke dlm acces
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_36109053.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & jt_36109053.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 ('" & nt_36109053.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
DT.Rows.Clear()
nt_36109053.Text = ""
jt_36109053.Text = ""
praditya()
End Sub
Private Sub Latih38_36109053_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
BalasHapusDim nur As New OleDb.OleDbDataAdapter
ded = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb_36109053.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces
DT.Rows.Clear() 'membersihkan data table
ded.Fill(DT) 'mengisi database ke dlm data table
DataGridView1.DataSource = DT 'memunculkan dlm datagridview
ded.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_36109053.TextChanged, hr_36109053.TextChanged
jm_36109053.Text = Val(un_36109053.Text) * Val(hr_36109053.Text)
End Sub
Public Sub praditya()
Dim total As Double
For Each x As DataRow In DT.Rows
total = total + x("jumlah")
Next
Tot_36109053.Text = total
End Sub
Private Sub nb_36109053_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles nb_36109053.Click
cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_36109053.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
If Latih3839_36109053.Visible = False Then
Latih3839_36109053.Show()
Else
Latih3839_36109053.Activate()
End If
Else
MsgBox("Kode barang baru")
nb_36109053.ReadOnly = False
Exit Sub
End If
End Sub
End Class
Public Class LATIHAN38_36109051
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=molnan")
'deklarasi data tabel
Dim DT As New DataTable
Dim BARIS As DataRow
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN035012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'deklarasi adapter
Dim milan As New OleDb.OleDbDataAdapter
milan = New OleDb.OleDbDataAdapter("select KODEBARANG, NAMABARANG FROM BARANG ", CONECT) 'memunculkan semua data dari tabel barang dlm acces
DT.Rows.Clear() 'membersihkan data table
milan.Fill(DT) 'mengisi database ke dlm data table
DataGridView1.DataSource = DT 'memunculkan dlm datagridview
milan.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
LATIHAN038012.nb.Text = BARIS("NAMABARANG")
End Sub
End Class
Public Class Form3836109050
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 Form3836109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim adapt As New OleDb.OleDbDataAdapter
adapt = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & kb.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces
data.Rows.Clear()
adapt.Fill(data)
adapt.Dispose()
Dim dcp(1) As DataColumn
dcp(0) = data.Columns("kodebarang")
data.PrimaryKey = dcp
DataGridView1.DataSource = data
End Sub
Private Sub hitung()
Dim inter As Integer
For Each r As DataRow In data.Rows
inter = inter + r("JUMLAH")
Next
Tot.Text = inter
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un.TextChanged, hr.TextChanged
jm.Text = Val(un.Text) * Val(hr.Text)
End Sub
Private Sub kb_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb.TextChanged
nb.Text = ""
un.Text = ""
hr.Text = ""
End Sub
Private Sub kb_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb.Leave
If kb.Text.Length = 0 Then 'jika kodebarang tidak diisi jgn lanjutkan perintah selanjutnya
Exit Sub
End If
cari.AturPencarianDataBase("barang", "kodebarang", kb.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
kb.Text = cari.DataTablenya.Rows(0).Item("KodeBarang")
nb.Text = cari.DataTablenya.Rows(0).Item("namabarang")
Else
MsgBox("Kode barang tersebut tidak ada")
If Form38394036109050.ShowDialog = Windows.Forms.DialogResult.OK Then
kb.Text = Form38394036109050.DataGridView1.CurrentRow.Cells("KodeBarang").Value
nb.Text = Form38394036109050.DataGridView1.CurrentRow.Cells("namabarang").Value
hr.Text = Form38394036109050.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value
Else
kb.Text = ""
End If
End If
End Sub
Sambungan form3836109050
BalasHapusPrivate Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If kb.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(un.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(hr.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
Dim simpan As DataRow
simpan = data.Rows.Find(kb.Text)
If simpan Is Nothing Then
simpan = data.NewRow
simpan("kodebarang") = kb.Text
simpan("namabarang") = nb.Text
simpan("unit") = un.Text
simpan("harga") = hr.Text
simpan("jumlah") = jm.Text
data.Rows.Add(simpan)
Else
MsgBox("nomor sudah ada")
End If
kb.Text = ""
un.Text = ""
hr.Text = ""
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 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("NO.TRANS sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values('" & nt.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('" & nt.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
TextBox1.Text = ""
jt.Text = ""
jm.Text = ""
Tot.Text = ""
data.Rows.Clear()
hitung()
End Sub
End Class
Public Class LATIHAN03836109029
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")
'deklarasi data tabel
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN03836109029_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'deklarasi adapter
Dim CUTE As New OleDb.OleDbDataAdapter
CUTE = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & kb36109029.Text & "'", CONNECT) 'memunculkan semua data dari tabel barang dlm acces
DT.Rows.Clear() 'membersihkan data table
CUTE.Fill(DT) 'mengisi database ke dlm data table
CUTE.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
'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
DataGridView1.DataSource = DT 'memunculkan dlm datagridview
End Sub
Private Sub hitung()
Dim INDAH As Integer
For Each r As DataRow In DT.Rows
INDAH = INDAH + r("JUMLAH")
Next
Tot36109029.Text = INDAH
End Sub
Private Sub un36109029_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109029.TextChanged, hr36109029.TextChanged
jm36109029.Text = Val(un36109029.Text) * Val(hr36109029.Text)
End Sub
Private Sub kb36109029_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb36109029.TextChanged
nb36109029.Text = ""
un36109029.Text = ""
hr36109029.Text = ""
End Sub
'moment mencari saat kursor meninggalkan texbox
Private Sub kb36109029_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb36109029.Leave
If kb36109029.Text.Length = 0 Then 'jika kodebarang tidak diisi jgn lanjutkan perintah selanjutnya
Exit Sub
End If
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("barang", "kodebarang", kb36109029.Text, 1, CONNECT) '1 untuk huruf
If cari.JumlanBaris > 0 Then 'jika barang yg kita cari ada dlm table
kb36109029.Text = cari.DataTablenya.Rows(0).Item("KodeBarang")
nb36109029.Text = cari.DataTablenya.Rows(0).Item("namabarang")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan38029.ShowDialog = Windows.Forms.DialogResult.OK Then
kb36109029.Text = Latihan38029.DataGridView1.CurrentRow.Cells("KodeBarang").Value
nb36109029.Text = Latihan38029.DataGridView1.CurrentRow.Cells("namabarang").Value
hr36109029.Text = Latihan38029.DataGridView1.CurrentRow.Cells("HARGAJUAL").Value
Else
kb36109029.Text = ""
End If
End If
End Sub
Private Sub Button136109029_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109029.Click
'untuk mencari jgn sampai data yg akan dimasukkan tidak lengkap
If kb36109029.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(un36109029.Text) = 0 Then 'untuk pencarian yang bersifat angka
BalasHapusMsgBox("UNIT belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(hr36109029.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("HARGA belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
'UNTUK MENYMPAN DATA YG DIMASUKKAN KE DALAM DATAGRIDVIEW
Dim INDAH As DataRow
INDAH = DT.Rows.Find(kb36109029.Text) 'untuk mencari apakah ada no.pembelian sdh ada agar tdak double
If INDAH Is Nothing Then 'jika tidak ad ji maka lanjutkan penyimpanan
INDAH = DT.NewRow ' menambah baris
INDAH("kodebarang") = kb36109029.Text
INDAH("namabarang") = nb36109029.Text
INDAH("unit") = un36109029.Text
INDAH("harga") = hr36109029.Text
INDAH("jumlah") = jm36109029.Text
DT.Rows.Add(INDAH)
Else
MsgBox("nomor sudah ada")
End If
kb36109029.Text = ""
un36109029.Text = ""
hr36109029.Text = ""
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("NO.TRANS 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('" & nt.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('" & nt.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONNECT)
CONNECT.Open()
com.ExecuteNonQuery()
CONNECT.Close()
com.Dispose()
Next
TextBox136109029.Text = ""
jt36109029.Text = ""
jm36109029.Text = ""
Tot36109029.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
Public Class LATIHAN03836109032
BalasHapus'DEKLARASI CONECTION
Dim sambung As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=jayapura")
'deklarasi data tabel
Dim toshiba As New DataTable
Dim kolom(3) As DataColumn
Dim nokia As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
kolom(0) = toshiba.Columns("kodebarang")
toshiba.PrimaryKey = kolom
Dim key As DataRow
key = toshiba.Rows.Find(KB.Text)
If key Is Nothing Then
key = toshiba.NewRow ' menambah baris
key("KODEBARANG") = KB.Text
key("NAMABARANG") = NB.Text
key("UNIT") = UN.Text
key("HARGA") = HR.Text
key("JUMLAH") = JM.Text
toshiba.Rows.Add(key)
Else
MsgBox("baris sudah ada")
KB.Text = ""
End If
If KB.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(UN.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("UNIT belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(HR.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("HARGA belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
KB.Text = ""
UN.Text = ""
HR.Text = ""
NB.Text = ""
JM.Text = ""
apkom()
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
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
nokia.AturPencarianDataBase("mastertransaksi", "notrans", TextBox1.Text, 1, sambung)
If nokia.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If toshiba.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
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.Text & "',#" & DateTimePicker1.Value.Date & "#,'" & JT.Text & "')", sambung)
sambung.Open()
com.ExecuteNonQuery()
sambung.Close()
For Each r As DataRow In toshiba.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & TextBox1.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", sambung)
sambung.Open()
com.ExecuteNonQuery()
sambung.Close()
com.Dispose()
Next
toshiba.Rows.Clear()
TextBox1.Text = ""
JT.Text = ""
apkom()
End Sub
Private Sub LATIHAN03836109032_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim akun As New OleDb.OleDbDataAdapter
akun = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & KB.Text & "'", sambung) 'memunculkan semua data dari tabel barang dlm acces
toshiba.Rows.Clear() 'membersihkan data table
akun.Fill(toshiba) 'mengisi database ke dlm data table
DataGridView1.DataSource = toshiba 'memunculkan dlm datagridview
akun.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub UN_(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UN.TextChanged, HR.TextChanged
JM.Text = Val(UN.Text) * Val(HR.Text)
End Sub
Public Sub apkom()
Dim total As Double
For Each x As DataRow In toshiba.Rows
total = total + x("jumlah")
Next
TOT.Text = total
End Sub
Private Sub NB_(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NB.Click
nokia.AturPencarianDataBase("BARANG", "KODEBARANG", KB.Text, 1, sambung)
If nokia.JumlanBaris > 0 Then
If LATIHAN038039.Visible = False Then
LATIHAN038039.Show()
Else
LATIHAN038039.Activate()
End If
Else
MsgBox("Kode barang baru")
NB.ReadOnly = False
Exit Sub
End If
End Sub
End Class
Public Class LATIHAN03836109054
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")
'deklarasi data tabel
Dim DT As New DataTable
Dim kolom(3) As DataColumn
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109054.Click
kolom(0) = DT.Columns("kodebarang")
DT.PrimaryKey = kolom
Dim drzany As DataRow
drzany = DT.Rows.Find(kb36109054.Text)
If drzany Is Nothing Then
drzany = DT.NewRow ' menambah baris
drzany("KODEBARANG") = kb36109054.Text
drzany("NAMABARANG") = nb36109054.Text
drzany("UNIT") = un36109054.Text
drzany("HARGA") = hr36109054.Text
drzany("JUMLAH") = jm36109054.Text
DT.Rows.Add(drzany)
Else
MsgBox("baris sudah ada")
kb36109054.Text = ""
End If
If kb36109054.Text.Length = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("kode barang belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(un36109054.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("UNIT belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
If Val(hr36109054.Text) = 0 Then 'untuk pencarian yang bersifat angka
MsgBox("HARGA belum terisi")
Exit Sub 'jgn lanjut ke proses berikutnya
End If
kb36109054.Text = ""
un36109054.Text = ""
hr36109054.Text = ""
nb36109054.Text = ""
jm36109054.Text = ""
wawan()
End 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 nt.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
'untuk mencari jgn sampai data yg akan dimasukkan sudah ada
cari.AturPencarianDataBase("mastertransaksi", "notrans", nt.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
BalasHapusMsgBox("data tidak tersedia")
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 ('" & nt.Text & "',#" & DTP136109054.Value.Date & "#,'" & 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 ('" & nt.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
DT.Rows.Clear()
nt.Text = ""
jt36109054.Text = ""
wawan()
End Sub
Private Sub LATIHAN036012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim nisa As New OleDb.OleDbDataAdapter
nisa = New OleDb.OleDbDataAdapter("select detailtransaksi.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, (detailtransaksi.unit * detailtransaksi.harga) as jumlah from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE detailtransaksi.NOTRANS='" & kb36109054.Text & "'", CONECT) 'memunculkan semua data dari tabel barang dlm acces
DT.Rows.Clear() 'membersihkan data table
nisa.Fill(DT) 'mengisi database ke dlm data table
DGV136109054.DataSource = DT 'memunculkan dlm datagridview
nisa.Dispose() 'menghancurkan kendaraan (adapter) yg sdh dipake
End Sub
Private Sub un_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un36109054.TextChanged, hr36109054.TextChanged
jm36109054.Text = Val(un36109054.Text) * Val(hr36109054.Text)
End Sub
Public Sub wawan()
Dim total As Double
For Each x As DataRow In DT.Rows
total = total + x("jumlah")
Next
Tot36109054.Text = total
End Sub
Private Sub label4_click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label4.Click
cari.AturPencarianDataBase("BARANG", "KODEBARANG", kb36109054.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
If Latihan383940012.Visible = False Then
Latihan383940012.Show()
Else
Latihan383940012.Activate()
End If
Else
MsgBox("Kode barang baru")
nb36109054.ReadOnly = False
Exit Sub
End If
End Sub
End Class
pembaharuan
BalasHapusPublic Class Form38394036108001
Dim INCE As New OleDb.OleDbConnection("provider=Microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DataMajemuk.accdb;Jet OLEDB:Database Password=36108001")
Dim ANHYE As New DataTable
Private Sub Form38394036108001_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 * FROM BARANG", INCE)
ANHYE.Rows.Clear()
YNK.Fill(ANHYE)
YNK.Dispose()
DGV36108001.DataSource = ANHYE
End Sub
End Class
pembaharuan lg..
BalasHapusPublic Class Form3836108001
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
Private Sub AI()
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 Form3836108001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AI()
Dim PK(1) As DataColumn
PK(0) = LOVE.Columns("KODEBARANG")
LOVE.PrimaryKey = PK
End Sub
Private Sub TOTAL()
Dim LO As Integer
For Each VE As DataRow In LOVE.Rows
LO = LO + VE("Jumlah")
Next
T836108001.Text = LO
End Sub
Private Sub T536108001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T536108001.TextChanged, T636108001.TextChanged
T736108001.Text = Val(T536108001.Text) * Val(T636108001.Text)
End Sub
Private Sub T336108001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T336108001.TextChanged
T436108001.Text = ""
T536108001.Text = ""
T636108001.Text = ""
End Sub
Private Sub T336108001_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles T336108001.Leave
If T336108001.Text.Length = 0 Then
Exit Sub
End If
Dim IA As New ByIskandar.CariKeDataBaseByIskandar
IA.AturPencarianDataBase("barang", "kodebarang", T336108001.Text, 1, INCE)
If IA.JumlanBaris > 0 Then
T336108001.Text = IA.DataTablenya.Rows(0).Item("KodeBarang")
T436108001.Text = IA.DataTablenya.Rows(0).Item("NamaBarang")
T636108001.Text = IA.DataTablenya.Rows(0).Item("HargaJual")
Else
MsgBox("Kode barang tersbut tidak ada")
If Form38394036108001.ShowDialog = Windows.Forms.DialogResult.OK Then
T336108001.Text = Form38394036108001.DGV36108001.CurrentRow.Cells("KodeBarang").Value
T436108001.Text = Form38394036108001.DGV36108001.CurrentRow.Cells("NamaBarang").Value
T636108001.Text = Form38394036108001.DGV36108001.CurrentRow.Cells("HargaJual").Value
Else
T336108001.Text = ""
End If
End If
End Sub
lanjutan pembaharuan lg..
BalasHapusPrivate Sub B136108001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B136108001.Click
If T336108001.Text.Length = 0 Then
MsgBox("Kode Barang belum terisi")
Exit Sub
End If
If Val(T536108001.Text) = 0 Then
MsgBox("Unit belum terisi")
Exit Sub
End If
If Val(T636108001.Text) = 0 Then
MsgBox("Harga belum terisi")
Exit Sub
End If
If LOVE.Rows.Find(T336108001.Text) Is Nothing Then
LOVE.Rows.Add(T336108001.Text, T436108001.Text, Val(T536108001.Text), Val(T636108001.Text), Val(T736108001.Text))
Else
MsgBox("Kode barang sudah ada")
End If
T336108001.Text = ""
T536108001.Text = ""
T636108001.Text = ""
TOTAL()
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
AYI.AturPencarianDataBase("mastertransaksi", "NOTRANS", T136108001.Text, 1, INCE)
If AYI.JumlanBaris > 0 Then
MsgBox("Nomor transaksi tersebut sudah ada")
Exit Sub
End If
Dim ANHYE As New OleDb.OleDbCommand
Dim VENUS As String
VENUS = "INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & T136108001.Text & "', #" & DTP36108001.Value.Date & "#, '" & T236108001.Text & "');"
ANHYE = New OleDb.OleDbCommand(VENUS, INCE)
INCE.Open()
ANHYE.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") & "');"
ANHYE = New OleDb.OleDbCommand(EGIET, INCE)
INCE.Open()
ANHYE.ExecuteNonQuery()
INCE.Close()
Next
ANHYE.Dispose()
T136108001.Text = ""
T236108001.Text = ""
T736108001.Text = ""
T836108001.Text = ""
AI()
TOTAL()
End Sub
End Class
Public Class LATIHAN3836109044
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN3836109044_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Magfirah As New OleDb.OleDbDataAdapter
Magfirah = New OleDb.OleDbDataAdapter("select detailtransaksi.KODEBARANG, barang.namabarang, detailtransaksi.UNIT, detailtransaksi.HARGA,detailtransaksi.UNIT * detailtransaksi.HARGA AS JUMLAH from detailtransaksi inner join barang on detailtransaksi.kodebarang=barang.kodebarang WHERE NOTRANS= '" & KB36109044.Text & "'", CONECT)
DT.Rows.Clear()
Magfirah.Fill(DT)
Magfirah.Dispose()
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("kodebarang")
DT.PrimaryKey = dcp
DataGridView136109044.DataSource = DT
End Sub
Private Sub hitung()
Dim kyu As Integer
For Each r As DataRow In DT.Rows
kyu = kyu + r("JUMLAH")
Next
Tot36109044.Text = kyu
End Sub
Private Sub UN36109044_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UN36109044.TextChanged
JM36109044.Text = Val(UN36109044.Text) * Val(HR36109044.Text)
End Sub
Private Sub KB36109044_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB36109044.TextChanged
NB36109044.Text = ""
UN36109044.Text = ""
HR36109044.Text = ""
End Sub
Private Sub KB36109044_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB36109044.Leave
If KB36109044.Text.Length = 0 Then
Exit Sub
End If
cari.AturPencarianDataBase("barang", "kodebarang", KB36109044.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
KB36109044.Text = cari.DataTablenya.Rows(0).Item("KodeBarang")
NB36109044.Text = cari.DataTablenya.Rows(0).Item("namabarang")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan03803904036109044.ShowDialog = Windows.Forms.DialogResult.OK Then
KB36109044.Text = LATIHAN03803904036109044.DataGridView136109044.CurrentRow.Cells("KodeBarang").Value
NB36109044.Text = LATIHAN03803904036109044.DataGridView136109044.CurrentRow.Cells("namabarang").Value
HR36109044.Text = LATIHAN03803904036109044.DataGridView136109044.CurrentRow.Cells("HARGAJUAL").Value
Else
KB36109044.Text = ""
End If
End If
End Sub
http://hilariusmariotonapa.blogspot.com/2012/10/prosedur-penyelesaian-latihan3836110048.html
BalasHapushttp://hilariusmariotonapa.blogspot.com/2012/10/deskripsi-latihan3836110048.html
http://tiya-sri.blogspot.com/2012/10/latihan3836110044-aplikasi-komputer-4.html
BalasHapushttp://eminaomi.blogspot.com/2012/10/latihan3836110049.html
BalasHapushttp://nurrahmahrasyid2.blogspot.com/2012/10/latihan3836110042.html
BalasHapushttp://03melisa.blogspot.com/2012/10/latihan-38-36110051-apkom-4-d3b.html
BalasHapushttp://reskypurwono.blogspot.com/2012/10/prosedur-penyelesaian-latihan3836110037.html
BalasHapushttp://reskypurwono.blogspot.com/2012/10/prosedur-penyelesaian.html
http://benhilll.blogspot.com/2012/10/deskripsi-dan-prosedur-latihan3836110039.html
BalasHapushttp://rosyanausman.blogspot.com/2012/10/latihan3836110036.html
BalasHapushttp://hasfiahzain.blogspot.com/2012/10/latihan3836110052.html
BalasHapushttp://ilhaazzahra.blogspot.com/2012/10/latihan3836110033.html
BalasHapushttp://ias-anakbola.blogspot.com/2012/10/latihan3836110056.html
BalasHapushttp://rainaagrippinaa.blogspot.com/2012/10/latihan3836110032.html
BalasHapushttp://rahmisuryatama05.blogspot.com/2012/10/latihan3836110040.html
BalasHapushttp://sriayu-36110030.blogspot.com/2012/10/diskripsi-prosedur-latihan-38.html
BalasHapushttp://dewiwahyuni91.blogspot.com/2012/10/latihan3836110038.html
BalasHapushttp://andiniwarakusuma.blogspot.com/2012/10/latihan3836110034.html
BalasHapushttp://zulkiflitryputra.blogspot.com/2012/10/latihan3836110046.html
BalasHapushttp://sukadriady.blogspot.com/2012/10/latihan3836110043.html
BalasHapushttp://audryasharii.blogspot.com/2012/10/latihan3836110031.html
BalasHapushttp://ruslancullank1.blogspot.com/2012/10/deskripsilatihan3836110054.html
BalasHapushttp://burhankhang58.blogspot.com/2012/10/latihan3836110047.html
BalasHapushttp://rizka-azisah.blogspot.com/2012/11/deskripsi-penyelesaian-latihan3836110041.html
BalasHapus