Public NotInheritable Class form38_36109003 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 form38_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") If form38_39_40_36109003.ShowDialog = Windows.Forms.DialogResult.OK Then kb_36109003.Text = form38_39_40_36109003.dgv_36109003.CurrentRow.Cells("kodebarang").Value nb_36109003.Text = form38_39_40_36109003.dgv_36109003.CurrentRow.Cells("namabarang").Value Else kb_36109003.Text = "" End If 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
Public Class Form38_39_40_36109015 Dim ridha As New DataTable Dim risa As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb")
Private Sub Form38_39_40_36109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim rs As New OleDb.OleDbDataAdapter rs = New OleDb.OleDbDataAdapter("SELECT * FROM BARANG", risa) ridha.Rows.Clear() rs.Fill(ridha) rs.Dispose()
ALWIYAH
BalasHapus3A-D3 / 36109009
http://alwiyah-chucha.blogspot.com/2011/12/latihanform38.html
Terima Kasih Pak
Ismi Febriani Asyikin
BalasHapus3a D3
361 09 005
http://ismifebriani.blogspot.com/2011/12/apkom-4-latihan-38.html
Amelia Indahsari
BalasHapus361 09 023
http://heiamee.blogspot.com/2011/12/form-38.html
RUSNANINGSI R
BalasHapus36109010
http://rusnaningsi.blogspot.com/2011/12/latihan-38-apkom-4.html
Public NotInheritable Class form38_36109003
BalasHapusDim 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 form38_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
BalasHapusIf 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")
If form38_39_40_36109003.ShowDialog = Windows.Forms.DialogResult.OK Then
kb_36109003.Text = form38_39_40_36109003.dgv_36109003.CurrentRow.Cells("kodebarang").Value
nb_36109003.Text = form38_39_40_36109003.dgv_36109003.CurrentRow.Cells("namabarang").Value
Else
kb_36109003.Text = ""
End If
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
BalasHapusIf 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 38
http://ridhacayoo-ridhaahmad.blogspot.com/2011/12/tugas-38.html
ridhayanti
BalasHapus36109015
Public Class Form38_39_40_36109015
Dim ridha As New DataTable
Dim risa As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb")
Private Sub Form38_39_40_36109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rs As New OleDb.OleDbDataAdapter
rs = New OleDb.OleDbDataAdapter("SELECT * FROM BARANG", risa)
ridha.Rows.Clear()
rs.Fill(ridha)
rs.Dispose()
DGV_36109015.DataSource = ridha
End Sub
End Class
iwan
BalasHapus361 09 026
3A-D3
latihan 38 apkom4
http://iwandinejad.blogspot.com/#!/2012/01/latihan-38-apkom-4.html
Muhammad Harun Hamid
BalasHapus361 09 006
http://h4r0en.blogspot.com/2012/01/script-visual-basic-apkomp-4-pnup_8149.html
NURFAHNY
BalasHapus361 09 013
http://fanykecil.blogspot.com/2012/01/form-38.html