Form035_36109019
--------------------------------------------
Public Class Form035_36109019
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/datamajemuk.ACCDB")
Private Sub Form035_36109019_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 = '" & aa36109019.Text & "'", uni)
a.Fill(dt)
a.Dispose()
dgv.DataSource = dt
End Sub
Private Sub gg36109019_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gg36109019.Click
If dd36109019.Text.Length = 0 Then
MsgBox("Isi rong itu Kode Barang na..")
Exit Sub
End If
If Val(ee36109019.Text) = 0 Then
MsgBox("Isi rong itu Unit na..")
Exit Sub
End If
If Val(ff36109019.Text) = 0 Then
MsgBox("Isi rong itu Harga na..")
Exit Sub
End If
Dim dr As DataRow
dr = dt.NewRow
dr("KODEBARANG") = dd36109019.Text
dr("UNIT") = ee36109019.Text
dr("HARGA") = ff36109019.Text
dt.Rows.Add(dr)
dd36109019.Text = ""
ee36109019.Text = ""
ff36109019.Text = ""
End Sub
Private Sub hh36109019_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hh36109019.Click
If aa36109019.Text.Length = 0 Then
MsgBox("isi rong No Transaksi na..")
Exit Sub
End If
If cc36109019.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
wahyuni.AturPencarianDataBase("mastertransaksi", "notrans", aa36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & aa36109019.Text & "',#" & bb36109019.Value.Month & "/" & bb36109019.Value.Day & "/" & bb36109019.Value.Year & "#,'" & cc36109019.Text & "')", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & aa36109019.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
Next
cm.Dispose()
aa36109019.Text = ""
cc36109019.Text = ""
dt.Rows.Clear()
End Sub
End Class
---------------------------------------------------
Form036_36109019
--------------------------------------------------
Public Class Form036_36109019
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/datamajemuk.ACCDB")
Private Sub Form036_36109019_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 = '" & aa36109019.Text & "'", uni)
a.Fill(dt)
a.Dispose()
dgv.DataSource = dt
Dim dc(1) As DataColumn
dc(0) = dt.Columns("kodebarang")
dt.PrimaryKey = dc
End Sub
Private Sub gg36109019_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles gg36109019.Click
If dd36109019.Text.Length = 0 Then
MsgBox("Isi rong itu Kode Barang na..")
Exit Sub
End If
If Val(ee36109019.Text) = 0 Then
MsgBox("Isi rong itu Unit na..")
Exit Sub
End If
If Val(ff36109019.Text) = 0 Then
MsgBox("Isi rong itu Harga na..")
Exit Sub
End If
Dim dr As DataRow
dr = dt.Rows.Find(dd36109019.Text)
If dr Is Nothing Then
dr = dt.NewRow
dr("KODEBARANG") = dd36109019.Text
dr("UNIT") = ee36109019.Text
dr("HARGA") = ff36109019.Text
dt.Rows.Add(dr)
dd36109019.Text = ""
ee36109019.Text = ""
ff36109019.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain")
End If
End Sub
Private Sub hh36109019_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hh36109019.Click
If aa36109019.Text.Length = 0 Then
MsgBox("Isi rong No Transaksi na..")
Exit Sub
End If
If cc36109019.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
wahyuni.AturPencarianDataBase("mastertransaksi", "notrans", aa36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & aa36109019.Text & "',#" & bb36109019.Value.Month & "/" & bb36109019.Value.Day & "/" & bb36109019.Value.Year & "#,'" & cc36109019.Text & "')", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & aa36109019.Text & "', '" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
Next
cm.Dispose()
aa36109019.Text = ""
cc36109019.Text = ""
dt.Rows.Clear()
End Sub
End Class
------------------------------------------------
Form037_36109019
------------------------------------------------
Public Class Form037_36109019
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim wahyuni As New ByIskandar.CariKeDataBaseByIskandar
Dim uni As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Datamajemuk.ACCDB")
Private Sub Form037_36109019_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_36109019.Text & "'", uni)
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 nyai()
Dim nyai1 As Integer = 0
For Each nyai2 As DataRow In dt.Rows
nyai1 += nyai2("JUMLAH")
Next
jj_36109019.Text = nyai1
End Sub
Private Sub ff_36109019_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ff_36109019.TextChanged
hh_36109019.Text = Val(ff_36109019.Text) * Val(gg_36109019.Text)
End Sub
Private Sub dd_36109019_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles dd_36109019.Leave
If dd_36109019.Text.Length = 0 Then
Exit Sub
End If
wahyuni.AturPencarianDataBase("barang", "kodebarang", dd_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
dd_36109019.Text = wahyuni.DataTablenya.Rows(0).Item("KODEBARANG")
ee_36109019.Text = wahyuni.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang itu tidak ada..")
Exit Sub
End If
End Sub
Private Sub dd_36109019_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dd_36109019.TextChanged
ee_36109019.Text = ""
ff_36109019.Text = ""
gg_36109019.Text = ""
End Sub
Private Sub ii_36109019_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ii_36109019.Click
If dd_36109019.Text.Length = 0 Then
MsgBox("Isi rong itu Kode Barang na..")
Exit Sub
End If
If Val(ff_36109019.Text) = 0 Then
MsgBox("Isi rong itu Unit na..")
Exit Sub
End If
If Val(gg_36109019.Text) = 0 Then
MsgBox("Isi rong itu Harga na..")
Exit Sub
End If
Dim dr As DataRow
dr = dt.Rows.Find(dd_36109019.Text)
If dr Is Nothing Then
dr = dt.NewRow
dr("KODEBARANG") = dd_36109019.Text
dr("NAMABARANG") = ee_36109019.Text
dr("UNIT") = Val(ff_36109019.Text)
dr("HARGA") = Val(gg_36109019.Text)
dr("JUMLAH") = Val(hh_36109019.Text)
dt.Rows.Add(dr)
dd_36109019.Text = ""
ff_36109019.Text = ""
gg_36109019.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...")
End If
nyai()
End Sub
Private Sub kk_36109019_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kk_36109019.Click
If aa_36109019.Text.Length = 0 Then
MsgBox("Isi rong No Transaksi na..")
Exit Sub
End If
If cc_36109019.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
wahyuni.AturPencarianDataBase("mastertransaksi", "notrans", aa_36109019.Text, 1, uni)
If wahyuni.JumlanBaris > 0 Then
MsgBox("Adami no trans seperti itu...")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & aa_36109019.Text & "',#" & bb_36109019.Value.Month & "/" & bb_36109019.Value.Day & "/" & bb_36109019.Value.Year & "#,'" & cc_36109019.Text & "')", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & aa_36109019.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", uni)
uni.Open()
cm.ExecuteNonQuery()
uni.Close()
Next
cm.Dispose()
aa_36109019.Text = ""
cc_36109019.Text = ""
dt.Rows.Clear()
nyai()
End Sub
End Class