Dim wiwi As New DataTable Dim dwitya As New OleDb.OleDbCommand Dim saadah As New ByIskandar.CariKeDataBaseByIskandar Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=ngekngek") Private Sub Latihan_38_46109001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dwityasaadahsuaib As New OleDb.OleDbDataAdapter dwityasaadahsuaib = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & NT46109001.Text & "'", conect) wiwi.Rows.Clear() dwityasaadahsuaib.Fill(wiwi) dwityasaadahsuaib.Dispose()
Dim dpc(1) As DataColumn dpc(0) = wiwi.Columns("kodebarang") wiwi.PrimaryKey = dpc
DATA46109001.DataSource = wiwi End Sub
Private Sub ting() Dim ting1 As Integer = 0 For Each ting2 As DataRow In wiwi.Rows ting1 += ting2("JUMLAH") Next TOT46109001.Text = ting1 End Sub
Private Sub UN46109001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UN46109001.TextChanged, HR46109001.TextChanged JM46109001.Text = Val(UN46109001.Text) * Val(HR46109001.Text) End Sub
Private Sub KB46109001_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB46109001.TextChanged NB46109001.Text = "" HR46109001.Text = "" UN46109001.Text = "" End Sub
Private Sub KB46109001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB46109001.Leave If KB46109001.Text.Length = 0 Then Exit Sub End If saadah.AturPencarianDataBase("barang", "kodebarang", KB46109001.Text, 1, conect) If saadah.JumlanBaris > 0 Then KB46109001.Text = saadah.DataTablenya.Rows(0).Item("KODEBARANG") NB46109001.Text = saadah.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang seperti itu tidak ada..") If Latihan383940_46109001.ShowDialog = Windows.Forms.DialogResult.OK Then KB46109001.Text = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("kodebarang").Value NB46109001.Text = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("namabarang").Value Else KB46109001.Text = "" End If End If End Sub
Private Sub TM46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM46109001.Click If KB46109001.Text.Length = 0 Then MsgBox("Isi Kode Barang") Exit Sub End If
If Val(UN46109001.Text) = 0 Then MsgBox("Isi Unit Barang") Exit Sub End If
If Val(HR46109001.Text) = 0 Then MsgBox("Isi Harga Barang") Exit Sub End If
Dim sule As DataRow sule = wiwi.Rows.Find(KB46109001.Text) If sule Is Nothing Then sule = wiwi.NewRow sule("KODEBARANG") = KB46109001.Text sule("NAMABARANG") = NB46109001.Text sule("UNIT") = Val(UN46109001.Text) sule("HARGA") = Val(HR46109001.Text) sule("JUMLAH") = Val(JM46109001.Text)
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...") End If ting() End Sub
Private Sub S46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles S46109001.Click If NT46109001.Text.Length = 0 Then MsgBox("Isi No Transaksi") Exit Sub End If
If JT46109001.Text.Length = 0 Then MsgBox("isi Jenis Transaksi") Exit Sub End If
If wiwi.Rows.Count = 0 Then MsgBox("Isi datatable") Exit Sub End If
saadah.AturPencarianDataBase("mastertransaksi", "notrans", NT46109001.Text, 1, conect) If saadah.JumlanBaris > 0 Then MsgBox("No Trans sudah ada") Exit Sub End If
For Each x As DataRow In wiwi.Rows dwitya = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT46109001.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect) conect.Open() dwitya.ExecuteNonQuery() conect.Close() Next dwitya.Dispose()
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 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) DataGridView136109041.DataSource = DT
nisa.Dispose()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109041.Click BARIS = DT.DefaultView(BindingContext(DT).Position).Row LATIHAN038041.nb36109041.Text = BARIS("NAMABARANG") End Sub End Class
Dim WAHDA As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet oledb:database Password=thepinkers29") Dim NIAH As New DataTable Dim ANI As DataRow
Private Sub LATIHAN38_46109051_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Z As New OleDb.OleDbDataAdapter Z = New OleDb.OleDbDataAdapter("Select BARANG.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= '" & NT_46109051.Text & "'", WAHDA) Z.Fill(NIAH) Z.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = NIAH.Columns("KODEBARANG") NIAH.PrimaryKey = dataPrimary
DG_46109051.DataSource = NIAH
End Sub
Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each Z As DataRow In NIAH.Rows TOT = TOT + Z("JUMLAH") Next TOT_46109051.Text = TOT
End Sub
Private Sub KB_46109051_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB_46109051.Leave If KB_46109051.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB_46109051.Text, 1, WAHDA) If Pencari.JumlanBaris > 0 Then KB_46109051.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") NB_46109051.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If LATIHAN383940_46109051.ShowDialog = Windows.Forms.DialogResult.OK Then KB_46109051.Text = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("KodeBarang").Value NB_46109051.Text = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("NamaBarang").Value Else KB_46109051.Text = "" End If End If End Sub
Private Sub TM_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM_46109051.Click
If KB_46109051.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If NB_46109051.Text.Length = 0 Then MsgBox("Nama barang sudah ada bos !!!") End If
If Val(U_46109051.Text) = 0 Then MsgBox("Masukkan unit barang nah !!!") Exit Sub End If
If Val(H_46109051.Text) = 0 Then MsgBox("Masukkan harga barang barang nah !!!") Exit Sub End If
ANI = NIAH.Rows.Find(KB_46109051.Text)
If ANI Is Nothing Then ANI = NIAH.NewRow ANI("KODEBARANG") = KB_46109051.Text Else MsgBox("Maaf kodebarang sudah ada bos !!!") Exit Sub End If
Private Sub KB_46109051_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_46109051.TextChanged NB_46109051.Text = "" U_46109051.Text = "" H_46109051.Text = "" End Sub
Private Sub U_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles U_46109051.TextChanged, H_46109051.TextChanged J_46109051.Text = Val(U_46109051.Text) * Val(H_46109051.Text) End Sub
Private Sub SAVE_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_46109051.Click
If NT_46109051.Text.Length = 0 Then MsgBox("No. transaksi sudah ada nah !!!") Exit Sub End If
If JT_46109051.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada nah !!!") Exit Sub End If
If NIAH.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi gang !!!") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109051.Text, 1, WAHDA) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada bos !!!") Exit Sub End If
Dim MMM As New OleDb.OleDbCommand MMM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109051.Text & "', #" & DT_46109051.Value.Month & "/" & DT_46109051.Value.Day & "/" & DT_46109051.Value.Year & "#, '" & JT_46109051.Text & "')", WAHDA) WAHDA.Open() MMM.ExecuteNonQuery() WAHDA.Close()
For Each Z As DataRow In NIAH.Rows MMM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109051.Text & "','" & Z("KODEBARANG") & "'," & Z("UNIT") & ", " & Z("HARGA") & ")", WAHDA) WAHDA.Open() MMM.ExecuteNonQuery() WAHDA.Close() MMM.Dispose() Next
Public Class Form38 Dim DILA As New DataTable Dim FADILLAH As New OleDb.OleDbCommand Dim SAGENA As New ByIskandar.CariKeDataBaseByIskandar Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=240991") Private Sub Form38_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim FADILLAHSAGENADAUDE As New OleDb.OleDbDataAdapter FADILLAHSAGENADAUDE = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & DILA1_059.Text & "'", conect) DILA.Rows.Clear() FADILLAHSAGENADAUDE.Fill(DILA) FADILLAHSAGENADAUDE.Dispose()
Dim IPIN(1) As DataColumn IPIN(0) = DILA.Columns("kodebarang") DILA.PrimaryKey = IPIN
DATA_059.DataSource = DILA End Sub
Private Sub UDHE() Dim UDHE1 As Integer = 0 For Each UDHE2 As DataRow In DILA.Rows UDHE1 += UDHE2("JUMLAH") Next TOTAL_059.Text = UDHE1 End Sub
Private Sub UNIT_059_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UNIT_059.TextChanged, HARGA_059.TextChanged JUMLAH_059.Text = Val(UNIT_059.Text) * Val(HARGA_059.Text) End Sub
Private Sub KODE_059_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KODE_059.Leave If KODE_059.Text.Length = 0 Then Exit Sub End If SAGENA.AturPencarianDataBase("barang", "kodebarang", KODE_059.Text, 1, conect) If SAGENA.JumlanBaris > 0 Then KODE_059.Text = SAGENA.DataTablenya.Rows(0).Item("KODEBARANG") NAMA_059.Text = SAGENA.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang itu tidak ada..") Exit Sub End If End Sub
Private Sub KODE_059_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KODE_059.TextChanged NAMA_059.Text = "" UNIT_059.Text = "" HARGA_059.Text = "" End Sub
Private Sub TAMBAH_059_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH_059.Click If KODE_059.Text.Length = 0 Then MsgBox("Isi Kode Barang") Exit Sub End If
If Val(UNIT_059.Text) = 0 Then MsgBox("Isi Unit Barang") Exit Sub End If
If Val(HARGA_059.Text) = 0 Then MsgBox("Isi Harga Barang") Exit Sub End If
Dim UDHE As DataRow UDHE = DILA.Rows.Find(KODE_059.Text) If UDHE Is Nothing Then UDHE = DILA.NewRow UDHE("KODEBARANG") = KODE_059.Text UDHE("NAMABARANG") = NAMA_059.Text UDHE("UNIT") = Val(UNIT_059.Text) UDHE("HARGA") = Val(HARGA_059.Text) UDHE("JUMLAH") = Val(JUMLAH_059.Text)
Private Sub SIMPAN_059_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN_059.Click If DILA1_059.Text.Length = 0 Then MsgBox("Isi No Transaksi") Exit Sub End If
If DILA2_059.Text.Length = 0 Then MsgBox("isi Jenis Transaksi") Exit Sub End If
If DILA.Rows.Count = 0 Then MsgBox("Isi datatable") Exit Sub End If
SAGENA.AturPencarianDataBase("mastertransaksi", "notrans", DILA1_059.Text, 1, conect) If SAGENA.JumlanBaris > 0 Then MsgBox("No Trans sudah ada") Exit Sub End If
For Each x As DataRow In DILA.Rows FADILLAH = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & DILA1_059.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect) conect.Open() FADILLAH.ExecuteNonQuery() conect.Close() Next FADILLAH.Dispose()
DILA1_059.Text = "" DILA2_059.Text = ""
DILA.Rows.Clear() UDHE() End Sub
Private Sub DILA1_059_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DILA1_059.TextChanged
Dim ai As New DataTable Dim nun As New OleDb.OleDbCommand Dim ainun As New ByIskandar.CariKeDataBaseByIskandar Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=ainun") Private Sub LATIHAN038_46109030_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim ainunasadik As New OleDb.OleDbDataAdapter ainunasadik = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & nt_46109030.Text & "'", conect) ai.Rows.Clear() ainunasadik.Fill(ai) ainunasadik.Dispose()
Dim dpc(1) As DataColumn dpc(0) = ai.Columns("kodebarang") ai.PrimaryKey = dpc
dg_46109030.DataSource = ai End Sub
Private Sub ari() Dim ari1 As Integer = 0 For Each ari2 As DataRow In ai.Rows ari1 += ari2("JUMLAH") Next Tot_46109030.Text = ari1
End Sub
Private Sub un_46109030_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_46109030.TextChanged, hr_46109030.TextChanged jm_46109030.Text = Val(un_46109030.Text) * Val(hr_46109030.Text) End Sub
Private Sub kb_46109030_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_46109030.TextChanged nb_46109030.Text = "" un_46109030.Text = "" hr_46109030.Text = "" End Sub
Private Sub kb_46109030_leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_46109030.Leave If kb_46109030.Text.Length = 0 Then Exit Sub End If ainun.AturPencarianDataBase("barang", "kodebarang", kb_46109030.Text, 1, conect) If ainun.JumlanBaris > 0 Then kb_46109030.Text = ainun.DataTablenya.Rows(0).Item("KODEBARANG") nb_46109030.Text = ainun.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang itu tidak ada..") Exit Sub End If End Sub
Private Sub t_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t_46109030.Click If kb_46109030.Text.Length = 0 Then MsgBox("Isi Kode Barang") Exit Sub End If
If Val(un_46109030.Text) = 0 Then MsgBox("Isi Unit Barang") Exit Sub End If
If Val(hr_46109030.Text) = 0 Then MsgBox("Isi Harga Barang") Exit Sub End If
Dim sadik As DataRow sadik = ai.Rows.Find(kb_46109030.Text) If sadik Is Nothing Then sadik = ai.NewRow sadik("KODEBARANG") = kb_46109030.Text sadik("NAMABARANG") = nb_46109030.Text sadik("UNIT") = Val(un_46109030.Text) sadik("HARGA") = Val(hr_46109030.Text) sadik("JUMLAH") = Val(jm_46109030.Text)
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...") End If ari() End Sub
Private Sub s_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109030.Click If nt_46109030.Text.Length = 0 Then MsgBox("Isi No Transaksi") Exit Sub End If
If jt_46109030.Text.Length = 0 Then MsgBox("isi Jenis Transaksi") Exit Sub End If
If ai.Rows.Count = 0 Then MsgBox("Isi datatable") Exit Sub End If
ainun.AturPencarianDataBase("mastertransaksi", "notrans", nt_46109030.Text, 1, conect) If ainun.JumlanBaris > 0 Then MsgBox("No Trans sudah ada") Exit Sub End If
For Each x As DataRow In ai.Rows nun = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt_46109030.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect) conect.Open() nun.ExecuteNonQuery() conect.Close() Next nun.Dispose()
Public Class LATIHAN38_46109021 Dim KONEKSI As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=46109021") Dim NOVI As New DataTable Dim CARI As New ByIskandar.CariKeDataBaseByIskandar Dim SERU As New OleDb.OleDbCommand
Private Sub LATIHAN38_46109021_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim KUDA As New OleDb.OleDbDataAdapter KUDA = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & NT_46109021.Text & "'", KONEKSI) NOVI.Rows.Clear() KUDA.Fill(NOVI) KUDA.Dispose()
Dim DC(1) As DataColumn DC(0) = NOVI.Columns("kodebarang") NOVI.PrimaryKey = DC
DGV_46109021.DataSource = NOVI End Sub Private Sub Z() Dim ZA As Integer = 0 For Each ZB As DataRow In NOVI.Rows ZA += ZB("JUMLAH") Next TOT_46109021.Text = ZA End Sub
Private Sub U_46109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles U_46109021.TextChanged, H_46109021.TextChanged J_46109021.Text = Val(U_46109021.Text) * Val(H_46109021.Text) End Sub Private Sub KB_46109021_LEAVE(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_46109021.Leave If KB_46109021.Text.Length = 0 Then Exit Sub End If CARI.AturPencarianDataBase("barang", "kodebarang", KB_46109021.Text, 1, KONEKSI) If CARI.JumlanBaris > 0 Then KB_46109021.Text = CARI.DataTablenya.Rows(0).Item("KODEBARANG") NB_46109021.Text = CARI.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang itu tidak ada..") Exit Sub End If End Sub Private Sub KB_46109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_46109021.TextChanged NB_46109021.Text = "" U_46109021.Text = "" H_46109021.Text = "" End Sub
Private Sub TAM_46109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAM_46109021.Click If KB_46109021.Text.Length = 0 Then MsgBox("Isi Kode Barang") Exit Sub End If
If Val(U_46109021.Text) = 0 Then MsgBox("Isi Unit Barang") Exit Sub End If
If Val(H_46109021.Text) = 0 Then MsgBox("Isi Harga Barang") Exit Sub End If
Dim DR As DataRow DR = NOVI.Rows.Find(KB_46109021.Text) If DR Is Nothing Then DR = NOVI.NewRow DR("KODEBARANG") = KB_46109021.Text DR("NAMABARANG") = NB_46109021.Text DR("UNIT") = Val(U_46109021.Text) DR("HARGA") = Val(H_46109021.Text) DR("JUMLAH") = Val(J_46109021.Text)
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...") End If Z() End Sub
Private Sub SIM_46109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIM_46109021.Click If NT_46109021.Text.Length = 0 Then MsgBox("Isi No Transaksi") Exit Sub End If
If JT_46109021.Text.Length = 0 Then MsgBox("isi Jenis Transaksi") Exit Sub End If
If NOVI.Rows.Count = 0 Then MsgBox(" Isi datatable") Exit Sub End If
CARI.AturPencarianDataBase("mastertransaksi", "notrans", NT_46109021.Text, 1, KONEKSI) If CARI.JumlanBaris > 0 Then MsgBox("No Trans sudah ada") Exit Sub End If
For Each x As DataRow In NOVI.Rows SERU = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT_46109021.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", KONEKSI) KONEKSI.Open() SERU.ExecuteNonQuery() KONEKSI.Close() Next SERU.Dispose()
Public Class LATIHAN038_46109054 Dim DWI As New DataTable Dim MUSTIKA As New OleDb.OleDbCommand Dim CHAERUNNISA As New ByIskandar.CariKeDataBaseByIskandar Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=wiwi") Private Sub LATIHAN038_46109054_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim MUSTIKACHAERUNNISAMULYADI As New OleDb.OleDbDataAdapter MUSTIKACHAERUNNISAMULYADI = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & ww1_46109054.Text & "'", conect) DWI.Rows.Clear() MUSTIKACHAERUNNISAMULYADI.Fill(DWI) MUSTIKACHAERUNNISAMULYADI.Dispose()
Dim WHI_WHI(1) As DataColumn WHI_WHI(0) = DWI.Columns("kodebarang") DWI.PrimaryKey = WHI_WHI
DGV_46109054.DataSource = DWI End Sub
Private Sub WHI_CHA() Dim WHI_CHA1 As Integer = 0 For Each WHI_CHA2 As DataRow In DWI.Rows WHI_CHA1 += WHI_CHA2("JUMLAH") Next ww8_46109054.Text = WHI_CHA1 End Sub
Private Sub ww5_46109054_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ww5_46109054.TextChanged, ww6_46109054.TextChanged ww7_46109054.Text = Val(ww5_46109054.Text) * Val(ww6_46109054.Text) End Sub
Private Sub ww3_46109054_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles ww3_46109054.Leave If ww3_46109054.Text.Length = 0 Then Exit Sub End If CHAERUNNISA.AturPencarianDataBase("barang", "kodebarang", ww3_46109054.Text, 1, conect) If CHAERUNNISA.JumlanBaris > 0 Then ww3_46109054.Text = CHAERUNNISA.DataTablenya.Rows(0).Item("KODEBARANG") ww4_46109054.Text = CHAERUNNISA.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang itu tidak ada..") Exit Sub End If End Sub
Private Sub ww3_46109054_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ww3_46109054.TextChanged ww4_46109054.Text = "" ww5_46109054.Text = "" ww6_46109054.Text = "" End Sub
Private Sub Dwi1_46109054_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi1_46109054.Click If ww3_46109054.Text.Length = 0 Then MsgBox("Isi Kode Barang") Exit Sub End If
If Val(ww5_46109054.Text) = 0 Then MsgBox("Isi Unit Barang") Exit Sub End If
If Val(ww6_46109054.Text) = 0 Then MsgBox("Isi Harga Barang") Exit Sub End If
Dim WHI_CHA As DataRow WHI_CHA = DWI.Rows.Find(ww3_46109054.Text) If WHI_CHA Is Nothing Then WHI_CHA = DWI.NewRow WHI_CHA("KODEBARANG") = ww3_46109054.Text WHI_CHA("NAMABARANG") = ww4_46109054.Text WHI_CHA("UNIT") = Val(ww5_46109054.Text) WHI_CHA("HARGA") = Val(ww6_46109054.Text) WHI_CHA("JUMLAH") = Val(ww7_46109054.Text)
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...") End If End Sub
Private Sub Dwi2_46109054_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi2_46109054.Click If ww1_46109054.Text.Length = 0 Then MsgBox("Isi No Transaksi") Exit Sub End If
If ww2_46109054.Text.Length = 0 Then MsgBox("isi Jenis Transaksi") Exit Sub End If
If DWI.Rows.Count = 0 Then MsgBox("Isi datatable") Exit Sub End If
CHAERUNNISA.AturPencarianDataBase("mastertransaksi", "notrans", ww1_46109054.Text, 1, conect) If CHAERUNNISA.JumlanBaris > 0 Then MsgBox("No Trans sudah ada") Exit Sub End If
For Each x As DataRow In DWI.Rows MUSTIKA = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & ww1_46109054.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect) conect.Open() MUSTIKA.ExecuteNonQuery() conect.Close() Next MUSTIKA.Dispose()
ww1_46109054.Text = "" ww2_46109054.Text = ""
DWI.Rows.Clear() WHI_CHA() End Sub
Private Sub ww1_46109054_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ww1_46109054.TextChanged
Dim ff As New DataTable Dim bhe As New OleDb.OleDbCommand Dim bheku As New ByIskandar.CfransKeDataBaseByIskandar Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=bheku") Private Sub LATIHAN038_46109027_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim febianafransiskus As New OleDb.OleDbDataAdapter febianafransiskus = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detffltransaksi.UNIT, detffltransaksi.HARGA, detffltransaksi.unit*harga as JUMLAH from barang inner join detffltransaksi on barang.kodebarang = detffltransaksi.kodebarang where notrans ='" & nt_46109027.Text & "'", conect) ff.Rows.Clear() febianafransiskus.Fill(ff) febianafransiskus.Dispose()
Dim dpc(1) As DataColumn dpc(0) = ff.Columns("kodebarang") ff.PrimaryKey = dpc
dg_46109027.DataSource = ff End Sub
Private Sub frans() Dim frans1 As Integer = 0 For Each frans2 As DataRow In ff.Rows frans1 += frans2("JUMLAH") Next Tot_46109027.Text = frans1
End Sub
Private Sub un_46109027_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_46109027.TextChanged, hr_46109027.TextChanged jm_46109027.Text = Val(un_46109027.Text) * Val(hr_46109027.Text) End Sub
Private Sub kb_46109027_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_46109027.TextChanged nb_46109027.Text = "" un_46109027.Text = "" hr_46109027.Text = "" End Sub
Private Sub kb_46109027_leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_46109027.Leave If kb_46109027.Text.Length = 0 Then Exit Sub End If bheku.AturPencfransanDataBase("barang", "kodebarang", kb_46109027.Text, 1, conect) If bheku.JumlanBfranss > 0 Then kb_46109027.Text = bheku.DataTablenya.Rows(0).Item("KODEBARANG") nb_46109027.Text = bheku.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang itu tidak ada..") Exit Sub End If End Sub
Private Sub t_46109027_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t_46109027.Click If kb_46109027.Text.Length = 0 Then MsgBox("Isi Kode Barang") Exit Sub End If
If Val(un_46109027.Text) = 0 Then MsgBox("Isi Unit Barang") Exit Sub End If
If Val(hr_46109027.Text) = 0 Then MsgBox("Isi Harga Barang") Exit Sub End If
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lffn...") End If frans() End Sub
Private Sub s_46109027_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109027.Click If nt_46109027.Text.Length = 0 Then MsgBox("Isi No Transaksi") Exit Sub End If
If jt_46109027.Text.Length = 0 Then MsgBox("isi Jenis Transaksi") Exit Sub End If
If ff.Rows.Count = 0 Then MsgBox("Isi datatable") Exit Sub End If
bheku.AturPencfransanDataBase("mastertransaksi", "notrans", nt_46109027.Text, 1, conect) If bheku.JumlanBfranss > 0 Then MsgBox("No Trans sudah ada") Exit Sub End If
For Each x As DataRow In ff.Rows bhe = New OleDb.OleDbCommand("insert into detffltransaksi (notrans, kodebarang, unit, harga) values ('" & nt_46109027.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect) conect.Open() bhe.ExecuteNonQuery() conect.Close() Next bhe.Dispose()
Public Class Latihan383940_46109054 Dim DWI As New DataTable Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=wiwi")
Private Sub Latihan383940_46109054_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim wiwi As New OleDb.OleDbDataAdapter wiwi = New OleDb.OleDbDataAdapter("SELECT * FROM BARANG", conect) DWI.Rows.Clear() wiwi.Fill(DWI) wiwi.Dispose()
Public Class LATIHAN_038_46109053 Dim SAE As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data sounitrce= " & Application.StartunitpPathrg & "\DATAMAJUMEMUNITK.accdb;jumet oledb:database Password=thrgepinkers29") Dim INDAH As New DataTable Dim YANI As DataRow
Private Sub LATIHAN_038_46109053_Load(ByVal sender As System.object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Z As New OleDb.OleDbDataAdapter Z = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNITNIT, DETAILTRANSAKSI.HRGARGA, DETAILTRANSAKSI.UNITNIT*DETAILTRANSAKSI.HRGARGA AS JUMLAH from DETAILTRANSAKSI INNER JUMOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHRGERE NOTRANS= '" & NT_053.Text & "'", SAE) Z.Fill(INDAH) Z.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = INDAH.Columns("KODEBARANG") INDAH.PrimaryKey = dataPrimary
DATA_053.DataSource = INDAH
End Sub
Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each Z As DataRow In INDAH.Rows TOT = TOT + Z("JUMLAH") Next TOT_053.Text = TOT
End Sub
Private Sub KB_053_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB_053.Leave If KB_053.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB_053.Text, 1, SAE) If Pencari.jumlanbaris > 0 Then KB_053.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") NB_053.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If LATIHAN383940_053.showDialog = Windows.Forms.DialogResult.OK Then KB_053.Text = LATIHAN383940_053.DATA_053.CunitrrentRow.Cells("KodeBarang").Valunite NB_053.Text = LATIHAN383940_053.DATA_053.CunitrrentRow.Cells("NamaBarang").Valunite Else KB_053.Text = "" End If End If End Sub
Private Sub KB_053_TextChrganged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_053.TextChrganged NB_053.Text = "" UNIT_053.Text = "" HRG_053.Text = "" End Sub
Private Sub UNIT_TextChrganged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UNIT_053.TextChrganged, HRG_053.TextChrganged JUM_053.Text = Val(UNIT_053.Text) * Val(HRG_053.Text) End Sub
Private Sub SAVE_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_053.Click
If NT_053.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") Exit Sub End If
If JT_053.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If INDAH.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_053.Text, 1, SAE) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim MMM As New OleDb.OleDbCommand MMM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JUMENISTRANSAKSI) VALUNITES ('" & NT_053.Text & "', #" & DT_053.Valunite.Monthrg & "/" & DT_053.Valunite.Day & "/" & DT_053.Valunite.Year & "#, '" & JT_053.Text & "')", SAE) SAE.Open() MMM.ExecuteNonQuery() SAE.Close()
For Each Z As DataRow In INDAH.Rows MMM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNITNIT, HRGARGA) VALUNITES ('" & NT_053.Text & "','" & Z("KODEBARANG") & "'," & Z("UNITNIT") & ", " & Z("HRGARGA") & ")", SAE) SAE.Open() MMM.ExecuteNonQuery() SAE.Close() MMM.Dispose() Next
ARYANDIRA(46109034) Public Class Latihan38_034 Dim dt As New DataTable Dim cm As New OleDb.OleDbCommand Dim dira As New ByIskandar.CariKeDataBaseByIskandar Dim satu As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Datamajemuk.ACCDB")
Private Sub Latihan38_034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim a As New OleDb.OleDbDataAdapter a = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETAILTRANSAKSI ON BARANG.KODEBARANG = DETAILTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & aa_034.Text & "'", satu) a.Fill(dt) a.Dispose()
Dim dc(1) As DataColumn dc(0) = dt.Columns("Kodebarang") dt.PrimaryKey = dc
dgv.DataSource = dt End Sub
Private Sub ira() Dim ira1 As Integer = 0For Each ira2 As DataRow In dt.Rows ira1 += ira2("JUMLAH") Next Jj_034.Text = ira1 End Sub
Private Sub ff_034_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ff_034.TextChanged, gg_034.TextChanged Hh_034.Text = Val(ff_034.Text) * Val(gg_034.Text) End Sub
Private Sub dd_034_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles dd_034.Leave If dd_034.Text.Length = 0 Then Exit Sub End If dira.AturPencarianDataBase("barang", "kodebarang", dd_034.Text, 1, satu) If dira.JumlanBaris > 0 Then Dd_034.Text = dira.DataTablenya.Rows(0).Item("KODEBARANG") Ee_034.Text = dira.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang seperti itu tidak ada..") If Latihan_38_39_40_034.ShowDialog = Windows.Forms.DialogResult.OK Then Dd_034.Text = Latihan_38_39_40_034.dgv.CurrentRow.Cells("kodebarang").Value Ee_034.Text = Latihan_38_39_40_034.dgv.CurrentRow.Cells("namabarang").Value Else Dd_034.Text = "" End If End If End Sub
Private Sub dd_034_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dd_034.TextChanged Ee_034.Text = "" Ff_034.Text = "" Gg_034.Text = "" End Sub Private Sub ii_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ii_034.Click If dd_034.Text.Length = 0 Then MsgBox("Isi rong itu Kode Barang ") Exit Sub End If
If Val(ff_034.Text) = 0 Then MsgBox("Isi rong itu Unit ") Exit Sub End If
If Val(gg_034.Text) = 0 Then MsgBox("Isi rong itu Harga ")
Dim dr As DataRow dr = dt.Rows.Find(dd_034.Text) If dr Is Nothing Then dr = dt.NewRow dr("KODEBARANG") = dd_034.Text dr("NAMABARANG") = ee_034.Text dr("UNIT") = ff_034.Text dr("HARGA") = gg_034.Text dr("JUMLAH") = hh_034.Text
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain") End If ira () End Sub
Private Sub kk_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kk_034.Click If aa_034.Text.Length = 0 Then MsgBox("Isi rong itu No Transaksi “) Exit Sub End If
If cc_034.Text.Length = 0 Then MsgBox("Isi rong itu Jenis Transaksi ") Exit Sub End If If dt.Rows.Count = 0 Then MsgBox("Isi rong itu datatable") Exit Sub End If
dira.AturPencarianDataBase("mastertransaksi", "notrans", aa_034.Text, 1, satu) If dira.JumlanBaris > 0 Then MsgBox("Adami No Transaksi seperti itu") Exit Sub End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & aa_034.Text & "',#" & bb_034.Value.Month & "/" & bb_034.Value.Day & "/" & bb_034.Value.Year & "#,'" & cc_034.Text & "')", satu) satu.Open() cm.ExecuteNonQuery() satu.Close() For Each x As DataRow In dt.Rows cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & aa_034.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", satu) satu.Open() cm.ExecuteNonQuery() satu.Close() Next cm.Dispose()
Dim FAHRUL As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet oledb:database Password=arul") Dim ARUL As New DataTable Dim APRIL As DataRow
Private Sub LATIHAN38_46109005_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Z As New OleDb.OleDbDataAdapter Z = New OleDb.OleDbDataAdapter("Select BARANG.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= '" & NT_46109005.Text & "'", FAHRUL) Z.Fill(ARUL) Z.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = ARUL.Columns("KODEBARANG") ARUL.PrimaryKey = dataPrimary
DG_46109005.DataSource = ARUL
End Sub
Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each Z As DataRow In ARUL.Rows TOT = TOT + Z("JUMLAH") Next TOT_46109005.Text = TOT
End Sub
Private Sub KB_46109005_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB_46109005.Leave If KB_46109005.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB_46109005.Text, 1, FAHRUL) If Pencari.JumlanBaris > 0 Then KB_46109005.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") NB_46109005.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If Latihan383940_46109005.ShowDialog = Windows.Forms.DialogResult.OK Then KB_46109005.Text = Latihan383940_46109005.DATA46109005.CurrentRow.Cells("KodeBarang").Value NB_46109005.Text = Latihan383940_46109005.DATA46109005.CurrentRow.Cells("NamaBarang").Value Else KB_46109005.Text = "" End If End If End Sub
Private Sub KB_46109005_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_46109005.TextChanged NB_46109005.Text = "" U_46109005.Text = "" H_46109005.Text = "" End Sub
Private Sub U_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles U_46109005.TextChanged, H_46109005.TextChanged J_46109005.Text = Val(U_46109005.Text) * Val(H_46109005.Text) End Sub Private Sub TM_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM_46109005.Click
If KB_46109005.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If NB_46109005.Text.Length = 0 Then MsgBox("Nama barang sudah ada") End If
If Val(U_46109005.Text) = 0 Then MsgBox("Masukkan unit barang") Exit Sub End If
If Val(H_46109005.Text) = 0 Then MsgBox("Masukkan harga barang barang") Exit Sub End If
Private Sub SAVE_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_46109005.Click
If NT_46109005.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") Exit Sub End If
If JT_46109005.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If ARUL.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109005.Text, 1, FAHRUL) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim MMM As New OleDb.OleDbCommand MMM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109005.Text & "', #" & DT_46109005.Value.Month & "/" & DT_46109005.Value.Day & "/" & DT_46109005.Value.Year & "#, '" & JT_46109005.Text & "')", FAHRUL) FAHRUL.Open() MMM.ExecuteNonQuery() FAHRUL.Close()
For Each Z As DataRow In ARUL.Rows MMM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109005.Text & "','" & Z("KODEBARANG") & "'," & Z("UNIT") & ", " & Z("HARGA") & ")", FAHRUL) FAHRUL.Open() MMM.ExecuteNonQuery() FAHRUL.Close() MMM.Dispose() Next
If Val(U_46109021.Text) = 0 Then MsgBox("Isi Unit Barang") Exit Sub End If
If Val(H_46109021.Text) = 0 Then MsgBox("Isi Harga Barang") Exit Sub End If
Dim DR As DataRow DR = NOVI.Rows.Find(KB_46109021.Text) If DR Is Nothing Then DR = NOVI.NewRow DR("KODEBARANG") = KB_46109021.Text DR("NAMABARANG") = NB_46109021.Text DR("UNIT") = Val(U_46109021.Text) DR("HARGA") = Val(H_46109021.Text) DR("JUMLAH") = Val(J_46109021.Text)
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...") End If Z() End Sub
Private Sub SIM_46109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIM_46109021.Click If NT_46109021.Text.Length = 0 Then MsgBox("Isi No Transaksi") Exit Sub End If
If JT_46109021.Text.Length = 0 Then MsgBox("isi Jenis Transaksi") Exit Sub End If
If NOVI.Rows.Count = 0 Then MsgBox(" Isi datatable") Exit Sub End If
CARI.AturPencarianDataBase("mastertransaksi", "notrans", NT_46109021.Text, 1, KONEKSI) If CARI.JumlanBaris > 0 Then MsgBox("No Trans sudah ada") Exit Sub End If
For Each x As DataRow In NOVI.Rows SERU = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT_46109021.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", KONEKSI) KONEKSI.Open() SERU.ExecuteNonQuery() KONEKSI.Close() Next SERU.Dispose()
Public Class Latihan038_46109001
BalasHapusDim wiwi As New DataTable
Dim dwitya As New OleDb.OleDbCommand
Dim saadah As New ByIskandar.CariKeDataBaseByIskandar
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=ngekngek")
Private Sub Latihan_38_46109001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dwityasaadahsuaib As New OleDb.OleDbDataAdapter
dwityasaadahsuaib = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & NT46109001.Text & "'", conect)
wiwi.Rows.Clear()
dwityasaadahsuaib.Fill(wiwi)
dwityasaadahsuaib.Dispose()
Dim dpc(1) As DataColumn
dpc(0) = wiwi.Columns("kodebarang")
wiwi.PrimaryKey = dpc
DATA46109001.DataSource = wiwi
End Sub
Private Sub ting()
Dim ting1 As Integer = 0
For Each ting2 As DataRow In wiwi.Rows
ting1 += ting2("JUMLAH")
Next
TOT46109001.Text = ting1
End Sub
Private Sub UN46109001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UN46109001.TextChanged, HR46109001.TextChanged
JM46109001.Text = Val(UN46109001.Text) * Val(HR46109001.Text)
End Sub
Private Sub KB46109001_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB46109001.TextChanged
NB46109001.Text = ""
HR46109001.Text = ""
UN46109001.Text = ""
End Sub
Private Sub KB46109001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB46109001.Leave
If KB46109001.Text.Length = 0 Then
Exit Sub
End If
saadah.AturPencarianDataBase("barang", "kodebarang", KB46109001.Text, 1, conect)
If saadah.JumlanBaris > 0 Then
KB46109001.Text = saadah.DataTablenya.Rows(0).Item("KODEBARANG")
NB46109001.Text = saadah.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang seperti itu tidak ada..")
If Latihan383940_46109001.ShowDialog = Windows.Forms.DialogResult.OK Then
KB46109001.Text = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("kodebarang").Value
NB46109001.Text = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("namabarang").Value
Else
KB46109001.Text = ""
End If
End If
End Sub
Private Sub TM46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM46109001.Click
BalasHapusIf KB46109001.Text.Length = 0 Then
MsgBox("Isi Kode Barang")
Exit Sub
End If
If Val(UN46109001.Text) = 0 Then
MsgBox("Isi Unit Barang")
Exit Sub
End If
If Val(HR46109001.Text) = 0 Then
MsgBox("Isi Harga Barang")
Exit Sub
End If
Dim sule As DataRow
sule = wiwi.Rows.Find(KB46109001.Text)
If sule Is Nothing Then
sule = wiwi.NewRow
sule("KODEBARANG") = KB46109001.Text
sule("NAMABARANG") = NB46109001.Text
sule("UNIT") = Val(UN46109001.Text)
sule("HARGA") = Val(HR46109001.Text)
sule("JUMLAH") = Val(JM46109001.Text)
wiwi.Rows.Add(sule)
KB46109001.Text = ""
UN46109001.Text = ""
HR46109001.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...")
End If
ting()
End Sub
Private Sub S46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles S46109001.Click
If NT46109001.Text.Length = 0 Then
MsgBox("Isi No Transaksi")
Exit Sub
End If
If JT46109001.Text.Length = 0 Then
MsgBox("isi Jenis Transaksi")
Exit Sub
End If
If wiwi.Rows.Count = 0 Then
MsgBox("Isi datatable")
Exit Sub
End If
saadah.AturPencarianDataBase("mastertransaksi", "notrans", NT46109001.Text, 1, conect)
If saadah.JumlanBaris > 0 Then
MsgBox("No Trans sudah ada")
Exit Sub
End If
dwitya = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT46109001.Text & "',#" & T46109001.Value.Month & "/" & T46109001.Value.Day & "/" & T46109001.Value.Year & "#,'" & JT46109001.Text & "')", conect)
conect.Open()
dwitya.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In wiwi.Rows
dwitya = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT46109001.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect)
conect.Open()
dwitya.ExecuteNonQuery()
conect.Close()
Next
dwitya.Dispose()
NT46109001.Text = ""
JT46109001.Text = ""
wiwi.Rows.Clear()
ting()
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=12")
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)
DataGridView136109041.DataSource = DT
nisa.Dispose()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button136109041.Click
BARIS = DT.DefaultView(BindingContext(DT).Position).Row
LATIHAN038041.nb36109041.Text = BARIS("NAMABARANG")
End Sub
End Class
Public Class LATIHAN38_46109051
BalasHapusDim WAHDA As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet oledb:database Password=thepinkers29")
Dim NIAH As New DataTable
Dim ANI As DataRow
Private Sub LATIHAN38_46109051_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Z As New OleDb.OleDbDataAdapter
Z = New OleDb.OleDbDataAdapter("Select BARANG.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= '" & NT_46109051.Text & "'", WAHDA)
Z.Fill(NIAH)
Z.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = NIAH.Columns("KODEBARANG")
NIAH.PrimaryKey = dataPrimary
DG_46109051.DataSource = NIAH
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each Z As DataRow In NIAH.Rows
TOT = TOT + Z("JUMLAH")
Next
TOT_46109051.Text = TOT
End Sub
Private Sub KB_46109051_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB_46109051.Leave
If KB_46109051.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB_46109051.Text, 1, WAHDA)
If Pencari.JumlanBaris > 0 Then
KB_46109051.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
NB_46109051.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If LATIHAN383940_46109051.ShowDialog = Windows.Forms.DialogResult.OK Then
KB_46109051.Text = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("KodeBarang").Value
NB_46109051.Text = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("NamaBarang").Value
Else
KB_46109051.Text = ""
End If
End If
End Sub
Private Sub TM_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM_46109051.Click
If KB_46109051.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If NB_46109051.Text.Length = 0 Then
MsgBox("Nama barang sudah ada bos !!!")
End If
If Val(U_46109051.Text) = 0 Then
MsgBox("Masukkan unit barang nah !!!")
Exit Sub
End If
If Val(H_46109051.Text) = 0 Then
MsgBox("Masukkan harga barang barang nah !!!")
Exit Sub
End If
ANI = NIAH.Rows.Find(KB_46109051.Text)
If ANI Is Nothing Then
ANI = NIAH.NewRow
ANI("KODEBARANG") = KB_46109051.Text
Else
MsgBox("Maaf kodebarang sudah ada bos !!!")
Exit Sub
End If
ANI = NIAH.NewRow
ANI("KODEBARANG") = KB_46109051.Text
ANI("NAMABARANG") = NB_46109051.Text
ANI("UNIT") = U_46109051.Text
ANI("HARGA") = H_46109051.Text
ANI("JUMLAH") = J_46109051.Text
NIAH.Rows.Add(ANI)
KB_46109051.Text = ""
NB_46109051.Text = ""
U_46109051.Text = ""
H_46109051.Text = ""
TOTALJUMLAH()
End Sub
Private Sub KB_46109051_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_46109051.TextChanged
BalasHapusNB_46109051.Text = ""
U_46109051.Text = ""
H_46109051.Text = ""
End Sub
Private Sub U_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles U_46109051.TextChanged, H_46109051.TextChanged
J_46109051.Text = Val(U_46109051.Text) * Val(H_46109051.Text)
End Sub
Private Sub SAVE_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_46109051.Click
If NT_46109051.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada nah !!!")
Exit Sub
End If
If JT_46109051.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada nah !!!")
Exit Sub
End If
If NIAH.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi gang !!!")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109051.Text, 1, WAHDA)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada bos !!!")
Exit Sub
End If
Dim MMM As New OleDb.OleDbCommand
MMM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109051.Text & "', #" & DT_46109051.Value.Month & "/" & DT_46109051.Value.Day & "/" & DT_46109051.Value.Year & "#, '" & JT_46109051.Text & "')", WAHDA)
WAHDA.Open()
MMM.ExecuteNonQuery()
WAHDA.Close()
For Each Z As DataRow In NIAH.Rows
MMM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109051.Text & "','" & Z("KODEBARANG") & "'," & Z("UNIT") & ", " & Z("HARGA") & ")", WAHDA)
WAHDA.Open()
MMM.ExecuteNonQuery()
WAHDA.Close()
MMM.Dispose()
Next
NT_46109051.Text = ""
JT_46109051.Text = ""
J_46109051.Text = ""
NIAH.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
Public Class Form38
BalasHapusDim DILA As New DataTable
Dim FADILLAH As New OleDb.OleDbCommand
Dim SAGENA As New ByIskandar.CariKeDataBaseByIskandar
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=240991")
Private Sub Form38_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim FADILLAHSAGENADAUDE As New OleDb.OleDbDataAdapter
FADILLAHSAGENADAUDE = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & DILA1_059.Text & "'", conect)
DILA.Rows.Clear()
FADILLAHSAGENADAUDE.Fill(DILA)
FADILLAHSAGENADAUDE.Dispose()
Dim IPIN(1) As DataColumn
IPIN(0) = DILA.Columns("kodebarang")
DILA.PrimaryKey = IPIN
DATA_059.DataSource = DILA
End Sub
Private Sub UDHE()
Dim UDHE1 As Integer = 0
For Each UDHE2 As DataRow In DILA.Rows
UDHE1 += UDHE2("JUMLAH")
Next
TOTAL_059.Text = UDHE1
End Sub
Private Sub UNIT_059_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UNIT_059.TextChanged, HARGA_059.TextChanged
JUMLAH_059.Text = Val(UNIT_059.Text) * Val(HARGA_059.Text)
End Sub
Private Sub KODE_059_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KODE_059.Leave
If KODE_059.Text.Length = 0 Then
Exit Sub
End If
SAGENA.AturPencarianDataBase("barang", "kodebarang", KODE_059.Text, 1, conect)
If SAGENA.JumlanBaris > 0 Then
KODE_059.Text = SAGENA.DataTablenya.Rows(0).Item("KODEBARANG")
NAMA_059.Text = SAGENA.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang itu tidak ada..")
Exit Sub
End If
End Sub
Private Sub KODE_059_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KODE_059.TextChanged
NAMA_059.Text = ""
UNIT_059.Text = ""
HARGA_059.Text = ""
End Sub
Private Sub TAMBAH_059_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH_059.Click
If KODE_059.Text.Length = 0 Then
MsgBox("Isi Kode Barang")
Exit Sub
End If
If Val(UNIT_059.Text) = 0 Then
MsgBox("Isi Unit Barang")
Exit Sub
End If
If Val(HARGA_059.Text) = 0 Then
MsgBox("Isi Harga Barang")
Exit Sub
End If
Dim UDHE As DataRow
UDHE = DILA.Rows.Find(KODE_059.Text)
If UDHE Is Nothing Then
UDHE = DILA.NewRow
UDHE("KODEBARANG") = KODE_059.Text
UDHE("NAMABARANG") = NAMA_059.Text
UDHE("UNIT") = Val(UNIT_059.Text)
UDHE("HARGA") = Val(HARGA_059.Text)
UDHE("JUMLAH") = Val(JUMLAH_059.Text)
DILA.Rows.Add(UDHE)
KODE_059.Text = ""
UNIT_059.Text = ""
HARGA_059.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...")
End If
End Sub
Private Sub SIMPAN_059_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN_059.Click
BalasHapusIf DILA1_059.Text.Length = 0 Then
MsgBox("Isi No Transaksi")
Exit Sub
End If
If DILA2_059.Text.Length = 0 Then
MsgBox("isi Jenis Transaksi")
Exit Sub
End If
If DILA.Rows.Count = 0 Then
MsgBox("Isi datatable")
Exit Sub
End If
SAGENA.AturPencarianDataBase("mastertransaksi", "notrans", DILA1_059.Text, 1, conect)
If SAGENA.JumlanBaris > 0 Then
MsgBox("No Trans sudah ada")
Exit Sub
End If
FADILLAH = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & DILA1_059.Text & "',#" & TGL_059.Value.Month & "/" & TGL_059.Value.Day & "/" & TGL_059.Value.Year & "#,'" & DILA2_059.Text & "')", conect)
conect.Open()
FADILLAH.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In DILA.Rows
FADILLAH = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & DILA1_059.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect)
conect.Open()
FADILLAH.ExecuteNonQuery()
conect.Close()
Next
FADILLAH.Dispose()
DILA1_059.Text = ""
DILA2_059.Text = ""
DILA.Rows.Clear()
UDHE()
End Sub
Private Sub DILA1_059_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DILA1_059.TextChanged
End Sub
End Class
LATIHAN 38
BalasHapusPublic Class LATIHAN038_46109030
Dim ai As New DataTable
Dim nun As New OleDb.OleDbCommand
Dim ainun As New ByIskandar.CariKeDataBaseByIskandar
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=ainun")
Private Sub LATIHAN038_46109030_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ainunasadik As New OleDb.OleDbDataAdapter
ainunasadik = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & nt_46109030.Text & "'", conect)
ai.Rows.Clear()
ainunasadik.Fill(ai)
ainunasadik.Dispose()
Dim dpc(1) As DataColumn
dpc(0) = ai.Columns("kodebarang")
ai.PrimaryKey = dpc
dg_46109030.DataSource = ai
End Sub
Private Sub ari()
Dim ari1 As Integer = 0
For Each ari2 As DataRow In ai.Rows
ari1 += ari2("JUMLAH")
Next
Tot_46109030.Text = ari1
End Sub
Private Sub un_46109030_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_46109030.TextChanged, hr_46109030.TextChanged
jm_46109030.Text = Val(un_46109030.Text) * Val(hr_46109030.Text)
End Sub
Private Sub kb_46109030_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_46109030.TextChanged
nb_46109030.Text = ""
un_46109030.Text = ""
hr_46109030.Text = ""
End Sub
Private Sub kb_46109030_leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_46109030.Leave
If kb_46109030.Text.Length = 0 Then
Exit Sub
End If
ainun.AturPencarianDataBase("barang", "kodebarang", kb_46109030.Text, 1, conect)
If ainun.JumlanBaris > 0 Then
kb_46109030.Text = ainun.DataTablenya.Rows(0).Item("KODEBARANG")
nb_46109030.Text = ainun.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang itu tidak ada..")
Exit Sub
End If
End Sub
Private Sub t_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t_46109030.Click
BalasHapusIf kb_46109030.Text.Length = 0 Then
MsgBox("Isi Kode Barang")
Exit Sub
End If
If Val(un_46109030.Text) = 0 Then
MsgBox("Isi Unit Barang")
Exit Sub
End If
If Val(hr_46109030.Text) = 0 Then
MsgBox("Isi Harga Barang")
Exit Sub
End If
Dim sadik As DataRow
sadik = ai.Rows.Find(kb_46109030.Text)
If sadik Is Nothing Then
sadik = ai.NewRow
sadik("KODEBARANG") = kb_46109030.Text
sadik("NAMABARANG") = nb_46109030.Text
sadik("UNIT") = Val(un_46109030.Text)
sadik("HARGA") = Val(hr_46109030.Text)
sadik("JUMLAH") = Val(jm_46109030.Text)
ai.Rows.Add(sadik)
kb_46109030.Text = ""
un_46109030.Text = ""
hr_46109030.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...")
End If
ari()
End Sub
Private Sub s_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109030.Click
If nt_46109030.Text.Length = 0 Then
MsgBox("Isi No Transaksi")
Exit Sub
End If
If jt_46109030.Text.Length = 0 Then
MsgBox("isi Jenis Transaksi")
Exit Sub
End If
If ai.Rows.Count = 0 Then
MsgBox("Isi datatable")
Exit Sub
End If
ainun.AturPencarianDataBase("mastertransaksi", "notrans", nt_46109030.Text, 1, conect)
If ainun.JumlanBaris > 0 Then
MsgBox("No Trans sudah ada")
Exit Sub
End If
nun = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_46109030.Text & "',#" & dtp_46109030.Value.Month & "/" & dtp_46109030.Value.Day & "/" & dtp_46109030.Value.Year & "#,'" & jt_46109030.Text & "')", conect)
conect.Open()
nun.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In ai.Rows
nun = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt_46109030.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect)
conect.Open()
nun.ExecuteNonQuery()
conect.Close()
Next
nun.Dispose()
nt_46109030.Text = ""
jt_46109030.Text = ""
ai.Rows.Clear()
ari()
End Sub
End Class
http://ayuwandikaputriutami.blogspot.com/2012/01/latihan03846109017.html
BalasHapusPublic Class LATIHAN38_46109021
BalasHapusDim KONEKSI As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=46109021")
Dim NOVI As New DataTable
Dim CARI As New ByIskandar.CariKeDataBaseByIskandar
Dim SERU As New OleDb.OleDbCommand
Private Sub LATIHAN38_46109021_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim KUDA As New OleDb.OleDbDataAdapter
KUDA = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & NT_46109021.Text & "'", KONEKSI)
NOVI.Rows.Clear()
KUDA.Fill(NOVI)
KUDA.Dispose()
Dim DC(1) As DataColumn
DC(0) = NOVI.Columns("kodebarang")
NOVI.PrimaryKey = DC
DGV_46109021.DataSource = NOVI
End Sub
Private Sub Z()
Dim ZA As Integer = 0
For Each ZB As DataRow In NOVI.Rows
ZA += ZB("JUMLAH")
Next
TOT_46109021.Text = ZA
End Sub
Private Sub U_46109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles U_46109021.TextChanged, H_46109021.TextChanged
J_46109021.Text = Val(U_46109021.Text) * Val(H_46109021.Text)
End Sub
Private Sub KB_46109021_LEAVE(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_46109021.Leave
If KB_46109021.Text.Length = 0 Then
Exit Sub
End If
CARI.AturPencarianDataBase("barang", "kodebarang", KB_46109021.Text, 1, KONEKSI)
If CARI.JumlanBaris > 0 Then
KB_46109021.Text = CARI.DataTablenya.Rows(0).Item("KODEBARANG")
NB_46109021.Text = CARI.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang itu tidak ada..")
Exit Sub
End If
End Sub
Private Sub KB_46109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_46109021.TextChanged
NB_46109021.Text = ""
U_46109021.Text = ""
H_46109021.Text = ""
End Sub
Private Sub TAM_46109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAM_46109021.Click
If KB_46109021.Text.Length = 0 Then
MsgBox("Isi Kode Barang")
Exit Sub
End If
If Val(U_46109021.Text) = 0 Then
MsgBox("Isi Unit Barang")
Exit Sub
End If
If Val(H_46109021.Text) = 0 Then
MsgBox("Isi Harga Barang")
Exit Sub
End If
Dim DR As DataRow
BalasHapusDR = NOVI.Rows.Find(KB_46109021.Text)
If DR Is Nothing Then
DR = NOVI.NewRow
DR("KODEBARANG") = KB_46109021.Text
DR("NAMABARANG") = NB_46109021.Text
DR("UNIT") = Val(U_46109021.Text)
DR("HARGA") = Val(H_46109021.Text)
DR("JUMLAH") = Val(J_46109021.Text)
NOVI.Rows.Add(DR)
KB_46109021.Text = ""
U_46109021.Text = ""
H_46109021.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...")
End If
Z()
End Sub
Private Sub SIM_46109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIM_46109021.Click
If NT_46109021.Text.Length = 0 Then
MsgBox("Isi No Transaksi")
Exit Sub
End If
If JT_46109021.Text.Length = 0 Then
MsgBox("isi Jenis Transaksi")
Exit Sub
End If
If NOVI.Rows.Count = 0 Then
MsgBox(" Isi datatable")
Exit Sub
End If
CARI.AturPencarianDataBase("mastertransaksi", "notrans", NT_46109021.Text, 1, KONEKSI)
If CARI.JumlanBaris > 0 Then
MsgBox("No Trans sudah ada")
Exit Sub
End If
SERU = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT_46109021.Text & "',#" & DTP_46109021.Value.Month & "/" & DTP_46109021.Value.Day & "/" & DTP_46109021.Value.Year & "#,'" & JT_46109021.Text & "')", KONEKSI)
KONEKSI.Open()
SERU.ExecuteNonQuery()
KONEKSI.Close()
For Each x As DataRow In NOVI.Rows
SERU = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT_46109021.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", KONEKSI)
KONEKSI.Open()
SERU.ExecuteNonQuery()
KONEKSI.Close()
Next
SERU.Dispose()
NT_46109021.Text = ""
JT_46109021.Text = ""
NOVI.Rows.Clear()
Z()
End Sub
End Class
http://ismisriwahyuni.blogspot.com/2012/01/public-class-form38-dim-cimi-as-new.html
BalasHapusPublic Class LATIHAN038_46109054
BalasHapusDim DWI As New DataTable
Dim MUSTIKA As New OleDb.OleDbCommand
Dim CHAERUNNISA As New ByIskandar.CariKeDataBaseByIskandar
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=wiwi")
Private Sub LATIHAN038_46109054_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim MUSTIKACHAERUNNISAMULYADI As New OleDb.OleDbDataAdapter
MUSTIKACHAERUNNISAMULYADI = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & ww1_46109054.Text & "'", conect)
DWI.Rows.Clear()
MUSTIKACHAERUNNISAMULYADI.Fill(DWI)
MUSTIKACHAERUNNISAMULYADI.Dispose()
Dim WHI_WHI(1) As DataColumn
WHI_WHI(0) = DWI.Columns("kodebarang")
DWI.PrimaryKey = WHI_WHI
DGV_46109054.DataSource = DWI
End Sub
Private Sub WHI_CHA()
Dim WHI_CHA1 As Integer = 0
For Each WHI_CHA2 As DataRow In DWI.Rows
WHI_CHA1 += WHI_CHA2("JUMLAH")
Next
ww8_46109054.Text = WHI_CHA1
End Sub
Private Sub ww5_46109054_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ww5_46109054.TextChanged, ww6_46109054.TextChanged
ww7_46109054.Text = Val(ww5_46109054.Text) * Val(ww6_46109054.Text)
End Sub
Private Sub ww3_46109054_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles ww3_46109054.Leave
If ww3_46109054.Text.Length = 0 Then
Exit Sub
End If
CHAERUNNISA.AturPencarianDataBase("barang", "kodebarang", ww3_46109054.Text, 1, conect)
If CHAERUNNISA.JumlanBaris > 0 Then
ww3_46109054.Text = CHAERUNNISA.DataTablenya.Rows(0).Item("KODEBARANG")
ww4_46109054.Text = CHAERUNNISA.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang itu tidak ada..")
Exit Sub
End If
End Sub
Private Sub ww3_46109054_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ww3_46109054.TextChanged
ww4_46109054.Text = ""
ww5_46109054.Text = ""
ww6_46109054.Text = ""
End Sub
Private Sub Dwi1_46109054_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi1_46109054.Click
BalasHapusIf ww3_46109054.Text.Length = 0 Then
MsgBox("Isi Kode Barang")
Exit Sub
End If
If Val(ww5_46109054.Text) = 0 Then
MsgBox("Isi Unit Barang")
Exit Sub
End If
If Val(ww6_46109054.Text) = 0 Then
MsgBox("Isi Harga Barang")
Exit Sub
End If
Dim WHI_CHA As DataRow
WHI_CHA = DWI.Rows.Find(ww3_46109054.Text)
If WHI_CHA Is Nothing Then
WHI_CHA = DWI.NewRow
WHI_CHA("KODEBARANG") = ww3_46109054.Text
WHI_CHA("NAMABARANG") = ww4_46109054.Text
WHI_CHA("UNIT") = Val(ww5_46109054.Text)
WHI_CHA("HARGA") = Val(ww6_46109054.Text)
WHI_CHA("JUMLAH") = Val(ww7_46109054.Text)
DWI.Rows.Add(WHI_CHA)
ww3_46109054.Text = ""
ww5_46109054.Text = ""
ww6_46109054.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...")
End If
End Sub
Private Sub Dwi2_46109054_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi2_46109054.Click
If ww1_46109054.Text.Length = 0 Then
MsgBox("Isi No Transaksi")
Exit Sub
End If
If ww2_46109054.Text.Length = 0 Then
MsgBox("isi Jenis Transaksi")
Exit Sub
End If
If DWI.Rows.Count = 0 Then
MsgBox("Isi datatable")
Exit Sub
End If
CHAERUNNISA.AturPencarianDataBase("mastertransaksi", "notrans", ww1_46109054.Text, 1, conect)
If CHAERUNNISA.JumlanBaris > 0 Then
MsgBox("No Trans sudah ada")
Exit Sub
End If
MUSTIKA = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & ww1_46109054.Text & "',#" & DTP_46109054.Value.Month & "/" & DTP_46109054.Value.Day & "/" & DTP_46109054.Value.Year & "#,'" & ww2_46109054.Text & "')", conect)
conect.Open()
MUSTIKA.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In DWI.Rows
MUSTIKA = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & ww1_46109054.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect)
conect.Open()
MUSTIKA.ExecuteNonQuery()
conect.Close()
Next
MUSTIKA.Dispose()
ww1_46109054.Text = ""
ww2_46109054.Text = ""
DWI.Rows.Clear()
WHI_CHA()
End Sub
Private Sub ww1_46109054_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ww1_46109054.TextChanged
End Sub
End Class
Public Class LATIHAN038_46109027
BalasHapusDim ff As New DataTable
Dim bhe As New OleDb.OleDbCommand
Dim bheku As New ByIskandar.CfransKeDataBaseByIskandar
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=bheku")
Private Sub LATIHAN038_46109027_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim febianafransiskus As New OleDb.OleDbDataAdapter
febianafransiskus = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detffltransaksi.UNIT, detffltransaksi.HARGA, detffltransaksi.unit*harga as JUMLAH from barang inner join detffltransaksi on barang.kodebarang = detffltransaksi.kodebarang where notrans ='" & nt_46109027.Text & "'", conect)
ff.Rows.Clear()
febianafransiskus.Fill(ff)
febianafransiskus.Dispose()
Dim dpc(1) As DataColumn
dpc(0) = ff.Columns("kodebarang")
ff.PrimaryKey = dpc
dg_46109027.DataSource = ff
End Sub
Private Sub frans()
Dim frans1 As Integer = 0
For Each frans2 As DataRow In ff.Rows
frans1 += frans2("JUMLAH")
Next
Tot_46109027.Text = frans1
End Sub
Private Sub un_46109027_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_46109027.TextChanged, hr_46109027.TextChanged
jm_46109027.Text = Val(un_46109027.Text) * Val(hr_46109027.Text)
End Sub
Private Sub kb_46109027_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_46109027.TextChanged
nb_46109027.Text = ""
un_46109027.Text = ""
hr_46109027.Text = ""
End Sub
Private Sub kb_46109027_leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_46109027.Leave
If kb_46109027.Text.Length = 0 Then
Exit Sub
End If
bheku.AturPencfransanDataBase("barang", "kodebarang", kb_46109027.Text, 1, conect)
If bheku.JumlanBfranss > 0 Then
kb_46109027.Text = bheku.DataTablenya.Rows(0).Item("KODEBARANG")
nb_46109027.Text = bheku.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang itu tidak ada..")
Exit Sub
End If
End Sub
Private Sub t_46109027_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t_46109027.Click
If kb_46109027.Text.Length = 0 Then
MsgBox("Isi Kode Barang")
Exit Sub
End If
If Val(un_46109027.Text) = 0 Then
MsgBox("Isi Unit Barang")
Exit Sub
End If
If Val(hr_46109027.Text) = 0 Then
MsgBox("Isi Harga Barang")
Exit Sub
End If
Dim fransiskus As DataRow
BalasHapusfransiskus = ff.Rows.Find(kb_46109027.Text)
If fransiskus Is Nothing Then
fransiskus = ff.NewRow
fransiskus("KODEBARANG") = kb_46109027.Text
fransiskus("NAMABARANG") = nb_46109027.Text
fransiskus("UNIT") = Val(un_46109027.Text)
fransiskus("HARGA") = Val(hr_46109027.Text)
fransiskus("JUMLAH") = Val(jm_46109027.Text)
ff.Rows.Add(fransiskus)
kb_46109027.Text = ""
un_46109027.Text = ""
hr_46109027.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lffn...")
End If
frans()
End Sub
Private Sub s_46109027_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109027.Click
If nt_46109027.Text.Length = 0 Then
MsgBox("Isi No Transaksi")
Exit Sub
End If
If jt_46109027.Text.Length = 0 Then
MsgBox("isi Jenis Transaksi")
Exit Sub
End If
If ff.Rows.Count = 0 Then
MsgBox("Isi datatable")
Exit Sub
End If
bheku.AturPencfransanDataBase("mastertransaksi", "notrans", nt_46109027.Text, 1, conect)
If bheku.JumlanBfranss > 0 Then
MsgBox("No Trans sudah ada")
Exit Sub
End If
bhe = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_46109027.Text & "',#" & dtp_46109027.Value.Month & "/" & dtp_46109027.Value.Day & "/" & dtp_46109027.Value.Year & "#,'" & jt_46109027.Text & "')", conect)
conect.Open()
bhe.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In ff.Rows
bhe = New OleDb.OleDbCommand("insert into detffltransaksi (notrans, kodebarang, unit, harga) values ('" & nt_46109027.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect)
conect.Open()
bhe.ExecuteNonQuery()
conect.Close()
Next
bhe.Dispose()
nt_46109027.Text = ""
jt_46109027.Text = ""
ff.Rows.Clear()
frans()
End Sub
End Class
Public Class Latihan383940_46109054
BalasHapusDim DWI As New DataTable
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=wiwi")
Private Sub Latihan383940_46109054_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim wiwi As New OleDb.OleDbDataAdapter
wiwi = New OleDb.OleDbDataAdapter("SELECT * FROM BARANG", conect)
DWI.Rows.Clear()
wiwi.Fill(DWI)
wiwi.Dispose()
DGV_46109054.DataSource = DWI
End Sub
End Class
Public Class LATIHAN_038_46109053
BalasHapusDim SAE As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data sounitrce= " & Application.StartunitpPathrg & "\DATAMAJUMEMUNITK.accdb;jumet oledb:database Password=thrgepinkers29")
Dim INDAH As New DataTable
Dim YANI As DataRow
Private Sub LATIHAN_038_46109053_Load(ByVal sender As System.object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Z As New OleDb.OleDbDataAdapter
Z = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNITNIT, DETAILTRANSAKSI.HRGARGA, DETAILTRANSAKSI.UNITNIT*DETAILTRANSAKSI.HRGARGA AS JUMLAH from DETAILTRANSAKSI INNER JUMOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHRGERE NOTRANS= '" & NT_053.Text & "'", SAE)
Z.Fill(INDAH)
Z.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = INDAH.Columns("KODEBARANG")
INDAH.PrimaryKey = dataPrimary
DATA_053.DataSource = INDAH
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each Z As DataRow In INDAH.Rows
TOT = TOT + Z("JUMLAH")
Next
TOT_053.Text = TOT
End Sub
Private Sub KB_053_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB_053.Leave
If KB_053.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB_053.Text, 1, SAE)
If Pencari.jumlanbaris > 0 Then
KB_053.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
NB_053.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If LATIHAN383940_053.showDialog = Windows.Forms.DialogResult.OK Then
KB_053.Text = LATIHAN383940_053.DATA_053.CunitrrentRow.Cells("KodeBarang").Valunite
NB_053.Text = LATIHAN383940_053.DATA_053.CunitrrentRow.Cells("NamaBarang").Valunite
Else
KB_053.Text = ""
End If
End If
End Sub
Private Sub KB_053_TextChrganged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_053.TextChrganged
NB_053.Text = ""
UNIT_053.Text = ""
HRG_053.Text = ""
End Sub
Private Sub UNIT_TextChrganged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UNIT_053.TextChrganged, HRG_053.TextChrganged
JUM_053.Text = Val(UNIT_053.Text) * Val(HRG_053.Text)
End Sub
Private Sub TM_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM_053.Click
BalasHapusIf KB_053.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If NB_053.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(UNIT_053.Text) = 0 Then
MsgBox("masukkan unit barang")
Exit Sub
End If
If Val(HRG_053.Text) = 0 Then
MsgBox("masukkan harga barang")
Exit Sub
End If
YANI = INDAH.Rows.Find(KB_053.Text)
If YANI Is Nothing Then
YANI = INDAH.NewRow
YANI("KODEBARANG") = KB_053.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
YANI = INDAH.NewRow
YANI("KODEBARANG") = KB_053.Text
YANI("NAMABARANG") = NB_053.Text
YANI("UNITNIT") = UNIT_053.Text
YANI("HRGARGA") = HRG_053.Text
YANI("JUMLAH") = JUM_053.Text
INDAH.Rows.Add(YANI)
KB_053.Text = ""
NB_053.Text = ""
UNIT_053.Text = ""
HRG_053.Text = ""
TOTALJUMLAH()
End Sub
Private Sub SAVE_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_053.Click
If NT_053.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If JT_053.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If INDAH.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_053.Text, 1, SAE)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim MMM As New OleDb.OleDbCommand
MMM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JUMENISTRANSAKSI) VALUNITES ('" & NT_053.Text & "', #" & DT_053.Valunite.Monthrg & "/" & DT_053.Valunite.Day & "/" & DT_053.Valunite.Year & "#, '" & JT_053.Text & "')", SAE)
SAE.Open()
MMM.ExecuteNonQuery()
SAE.Close()
For Each Z As DataRow In INDAH.Rows
MMM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNITNIT, HRGARGA) VALUNITES ('" & NT_053.Text & "','" & Z("KODEBARANG") & "'," & Z("UNITNIT") & ", " & Z("HRGARGA") & ")", SAE)
SAE.Open()
MMM.ExecuteNonQuery()
SAE.Close()
MMM.Dispose()
Next
NT_053.Text = ""
JT_053.Text = ""
JUM_053.Text = ""
INDAH.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
ARYANDIRA(46109034)
BalasHapusPublic Class Latihan38_034
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim dira As New ByIskandar.CariKeDataBaseByIskandar
Dim satu As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Datamajemuk.ACCDB")
Private Sub Latihan38_034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETAILTRANSAKSI ON BARANG.KODEBARANG = DETAILTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & aa_034.Text & "'", satu)
a.Fill(dt)
a.Dispose()
Dim dc(1) As DataColumn
dc(0) = dt.Columns("Kodebarang")
dt.PrimaryKey = dc
dgv.DataSource = dt
End Sub
Private Sub ira()
Dim ira1 As Integer = 0For Each ira2 As DataRow In dt.Rows
ira1 += ira2("JUMLAH")
Next
Jj_034.Text = ira1
End Sub
Private Sub ff_034_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ff_034.TextChanged, gg_034.TextChanged
Hh_034.Text = Val(ff_034.Text) * Val(gg_034.Text)
End Sub
Private Sub dd_034_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles dd_034.Leave
If dd_034.Text.Length = 0 Then
Exit Sub
End If
dira.AturPencarianDataBase("barang", "kodebarang", dd_034.Text, 1, satu)
If dira.JumlanBaris > 0 Then
Dd_034.Text = dira.DataTablenya.Rows(0).Item("KODEBARANG")
Ee_034.Text = dira.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang seperti itu tidak ada..")
If Latihan_38_39_40_034.ShowDialog = Windows.Forms.DialogResult.OK Then
Dd_034.Text = Latihan_38_39_40_034.dgv.CurrentRow.Cells("kodebarang").Value
Ee_034.Text = Latihan_38_39_40_034.dgv.CurrentRow.Cells("namabarang").Value
Else
Dd_034.Text = ""
End If
End If
End Sub
Private Sub dd_034_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dd_034.TextChanged
Ee_034.Text = ""
Ff_034.Text = ""
Gg_034.Text = ""
End Sub
Private Sub ii_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ii_034.Click
If dd_034.Text.Length = 0 Then
MsgBox("Isi rong itu Kode Barang ")
Exit Sub
End If
If Val(ff_034.Text) = 0 Then
MsgBox("Isi rong itu Unit ")
Exit Sub
End If
If Val(gg_034.Text) = 0 Then
MsgBox("Isi rong itu Harga ")
exit sub
BalasHapusEnd If
Dim dr As DataRow
dr = dt.Rows.Find(dd_034.Text)
If dr Is Nothing Then
dr = dt.NewRow
dr("KODEBARANG") = dd_034.Text
dr("NAMABARANG") = ee_034.Text
dr("UNIT") = ff_034.Text
dr("HARGA") = gg_034.Text
dr("JUMLAH") = hh_034.Text
dt.Rows.Add(dr)
dd_034.Text = ""
ff_034.Text = ""
gg_034.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain")
End If
ira ()
End Sub
Private Sub kk_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kk_034.Click
If aa_034.Text.Length = 0 Then
MsgBox("Isi rong itu No Transaksi “)
Exit Sub
End If
If cc_034.Text.Length = 0 Then
MsgBox("Isi rong itu Jenis Transaksi ")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Isi rong itu datatable")
Exit Sub
End If
dira.AturPencarianDataBase("mastertransaksi", "notrans", aa_034.Text, 1, satu)
If dira.JumlanBaris > 0 Then
MsgBox("Adami No Transaksi seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & aa_034.Text & "',#" & bb_034.Value.Month & "/" & bb_034.Value.Day & "/" & bb_034.Value.Year & "#,'" & cc_034.Text & "')", satu)
satu.Open()
cm.ExecuteNonQuery()
satu.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & aa_034.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", satu)
satu.Open()
cm.ExecuteNonQuery()
satu.Close()
Next
cm.Dispose()
aa_034.Text = ""
cc_034.Text = ""
dt.Rows.Clear()
ira()
End Sub
end class
Public Class LATIHAN38_46109005
BalasHapusDim FAHRUL As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet oledb:database Password=arul")
Dim ARUL As New DataTable
Dim APRIL As DataRow
Private Sub LATIHAN38_46109005_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Z As New OleDb.OleDbDataAdapter
Z = New OleDb.OleDbDataAdapter("Select BARANG.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= '" & NT_46109005.Text & "'", FAHRUL)
Z.Fill(ARUL)
Z.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = ARUL.Columns("KODEBARANG")
ARUL.PrimaryKey = dataPrimary
DG_46109005.DataSource = ARUL
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each Z As DataRow In ARUL.Rows
TOT = TOT + Z("JUMLAH")
Next
TOT_46109005.Text = TOT
End Sub
Private Sub KB_46109005_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB_46109005.Leave
If KB_46109005.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB_46109005.Text, 1, FAHRUL)
If Pencari.JumlanBaris > 0 Then
KB_46109005.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
NB_46109005.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan383940_46109005.ShowDialog = Windows.Forms.DialogResult.OK Then
KB_46109005.Text = Latihan383940_46109005.DATA46109005.CurrentRow.Cells("KodeBarang").Value
NB_46109005.Text = Latihan383940_46109005.DATA46109005.CurrentRow.Cells("NamaBarang").Value
Else
KB_46109005.Text = ""
End If
End If
End Sub
Private Sub KB_46109005_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_46109005.TextChanged
NB_46109005.Text = ""
U_46109005.Text = ""
H_46109005.Text = ""
End Sub
Private Sub U_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles U_46109005.TextChanged, H_46109005.TextChanged
J_46109005.Text = Val(U_46109005.Text) * Val(H_46109005.Text)
End Sub
Private Sub TM_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM_46109005.Click
If KB_46109005.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If NB_46109005.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(U_46109005.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(H_46109005.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
Exit Sub
End If
APRIL = ARUL.Rows.Find(KB_46109005.Text)
BalasHapusIf APRIL Is Nothing Then
APRIL = ARUL.NewRow
APRIL("KODEBARANG") = KB_46109005.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
APRIL = ARUL.NewRow
APRIL("KODEBARANG") = KB_46109005.Text
APRIL("NAMABARANG") = NB_46109005.Text
APRIL("UNIT") = U_46109005.Text
APRIL("HARGA") = H_46109005.Text
APRIL("JUMLAH") = J_46109005.Text
ARUL.Rows.Add(APRIL)
KB_46109005.Text = ""
NB_46109005.Text = ""
U_46109005.Text = ""
H_46109005.Text = ""
TOTALJUMLAH()
End Sub
Private Sub SAVE_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_46109005.Click
If NT_46109005.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If JT_46109005.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If ARUL.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109005.Text, 1, FAHRUL)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim MMM As New OleDb.OleDbCommand
MMM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109005.Text & "', #" & DT_46109005.Value.Month & "/" & DT_46109005.Value.Day & "/" & DT_46109005.Value.Year & "#, '" & JT_46109005.Text & "')", FAHRUL)
FAHRUL.Open()
MMM.ExecuteNonQuery()
FAHRUL.Close()
For Each Z As DataRow In ARUL.Rows
MMM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109005.Text & "','" & Z("KODEBARANG") & "'," & Z("UNIT") & ", " & Z("HARGA") & ")", FAHRUL)
FAHRUL.Open()
MMM.ExecuteNonQuery()
FAHRUL.Close()
MMM.Dispose()
Next
NT_46109005.Text = ""
JT_46109005.Text = ""
J_46109005.Text = ""
ARUL.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
If Val(U_46109021.Text) = 0 Then
BalasHapusMsgBox("Isi Unit Barang")
Exit Sub
End If
If Val(H_46109021.Text) = 0 Then
MsgBox("Isi Harga Barang")
Exit Sub
End If
Dim DR As DataRow
DR = NOVI.Rows.Find(KB_46109021.Text)
If DR Is Nothing Then
DR = NOVI.NewRow
DR("KODEBARANG") = KB_46109021.Text
DR("NAMABARANG") = NB_46109021.Text
DR("UNIT") = Val(U_46109021.Text)
DR("HARGA") = Val(H_46109021.Text)
DR("JUMLAH") = Val(J_46109021.Text)
NOVI.Rows.Add(DR)
KB_46109021.Text = ""
U_46109021.Text = ""
H_46109021.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...")
End If
Z()
End Sub
Private Sub SIM_46109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIM_46109021.Click
If NT_46109021.Text.Length = 0 Then
MsgBox("Isi No Transaksi")
Exit Sub
End If
If JT_46109021.Text.Length = 0 Then
MsgBox("isi Jenis Transaksi")
Exit Sub
End If
If NOVI.Rows.Count = 0 Then
MsgBox(" Isi datatable")
Exit Sub
End If
CARI.AturPencarianDataBase("mastertransaksi", "notrans", NT_46109021.Text, 1, KONEKSI)
If CARI.JumlanBaris > 0 Then
MsgBox("No Trans sudah ada")
Exit Sub
End If
SERU = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT_46109021.Text & "',#" & DTP_46109021.Value.Month & "/" & DTP_46109021.Value.Day & "/" & DTP_46109021.Value.Year & "#,'" & JT_46109021.Text & "')", KONEKSI)
KONEKSI.Open()
SERU.ExecuteNonQuery()
KONEKSI.Close()
For Each x As DataRow In NOVI.Rows
SERU = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT_46109021.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", KONEKSI)
KONEKSI.Open()
SERU.ExecuteNonQuery()
KONEKSI.Close()
Next
SERU.Dispose()
NT_46109021.Text = ""
JT_46109021.Text = ""
NOVI.Rows.Clear()
Z()
End Sub
End Class
http://cacalisa.blogspot.com/2012/11/latihan3846110038.html
BalasHapushttp://rafidashaleh.blogspot.com/2012/11/latihan3846110041.html
BalasHapushttp://mulyawarman039.blogspot.com/2012/11/latihan3846110039.html
BalasHapushttp://wahyunirachman.blogspot.com/2012/11/latihan3846110020.html
BalasHapushttp://srikartikafanty.blogspot.com/2012/11/latihan3846110007.html
BalasHapusKomentar ini telah dihapus oleh pengarang.
Hapushttp://dianmegariski.blogspot.com/2012/11/latihan3846110023_5.html
BalasHapushttp://bahrizj.blogspot.com/2012/11/latihan3846110001.html
BalasHapushttp://bahrizj.blogspot.com/2012/11/latihan3839940461100001.html
BalasHapushttp://restyaccounting.blogspot.com/2012/11/latihan3846110027.html
BalasHapushttp://idhamsyaam.blogspot.com/2012/11/latihan3846110021.html
BalasHapushttp://alfaega.blogspot.com/2012/11/latihan3846110022.html
BalasHapushttp://sulhihusni.blogspot.com/2012/11/latihan3846110004.html
BalasHapushttp://fitrianihamka.blogspot.com/2012/11/latihan3846110006.html
BalasHapushttp://ildayani.blogspot.com/2012/11/latihan3846110002.html
BalasHapushttp://hanihasan07.blogspot.com/2012/12/latihan3846110044.html
BalasHapushttp://bothbon.blogspot.com/2013/01/latihan3846110043.html
BalasHapushttp://muthmil8.blogspot.com/2012/11/latihan3846110037.html
BalasHapushttp://amalmaulana92.blogspot.com/2013/01/latihan3846110003.html
BalasHapushttp://aardianzah2.blogspot.com/2013/01/latihan-38.html
BalasHapushttp://feibyfrycilia.blogspot.com/2013/01/latihan3846110055.html
BalasHapushttp://feibyfrycilia.blogspot.com/2013/01/latihan38394046110055.html
http://diyanahdina.blogspot.com/2013/01/latihan38a46110045.html
BalasHapushttp://diyanahdina.blogspot.com/2013/01/latihan-38b46110045.html
http://deodns.blogspot.com/#!/2013/01/latihan3846110040.html
BalasHapushttp://deodns.blogspot.com/#!/2013/01/latihan38394046110040.html