Public Class Form35
Dim ami As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=25")
Dim nurul As New DataTable
Dim irma As New ByIskandar.CariKeDataBaseByIskandar
Private Sub latihan35_017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim apa As New OleDb.OleDbDataAdapter
apa = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & t4_36109021.Text & "'", ami)
nurul.Rows.Clear()
apa.Fill(nurul)
dgv_36109021.DataSource = nurul
apa.Dispose()
End Sub
Private Sub button1_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_36109021.Click
If t4_36109021.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(t5_36109021.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(t6_36109021.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
Dim paa As DataRow
paa = nurul.NewRow
paa("KODEBARANG") = t4_36109021.Text
paa("UNIT") = t5_36109021.Text
paa("HARGA") = t6_36109021.Text
nurul.Rows.Add(paa)
t4_36109021.Text = ""
t5_36109021.Text = ""
t6_36109021.Text = ""
End Sub
Private Sub button2_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_36109021.Click
If t1_36109021.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
Exit Sub
End If
If t3_36109021.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
irma.AturPencarianDataBase("mastertransaksi", "notrans", t1_36109021.Text, 1, ami)
If irma.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If nurul.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & t1_36109021.Text & "',#" & t2_36109021.Value.Month & "/" & t2_36109021.Value.Day & "/" & t2_36109021.Value.Year & "#,'" & t3_36109021.Text & "')", ami)
ami.Open()
com.ExecuteNonQuery()
ami.Close()
For Each r As DataRow In nurul.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & t1_36109021.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", ami)
ami.Open()
com.ExecuteNonQuery()
ami.Close()
com.Dispose()
Next
nurul.Rows.Clear()
t1_36109021.Text = ""
t3_36109021.Text = ""
End Sub
End Class
___________________________________________________
Public Class Form36
Dim dt As New DataTable
Dim oc As New OleDb.OleDbCommand
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/datamajemuk.ACCDB")
Private Sub Form36_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 KODEBARANG, UNIT, HARGA from detailtransaksi where notrans = '" & t1_36109021.Text & "'", nurul)
a.Fill(dt)
a.Dispose()
dgv_36109021.DataSource = dt
Dim col(1) As DataColumn
col(0) = dt.Columns("kodebarang")
dt.PrimaryKey = col
End Sub
Private Sub tambah_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah_36109021.Click
If kb_36109021.Text.Length = 0 Then
MsgBox("Isi rong itu Kode Barang na..")
Exit Sub
End If
If Val(un_36109021.Text) = 0 Then
MsgBox("Isi rong itu Unit na..")
Exit Sub
End If
If Val(hr_36109021.Text) = 0 Then
MsgBox("Isi rong itu Harga na..")
Exit Sub
End If
Dim row As DataRow
row = dt.Rows.Find(kb_36109021.Text)
If row Is Nothing Then
row = dt.NewRow
row("KODEBARANG") = kb_36109021.Text
row("UNIT") = un_36109021.Text
row("HARGA") = hr_36109021.Text
dt.Rows.Add(row)
kb_36109021.Text = ""
un_36109021.Text = ""
hr_36109021.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain")
End If
End Sub
Private Sub simpan_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109021.Click
If t1_36109021.Text.Length = 0 Then
MsgBox("Isi rong No Transaksi na..")
Exit Sub
End If
If t3_36109021.Text.Length = 0 Then
MsgBox("Isi rong Jenis Transaksi na..")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Maaf...Isi rong itu datatable na..")
Exit Sub
End If
ami.AturPencarianDataBase("mastertransaksi", "notrans", t1_36109021.Text, 1, nurul)
If ami.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu")
Exit Sub
End If
oc = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & t1_36109021.Text & "',#" & t2_36109021.Value.Month & "/" & t2_36109021.Value.Day & "/" & t2_36109021.Value.Year & "#,'" & t3_36109021.Text & "')", nurul)
nurul.Open()
oc.ExecuteNonQuery()
nurul.Close()
For Each x As DataRow In dt.Rows
oc = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & t1_36109021.Text & "', '" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", nurul)
nurul.Open()
oc.ExecuteNonQuery()
nurul.Close()
Next
oc.Dispose()
t1_36109021.Text = ""
t3_36109021.Text = ""
dt.Rows.Clear()
End Sub
End Class
___________________________________________________
Public Class Form37
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim nurul As New ByIskandar.CariKeDataBaseByIskandar
Dim ami As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Datamajemuk.ACCDB")
Private Sub Form37_36109023_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 ='" & nt_36109021.Text & "'", ami)
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
Dim dc(1) As DataColumn
dc(0) = dt.Columns("kodebarang")
dt.PrimaryKey = dc
dgv_36109021.DataSource = dt
End Sub
Private Sub pororo()
Dim pororo As Integer = 0
For Each pororo2 As DataRow In dt.Rows
pororo += pororo2("JUMLAH")
Next
Total_36109021.Text = pororo
End Sub
Private Sub un_36109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_36109021.TextChanged
jm_36109021.Text = Val(un_36109021.Text) * Val(hr_36109021.Text)
End Sub
Private Sub kb_36109021_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb_36109021.Leave
If kb_36109021.Text.Length = 0 Then
Exit Sub
End If
nurul.AturPencarianDataBase("barang", "kodebarang", kb_36109021.Text, 1, ami)
If nurul.JumlanBaris > 0 Then
kb_36109021.Text = nurul.DataTablenya.Rows(0).Item("KODEBARANG")
nb_36109021.Text = nurul.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang itu tidak ada..")
Exit Sub
End If
End Sub
Private Sub kb_36109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_36109021.TextChanged
nb_36109021.Text = ""
un_36109021.Text = ""
hr_36109021.Text = ""
End Sub
Private Sub tambah_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah_36109021.Click
If kb_36109021.Text.Length = 0 Then
MsgBox("Isi rong itu Kode Barang na..")
Exit Sub
End If
If Val(un_36109021.Text) = 0 Then
MsgBox("Isi rong itu Unit na..")
Exit Sub
End If
If Val(hr_36109021.Text) = 0 Then
MsgBox("Isi rong itu Harga na..")
Exit Sub
End If
Dim dr As DataRow
dr = dt.Rows.Find(kb_36109021.Text)
If dr Is Nothing Then
dr = dt.NewRow
dr("KODEBARANG") = kb_36109021.Text
dr("NAMABARANG") = nb_36109021.Text
dr("UNIT") = Val(un_36109021.Text)
dr("HARGA") = Val(hr_36109021.Text)
dr("JUMLAH") = Val(jm_36109021.Text)
dt.Rows.Add(dr)
kb_36109021.Text = ""
un_36109021.Text = ""
hr_36109021.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...")
End If
pororo()
End Sub
Private Sub simpan_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109021.Click
If nt_36109021.Text.Length = 0 Then
MsgBox("Isi rong No Transaksi na..")
Exit Sub
End If
If jt_36109021.Text.Length = 0 Then
MsgBox("isi rong Jenis Transaksi na..")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Maaf..Isi rong itu datatable na..")
Exit Sub
End If
nurul.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109021.Text, 1, ami)
If nurul.JumlanBaris > 0 Then
MsgBox("Adami no trans seperti itu...")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_36109021.Text & "',#" & t2_36109021.Value.Month & "/" & t2_36109021.Value.Day & "/" & t2_36109021.Value.Year & "#,'" & jt_36109021.Text & "')", ami)
ami.Open()
cm.ExecuteNonQuery()
ami.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt_36109021.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", ami)
ami.Open()
cm.ExecuteNonQuery()
ami.Close()
Next
cm.Dispose()
nt_36109021.Text = ""
jt_36109021.Text = ""
dt.Rows.Clear()
pororo()
End Sub
Private Sub hr_36109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hr_36109021.TextChanged
jm_36109021.Text = Val(un_36109021.Text) * Val(hr_36109021.Text)
End Sub
Private Sub jm_36109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles jm_36109021.TextChanged
jm_36109021.Text = Val(un_36109021.Text) * Val(hr_36109021.Text)
End Sub
End Class
___________________________________________________
Public Class Form38
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim nurul As New ByIskandar.CariKeDataBaseByIskandar
Dim ami As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Datamajemuk.ACCDB")
Private Sub Form38_36109023_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_36109021.Text & "'", ami)
a.Fill(dt)
a.Dispose()
Dim dc(1) As DataColumn
dc(0) = dt.Columns("Kodebarang")
dt.PrimaryKey = dc
dgv_36109021.DataSource = dt
End Sub
Private Sub sj()
Dim sj1 As Integer = 0
For Each sj2 As DataRow In dt.Rows
sj1 += sj2("JUMLAH")
Next
jj_36109021.Text = sj1
End Sub
Private Sub ff_36109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ff_36109021.TextChanged
hh_36109021.Text = Val(ff_36109021.Text) * Val(gg_36109021.Text)
End Sub
Private Sub gg_36109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gg_36109021.TextChanged
hh_36109021.Text = Val(ff_36109021.Text) * Val(gg_36109021.Text)
End Sub
Private Sub hh_36109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hh_36109021.TextChanged
hh_36109021.Text = Val(ff_36109021.Text) * Val(gg_36109021.Text)
End Sub
Private Sub dd_36109021_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles dd_36109021.Leave
If dd_36109021.Text.Length = 0 Then
Exit Sub
End If
nurul.AturPencarianDataBase("barang", "kodebarang", dd_36109021.Text, 1, ami)
If nurul.JumlanBaris > 0 Then
dd_36109021.Text = nurul.DataTablenya.Rows(0).Item("KODEBARANG")
ee_36109021.Text = nurul.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang seperti itu tidak ada..")
' If Form38_39_40_36109021.ShowDialog = Windows.Forms.DialogResult.OK Then
'dd_36109021.Text = Form38_39_40_36109021.dgv36109023.CurrentRow.Cells("kodebarang").Value
' ee_36109021.Text = Form38_39_40_36109021.dgv36109023.CurrentRow.Cells("namabarang").Value
' Else
' dd_36109021.Text = ""
' End If
End If
End Sub
Private Sub dd_36109021_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dd_36109021.TextChanged
ee_36109021.Text = ""
ff_36109021.Text = ""
gg_36109021.Text = ""
End Sub
Private Sub ii_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ii_36109021.Click
If dd_36109021.Text.Length = 0 Then
MsgBox("Isi rong itu Kode Barang na..")
Exit Sub
End If
If Val(ff_36109021.Text) = 0 Then
MsgBox("Isi rong itu Unit na..")
Exit Sub
End If
If Val(gg_36109021.Text) = 0 Then
MsgBox("Isi rong itu Harga na..")
Exit Sub
End If
Dim dr As DataRow
dr = dt.Rows.Find(dd_36109021.Text)
If dr Is Nothing Then
dr = dt.NewRow
dr("KODEBARANG") = dd_36109021.Text
dr("NAMABARANG") = ee_36109021.Text
dr("UNIT") = ff_36109021.Text
dr("HARGA") = gg_36109021.Text
dr("JUMLAH") = hh_36109021.Text
dt.Rows.Add(dr)
dd_36109021.Text = ""
ff_36109021.Text = ""
gg_36109021.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain")
End If
sj()
End Sub
Private Sub kk_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kk_36109021.Click
If aa_36109021.Text.Length = 0 Then
MsgBox("Isi rong itu No Transaksi na..")
Exit Sub
End If
If cc_36109021.Text.Length = 0 Then
MsgBox("Isi rong itu Jenis Transaksi na..")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Isi rong itu datatable na..")
Exit Sub
End If
nurul.AturPencarianDataBase("mastertransaksi", "notrans", aa_36109021.Text, 1, ami)
If nurul.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_36109021.Text & "',#" & bb_36109021.Value.Month & "/" & bb_36109021.Value.Day & "/" & bb_36109021.Value.Year & "#,'" & cc_36109021.Text & "')", ami)
ami.Open()
cm.ExecuteNonQuery()
ami.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & aa_36109021.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", ami)
ami.Open()
cm.ExecuteNonQuery()
ami.Close()
Next
cm.Dispose()
aa_36109021.Text = ""
cc_36109021.Text = ""
dt.Rows.Clear()
sj()
End Sub
End Class
___________________________________________________
Public Class Form39
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub latihan39_36109017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String)))
DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String)))
DT.Columns.Add(New DataColumn("UNIT", GetType(Double)))
DT.Columns.Add(New DataColumn("HARGA", GetType(Integer)))
DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
dgv_36109021.DataSource = DT
Dim dcp(1) As DataColumn
dcp(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dcp
DT.Columns("UNIT").DefaultValue = 0
DT.Columns("HARGA").DefaultValue = 0
DT.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
Dim manis As Integer
For Each r As DataGridViewRow In dgv_36109021.Rows
manis = manis + r.Cells("JUMLAH").Value
Next
Tot_36109021.Text = manis
End Sub
Private Sub dgv_36109021_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv_36109021.CellEndEdit
If e.ColumnIndex = 0 Then
cari.AturPencarianDataBase("BARANG", "kodebarang", dgv_36109021.CurrentRow.Cells("kodebarang").Value, 1, CONECT)
If cari.JumlanBaris > 0 Then
dgv_36109021.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
dgv_36109021.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
' If Form38_39_40_36109021.ShowDialog = Windows.Forms.DialogResult.OK Then
'dgv_36109021.CurrentRow.Cells("KODEBARANG").Value = Form38_39_40_36109021.dgv_36109017.CurrentRow.Cells("KodeBarang").Value
' dgv_36109021.CurrentRow.Cells("NAMABARANG").Value = Form38_39_40_36109021.dgv_36109017.CurrentRow.Cells("namabarang").Value
' dgv_36109021.CurrentRow.Cells("HARGA").Value = Form38_39_40_36109021.dgv_36109017.CurrentRow.Cells("HARGAJUAL").Value
' Else
' dgv_36109021.CurrentRow.Cells("KODEBARANG").Value = ""
'dgv_36109021.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
' End If
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
dgv_36109021.CurrentRow.Cells("JUMLAH").Value = dgv_36109021.CurrentRow.Cells("UNIT").Value * dgv_36109021.CurrentRow.Cells("HARGA").Value
End If
hitung()
End Sub
Private Sub simpan_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109021.Click
If nt_36109021.Text.Length = 0 Then
MsgBox("no transaksi belum terisi")
Exit Sub
End If
If jt_36109021.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109021.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_36109021.Text & "',#" & tgl_36109021.Value.Date & "#," & Val(jt_36109021.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & nt_36109021.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
nt_36109021.Text = ""
jt_36109021.Text = ""
Tot_36109021.Text = ""
DT.Rows.Clear()
hitung()
End Sub
End Class
___________________________________________________
Public Class Form40A
Dim ami As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/DataMajemuk.accdb")
Dim DT1 As New DataTable
Dim DT2 As New DataTable
Dim DS As New DataSet
Dim BS1 As New BindingSource
Dim BS2 As New BindingSource
Public Sub irma1()
Dim S As New OleDb.OleDbDataAdapter
DT2.Rows.Clear()
DT1.Rows.Clear()
S = New OleDb.OleDbDataAdapter("select * from mastertransaksi", ami)
S.Fill(DT1)
S = New OleDb.OleDbDataAdapter("select detailtransaksi.notrans, barang.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, detailtransaksi.unit*harga as jumlah from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang", ami)
S.Fill(DT2)
End Sub
Private Sub Latihan40A_36109005_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
irma1()
DS.Tables.Add(DT1)
DS.Tables.Add(DT2)
DT1.TableName = "nurul"
DT2.TableName = "nurul2"
DS.Relations.Add(New DataRelation("S", DS.Tables("nurul").Columns("notrans"), DS.Tables("nurul2").Columns("notrans")))
BS1.DataSource = DS
BS1.DataMember = "nurul"
BS2.DataSource = BS1
BS2.DataMember = "S"
Dim DC(1) As DataColumn
DC(0) = DT1.Columns("notrans")
DT1.PrimaryKey = dc
dgv1_36109021.DataSource = BS1
dgv2_36109021.DataSource = BS2
End Sub
Private Sub hapus_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus_36109021.Click
Dim COM As New OleDb.OleDbCommand
COM = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & dgv1_36109021.CurrentRow.Cells("notrans").Value & "'", ami)
ami.Open()
COM.ExecuteNonQuery()
ami.Close()
COM = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & dgv1_36109021.CurrentRow.Cells("notrans").Value & "'", ami)
ami.Open()
COM.ExecuteNonQuery()
ami.Close()
COM.Dispose()
irma1()
End Sub
Private Sub tambah_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah_36109021.Click
If Form40B.Visible = False Then
Form40B.Show()
Else
Form40B.Activate()
End If
Form40B.nt_36109021.Text = ""
Form40B.jt_36109021.Text = ""
Form40B.TS_36109021.Text = "-"
Form40B.irma2()
Form40B.irma3()
End Sub
Private Sub edit_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit_36109021.Click
If Form40B.Visible = False Then
Form40B.Show()
Else
Form40B.Activate()
End If
Form40B.nt_36109021.Text = dgv1_36109021.CurrentRow.Cells("notrans").Value
Form40B.tgl_36109021.Value = dgv1_36109021.CurrentRow.Cells("tanggaltransaksi").Value
Form40B.jt_36109021.Text = dgv1_36109021.CurrentRow.Cells("jenistransaksi").Value
Form40B.TS_36109021.Text = dgv1_36109021.CurrentRow.Cells("notrans").Value
Form40B.irma2()
Form40B.irma3()
End Sub
End Class
___________________________________________________
Public Class Form40B
Dim ami As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/dataMajemuk.accdb")
Dim DT As New DataTable
Dim nurul As New ByIskandar.CariKeDataBaseByIskandar
Dim COM As New OleDb.OleDbCommand
Public Sub irma2()
Dim S As New OleDb.OleDbDataAdapter
S = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit * detailtransaksi.harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans = '" & nt_36109021.Text & "'", ami)
DT.Rows.Clear()
S.Fill(DT)
End Sub
Public Sub irma3()
Dim total As Integer = 0
For Each x As DataRow In DT.Rows
total += x("Jumlah")
Next
Tot_36109021.Text = total
End Sub
Private Sub irma4()
If nt_36109021.Text.Length = 0 Then
MsgBox("No Transaksi Belum Di isi")
Exit Sub
End If
If jt_36109021.Text.Length = 0 Then
MsgBox("Jenis Transaksi Belum Di isi")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("Datatable Bulum Di isi")
Exit Sub
End If
End Sub
Private Sub megumi()
irma4()
nurul.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109021.Text, 1, ami)
If nurul.JumlanBaris > 0 Then
MsgBox("No Transaksi Seperti Itu Sudah Ada")
Exit Sub
End If
COM = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_36109021.Text & "',#" & tgl_36109021.Value.Month & "/" & tgl_36109021.Value.Day & "/" & tgl_36109021.Value.Year & "#,'" & jt_36109021.Text & "')", ami)
ami.Open()
COM.ExecuteNonQuery()
ami.Close()
For Each x As DataRow In DT.Rows
COM = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt_36109021.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", ami)
ami.Open()
COM.ExecuteNonQuery()
ami.Close()
Next
COM.Dispose()
nt_36109021.Text = ""
jt_36109021.Text = ""
Tot_36109021.Text = ""
TS_36109021.Text = "-"
DT.Rows.Clear()
Form40A.irma1()
End Sub
Public Sub Edit()
irma4()
If nt_36109021.Text <> TS_36109021.Text Then
nurul.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109021.Text, 1, ami)
If nurul.JumlanBaris > 0 Then
MsgBox("No Transaksi Seperti Itu Sudah Ada")
Exit Sub
End If
End If
COM = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & TS_36109021.Text & "'", ami)
ami.Open()
COM.ExecuteNonQuery()
ami.Close()
COM = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_36109021.Text & "',#" & tgl_36109021.Value.Month & "/" & tgl_36109021.Value.Day & "/" & tgl_36109021.Value.Year & "#,'" & jt_36109021.Text & "')", ami)
ami.Open()
COM.ExecuteNonQuery()
ami.Close()
COM = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & TS_36109021.Text & "'", ami)
ami.Open()
COM.ExecuteNonQuery()
ami.Close()
For Each x As DataRow In DT.Rows
COM = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & nt_36109021.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", ami)
ami.Open()
COM.ExecuteNonQuery()
ami.Close()
Next
COM.Dispose()
nt_36109021.Text = ""
jt_36109021.Text = ""
Tot_36109021.Text = ""
TS_36109021.Text = "-"
DT.Rows.Clear()
Form40A.irma1()
End Sub
Private Sub Latihan40B_36109005_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
irma2()
Dim DC(1) As DataColumn
DC(0) = DT.Columns("kodebarang")
DT.PrimaryKey = DC
DT.Columns("unit").DefaultValue = 0
DT.Columns("harga").DefaultValue = 0
DT.Columns("jumlah").DefaultValue = 0
dgv_36109021.DataSource = DT
End Sub
Private Sub DGV_36109005_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv_36109021.CellEndEdit
If dgv_36109021.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
dgv_36109021.CurrentRow.Cells("NAMABARANG").Value = ""
dgv_36109021.CurrentRow.Cells("UNIT").Value = 0
dgv_36109021.CurrentRow.Cells("HARGA").Value = 0
dgv_36109021.CurrentRow.Cells("JUMLAH").Value = 0
nurul.AturPencarianDataBase("barang", "kodebarang", dgv_36109021.CurrentRow.Cells("KODEBARANG").Value, 1, ami)
If nurul.JumlanBaris > 0 Then
dgv_36109021.CurrentRow.Cells("NAMABARANG").Value = nurul.DataTablenya.Rows(0).Item("NAMABARANG")
Else
dgv_36109021.CurrentRow.Cells("NAMABARANG").Value = ""
'If Form38_39_40_36109021.ShowDialog = Windows.Forms.DialogResult.OK Then
'dgv_36109021.CurrentRow.Cells("KODEBARANG").Value = Form38_39_40_36109021.dgv_36109021.CurrentRow.Cells("KODEBARANG").Value
'dgv_36109021.CurrentRow.Cells("NAMABARANG").Value = Form38_39_40_36109021.dgv_36109021.CurrentRow.Cells("NAMABARANG").Value
End If
End If
' ElseIf dgv_36109021.Columns(e.ColumnIndex).Name = "UNIT" Or dgv_36109021.Columns(e.ColumnIndex).Name = "HARGA" Then
' dgv_36109021.CurrentRow.Cells("JUMLAH").Value = dgv_36109021.CurrentRow.Cells("UNIT").Value * dgv_36109021.CurrentRow.Cells("HARGA").Value
' irma3()
' End If
End Sub
Private Sub simpan_36109021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109021.Click
If TS_36109021.Text = "-" Then
megumi()
Else
Edit()
End If
End Sub
Private Sub dgv_36109021_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles dgv_36109021.DataError
MsgBox("Terjadi sedikit kesalahan...")
End Sub
End Class
___________________________________________________
ami nurul
Rabu, 11 Januari 2012
Kamis, 24 November 2011
Form 32A-34C
Public Class Form32A
Dim dt As New DataTable
Dim conect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub ami()
Dim fm As New OleDb.OleDbDataAdapter
fm = New OleDb.OleDbDataAdapter("select * from barang", conect)
dt.Rows.Clear()
fm.Fill(dt)
fm.Dispose()
End Sub
Private Sub latihan32A_36109017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ami()
dgv_021.DataSource = dt
End Sub
Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
If Form32B.Visible = False Then
Form32B.Show()
Else
Form32B.Activate()
End If
End Sub
Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
If Form32C.Visible = False Then
Form32C.Show()
Else
Form32C.Activate()
End If
Form32C.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form32C.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
Form32C.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
Form32C.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
Form32C.KB.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form32C.Show()
End Sub
End Class
Public Class Form32B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim conect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, conect)
If ami.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
nurul = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")", conect)
conect.Open()
nurul.ExecuteNonQuery()
conect.Close()
nurul.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Form32A.ami()
End Sub
End Class
Public Class Form32C
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim conect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t1_021.Text <> KB.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, conect)
If ami.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
nurul = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'", conect)
conect.Open()
nurul.ExecuteNonQuery()
conect.Close()
nurul.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
KB.Text = ""
Form32A.ami()
End Sub
End Class
Public Class Form33A
Dim ami As New DataTable
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")
Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
If Form33B.Visible = False Then
Form33B.Show()
Else
Form33B.Activate()
End If
End Sub
Private Sub button3_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3_021.Click
If Form33B.Visible = False Then
Form33B.Show()
Else
Form33B.Activate()
End If
Form33B.KB.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form33B.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form33B.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
Form33B.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
Form33B.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
End Sub
Private Sub Form33A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim adapter As New OleDb.OleDbDataAdapter
adapter = New OleDb.OleDbDataAdapter("select * from barang", irma)
ami.Rows.Clear()
adapter.Fill(ami)
adapter.Dispose()
dgv_021.DataSource = ami
End Sub
Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
Dim ara As String = "delete * from barang where kodebarang = '" & dgv_021.CurrentRow.Cells("kodebarang").Value & "'"
nurul = New OleDb.OleDbCommand(ara, irma)
irma.Open()
nurul.ExecuteNonQuery()
irma.Close()
nurul.Dispose()
Dim adapter As New OleDb.OleDbDataAdapter
adapter = New OleDb.OleDbDataAdapter("select * from barang", irma)
ami.Rows.Clear()
adapter.Fill(ami)
adapter.Dispose()
dgv_021.DataSource = ami
End Sub
End Class
Public Class Form33B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If KB.Text = "" Then
ami.AturPencarianDataBase("Barang", "KodeBarang", KB.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("kode barang telah ada")
t1_021.Text = ""
Exit Sub
ElseIf t1_021.Text.Length = 0 Then
MsgBox("kode barang harus tercantum")
Exit Sub
ElseIf t2_021.Text.Length = 0 Then
MsgBox("nama barang harus tercantum")
Exit Sub
ElseIf t3_021.Text.Length = 0 Then
MsgBox("harga jual harus tercantum")
Exit Sub
ElseIf t4_021.Text.Length = 0 Then
MsgBox("jumlah barang harus tercantum")
Exit Sub
End If
Dim soe As String = "insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")"
nurul = New OleDb.OleDbCommand(soe, irma)
irma.Open()
nurul.ExecuteNonQuery()
irma.Close()
nurul.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Else
If KB.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("kode barang tidak dapat diupdate")
Exit Sub
End If
End If
If t1_021.Text.Length = 0 Then
MsgBox("kode barang harus tercantum")
Exit Sub
ElseIf t2_021.Text.Length = 0 Then
MsgBox("nama barang harus tercantum")
Exit Sub
ElseIf t3_021.Text.Length = 0 Then
MsgBox("harga jual harus tercantum")
Exit Sub
ElseIf t4_021.Text.Length = 0 Then
MsgBox("jumlah barang harus tercantum")
Exit Sub
End If
Dim soe As String = "update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'"
nurul = New OleDb.OleDbCommand(soe, irma)
irma.Open()
nurul.ExecuteNonQuery()
irma.Close()
nurul.Dispose()
KB.Text = "-"
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End If
End Sub
End Class
Public Class Form34A
Private Sub DATABARANGToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DAFTARBARANGToolStripMenuItem.Click
If Form34B.Visible = False Then
Form34B.MdiParent = Me
Form34B.Show()
Else
Form34B.Activate()
End If
End Sub
Private Sub INPUTBARANGToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUTBARANGToolStripMenuItem.Click
If Form34C.Visible = False Then
Form34C.MdiParent = Me
Form34C.Show()
Else
Form34C.Activate()
End If
End Sub
Private Sub ToolStripButton1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1_021.Click
If Form34B.Visible = False Then
Form34B.MdiParent = Me
Form34B.Show()
Else
Form34B.Activate()
End If
End Sub
Private Sub ToolStripButton2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2_021.Click
If Form34C.Visible = False Then
Form34C.MdiParent = Me
Form34C.Show()
Else
Form34B.Activate()
End If
End Sub
End Class
Public Class Form34B
Dim DT As New DataTable
Dim CM As New OleDb.OleDbCommand
Dim MM As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
If Form34C.Visible = False Then
Form34C.Show()
Else
Form34C.Activate()
End If
End Sub
Private Sub button3_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3_021.Click
If Form34C.Visible = False Then
Form34C.Show()
Else
Form34C.Activate()
End If
Form34C.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form34C.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
Form34C.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
Form34C.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
Form34C.KB.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
End Sub
Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
Dim ICHMI As String = "delete * from barang where kodebarang = '" & dgv_021.CurrentRow.Cells("kodebarang").Value & "'"
CM = New OleDb.OleDbCommand(ICHMI, MM)
MM.Open()
CM.ExecuteNonQuery()
MM.Close()
CM.Dispose()
Dim MILK As New OleDb.OleDbDataAdapter
MILK = New OleDb.OleDbDataAdapter("select * from barang", MM)
DT.Rows.Clear()
MILK.Fill(DT)
MILK.Dispose()
dgv_021.DataSource = DT
End Sub
Private Sub Form34B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim MILK As New OleDb.OleDbDataAdapter
MILK = New OleDb.OleDbDataAdapter("Select * from barang", MM)
DT.Rows.Clear()
MILK.Fill(DT)
MILK.Dispose()
dgv_021.DataSource = DT
End Sub
End Class
Public Class Form34C
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim OD As New OleDb.OleDbCommand
Dim DB As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If KB.Text = "" Then
ami.AturPencarianDataBase("Barang", "KodeBArang", t1_021.Text, 1, DB)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
t1_021.Text = ""
Exit Sub
ElseIf t1_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf t2_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf t3_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf t4_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
End If
Dim nurul As String = "insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")"
OD = New OleDb.OleDbCommand(nurul, DB)
DB.Open()
OD.ExecuteNonQuery()
DB.Close()
OD.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Else
If KB.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, DB)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
If t1_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf t2_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf Val(t3_021.Text) = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf Val(t4_021.Text) = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
End If
Dim nurul As String = "update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'"
OD = New OleDb.OleDbCommand(nurul, DB)
DB.Open()
OD.ExecuteNonQuery()
DB.Close()
OD.Dispose()
KB.Text = "-"
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End If
End Sub
End Class
Dim dt As New DataTable
Dim conect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub ami()
Dim fm As New OleDb.OleDbDataAdapter
fm = New OleDb.OleDbDataAdapter("select * from barang", conect)
dt.Rows.Clear()
fm.Fill(dt)
fm.Dispose()
End Sub
Private Sub latihan32A_36109017_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ami()
dgv_021.DataSource = dt
End Sub
Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
If Form32B.Visible = False Then
Form32B.Show()
Else
Form32B.Activate()
End If
End Sub
Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
If Form32C.Visible = False Then
Form32C.Show()
Else
Form32C.Activate()
End If
Form32C.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form32C.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
Form32C.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
Form32C.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
Form32C.KB.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form32C.Show()
End Sub
End Class
Public Class Form32B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim conect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, conect)
If ami.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
nurul = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")", conect)
conect.Open()
nurul.ExecuteNonQuery()
conect.Close()
nurul.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Form32A.ami()
End Sub
End Class
Public Class Form32C
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim conect As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t1_021.Text <> KB.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, conect)
If ami.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
nurul = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'", conect)
conect.Open()
nurul.ExecuteNonQuery()
conect.Close()
nurul.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
KB.Text = ""
Form32A.ami()
End Sub
End Class
Public Class Form33A
Dim ami As New DataTable
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")
Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
If Form33B.Visible = False Then
Form33B.Show()
Else
Form33B.Activate()
End If
End Sub
Private Sub button3_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3_021.Click
If Form33B.Visible = False Then
Form33B.Show()
Else
Form33B.Activate()
End If
Form33B.KB.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form33B.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form33B.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
Form33B.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
Form33B.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
End Sub
Private Sub Form33A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim adapter As New OleDb.OleDbDataAdapter
adapter = New OleDb.OleDbDataAdapter("select * from barang", irma)
ami.Rows.Clear()
adapter.Fill(ami)
adapter.Dispose()
dgv_021.DataSource = ami
End Sub
Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
Dim ara As String = "delete * from barang where kodebarang = '" & dgv_021.CurrentRow.Cells("kodebarang").Value & "'"
nurul = New OleDb.OleDbCommand(ara, irma)
irma.Open()
nurul.ExecuteNonQuery()
irma.Close()
nurul.Dispose()
Dim adapter As New OleDb.OleDbDataAdapter
adapter = New OleDb.OleDbDataAdapter("select * from barang", irma)
ami.Rows.Clear()
adapter.Fill(ami)
adapter.Dispose()
dgv_021.DataSource = ami
End Sub
End Class
Public Class Form33B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If KB.Text = "" Then
ami.AturPencarianDataBase("Barang", "KodeBarang", KB.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("kode barang telah ada")
t1_021.Text = ""
Exit Sub
ElseIf t1_021.Text.Length = 0 Then
MsgBox("kode barang harus tercantum")
Exit Sub
ElseIf t2_021.Text.Length = 0 Then
MsgBox("nama barang harus tercantum")
Exit Sub
ElseIf t3_021.Text.Length = 0 Then
MsgBox("harga jual harus tercantum")
Exit Sub
ElseIf t4_021.Text.Length = 0 Then
MsgBox("jumlah barang harus tercantum")
Exit Sub
End If
Dim soe As String = "insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")"
nurul = New OleDb.OleDbCommand(soe, irma)
irma.Open()
nurul.ExecuteNonQuery()
irma.Close()
nurul.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Else
If KB.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("kode barang tidak dapat diupdate")
Exit Sub
End If
End If
If t1_021.Text.Length = 0 Then
MsgBox("kode barang harus tercantum")
Exit Sub
ElseIf t2_021.Text.Length = 0 Then
MsgBox("nama barang harus tercantum")
Exit Sub
ElseIf t3_021.Text.Length = 0 Then
MsgBox("harga jual harus tercantum")
Exit Sub
ElseIf t4_021.Text.Length = 0 Then
MsgBox("jumlah barang harus tercantum")
Exit Sub
End If
Dim soe As String = "update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'"
nurul = New OleDb.OleDbCommand(soe, irma)
irma.Open()
nurul.ExecuteNonQuery()
irma.Close()
nurul.Dispose()
KB.Text = "-"
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End If
End Sub
End Class
Public Class Form34A
Private Sub DATABARANGToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DAFTARBARANGToolStripMenuItem.Click
If Form34B.Visible = False Then
Form34B.MdiParent = Me
Form34B.Show()
Else
Form34B.Activate()
End If
End Sub
Private Sub INPUTBARANGToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles INPUTBARANGToolStripMenuItem.Click
If Form34C.Visible = False Then
Form34C.MdiParent = Me
Form34C.Show()
Else
Form34C.Activate()
End If
End Sub
Private Sub ToolStripButton1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton1_021.Click
If Form34B.Visible = False Then
Form34B.MdiParent = Me
Form34B.Show()
Else
Form34B.Activate()
End If
End Sub
Private Sub ToolStripButton2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripButton2_021.Click
If Form34C.Visible = False Then
Form34C.MdiParent = Me
Form34C.Show()
Else
Form34B.Activate()
End If
End Sub
End Class
Public Class Form34B
Dim DT As New DataTable
Dim CM As New OleDb.OleDbCommand
Dim MM As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
If Form34C.Visible = False Then
Form34C.Show()
Else
Form34C.Activate()
End If
End Sub
Private Sub button3_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button3_021.Click
If Form34C.Visible = False Then
Form34C.Show()
Else
Form34C.Activate()
End If
Form34C.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form34C.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
Form34C.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
Form34C.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
Form34C.KB.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
End Sub
Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
Dim ICHMI As String = "delete * from barang where kodebarang = '" & dgv_021.CurrentRow.Cells("kodebarang").Value & "'"
CM = New OleDb.OleDbCommand(ICHMI, MM)
MM.Open()
CM.ExecuteNonQuery()
MM.Close()
CM.Dispose()
Dim MILK As New OleDb.OleDbDataAdapter
MILK = New OleDb.OleDbDataAdapter("select * from barang", MM)
DT.Rows.Clear()
MILK.Fill(DT)
MILK.Dispose()
dgv_021.DataSource = DT
End Sub
Private Sub Form34B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim MILK As New OleDb.OleDbDataAdapter
MILK = New OleDb.OleDbDataAdapter("Select * from barang", MM)
DT.Rows.Clear()
MILK.Fill(DT)
MILK.Dispose()
dgv_021.DataSource = DT
End Sub
End Class
Public Class Form34C
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim OD As New OleDb.OleDbCommand
Dim DB As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If KB.Text = "" Then
ami.AturPencarianDataBase("Barang", "KodeBArang", t1_021.Text, 1, DB)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
t1_021.Text = ""
Exit Sub
ElseIf t1_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf t2_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf t3_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf t4_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
End If
Dim nurul As String = "insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")"
OD = New OleDb.OleDbCommand(nurul, DB)
DB.Open()
OD.ExecuteNonQuery()
DB.Close()
OD.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Else
If KB.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, DB)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
If t1_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf t2_021.Text.Length = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf Val(t3_021.Text) = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
ElseIf Val(t4_021.Text) = 0 Then
MsgBox("Kode barang harus ada")
Exit Sub
End If
Dim nurul As String = "update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'"
OD = New OleDb.OleDbCommand(nurul, DB)
DB.Open()
OD.ExecuteNonQuery()
DB.Close()
OD.Dispose()
KB.Text = "-"
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End If
End Sub
End Class
Form 27-31B
Public Class Form27
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
Dim search As New ByIskandar.CariKeDataBaseByIskandar
search.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If search.JumlanBaris > 0 Then
MsgBox("kode barang sudah ada")
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Exit Sub
End If
Dim cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")", irma)
irma.Open()
cm.ExecuteNonQuery()
irma.Close()
cm.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End Sub
End Class
Public Class Form28A
Dim ar As New DataTable
Dim nurul As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub ami()
Dim am As New OleDb.OleDbDataAdapter
am = New OleDb.OleDbDataAdapter("select * from barang", nurul)
ar.Rows.Clear()
am.Fill(ar)
am.Dispose()
End Sub
Private Sub Form28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ami()
dgv_021.DataSource = ar
End Sub
Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
If Form28B.Visible = False Then
Form28B.Show()
Else
Form28B.Activate()
End If
End Sub
Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
Close()
End Sub
End Class
Public Class Form28B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
Dim search As New ByIskandar.CariKeDataBaseByIskandar
search.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If search.JumlanBaris > 0 Then
MsgBox("Data sudah dimasukkan")
Exit Sub
End If
Dim cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")", irma)
irma.Open()
cm.ExecuteNonQuery()
irma.Close()
cm.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End Sub
End Class
Public Class Form29
Dim ar As New OleDb.OleDbCommand
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If kb_021.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)
irma.Open()
ar.ExecuteNonQuery()
irma.Close()
ar.Dispose()
kb_021.Text = ""
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
ts4_021.Text = ""
End Sub
End Class
Public Class Form30A
Dim ar As New DataTable
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub ami()
Dim mee As New OleDb.OleDbDataAdapter
mee = New OleDb.OleDbDataAdapter("select * from barang", irma)
ar.Rows.Clear()
mee.Fill(ar)
mee.Dispose()
End Sub
Private Sub Form30A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ami()
dgv_021.DataSource = ar
End Sub
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If Form30B.Visible = False Then
Form30B.Show()
Else
Form30B.Activate()
End If
Form30B.kb_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form30B.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form30B.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
Form30B.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
Form30B.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
Form30B.Show()
End Sub
End Class
Public Class Form30B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim ar As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If kb_021.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)
irma.Open()
ar.ExecuteNonQuery()
irma.Close()
ar.Dispose()
kb_021.Text = ""
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Form30A.ami()
End Sub
End Class
Public Class Form30B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim ar As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If kb_021.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)
irma.Open()
ar.ExecuteNonQuery()
irma.Close()
ar.Dispose()
kb_021.Text = ""
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Form30A.ami()
End Sub
End Class
Public Class Form31B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If KB.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("kode barang tidak dapat diupdate")
Exit Sub
End If
End If
If t1_021.Text.Length = 0 Then
MsgBox("kode barang harus tercantum")
Exit Sub
ElseIf t2_021.Text.Length = 0 Then
MsgBox("nama barang harus tercantum")
Exit Sub
ElseIf t3_021.Text.Length = 0 Then
MsgBox("harga jual harus tercantum")
Exit Sub
ElseIf t4_021.Text.Length = 0 Then
MsgBox("jumlah barang harus tercantum")
Exit Sub
End If
Dim ara As String = "update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'"
nurul = New OleDb.OleDbCommand(ara, irma)
irma.Open()
nurul.ExecuteNonQuery()
irma.Close()
nurul.Dispose()
KB.Text = "-"
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End Sub
End Class
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
Dim search As New ByIskandar.CariKeDataBaseByIskandar
search.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If search.JumlanBaris > 0 Then
MsgBox("kode barang sudah ada")
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Exit Sub
End If
Dim cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")", irma)
irma.Open()
cm.ExecuteNonQuery()
irma.Close()
cm.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End Sub
End Class
Public Class Form28A
Dim ar As New DataTable
Dim nurul As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub ami()
Dim am As New OleDb.OleDbDataAdapter
am = New OleDb.OleDbDataAdapter("select * from barang", nurul)
ar.Rows.Clear()
am.Fill(ar)
am.Dispose()
End Sub
Private Sub Form28A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ami()
dgv_021.DataSource = ar
End Sub
Private Sub button1_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1_021.Click
If Form28B.Visible = False Then
Form28B.Show()
Else
Form28B.Activate()
End If
End Sub
Private Sub button2_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button2_021.Click
Close()
End Sub
End Class
Public Class Form28B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("Masukkan teks")
Exit Sub
End If
Dim search As New ByIskandar.CariKeDataBaseByIskandar
search.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If search.JumlanBaris > 0 Then
MsgBox("Data sudah dimasukkan")
Exit Sub
End If
Dim cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_021.Text & "','" & t2_021.Text & "'," & Val(t3_021.Text) & "," & Val(t4_021.Text) & ")", irma)
irma.Open()
cm.ExecuteNonQuery()
irma.Close()
cm.Dispose()
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End Sub
End Class
Public Class Form29
Dim ar As New OleDb.OleDbCommand
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If kb_021.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)
irma.Open()
ar.ExecuteNonQuery()
irma.Close()
ar.Dispose()
kb_021.Text = ""
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
ts4_021.Text = ""
End Sub
End Class
Public Class Form30A
Dim ar As New DataTable
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub ami()
Dim mee As New OleDb.OleDbDataAdapter
mee = New OleDb.OleDbDataAdapter("select * from barang", irma)
ar.Rows.Clear()
mee.Fill(ar)
mee.Dispose()
End Sub
Private Sub Form30A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ami()
dgv_021.DataSource = ar
End Sub
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If Form30B.Visible = False Then
Form30B.Show()
Else
Form30B.Activate()
End If
Form30B.kb_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form30B.t1_021.Text = dgv_021.CurrentRow.Cells("kodebarang").Value
Form30B.t2_021.Text = dgv_021.CurrentRow.Cells("namabarang").Value
Form30B.t3_021.Text = dgv_021.CurrentRow.Cells("hargajual").Value
Form30B.t4_021.Text = dgv_021.CurrentRow.Cells("jumlahbarang").Value
Form30B.Show()
End Sub
End Class
Public Class Form30B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim ar As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If kb_021.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)
irma.Open()
ar.ExecuteNonQuery()
irma.Close()
ar.Dispose()
kb_021.Text = ""
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Form30A.ami()
End Sub
End Class
Public Class Form30B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim ar As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If t1_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If t2_021.Text.Length = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t3_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If Val(t4_021.Text) = 0 Then
MsgBox("masukkan teks")
Exit Sub
End If
If kb_021.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
End If
ar = New OleDb.OleDbCommand("update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & kb_021.Text & "'", irma)
irma.Open()
ar.ExecuteNonQuery()
irma.Close()
ar.Dispose()
kb_021.Text = ""
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
Form30A.ami()
End Sub
End Class
Public Class Form31B
Dim ami As New ByIskandar.CariKeDataBaseByIskandar
Dim nurul As New OleDb.OleDbCommand
Dim irma As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DATABARANG.accdb'")
Private Sub button_021_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_021.Click
If KB.Text <> t1_021.Text Then
ami.AturPencarianDataBase("Barang", "KodeBarang", t1_021.Text, 1, irma)
If ami.JumlanBaris > 0 Then
MsgBox("kode barang tidak dapat diupdate")
Exit Sub
End If
End If
If t1_021.Text.Length = 0 Then
MsgBox("kode barang harus tercantum")
Exit Sub
ElseIf t2_021.Text.Length = 0 Then
MsgBox("nama barang harus tercantum")
Exit Sub
ElseIf t3_021.Text.Length = 0 Then
MsgBox("harga jual harus tercantum")
Exit Sub
ElseIf t4_021.Text.Length = 0 Then
MsgBox("jumlah barang harus tercantum")
Exit Sub
End If
Dim ara As String = "update barang set kodebarang = '" & t1_021.Text & "', namabarang = '" & t2_021.Text & "', hargajual = " & Val(t3_021.Text) & ", jumlahbarang = " & Val(t4_021.Text) & " where kodebarang = '" & KB.Text & "'"
nurul = New OleDb.OleDbCommand(ara, irma)
irma.Open()
nurul.ExecuteNonQuery()
irma.Close()
nurul.Dispose()
KB.Text = "-"
t1_021.Text = ""
t2_021.Text = ""
t3_021.Text = ""
t4_021.Text = ""
End Sub
End Class
Langganan:
Postingan (Atom)