Public Class Latihan37_46109001 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_37_022_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.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 itu tidak ada..") Exit Sub End If End Sub
Private Sub KB46109001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB46109001.TextChanged NB46109001.Text = "" UN46109001.Text = "" HR46109001.Text = "" 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()
Public Class LATIHAN37_46109051 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 LATIHAN37_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") Exit Sub End If End Sub
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 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") Exit Sub End If
If JT_46109051.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If NIAH.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") 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") 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 & "#, '" & DT_46109051.Text & "')", WAHDA) WAHDA.Open() MMM.ExecuteNonQuery() WAHDA.Close()
For Each X As DataRow In NIAH.Rows MMM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109051.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", WAHDA) WAHDA.Open() MMM.ExecuteNonQuery() WAHDA.Close() MMM.Dispose() Next
Private Sub U_46109051_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 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") End If
If Val(U_46109051.Text) = 0 Then MsgBox("Masukkan unit barang") Exit Sub End If
If Val(H_46109051.Text) = 0 Then MsgBox("Masukkan harga barang barang") 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") Exit Sub End If
Public Class Form37 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 Form37_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 dpc(1) As DataColumn dpc(0) = DILA.Columns("kodebarang") DILA.PrimaryKey = dpc
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 IPIN As DataRow IPIN = DILA.Rows.Find(KODE_059.Text) If IPIN Is Nothing Then IPIN = DILA.NewRow IPIN("KODEBARANG") = KODE_059.Text IPIN("NAMABARANG") = NAMA_059.Text IPIN("UNIT") = Val(UNIT_059.Text) IPIN("HARGA") = Val(HARGA_059.Text) IPIN("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
LATIHAN 37 Public Class LATIHAN037_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 LATIHAN037_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 LATIHAN37_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 LATIHAN37_46109021_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim KERETA As New OleDb.OleDbDataAdapter KERETA = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & KB_46109021.Text & "'", KONEKSI) NOVI.Rows.Clear() KERETA.Fill(NOVI) KERETA.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 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 H_46109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles H_46109021.TextChanged J_46109021.Text = Val(H_46109021.Text) * Val(U_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("Data yang anda masukkan telah 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 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("no.transaksi belum terisi") Exit Sub End If If JT_46109021.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") 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()
NT_46109021.Text = "" JT_46109021.Text = ""
NOVI.Rows.Clear() Z() End Sub
Private Sub U_46109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles U_46109021.TextChanged J_46109021.Text = Val(U_46109021.Text) * Val(H_46109021.Text) End Sub End Class
Public Class LATIHAN037_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 LATIHAN037_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 dpc(1) As DataColumn dpc(0) = DWI.Columns("kodebarang") DWI.PrimaryKey = dpc
DGV_46109054.DataSource = DWI End Sub
Private Sub WHI_WHI() Dim WHI_WHI1 As Integer = 0 For Each WHI_WHI2 As DataRow In DWI.Rows WHI_WHI1 += WHI_WHI2("JUMLAH") Next ww8_46109054.Text = WHI_WHI1 End Sub
Public Class LATIHAN037_46109027 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 LATIHAN037_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
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 WHICHA As DataRow WHICHA = DWI.Rows.Find(ww3_46109054.Text) If WHICHA Is Nothing Then WHICHA = DWI.NewRow WHICHA("KODEBARANG") = ww3_46109054.Text WHICHA("NAMABARANG") = ww4_46109054.Text WHICHA("UNIT") = Val(ww5_46109054.Text) WHICHA("HARGA") = Val(ww6_46109054.Text) WHICHA("JUMLAH") = Val(ww7_46109054.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
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()
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_WHI() 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 LATIHAN_037_46109053 Dim INDAH As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data sounitrce= " & Application.StartupPath & "\DATAMAJUMLAHEMUNITK.accdb;jumlahet oledb:database Password=thrgepinkers29") Dim DT As New DataTable Dim DR As DataRow
Private Sub LATIHRGAN37_053_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 JUMLAHOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHRGERE NOTRANS= '" & NT_053.Text & "'", INDAH) Z.Fill(DT) Z.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dataPrimary
DATA_053.DataSource = DT End Sub
Private Sub TOTALALJUMLAH() Dim TOTAL As Double = 0 For Each Z As DataRow In DT.Rows TOTAL = TOTAL + Z("JUMLAH") Next TOTAL_053.Text = TOTAL 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, INDAH) 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") Exit Sub End If End Sub
Private Sub KB_053_textchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_053.TextChanged NB_053.Text = "" UNIT_053.Text = "" HRG_053.Text = "" End Sub
Private Sub UNIT_053_textchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UNIT_053.TextChanged, HRG_053.TextChanged JUMLAH_053.Text = Val(UNIT_053.Text) * Val(HRG_053.Text) End Sub
Private Sub TAMBAH_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH_053.Click
If 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("Masunitkkan unit barang") Exit Sub End If
If Val(HRG_053.Text) = 0 Then MsgBox("Masunitkkan harga barang barang") Exit Sub End If
DR = DT.Rows.Find(KB_053.Text)
If DR Is Nothing Then DR = DT.NewRow DR("KODEBARANG") = KB_053.Text Else MsgBox("Maaf kodebarang sudah ada") Exit Sub End If
Private Sub SIMPAN_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN_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 DT.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, INDAH) 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_053.Text & "', #" & DT_053.Valunite.Monthrg & "/" & DT_053.Valunite.Day & "/" & DT_053.Valunite.Year & "#, '" & DT_053.Text & "')", INDAH) INDAH.Open() MMM.ExecuteNonQuery() INDAH.Close()
For Each X As DataRow In DT.Rows MMM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_053.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", INDAH) INDAH.Open() MMM.ExecuteNonQuery() INDAH.Close() MMM.Dispose() Next
ARYANDIRA(46109034) Public Class Latihan37_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 Latihan37_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) dt.Rows.Clear() 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 = 0 For 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 itu tidak ada..") Exit Sub 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 End 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") = Val(ff_034.Text) dr("HARGA") = Val(gg_034.Text) dr("JUMLAH") = Val(hh_034.Text)
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 No Transaksi ") Exit Sub End If
If cc_034.Text.Length = 0 Then MsgBox("isi rong Jenis Transaksi") Exit Sub End If
If dt.Rows.Count = 0 Then MsgBox("Maaf..Isi rong itu datatable ") Exit Sub End If
If dt.Rows.Count = 0 Then MsgBox("Maaf..Isi rong itu datatable ") Exit Sub End If
dira.AturPencarianDataBase("mastertransaksi", "notrans", aa_034.Text, 1, satu) If dira.JumlanBaris > 0 Then MsgBox("Ada no trans 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()
Public Class Latihan37_46109001 Dim arul As New DataTable Dim fahrul As New OleDb.OleDbCommand Dim april 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=arul") Private Sub Latihan_37_022_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim muhammadfahrul As New OleDb.OleDbDataAdapter muhammadfahrul = 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 ='" & NT46109005.Text & "'", conect) arul.Rows.Clear() muhammadfahrul.Fill(arul) muhammadfahrul.Dispose()
Dim dpc(1) As DataColumn dpc(0) = arul.Columns("kodebarang") arul.PrimaryKey = dpc
DATA46109005.DataSource = arul End Sub
Private Sub ngek() Dim ngek1 As Integer = 0 For Each ngek2 As DataRow In arul.Rows ngek1 += ngek2("JUMLAH") Next TOT46109005.Text = ngek1 End Sub
Private Sub UN46109001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UN46109005.TextChanged, HR46109005.TextChanged JM46109005.Text = Val(UN46109005.Text) * Val(HR46109005.Text) End Sub
Private Sub KB46109001_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB46109005.Leave If KB46109005.Text.Length = 0 Then Exit Sub End If april.AturPencarianDataBase("barang", "kodebarang", KB46109005.Text, 1, conect) If april.JumlanBaris > 0 Then KB46109005.Text = april.DataTablenya.Rows(0).Item("KODEBARANG") NB46109005.Text = april.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang itu tidak ada..") Exit Sub End If End Sub
Private Sub KB46109001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB46109005.TextChanged NB46109005.Text = "" UN46109005.Text = "" HR46109005.Text = "" End Sub
Private Sub TM46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM46109005.Click If KB46109005.Text.Length = 0 Then MsgBox("Isi Kode Barang") Exit Sub End If
If Val(UN46109005.Text) = 0 Then MsgBox("Isi Unit Barang") Exit Sub End If
If Val(HR46109005.Text) = 0 Then MsgBox("Isi Harga Barang") Exit Sub End If
Dim barru As DataRow barru = arul.Rows.Find(KB46109005.Text) If barru Is Nothing Then barru = arul.NewRow barru("KODEBARANG") = KB46109005.Text barru("NAMABARANG") = NB46109005.Text barru("UNIT") = Val(UN46109005.Text) barru("HARGA") = Val(HR46109005.Text) barru("JUMLAH") = Val(JM46109005.Text)
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...") End If ngek() End Sub
Private Sub S46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles S46109005.Click If NT46109005.Text.Length = 0 Then MsgBox("Isi No Transaksi") Exit Sub End If
If JT46109005.Text.Length = 0 Then MsgBox("isi Jenis Transaksi") Exit Sub End If
If arul.Rows.Count = 0 Then MsgBox("Isi datatable") Exit Sub End If
april.AturPencarianDataBase("mastertransaksi", "notrans", NT46109005.Text, 1, conect) If april.JumlanBaris > 0 Then MsgBox("No Trans sudah ada") Exit Sub End If
For Each x As DataRow In arul.Rows fahrul = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT46109005.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect) conect.Open() fahrul.ExecuteNonQuery() conect.Close() Next fahrul.Dispose()
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 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("no.transaksi belum terisi") Exit Sub End If If JT_46109021.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") 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()
NT_46109021.Text = "" JT_46109021.Text = ""
NOVI.Rows.Clear() Z() End Sub
Private Sub U_46109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles U_46109021.TextChanged J_46109021.Text = Val(U_46109021.Text) * Val(H_46109021.Text) End Sub End Class
Public Class Latihan37_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_37_022_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.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 itu tidak ada..")
Exit Sub
End If
End Sub
Private Sub KB46109001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB46109001.TextChanged
BalasHapusNB46109001.Text = ""
UN46109001.Text = ""
HR46109001.Text = ""
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)
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 LATIHAN37_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 LATIHAN37_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")
Exit Sub
End If
End Sub
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 SAVE_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_46109051.Click
BalasHapusIf NT_46109051.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If JT_46109051.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If NIAH.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
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")
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 & "#, '" & DT_46109051.Text & "')", WAHDA)
WAHDA.Open()
MMM.ExecuteNonQuery()
WAHDA.Close()
For Each X As DataRow In NIAH.Rows
MMM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109051.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("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
Private Sub U_46109051_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 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")
End If
If Val(U_46109051.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(H_46109051.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
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")
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
End Class
Public Class Form37
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 Form37_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 dpc(1) As DataColumn
dpc(0) = DILA.Columns("kodebarang")
DILA.PrimaryKey = dpc
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 IPIN As DataRow
IPIN = DILA.Rows.Find(KODE_059.Text)
If IPIN Is Nothing Then
IPIN = DILA.NewRow
IPIN("KODEBARANG") = KODE_059.Text
IPIN("NAMABARANG") = NAMA_059.Text
IPIN("UNIT") = Val(UNIT_059.Text)
IPIN("HARGA") = Val(HARGA_059.Text)
IPIN("JUMLAH") = Val(JUMLAH_059.Text)
DILA.Rows.Add(IPIN)
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
UDHE()
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
http://ayuwandikaputriutami.blogspot.com/2012/01/latihan3746109017.html
BalasHapusLATIHAN 37
BalasHapusPublic Class LATIHAN037_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 LATIHAN037_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
Public Class LATIHAN37_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 LATIHAN37_46109021_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim KERETA As New OleDb.OleDbDataAdapter
KERETA = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & KB_46109021.Text & "'", KONEKSI)
NOVI.Rows.Clear()
KERETA.Fill(NOVI)
KERETA.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 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)
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 H_46109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles H_46109021.TextChanged
J_46109021.Text = Val(H_46109021.Text) * Val(U_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)
BalasHapusIf CARI.JumlanBaris > 0 Then
KB_46109021.Text = CARI.DataTablenya.Rows(0).Item("KODEBARANG")
NB_46109021.Text = CARI.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Data yang anda masukkan telah 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 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("no.transaksi belum terisi")
Exit Sub
End If
If JT_46109021.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
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
Private Sub U_46109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles U_46109021.TextChanged
J_46109021.Text = Val(U_46109021.Text) * Val(H_46109021.Text)
End Sub
End Class
http://joicenatalina.blogspot.com/2012/01/tugas-akpom-latihan-35-39.html
BalasHapushttp://ismisriwahyuni.blogspot.com/2012/01/public-class-form37-dim-cimi-as-new.html
BalasHapusPublic Class LATIHAN037_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 LATIHAN037_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 dpc(1) As DataColumn
dpc(0) = DWI.Columns("kodebarang")
DWI.PrimaryKey = dpc
DGV_46109054.DataSource = DWI
End Sub
Private Sub WHI_WHI()
Dim WHI_WHI1 As Integer = 0
For Each WHI_WHI2 As DataRow In DWI.Rows
WHI_WHI1 += WHI_WHI2("JUMLAH")
Next
ww8_46109054.Text = WHI_WHI1
End Sub
Public Class LATIHAN037_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 LATIHAN037_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
Private Sub ww5_46109054_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ww5_46109054.TextChanged, ww6_46109054.TextChanged
BalasHapusww7_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 WHICHA As DataRow
WHICHA = DWI.Rows.Find(ww3_46109054.Text)
If WHICHA Is Nothing Then
WHICHA = DWI.NewRow
WHICHA("KODEBARANG") = ww3_46109054.Text
WHICHA("NAMABARANG") = ww4_46109054.Text
WHICHA("UNIT") = Val(ww5_46109054.Text)
WHICHA("HARGA") = Val(ww6_46109054.Text)
WHICHA("JUMLAH") = Val(ww7_46109054.Text)
DWI.Rows.Add(WHICHA)
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
WHI_WHI()
End Sub
If Val(un_46109027.Text) = 0 Then
BalasHapusMsgBox("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
fransiskus = 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
Private Sub Dwi2_46109054_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi2_46109054.Click
BalasHapusIf 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_WHI()
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 LATIHAN_037_46109053
BalasHapusDim INDAH As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data sounitrce= " & Application.StartupPath & "\DATAMAJUMLAHEMUNITK.accdb;jumlahet oledb:database Password=thrgepinkers29")
Dim DT As New DataTable
Dim DR As DataRow
Private Sub LATIHRGAN37_053_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 JUMLAHOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHRGERE NOTRANS= '" & NT_053.Text & "'", INDAH)
Z.Fill(DT)
Z.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dataPrimary
DATA_053.DataSource = DT
End Sub
Private Sub TOTALALJUMLAH()
Dim TOTAL As Double = 0
For Each Z As DataRow In DT.Rows
TOTAL = TOTAL + Z("JUMLAH")
Next
TOTAL_053.Text = TOTAL
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, INDAH)
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")
Exit Sub
End If
End Sub
Private Sub KB_053_textchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_053.TextChanged
NB_053.Text = ""
UNIT_053.Text = ""
HRG_053.Text = ""
End Sub
Private Sub UNIT_053_textchanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UNIT_053.TextChanged, HRG_053.TextChanged
JUMLAH_053.Text = Val(UNIT_053.Text) * Val(HRG_053.Text)
End Sub
Private Sub TAMBAH_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH_053.Click
If 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("Masunitkkan unit barang")
Exit Sub
End If
If Val(HRG_053.Text) = 0 Then
MsgBox("Masunitkkan harga barang barang")
Exit Sub
End If
DR = DT.Rows.Find(KB_053.Text)
If DR Is Nothing Then
DR = DT.NewRow
DR("KODEBARANG") = KB_053.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
DR = DT.NewRow
DR("KODEBARANG") = KB_053.Text
DR("NAMABARANG") = NB_053.Text
DR("UNIT") = UNIT_053.Text
DR("HARGA") = HRG_053.Text
DR("JUMLAH") = JUMLAH_053.Text
DT.Rows.Add(DR)
KB_053.Text = ""
NB_053.Text = ""
UNIT_053.Text = ""
HRG_053.Text = ""
TOTALALJUMLAH()
End Sub
Private Sub SIMPAN_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN_053.Click
BalasHapusIf 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 DT.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, INDAH)
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_053.Text & "', #" & DT_053.Valunite.Monthrg & "/" & DT_053.Valunite.Day & "/" & DT_053.Valunite.Year & "#, '" & DT_053.Text & "')", INDAH)
INDAH.Open()
MMM.ExecuteNonQuery()
INDAH.Close()
For Each X As DataRow In DT.Rows
MMM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_053.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", INDAH)
INDAH.Open()
MMM.ExecuteNonQuery()
INDAH.Close()
MMM.Dispose()
Next
NT_053.Text = ""
JT_053.Text = ""
JUMLAH_053.Text = ""
DT.Rows.Clear()
TOTALALJUMLAH()
End Sub
End Class
ARYANDIRA(46109034)
BalasHapusPublic Class Latihan37_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 Latihan37_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)
dt.Rows.Clear()
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 = 0
For 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 itu tidak ada..")
Exit Sub
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
End 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") = Val(ff_034.Text)
dr("HARGA") = Val(gg_034.Text)
dr("JUMLAH") = Val(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
BalasHapusIf aa_034.Text.Length = 0 Then
MsgBox("Isi rong No Transaksi ")
Exit Sub
End If
If cc_034.Text.Length = 0 Then
MsgBox("isi rong Jenis Transaksi")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Maaf..Isi rong itu datatable ")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Maaf..Isi rong itu datatable ")
Exit Sub
End If
dira.AturPencarianDataBase("mastertransaksi", "notrans", aa_034.Text, 1, satu)
If dira.JumlanBaris > 0 Then
MsgBox("Ada no trans 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 Latihan37_46109001
BalasHapusDim arul As New DataTable
Dim fahrul As New OleDb.OleDbCommand
Dim april 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=arul")
Private Sub Latihan_37_022_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim muhammadfahrul As New OleDb.OleDbDataAdapter
muhammadfahrul = 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 ='" & NT46109005.Text & "'", conect)
arul.Rows.Clear()
muhammadfahrul.Fill(arul)
muhammadfahrul.Dispose()
Dim dpc(1) As DataColumn
dpc(0) = arul.Columns("kodebarang")
arul.PrimaryKey = dpc
DATA46109005.DataSource = arul
End Sub
Private Sub ngek()
Dim ngek1 As Integer = 0
For Each ngek2 As DataRow In arul.Rows
ngek1 += ngek2("JUMLAH")
Next
TOT46109005.Text = ngek1
End Sub
Private Sub UN46109001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UN46109005.TextChanged, HR46109005.TextChanged
JM46109005.Text = Val(UN46109005.Text) * Val(HR46109005.Text)
End Sub
Private Sub KB46109001_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB46109005.Leave
If KB46109005.Text.Length = 0 Then
Exit Sub
End If
april.AturPencarianDataBase("barang", "kodebarang", KB46109005.Text, 1, conect)
If april.JumlanBaris > 0 Then
KB46109005.Text = april.DataTablenya.Rows(0).Item("KODEBARANG")
NB46109005.Text = april.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang itu tidak ada..")
Exit Sub
End If
End Sub
Private Sub KB46109001_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB46109005.TextChanged
NB46109005.Text = ""
UN46109005.Text = ""
HR46109005.Text = ""
End Sub
Private Sub TM46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM46109005.Click
If KB46109005.Text.Length = 0 Then
MsgBox("Isi Kode Barang")
Exit Sub
End If
If Val(UN46109005.Text) = 0 Then
MsgBox("Isi Unit Barang")
Exit Sub
End If
If Val(HR46109005.Text) = 0 Then
MsgBox("Isi Harga Barang")
Exit Sub
End If
Dim barru As DataRow
barru = arul.Rows.Find(KB46109005.Text)
If barru Is Nothing Then
barru = arul.NewRow
barru("KODEBARANG") = KB46109005.Text
barru("NAMABARANG") = NB46109005.Text
barru("UNIT") = Val(UN46109005.Text)
barru("HARGA") = Val(HR46109005.Text)
barru("JUMLAH") = Val(JM46109005.Text)
arul.Rows.Add(barru)
KB46109005.Text = ""
UN46109005.Text = ""
HR46109005.Text = ""
Else
BalasHapusMsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...")
End If
ngek()
End Sub
Private Sub S46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles S46109005.Click
If NT46109005.Text.Length = 0 Then
MsgBox("Isi No Transaksi")
Exit Sub
End If
If JT46109005.Text.Length = 0 Then
MsgBox("isi Jenis Transaksi")
Exit Sub
End If
If arul.Rows.Count = 0 Then
MsgBox("Isi datatable")
Exit Sub
End If
april.AturPencarianDataBase("mastertransaksi", "notrans", NT46109005.Text, 1, conect)
If april.JumlanBaris > 0 Then
MsgBox("No Trans sudah ada")
Exit Sub
End If
fahrul = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT46109005.Text & "',#" & T46109005.Value.Month & "/" & T46109005.Value.Day & "/" & T46109005.Value.Year & "#,'" & JT46109005.Text & "')", conect)
conect.Open()
fahrul.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In arul.Rows
fahrul = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT46109005.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", conect)
conect.Open()
fahrul.ExecuteNonQuery()
conect.Close()
Next
fahrul.Dispose()
NT46109005.Text = ""
JT46109005.Text = ""
arul.Rows.Clear()
ngek()
End Sub
End Class
Private Sub KB_46109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_46109021.TextChanged
BalasHapusNB_46109021.Text = " "
U_46109021.Text = " "
H_46109021.Text = " "
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("no.transaksi belum terisi")
Exit Sub
End If
If JT_46109021.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
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
Private Sub U_46109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles U_46109021.TextChanged
J_46109021.Text = Val(U_46109021.Text) * Val(H_46109021.Text)
End Sub
End Class
http://cacalisa.blogspot.com/2012/11/latihan3746110038.html
BalasHapushttp://rafidashaleh.blogspot.com/2012/11/latihan3746110041.html
BalasHapushttp://mulyawarman039.blogspot.com/2012/11/latihan3746110039.html
BalasHapushttp://wahyunirachman.blogspot.com/2012/11/latihan3746110020.html
BalasHapushttp://srikartikafanty.blogspot.com/2012/11/latihan3746110007.html
BalasHapushttp://dianmegariski.blogspot.com/2012/11/latihan3746110023_4.html
BalasHapushttp://bahrizj.blogspot.com/2012/11/latihan3746110001.html
BalasHapushttp://restyaccounting.blogspot.com/2012/11/latihan3746110027.html
BalasHapushttp://idhamsyaam.blogspot.com/2012/11/latihan3746110021.html
BalasHapushttp://alfaega.blogspot.com/2012/11/latihan3746110022.html
BalasHapushttp://sulhihusni.blogspot.com/2012/11/latihan3746110004.html
BalasHapushttp://fitrianihamka.blogspot.com/2012/11/latihan3746110006.html
BalasHapushttp://ildayani.blogspot.com/2012/11/latihan3746110002.html
BalasHapushttp://masdarwati.blogspot.com/2012/11/latihan3746110024.html
BalasHapushttp://hanihasan07.blogspot.com/2012/12/latihan3746110044.html
BalasHapushttp://bothbon.blogspot.com/2013/01/latihan3746110043.html
BalasHapushttp://muthmil8.blogspot.com/2012/11/latihan3746110037.html
BalasHapushttp://amalmaulana92.blogspot.com/2013/01/latihan3746110003_3.html
BalasHapushttp://aardianzah2.blogspot.com/2013/01/latihan-37.html
BalasHapushttp://feibyfrycilia.blogspot.com/2013/01/latihan3746110055.html
BalasHapushttp://diyanahdina.blogspot.com/2013/01/latihan3746110045.html
BalasHapushttp://deodns.blogspot.com/#!/2013/01/latihan3746110040.html
BalasHapus