Dim arman As New ByIskandar.CariKeDataBaseByIskandar Dim anto As New DataTable Dim soe As New OleDb.OleDbCommand Dim ndut As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataMajemuk.accdb'")
Private Sub form37_36109003_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim r As New OleDb.OleDbDataAdapter r = 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_36109003.Text & "'", ndut) anto.Rows.Clear() r.Fill(anto) r.Dispose()
dgv_36109003.DataSource = anto
Dim sudar(1) As DataColumn sudar(0) = anto.Columns("kodebarang") anto.PrimaryKey = sudar End Sub Private Sub anra() Dim anra1 As Integer = 0 For Each anra2 As DataRow In anto.Rows anra1 += anra2("JUMLAH") Next total_36109003.Text = anra1 End Sub
Private Sub kb_36109003_leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_36109003.Leave If kb_36109003.Text.Length = 0 Then Exit Sub End If arman.AturPencarianDataBase("barang", "kodebarang", kb_36109003.Text, 1, ndut) If arman.JumlanBaris > 0 Then kb_36109003.Text = arman.DataTablenya.Rows(0).Item("KODEBARANG") nb_36109003.Text = arman.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tidak terdaftar") Exit Sub End If End Sub
Private Sub kb_36109003_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_36109003.TextChanged nb_36109003.Text = "" unit_36109003.Text = "" harga_36109003.Text = "" End Sub
Private Sub tambah_36109003_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah_36109003.Click If kb_36109003.Text.Length = 0 Then MsgBox("kode barang tidak terisi") ElseIf Val(unit_36109003.Text) = 0 Then MsgBox("unit tidak terisi") ElseIf Val(harga_36109003.Text) = 0 Then MsgBox("harga barang tidak terisi") Exit Sub End If
Dim dt As DataRow dt = anto.Rows.Find(kb_36109003.Text) If dt Is Nothing Then dt = anto.NewRow dt("KODEBARANG") = kb_36109003.Text dt("NAMABARANG") = nb_36109003.Text dt("UNIT") = unit_36109003.Text dt("HARGA") = harga_36109003.Text dt("JUMLAH") = Val(jumlah_36109003.Text)
anto.Rows.Add(dt)
kb_36109003.Text = "" unit_36109003.Text = "" harga_36109003.Text = "" Else MsgBox("kode barang telah terdaftar,") End If anra() End Sub
Private Sub simpan_36109003_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109003.Click If nt_36109003.Text.Length = 0 Then MsgBox("nomor transaksi harus terisi") ElseIf jt_36109003.Text.Length = 0 Then MsgBox("Isi rong Jenis Transaksi na..") ElseIf anto.Rows.Count = 0 Then MsgBox("data table tidak boleh kosong") Exit Sub End If
arman.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109003.Text, 1, ndut) If arman.JumlanBaris > 0 Then MsgBox("nomor transaksi telah ada") Exit Sub End If
For Each x As DataRow In anto.Rows soe = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & nt_36109003.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", ndut) ndut.Open() soe.ExecuteNonQuery() ndut.Close() Next soe.Dispose()
nt_36109003.Text = "" jt_36109003.Text = ""
anto.Rows.Clear() anra() End Sub
Private Sub unit_36109003_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles unit_36109003.TextChanged jumlah_36109003.Text = Val(unit_36109003.Text) * Val(harga_36109003.Text) End Sub
Private Sub harga_36109003_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles harga_36109003.TextChanged jumlah_36109003.Text = Val(unit_36109003.Text) * Val(harga_36109003.Text) End Sub End Class
ALWIYAH
BalasHapus3A-D3 / 36109009
http://alwiyah-chucha.blogspot.com/2011/12/latihanform37.html
Terima Kasih Pak
Ismi Febriani Asyikin
BalasHapus3a D3
361 09 005
http://ismifebriani.blogspot.com/2011/12/apkom-4-latihan-37.html
Amelia Indahsari
BalasHapus361 09 023
http://heiamee.blogspot.com/2011/12/form-37.html
RUSNANINGSI R
BalasHapus36109010
http://rusnaningsi.blogspot.com/2011/12/latihan-35-36-apkom-4.html
http://vievhy.blogspot.com/2011/12/form-35-37.html
BalasHapusDim arman As New ByIskandar.CariKeDataBaseByIskandar
BalasHapusDim anto As New DataTable
Dim soe As New OleDb.OleDbCommand
Dim ndut As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataMajemuk.accdb'")
Private Sub form37_36109003_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim r As New OleDb.OleDbDataAdapter
r = 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_36109003.Text & "'", ndut)
anto.Rows.Clear()
r.Fill(anto)
r.Dispose()
dgv_36109003.DataSource = anto
Dim sudar(1) As DataColumn
sudar(0) = anto.Columns("kodebarang")
anto.PrimaryKey = sudar
End Sub
Private Sub anra()
Dim anra1 As Integer = 0
For Each anra2 As DataRow In anto.Rows
anra1 += anra2("JUMLAH")
Next
total_36109003.Text = anra1
End Sub
Private Sub kb_36109003_leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_36109003.Leave
If kb_36109003.Text.Length = 0 Then
Exit Sub
End If
arman.AturPencarianDataBase("barang", "kodebarang", kb_36109003.Text, 1, ndut)
If arman.JumlanBaris > 0 Then
kb_36109003.Text = arman.DataTablenya.Rows(0).Item("KODEBARANG")
nb_36109003.Text = arman.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tidak terdaftar")
Exit Sub
End If
End Sub
Private Sub kb_36109003_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_36109003.TextChanged
nb_36109003.Text = ""
unit_36109003.Text = ""
harga_36109003.Text = ""
End Sub
Private Sub tambah_36109003_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah_36109003.Click
BalasHapusIf kb_36109003.Text.Length = 0 Then
MsgBox("kode barang tidak terisi")
ElseIf Val(unit_36109003.Text) = 0 Then
MsgBox("unit tidak terisi")
ElseIf Val(harga_36109003.Text) = 0 Then
MsgBox("harga barang tidak terisi")
Exit Sub
End If
Dim dt As DataRow
dt = anto.Rows.Find(kb_36109003.Text)
If dt Is Nothing Then
dt = anto.NewRow
dt("KODEBARANG") = kb_36109003.Text
dt("NAMABARANG") = nb_36109003.Text
dt("UNIT") = unit_36109003.Text
dt("HARGA") = harga_36109003.Text
dt("JUMLAH") = Val(jumlah_36109003.Text)
anto.Rows.Add(dt)
kb_36109003.Text = ""
unit_36109003.Text = ""
harga_36109003.Text = ""
Else
MsgBox("kode barang telah terdaftar,")
End If
anra()
End Sub
Private Sub simpan_36109003_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan_36109003.Click
If nt_36109003.Text.Length = 0 Then
MsgBox("nomor transaksi harus terisi")
ElseIf jt_36109003.Text.Length = 0 Then
MsgBox("Isi rong Jenis Transaksi na..")
ElseIf anto.Rows.Count = 0 Then
MsgBox("data table tidak boleh kosong")
Exit Sub
End If
arman.AturPencarianDataBase("mastertransaksi", "notrans", nt_36109003.Text, 1, ndut)
If arman.JumlanBaris > 0 Then
MsgBox("nomor transaksi telah ada")
Exit Sub
End If
soe = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_36109003.Text & "',#" & tgl_36109003.Value.Month & "/" & tgl_36109003.Value.Day & "/" & tgl_36109003.Value.Year & "#,'" & jt_36109003.Text & "')", ndut)
ndut.Open()
soe.ExecuteNonQuery()
ndut.Close()
For Each x As DataRow In anto.Rows
soe = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & nt_36109003.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", ndut)
ndut.Open()
soe.ExecuteNonQuery()
ndut.Close()
Next
soe.Dispose()
nt_36109003.Text = ""
jt_36109003.Text = ""
anto.Rows.Clear()
anra()
End Sub
Private Sub unit_36109003_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles unit_36109003.TextChanged
jumlah_36109003.Text = Val(unit_36109003.Text) * Val(harga_36109003.Text)
End Sub
Private Sub harga_36109003_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles harga_36109003.TextChanged
jumlah_36109003.Text = Val(unit_36109003.Text) * Val(harga_36109003.Text)
End Sub
End Class
ridhayanti saleh
BalasHapus36109015
tugas 37
http://ridhacayoo-ridhaahmad.blogspot.com/2011/12/tugas-37.html
ridhayanti saleh
BalasHapus36109015
tugas 36
http://ridhacayoo-ridhaahmad.blogspot.com/2011/12/tugas-36.html
ANDI WAHYUNI
BalasHapus361 09 019
http://wahyunistrongggg.blogspot.com/2011/12/latihan-35-37.html
http://febriantysuryaningtyas.blogspot.com/2011/12/latihan-37.html
BalasHapusiwan
BalasHapus361 09 026
3a-d3
http://iwandinejad.blogspot.com/#!/2012/01/latihan-37.html
Muhammad Harun Hamid
BalasHapus361 09 006
http://h4r0en.blogspot.com/2012/01/script-visual-basic-apkomp-4-pnup_9099.html
NURFAHNY
BalasHapus361 09 013
http://fanykecil.blogspot.com/2012/01/form-37.html