Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=ngekngek") Dim ngek1 As New DataTable Dim ngek2 As New DataTable Dim wiwi As New DataSet Dim ngok1 As New BindingSource Dim ngok2 As New BindingSource
Public Sub saadah1() Dim a As New OleDb.OleDbDataAdapter ngek2.Rows.Clear() ngek1.Rows.Clear() a = New OleDb.OleDbDataAdapter("select * from mastertransaksi", conect) a.Fill(ngek1) a = 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", conect) a.Fill(ngek2) End Sub
Private Sub Latihan40A_46109001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load saadah1()
Dim dc(1) As DataColumn dc(0) = ngek1.Columns("notrans") ngek1.PrimaryKey = dc
DATA146109001.DataSource = ngok1 DATA246109001.DataSource = ngok2 End Sub
Private Sub H46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles H46109001.Click Dim cm As New OleDb.OleDbCommand cm = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & DATA146109001.CurrentRow.Cells("notrans").Value & "'", conect) conect.Open() cm.ExecuteNonQuery() conect.Close()
cm = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & DATA146109001.CurrentRow.Cells("notrans").Value & "'", conect) conect.Open() cm.ExecuteNonQuery() conect.Close() cm.Dispose() saadah1() End Sub
Private Sub TM46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM46109001.Click If LATIHAN040B_46109001.Visible = False Then LATIHAN040B_46109001.Show() Else LATIHAN040B_46109001.Activate() End If
LATIHAN040B_46109001.saadah2() LATIHAN040B_46109001.saadah3() End Sub
Private Sub E46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles E46109001.Click If LATIHAN040B_46109001.Visible = False Then LATIHAN040B_46109001.Show() Else LATIHAN040B_46109001.Activate() End If
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=ngekngek") Dim dwitya As New DataTable Dim saadah As New ByIskandar.CariKeDataBaseByIskandar Dim wiwi As New OleDb.OleDbCommand
Public Sub saadah2() Dim a As New OleDb.OleDbDataAdapter a = 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 = '" & NT46109001.Text & "'", conect) dwitya.Rows.Clear() a.Fill(dwitya) End Sub
Public Sub saadah3() Dim total As Integer = 0 For Each x As DataRow In dwitya.Rows total += x("Jumlah") Next TOT46109001.Text = total End Sub
Private Sub saadah4() If NT46109001.Text.Length = 0 Then MsgBox("Isi rong itu Notransnya..") Exit Sub End If
If JT46109001.Text.Length = 0 Then MsgBox("Isi rong itu Jenis Transaksinya..") Exit Sub End If
If dwitya.Rows.Count = 0 Then MsgBox("Isi rong itu datatable k..") Exit Sub End If End Sub
Private Sub tambah() saadah4() saadah.AturPencarianDataBase("mastertransaksi", "notrans", NT46109001.Text, 1, conect) If saadah.JumlanBaris > 0 Then MsgBox("Adami notrans seperti itu..") Exit Sub End If
For Each x As DataRow In dwitya.Rows wiwi = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT46109001.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", conect) conect.Open() wiwi.ExecuteNonQuery() conect.Close() Next wiwi.Dispose()
dwitya.Rows.Clear() Latihan040A_46109001.saadah1() End Sub
Public Sub edit() saadah4() If NT46109001.Text <> TS46109001.Text Then saadah.AturPencarianDataBase("mastertransaksi", "notrans", NT46109001.Text, 1, conect) If saadah.JumlanBaris > 0 Then MsgBox("Adami Notrans seperti itu,,mohon ganti..") Exit Sub End If End If
wiwi = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & TS46109001.Text & "'", conect) conect.Open() wiwi.ExecuteNonQuery() conect.Close()
For Each x As DataRow In dwitya.Rows wiwi = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & NT46109001.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", conect) conect.Open() wiwi.ExecuteNonQuery() conect.Close() Next wiwi.Dispose()
Private Sub DATA46109001_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DATA46109001.CellEndEdit If DATA46109001.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
saadah.AturPencarianDataBase("barang", "kodebarang", DATA46109001.CurrentRow.Cells("KODEBARANG").Value, 1, conect) If saadah.JumlanBaris > 0 Then DATA46109001.CurrentRow.Cells("NAMABARANG").Value = saadah.DataTablenya.Rows(0).Item("NAMABARANG") Else DATA46109001.CurrentRow.Cells("NAMABARANG").Value = "" If Latihan383940_46109001.ShowDialog = Windows.Forms.DialogResult.OK Then DATA46109001.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("KODEBARANG").Value DATA46109001.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("NAMABARANG").Value End If End If
DATA46109001.Columns(e.ColumnIndex).Name = "UNIT" Or DATA46109001.Columns(e.ColumnIndex).Name = "HARGA" Then DATA46109001.CurrentRow.Cells("JUMLAH").Value = DATA46109001.CurrentRow.Cells("UNIT").Value * DATA46109001.CurrentRow.Cells("HARGA").Value saadah3() End If End Sub
Private Sub S46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles S46109001.Click If TS46109001.Text = "-" Then tambah() Else edit() End If End Sub
Private Sub DATA46109001_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DATA46109001.DataError MsgBox("Terjadi sedikit kesalahan...") End Sub End Class
Public Class LATIHAN40A_46109051 Dim Wahda As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=thepinkers29") Dim niah As New DataTable Dim niah1 As New DataTable Dim dset As New DataSet Dim MMM1 As New BindingSource Dim MMM2 As New BindingSource Public Sub wahdaaa()
niah1.Rows.Clear() niah.Rows.Clear()
Dim B1 As New OleDb.OleDbDataAdapter B1 = New OleDb.OleDbDataAdapter("Select * From MASTERTRANSAKSI", Wahda) B1.Fill(niah)
B1 = New OleDb.OleDbDataAdapter("Select DETAILTRANSAKSI.NOTRANS, DETAILTRANSAKSI.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG", Wahda) B1.Fill(niah1)
B1.Dispose() End Sub
Private Sub LATIHAN40A_46109051_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load wahdaaa()
Private Sub EDIT_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EDIT_46109051.Click If LATIHAN40B_46109051.Visible = False Then LATIHAN40B_46109051.Show() Else LATIHAN40B_46109051.Activate() End If
Private Sub TAMBAH_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH_46109051.Click If LATIHAN40B_46109051.Visible = False Then LATIHAN40B_46109051.Show() Else LATIHAN40B_46109051.Activate() End If
Private Sub HAPUS_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HAPUS_46109051.Click Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS='" & DG1_46109051.CurrentRow.Cells("NOTRANS").Value & "'", Wahda) Wahda.Open() T.ExecuteNonQuery() Wahda.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS='" & DG1_46109051.CurrentRow.Cells("NOTRANS").Value & "'", Wahda) Wahda.Open() T.ExecuteNonQuery() Wahda.Close()
Public Class LATIHAN40B_46109051 Dim Wahda As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=thepinkers29") Dim DATA As New DataTable
Public Sub MANIS() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NT_46109051.Text & "'", Wahda) DATA.Rows.Clear() X.Fill(DATA) End Sub
Private Sub Latihan40B46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dataPrimary(1) As DataColumn dataPrimary(0) = DATA.Columns("NOTRANS") DATA.PrimaryKey = dataPrimary
dg_46109051.DataSource = DATA
TOTALJUMLAH() End Sub Public Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In DATA.Rows TOT = TOT + x("JUMLAH") Next TOT_46109051.Text = TOT End Sub Private Sub dg_46109051_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DG_46109051.CellContentClick If dg_46109051.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", dg_46109051.CurrentRow.Cells("KODEBARANG").Value, 1, Wahda)
If Pencari.JumlanBaris > 0 Then dg_46109051.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else dg_46109051.CurrentRow.Cells("KODEBARANG").Value = "" If LATIHAN383940_46109051.ShowDialog = Windows.Forms.DialogResult.OK Then DG_46109051.CurrentRow.Cells("KODEBARANG").Value = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("KODEBARANG").Value DG_46109051.CurrentRow.Cells("NAMABARANG").Value = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf dg_46109051.Columns(e.ColumnIndex).Name = "UNIT" Or dg_46109051.Columns(e.ColumnIndex).Name = "HARGA" Then
dg_46109051.CurrentRow.Cells("JUMLAH").Value = dg_46109051.CurrentRow.Cells("UNIT").Value * dg_46109051.CurrentRow.Cells("HARGA").Value End If
Public Class LATIHAN40B_46109051 Dim Wahda As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=thepinkers29") Dim DATA As New DataTable
Public Sub MANIS() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NT_46109051.Text & "'", Wahda) DATA.Rows.Clear() X.Fill(DATA) End Sub
Private Sub Latihan40B46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dataPrimary(1) As DataColumn dataPrimary(0) = DATA.Columns("NOTRANS") DATA.PrimaryKey = dataPrimary
dg_46109051.DataSource = DATA
TOTALJUMLAH() End Sub Public Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In DATA.Rows TOT = TOT + x("JUMLAH") Next TOT_46109051.Text = TOT End Sub Private Sub dg_46109051_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DG_46109051.CellContentClick If dg_46109051.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", dg_46109051.CurrentRow.Cells("KODEBARANG").Value, 1, Wahda)
If Pencari.JumlanBaris > 0 Then dg_46109051.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else dg_46109051.CurrentRow.Cells("KODEBARANG").Value = "" If LATIHAN383940_46109051.ShowDialog = Windows.Forms.DialogResult.OK Then DG_46109051.CurrentRow.Cells("KODEBARANG").Value = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("KODEBARANG").Value DG_46109051.CurrentRow.Cells("NAMABARANG").Value = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf dg_46109051.Columns(e.ColumnIndex).Name = "UNIT" Or dg_46109051.Columns(e.ColumnIndex).Name = "HARGA" Then
dg_46109051.CurrentRow.Cells("JUMLAH").Value = dg_46109051.CurrentRow.Cells("UNIT").Value * dg_46109051.CurrentRow.Cells("HARGA").Value End If
Private Sub Button1_Button2() If NT_46109051.Text.Length = 0 Then MsgBox("Maaf, Nomor transaksi harus diisi dulu") Exit Sub End If
If JT_46109051.Text.Length = 0 Then MsgBox("Maaf, Jenis transaksi harus diisi dulu") Exit Sub End If
If DATA.Rows.Count() = 0 Then MsgBox("Maaf, Proses tidak dapat dilanjutkan") Exit Sub End If
If StatusStrip1.Text <> NT_46109051.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109051.Text, 1, Wahda) If pencari.JumlanBaris > 0 Then MsgBox("Nomor transaksi sudah ada") Exit Sub End If End If
Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI(NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109051.Text & "', #" & DT_46109051.Value.Month & "/" & DT_46109051.Value.Day & "/" & DT_46109051.Value.Year & "#, '" & JT_46109051.Text & "')", Wahda)
Wahda.Open()
T.ExecuteNonQuery()
Wahda.Close()
For Each X As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109051.Text & "', '" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Wahda) Wahda.Open() T.ExecuteNonQuery() Wahda.Close() T.Dispose() Next
Private Sub edit_46109051() If NT_46109051.Text.Length = 0 Then MsgBox("Maaf, Nomor transaksi harus diisi dulu nah !!!") Exit Sub End If
If JT_46109051.Text.Length = 0 Then MsgBox("Maaf, Jenis transaksi harus diisi dulu nah !!!") Exit Sub End If
If DATA.Rows.Count() = 0 Then MsgBox("Maaf, Proses tidak dapat dilanjutkan gang....") Exit Sub End If
If StatusStrip1.Text <> NT_46109051.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109051.Text, 1, Wahda) If pencari.JumlanBaris > 0 Then MsgBox("Nomor transaksi sudah ada") Exit Sub End If End If
Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS= '" & NT_46109051.Text & "'", Wahda) Wahda.Open() T.ExecuteNonQuery() Wahda.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS= '" & NT_46109051.Text & "'", Wahda) Wahda.Open() T.ExecuteNonQuery() Wahda.Close()
For Each XX As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109051.Text & "', '" & XX("KODEBARANG") & "', " & XX("UNIT") & ", " & XX("HARGA") & ")", Wahda) Wahda.Open() T.ExecuteNonQuery() Wahda.Close() T.Dispose() Next
TOTALJUMLAH() LATIHAN40A_46109051.wahdaaa() End Sub
Private Sub save_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_46109051.Click If StatusStrip1.Text = "-" Then Button1_Button2() Else edit_46109051() End If End Sub
Public Class Form40B Dim DILA As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=240991") Dim DATA As New DataTable
Public Sub MANIS() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & DILA1_059.Text & "'", DILA) DATA.Rows.Clear() X.Fill(DATA) End Sub
Private Sub Form40B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dataPrimary(1) As DataColumn dataPrimary(0) = DATA.Columns("NOTRANS") DATA.PrimaryKey = dataPrimary
DATA_059.DataSource = DATA
TOTALJUMLAH() End Sub Public Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In DATA.Rows TOT = TOT + x("JUMLAH") Next TOTAL_059.Text = TOT End Sub
Private Sub EDIT_059() If DILA1_059.Text.Length = 0 Then MsgBox("Maaf, Nomor transaksi harus diisi dulu nah !!!") Exit Sub End If
If DILA2_059.Text.Length = 0 Then MsgBox("Maaf, Jenis transaksi harus diisi dulu nah !!!") Exit Sub End If
If DATA.Rows.Count() = 0 Then MsgBox("Maaf, Proses tidak dapat dilanjutkan gang....") Exit Sub End If
If StatusStrip1.Text <> DILA1_059.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", DILA1_059.Text, 1, DILA) If pencari.JumlanBaris > 0 Then MsgBox("Nomor transaksi sudah ada") Exit Sub End If End If
Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS= '" & DILA1_059.Text & "'", DILA) DILA.Open() T.ExecuteNonQuery() DILA.Close()
Private Sub SAVE_059_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN_059.Click If StatusStrip1.Text = "-" Then Button1_Button2() Else EDIT_059() End If End Sub
Private Sub DILA1_059_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DILA1_059.TextChanged
LATIHAN 40A Public Class LATIHAN040A_46109030 Dim ainun As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=ainun") Dim ainun1 As New DataTable Dim ainun2 As New DataTable Dim nun As New DataSet Dim nun1 As New BindingSource Dim nun2 As New BindingSource Public Sub ainunas() Dim ai As New OleDb.OleDbDataAdapter ainun1.Rows.Clear() ainun2.Rows.Clear() ai = New OleDb.OleDbDataAdapter("select * from mastertransaksi", ainun) ai.Fill(ainun1) ai = 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", ainun) ai.Fill(ainun2)
End Sub
Private Sub LATIHAN040A_46109030_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ainunas()
Private Sub h_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles h_46109030.Click Dim h As New OleDb.OleDbCommand h = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & dg1_46109030.CurrentRow.Cells("notrans").Value & "'", ainun) ainun.Open() h.ExecuteNonQuery() ainun.Close()
h = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & dg1_46109030.CurrentRow.Cells("notrans").Value & "'", ainun) ainun.Open() h.ExecuteNonQuery() ainun.Close() h.Dispose() ainunas()
End Sub
Private Sub t_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t_46109030.Click If LATIHAN_040B_46109030.Visible = False Then
LATIHAN_040B_46109030.Show() Else LATIHAN_040B_46109030.Activate() End If
Private Sub e_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles e_46109030.Click If LATIHAN_040B_46109030.Visible = False Then LATIHAN_040B_46109030.Show() Else LATIHAN_040B_46109030.Activate() End If
LATIHAN 40B Public Class LATIHAN_040B_46109030 Dim ainun As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=ainun") Dim nun As New DataTable Dim telusur As New ByIskandar.CariKeDataBaseByIskandar Dim ai As New OleDb.OleDbCommand Public Sub ainunas1() Dim na As New OleDb.OleDbDataAdapter na = 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_46109030.Text & "'", ainun) nun.Rows.Clear() na.Fill(nun) End Sub Public Sub ainunas2() Dim total As Integer = 0 For Each x As DataRow In nun.Rows total += x("Jumlah") Next Tot_46109030.Text = total End Sub Private Sub ainunas3() If nt_46109030.Text.Length = 0 Then MsgBox("Isi Notransnya..") Exit Sub End If
If jt_46109030.Text.Length = 0 Then MsgBox("Isi Jenis Transaksinya..") Exit Sub End If
If nun.Rows.Count = 0 Then MsgBox("Isi datatable k..") Exit Sub End If
End Sub Private Sub tambah() ainunas3() telusur.AturPencarianDataBase("mastertransaksi", "notrans", nt_46109030.Text, 1, ainun) If telusur.JumlanBaris > 0 Then MsgBox("Adami notrans seperti itu..") Exit Sub End If
For Each x As DataRow In nun.Rows ai = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt_46109030.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", ainun)
ainun.Open() ai.ExecuteNonQuery() ainun.Close() Next ai.Dispose()
End Sub Private Sub edit() ainunas3() If nt_46109030.Text <> StatusStrip46109030.Text Then telusur.AturPencarianDataBase("mastertransaksi", "notrans", nt_46109030.Text, 1, ainun) If telusur.JumlanBaris > 0 Then MsgBox("Adami Notrans seperti itu,,mohon ganti..") Exit Sub End If End If
ai = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & StatusStrip46109030.Text & "'", ainun) ainun.Open() ai.ExecuteNonQuery() ainun.Close()
ai = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & StatusStrip46109030.Text & "'", ainun) ainun.Open() ai.ExecuteNonQuery() ainun.Close()
For Each x As DataRow In nun.Rows ai = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & nt_46109030.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", ainun) ainun.Open() ai.ExecuteNonQuery() ainun.Close() Next ai.Dispose()
nun.Rows.Clear() LATIHAN040A_46109030.ainunas() End Sub Private Sub LATIHAN_040B_46109030_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ainunas1()
Dim dc(1) As DataColumn dc(0) = nun.Columns("kodebarang") nun.PrimaryKey = dc
Private Sub dg_46109030_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dg_46109030.CellContentClick If dg_46109030.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
telusur.AturPencarianDataBase("barang", "kodebarang", dg_46109030.CurrentRow.Cells("KODEBARANG").Value, 1, ainun) If telusur.JumlanBaris > 0 Then dg_46109030.CurrentRow.Cells("NAMABARANG").Value = telusur.DataTablenya.Rows(0).Item("NAMABARANG") Else dg_46109030.CurrentRow.Cells("NAMABARANG").Value = "" If Latihan383940_46109030.ShowDialog = Windows.Forms.DialogResult.OK Then dg_46109030.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109030.dg_46109030.CurrentRow.Cells("KODEBARANG").Value dg_46109030.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109030.dg_46109030.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf dg_46109030.Columns(e.ColumnIndex).Name = "UNIT" Or dg_46109030.Columns(e.ColumnIndex).Name = "HARGA" Then dg_46109030.CurrentRow.Cells("JUMLAH").Value = dg_46109030.CurrentRow.Cells("UNIT").Value * dg_46109030.CurrentRow.Cells("HARGA").Value ainunas2() End If
End Sub
Private Sub s_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109030.Click If StatusStrip46109030.Text = "-" Then tambah() Else edit() End If End Sub
Private Sub dg_46109030_DataError(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles dg_46109030.DataError MsgBox("Terjadi sedikit kesalahan...")
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=chiko") Dim chiko1 As New DataTable Dim chiko2 As New DataTable Dim ikha As New DataSet Dim dewi1 As New BindingSource Dim dewi2 As New BindingSource
Public Sub sartika1() Dim a As New OleDb.OleDbDataAdapter chiko2.Rows.Clear() chiko1.Rows.Clear() a = New OleDb.OleDbDataAdapter("select * from mastertransaksi", conect) a.Fill(chiko1) a = 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", conect) a.Fill(chiko2) End Sub
Private Sub Latihan40A_46109045_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load sartika1()
Dim dc(1) As DataColumn dc(0) = chiko1.Columns("notrans") chiko1.PrimaryKey = dc
DATA146109045.DataSource = dewi1 DATA246109045.DataSource = dewi2 End Sub
Private Sub H46109045_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles H46109045.Click Dim cm As New OleDb.OleDbCommand cm = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & DATA146109045.CurrentRow.Cells("notrans").Value & "'", conect) conect.Open() cm.ExecuteNonQuery() conect.Close()
cm = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & DATA146109045.CurrentRow.Cells("notrans").Value & "'", conect) conect.Open() cm.ExecuteNonQuery() conect.Close() cm.Dispose() sartika1() End Sub
Private Sub TM46109045_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM46109045.Click If LATIHAN040B_46109045.Visible = False Then LATIHAN040B_46109045.Show() Else LATIHAN040B_46109045.Activate() End If
LATIHAN040B_46109045.kawai1() LATIHAN040B_46109045.kawai3() End Sub
Private Sub E46109045_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles E46109045.Click If LATIHAN040B_46109045.Visible = False Then LATIHAN040B_46109045.Show() Else LATIHAN040B_46109045.Activate() End If
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=chiko") Dim dewi As New DataTable Dim sartika As New ByIskandar.CariKeDataBaseByIskandar Dim dede As New OleDb.OleDbCommand
Public Sub sartika2() Dim a As New OleDb.OleDbDataAdapter a = 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 = '" & NT46109045.Text & "'", conect) dewi.Rows.Clear() a.Fill(dewi) End Sub
Public Sub sartika3() Dim total As Integer = 0 For Each x As DataRow In dewi.Rows total += x("Jumlah") Next TOT46109045.Text = total End Sub
Private Sub sartika4() If NT46109045.Text.Length = 0 Then MsgBox("Isi rong itu Notransnya..") Exit Sub End If
If JT46109045.Text.Length = 0 Then MsgBox("Isi rong itu Jenis Transaksinya..") Exit Sub End If
If dewi.Rows.Count = 0 Then MsgBox("Isi rong itu datatable k..") Exit Sub End If End Sub
Private Sub tambah() sartika4() sartika.AturPencarianDataBase("mastertransaksi", "notrans", NT46109045.Text, 1, conect) If sartika.JumlanBaris > 0 Then MsgBox("Adami notrans seperti itu..") Exit Sub End If
For Each x As DataRow In dewi.Rows dede = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT46109045.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", conect) conect.Open() dede.ExecuteNonQuery() conect.Close() Next dede.Dispose()
dewi.Rows.Clear() Latihan040A_46109045.sartika1() End Sub
Public Sub edit() sartika4() If NT46109045.Text <> TS46109045.Text Then sartika.AturPencarianDataBase("mastertransaksi", "notrans", NT46109045.Text, 1, conect) If sartika.JumlanBaris > 0 Then MsgBox("Adami Notrans seperti itu,,mohon ganti..") Exit Sub End If End If
dede = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & TS46109045.Text & "'", conect) conect.Open() dede.ExecuteNonQuery() conect.Close()
For Each x As DataRow In dewi.Rows dede = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & NT46109045.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", conect) conect.Open() dede.ExecuteNonQuery() conect.Close() Next dede.Dispose()
Private Sub DATA46109045_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DATA46109045.CellEndEdit If DATA46109045.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
sartika.AturPencarianDataBase("barang", "kodebarang", DATA46109045.CurrentRow.Cells("KODEBARANG").Value, 1, conect) If sartika.JumlanBaris > 0 Then DATA46109045.CurrentRow.Cells("NAMABARANG").Value = sartika.DataTablenya.Rows(0).Item("NAMABARANG") Else DATA46109045.CurrentRow.Cells("NAMABARANG").Value = "" If Latihan383940_46109045.ShowDialog = Windows.Forms.DialogResult.OK Then DATA46109045.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109045.DATA46109045.CurrentRow.Cells("KODEBARANG").Value DATA46109045.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109045.DATA46109045.CurrentRow.Cells("NAMABARANG").Value End If End If
DATA46109045.Columns(e.ColumnIndex).Name = "UNIT" Or DATA46109045.Columns(e.ColumnIndex).Name = "HARGA" Then DATA46109045.CurrentRow.Cells("JUMLAH").Value = DATA46109045.CurrentRow.Cells("UNIT").Value * DATA46109045.CurrentRow.Cells("HARGA").Value sartika3() End If End Sub
Private Sub S46109045_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles S46109045.Click If TS46109045.Text = "-" Then tambah() Else edit() End If End Sub
Private Sub DATA46109045_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DATA46109045.DataError MsgBox("Terjadi sedikit kesalahan...") End Sub End Class
Public Class LATIHAN040A_46109054 Dim cantik As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=wiwi") Dim MUSTIKA As New DataTable Dim CHAERUNNISA As New DataTable Dim dset As New DataSet Dim WWW1 As New BindingSource Dim WWW2 As New BindingSource Public Sub cantikI()
CHAERUNNISA.Rows.Clear() MUSTIKA.Rows.Clear()
Dim B1 As New OleDb.OleDbDataAdapter B1 = New OleDb.OleDbDataAdapter("Select * From MASTERTRANSAKSI", cantik) B1.Fill(MUSTIKA)
B1 = New OleDb.OleDbDataAdapter("Select DETAILTRANSAKSI.NOTRANS, DETAILTRANSAKSI.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG", cantik) B1.Fill(CHAERUNNISA)
B1.Dispose() End Sub
Private Sub LATIHAN040A_46109054_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load cantikI()
Private Sub cantik3_46109054_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi1_46109054.Click If LATIHAN_040B_46109054.Visible = False Then LATIHAN_040B_46109054.Show() Else LATIHAN_040B_46109054.Activate() End If
LATIHAN_040B_46109054.mustika() LATIHAN_040B_46109054.TOTALJUMLAH() End Sub
Private Sub TAMBAH_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi2_46109054.Click If LATIHAN_040B_46109054.Visible = False Then LATIHAN_040B_46109054.Show() Else LATIHAN_040B_46109054.Activate() End If
Private Sub HAPUS_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi3_46109054.Click Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS='" & DGV1_46109054.CurrentRow.Cells("NOTRANS").Value & "'", cantik) cantik.Open() T.ExecuteNonQuery() cantik.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS='" & DGV1_46109054.CurrentRow.Cells("NOTRANS").Value & "'", cantik) cantik.Open() T.ExecuteNonQuery() cantik.Close()
Public Class LATIHAN_040B_46109054 Dim cantik As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=wiwi") Dim DATA As New DataTable
Public Sub mustika() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & ww1_46109054.Text & "'", cantik) DATA.Rows.Clear() X.Fill(DATA) End Sub
Private Sub Latihan40B46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dataPrimary(1) As DataColumn dataPrimary(0) = DATA.Columns("NOTRANS") DATA.PrimaryKey = dataPrimary
DGV1_46109054.DataSource = DATA
TOTALJUMLAH() End Sub Public Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In DATA.Rows TOT = TOT + x("JUMLAH") Next ww3_46109054.Text = TOT End Sub Private Sub DGV1_46109054_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV1_46109054.CellContentClick If DGV1_46109054.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", DGV1_46109054.CurrentRow.Cells("KODEBARANG").Value, 1, cantik)
If Pencari.JumlanBaris > 0 Then DGV1_46109054.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else DGV1_46109054.CurrentRow.Cells("KODEBARANG").Value = "" If Latihan383940_46109054.ShowDialog = Windows.Forms.DialogResult.OK Then DGV1_46109054.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109054.DGV_46109054.CurrentRow.Cells("KODEBARANG").Value DGV1_46109054.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109054.DGV_46109054.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf DGV1_46109054.Columns(e.ColumnIndex).Name = "UNIT" Or DGV1_46109054.Columns(e.ColumnIndex).Name = "HARGA" Then
DGV1_46109054.CurrentRow.Cells("JUMLAH").Value = DGV1_46109054.CurrentRow.Cells("UNIT").Value * DGV1_46109054.CurrentRow.Cells("HARGA").Value End If
Private Sub Button1_Button2() If ww1_46109054.Text.Length = 0 Then MsgBox("Maaf, Nomor transaksi harus diisi dulu") Exit Sub End If
If ww2_46109054.Text.Length = 0 Then MsgBox("Maaf, Jenis transaksi harus diisi dulu") Exit Sub End If
If DATA.Rows.Count() = 0 Then MsgBox("Maaf, Proses tidak dapat dilanjutkan") Exit Sub End If
If StatusStrip1.Text <> ww1_46109054.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", ww1_46109054.Text, 1, cantik) If pencari.JumlanBaris > 0 Then MsgBox("Nomor transaksi sudah ada") Exit Sub End If End If
Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI(NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & ww1_46109054.Text & "', #" & DTP1_46109054.Value.Month & "/" & DTP1_46109054.Value.Day & "/" & DTP1_46109054.Value.Year & "#, '" & ww2_46109054.Text & "')", cantik)
cantik.Open()
T.ExecuteNonQuery()
cantik.Close()
For Each X As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & ww1_46109054.Text & "', '" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", cantik) cantik.Open() T.ExecuteNonQuery() cantik.Close() T.Dispose() Next
Private Sub edit_46109051() If ww1_46109054.Text.Length = 0 Then MsgBox("Maaf, Nomor transaksi harus diisi dulu nah !!!") Exit Sub End If
If ww2_46109054.Text.Length = 0 Then MsgBox("Maaf, Jenis transaksi harus diisi dulu nah !!!") Exit Sub End If
If DATA.Rows.Count() = 0 Then MsgBox("Maaf, Proses tidak dapat dilanjutkan gang....") Exit Sub End If
If StatusStrip1.Text <> ww1_46109054.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", ww1_46109054.Text, 1, cantik) If pencari.JumlanBaris > 0 Then MsgBox("Nomor transaksi sudah ada") Exit Sub End If End If
Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS= '" & ww1_46109054.Text & "'", cantik) cantik.Open() T.ExecuteNonQuery() cantik.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS= '" & ww1_46109054.Text & "'", cantik) cantik.Open() T.ExecuteNonQuery() cantik.Close()
For Each XX As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & ww1_46109054.Text & "', '" & XX("KODEBARANG") & "', " & XX("UNIT") & ", " & XX("HARGA") & ")", cantik) cantik.Open() T.ExecuteNonQuery() cantik.Close() T.Dispose() Next
TOTALJUMLAH() LATIHAN040A_46109054.cantikI() End Sub
Private Sub save_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi_46109054.Click If StatusStrip1.Text = "-" Then Button1_Button2() Else edit_46109051() End If End Sub End Class
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=eby") Dim feby As New DataTable Dim ana As New ByIskandar.CfransKeDataBaseByIskandar Dim eby As New OleDb.OleDbCommand
Public Sub ana2() Dim sayang As New OleDb.OleDbDataAdapter sayang = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detffltransaksi.UNIT, detffltransaksi.HARGA, detffltransaksi.unit * detffltransaksi.harga as JUMLAH from barang inner join detffltransaksi on barang.kodebarang = detffltransaksi.kodebarang where notrans = '" & tl_46109027.Text & "'", conect) feby.Rows.Clear() sayang.Fill(feby) End Sub
Public Sub ana3() Dim total As Integer = 0 For Each x As DataRow In feby.Rows total += x("Jumlah") Next tgl_46109027.Text = total End Sub
Private Sub ana4() If tl_46109027.Text.Length = 0 Then MsgBox("Isi rong itu Notransnya..") Exit Sub End If
If tl_46109027.Text.Length = 0 Then MsgBox("Isi rong itu Jenis Transaksinya..") Exit Sub End If
If feby.Rows.Count = 0 Then MsgBox("Isi rong itu datatable k..") Exit Sub End If End Sub
Private Sub tambah() ana4() ana.AturPencfransanDataBase("mastertransaksi", "notrans", tl_46109027.Text, 1, conect) If ana.JumlanBfranss > 0 Then MsgBox("Adami notrans seperti itu..") Exit Sub End If
For Each x As DataRow In feby.Rows eby = New OleDb.OleDbCommand("insert into detffltransaksi (notrans, kodebarang, unit, harga) values ('" & tl_46109027.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", conect) conect.Open() eby.ExecuteNonQuery() conect.Close() Next eby.Dispose()
Public Sub edit() ana4() If tl_46109027.Text <> tl_46109027.Text Then ana.AturPencfransanDataBase("mastertransaksi", "notrans", tl_46109027.Text, 1, conect) If ana.JumlanBfranss > 0 Then MsgBox("Adami Notrans seperti itu,,mohon ganti..") Exit Sub End If End If
eby = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & tl_46109027.Text & "'", conect) conect.Open() eby.ExecuteNonQuery() conect.Close()
eby = New OleDb.OleDbCommand("delete * from detffltransaksi where notrans = '" & tl_46109027.Text & "'", conect) conect.Open() eby.ExecuteNonQuery() conect.Close()
For Each x As DataRow In feby.Rows eby = New OleDb.OleDbCommand("insert into detffltransaksi(notrans, kodebarang, unit, harga) values ('" & tl_46109027.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", conect) conect.Open() eby.ExecuteNonQuery() conect.Close() Next eby.Dispose()
Private Sub dg_46109027_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dg_46109027.CellEndEdit If dg_46109027.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
ana.AturPencfransanDataBase("barang", "kodebarang", dg_46109027.CurrentRow.Cells("KODEBARANG").Value, 1, conect) If ana.JumlanBfranss > 0 Then dg_46109027.CurrentRow.Cells("NAMABARANG").Value = ana.DataTablenya.Rows(0).Item("NAMABARANG") Else dg_46109027.CurrentRow.Cells("NAMABARANG").Value = "" If Latihan383940012.ShowDialog = Windows.Forms.DialogResult.OK Then dg_46109027.CurrentRow.Cells("KODEBARANG").Value = Latihan383940012.dg_46109027.CurrentRow.Cells("KODEBARANG").Value dg_46109027.CurrentRow.Cells("NAMABARANG").Value = Latihan383940012.dg_46109027.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf dg_46109027.Columns(e.ColumnIndex).Name = "UNIT" Or dg_46109027.Columns(e.ColumnIndex).Name = "HARGA" Then dg_46109027.CurrentRow.Cells("JUMLAH").Value = dg_46109027.CurrentRow.Cells("UNIT").Value * dg_46109027.CurrentRow.Cells("HARGA").Value ana3() End If End Sub
Private Sub S46109027_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109027.Click If s_46109027.Text = "-" Then tambah() Else edit() End If End Sub
Private Sub dg_46109027_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles dg_46109027.DataError MsgBox("Terjadi sedikit kesalahan...") End Sub
Private Sub s_46109027_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109027.Click
Public Class LATIHAN_040A_46109053 Dim Indah As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=thepinkers29") Dim DT As New DataTable Dim DT1 As New DataTable Dim dset As New DataSet Dim MMM1 As New BindingSource Dim MMM2 As New BindingSource Public Sub saenong()
DT1.Rows.Clear() DT.Rows.Clear()
Dim B1 As New OleDb.OleDbDataAdapter B1 = New OleDb.OleDbDataAdapter("Select * From MASTERTRANSAKSI", Indah) B1.Fill(DT)
B1 = New OleDb.OleDbDataAdapter("Select DETAILTRANSAKSI.NOTRANS, DETAILTRANSAKSI.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG", Indah) B1.Fill(DT1)
B1.Dispose() End Sub
Private Sub LATIHAN40A_053_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load saenong()
Private Sub EDIT_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EDIT_053.Click If LATIHAN_040B_46109053.Visible = False Then LATIHAN_040B_46109053.Show() Else LATIHAN_040B_46109053.Activate() End If
LATIHAN_040B_46109053.MANIS() LATIHAN_040B_46109053.TOTALJUMLAH() End Sub
Private Sub TAMBAH_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH_053.Click If LATIHAN_040B_46109053.Visible = False Then LATIHAN_040B_46109053.Show() Else LATIHAN_040B_46109053.Activate() End If
Private Sub DEL_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DEL_053.Click Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS='" & DGV1_053.CurrentRow.Cells("NOTRANS").Value & "'", Indah) Indah.Open() T.ExecuteNonQuery() Indah.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS='" & DGV1_053.CurrentRow.Cells("NOTRANS").Value & "'", Indah) Indah.Open() T.ExecuteNonQuery() Indah.Close()
Public Class LATIHAN_040B_46109053 Dim Indah As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=thepinkers29") Dim DATA As New DataTable
Public Sub MANIS() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NT_053.Text & "'", Indah) DATA.Rows.Clear() X.Fill(DATA) End Sub
Private Sub Latihan40B46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dataPrimary(1) As DataColumn dataPrimary(0) = DATA.Columns("NOTRANS") DATA.PrimaryKey = dataPrimary
DATA_053.DataSource = DATA
TOTALJUMLAH() End Sub Public Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In DATA.Rows TOT = TOT + x("JUMLAH") Next TOT_053.Text = TOT End Sub Private Sub data_053_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DATA_053.CellContentClick If DATA_053.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", DATA_053.CurrentRow.Cells("KODEBARANG").Value, 1, Indah)
If Pencari.JumlanBaris > 0 Then DATA_053.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else DATA_053.CurrentRow.Cells("KODEBARANG").Value = "" If LATIHAN_383940_46109053.ShowDialog = Windows.Forms.DialogResult.OK Then
DATA_053.CurrentRow.Cells("KODEBARANG").Value = LATIHAN_383940_46109053.DGV_053.CurrentRow.Cells("KODEBARANG").Value DATA_053.CurrentRow.Cells("NAMABARANG").Value = LATIHAN_383940_46109053.DGV_053.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf DATA_053.Columns(e.ColumnIndex).Name = "UNIT" Or DATA_053.Columns(e.ColumnIndex).Name = "HARGA" Then
DATA_053.CurrentRow.Cells("JUMLAH").Value = DATA_053.CurrentRow.Cells("UNIT").Value * DATA_053.CurrentRow.Cells("HARGA").Value End If
TOTALJUMLAH() End Sub
Private Sub Button1_Button2() If NT_053.Text.Length = 0 Then MsgBox("Maaf, Nomor transaksi harus diisi dulu") Exit Sub End If
If JT_053.Text.Length = 0 Then MsgBox("Maaf, Jenis transaksi harus diisi dulu") Exit Sub End If
If DATA.Rows.Count() = 0 Then MsgBox("Maaf, Proses tidak dapat dilanjutkan") Exit Sub End If
If StatusStrip1.Text <> NT_053.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_053.Text, 1, Indah) If pencari.JumlanBaris > 0 Then MsgBox("Nomor transaksi sudah ada") Exit Sub End If End If
Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI(NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_053.Text & "', #" & TGL_053.Value.Month & "/" & TGL_053.Value.Day & "/" & TGL_053.Value.Year & "#, '" & JT_053.Text & "')", Indah)
Indah.Open()
T.ExecuteNonQuery()
Indah.Close()
For Each X As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_053.Text & "', '" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Indah) Indah.Open() T.ExecuteNonQuery() Indah.Close() T.Dispose() Next
If DATA.Rows.Count() = 0 Then MsgBox("Maaf, Proses tidak dapat dilanjutkan gang....") Exit Sub End If
If StatusStrip1.Text <> NT_053.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_053.Text, 1, Indah) If pencari.JumlanBaris > 0 Then MsgBox("Nomor transaksi sudah ada") Exit Sub End If End If
Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS= '" & NT_053.Text & "'", Indah) Indah.Open() T.ExecuteNonQuery() Indah.Close()
Private Sub save_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_053.Click If StatusStrip1.Text = "-" Then Button1_Button2() Else edit_053() End If End Sub End Class
ARYANDIRA(46109034) Public Class Latihan40A_034 Dim satu 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 dira1() Dim a As New OleDb.OleDbDataAdapter dt2.Rows.Clear() dt1.Rows.Clear() a = New OleDb.OleDbDataAdapter("select * from mastertransaksi", satu) a.Fill(dt1) a = 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", satu) a.Fill(dt2) End Sub
Private Sub Latihan40A_034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load dira1()
Dim dc(1) As DataColumn dc(0) = dt1.Columns("notrans") dt1.PrimaryKey = dc
dgv1.DataSource = bs1 dgv2.DataSource = bs2 End Sub
Private Sub aa_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles aa_034.Click Dim cm As New OleDb.OleDbCommand cm = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & dgv1.CurrentRow.Cells("notrans").Value & "'", satu) satu.Open() cm.ExecuteNonQuery() satu.Close()
cm = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & dgv1.CurrentRow.Cells("notrans").Value & "'", satu) satu.Open() cm.ExecuteNonQuery() satu.Close() cm.Dispose() dira1() End Sub
Private Sub bb_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bb_034.Click If Latihan40B_034.Visible = False Then Latihan40B_034.Show() Else Latihan40B_034.Activate() End If
Latihan40B_034.dira2() Latihan40B_034.dira3() End Sub
Private Sub cc_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cc_034.Click If Latihan40B_034.Visible = False Then Latihan40B_034.Show() Else Latihan40B_034.Activate() End If
ARYANDIRA(46109034) Lat.40B Public Class Latihan_40B_034 Dim satu As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/dataMajemuk.accdb") Dim dt As New DataTable Dim dira As New ByIskandar.CariKeDataBaseByIskandar Dim cm As New OleDb.OleDbCommand
Public Sub dira2() Dim a As New OleDb.OleDbDataAdapter a = 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 = '" & aa_034.Text & "'", satu) dt.Rows.Clear() a.Fill(dt) End Sub
Public Sub dira3() Dim total As Integer = 0 For Each x As DataRow In dt.Rows total += x("Jumlah") Next Dd_034.Text = total End Sub
Private Sub dira4() If aa_034.Text.Length = 0 Then MsgBox("Isi rong itu Notransnya..") Exit Sub End If
If cc_034.Text.Length = 0 Then MsgBox("Isi rong itu Jenis Transaksinya..") Exit Sub End If If dt.Rows.Count = 0 Then MsgBox("Isi rong itu datatable k..") Exit Sub End If End Sub
Private Sub tambah() dira4() dira.AturPencarianDataBase("mastertransaksi", "notrans", aa_034.Text, 1, satu) If dira.JumlanBaris > 0 Then MsgBox("Ada notrans seperti itu..") Exit Sub End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & aa_034.Text & "',#" & bb_034.Value.Month & "/" & bb_034.Value.Day & "/" & bb_034.Value.Year & "#, '" & cc_034.Text & "')", satu) satu.Open() cm.ExecuteNonQuery() satu.Close() For Each x As DataRow In dt.Rows cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & aa_034.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", satu) satu.Open() cm.ExecuteNonQuery() satu.Close() Next cm.Dispose()
Public Sub edit() dira4() If aa_034.Text <> ff_034.Text Then dira.AturPencarianDataBase("mastertransaksi", "notrans", aa_034.Text, 1, satu) If dira.JumlanBaris > 0 Then MsgBox("Ada Notrans seperti itu,,mohon ganti..") Exit Sub End If End If
cm = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & ff_034.Text & "'", satu) satu.Open() cm.ExecuteNonQuery() satu.Close()
For Each x As DataRow In dt.Rows cm = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & aa_034.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", satu) satu.Open() cm.ExecuteNonQuery() satu.Close() Next cm.Dispose()
Private Sub Latihan40B_034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dira2()
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.DataSource = dt End Sub
Private Sub dgv_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellEndEdit If dgv.Columns(e.ColumnIndex).Name = "KODEBARANG" Then 'If dgv.CurrentRow.Cells(0) = "KODEBARANG" Then (rumus lain)
'untuk mencari nama barang dgv.CurrentRow.Cells("NAMABARANG").Value = "" dgv.CurrentRow.Cells("UNIT").Value = 0 dgv.CurrentRow.Cells("HARGA").Value = 0 dgv.CurrentRow.Cells("JUMLAH").Value = 0
dira.AturPencarianDataBase("barang", "kodebarang", dgv.CurrentRow.Cells("KODEBARANG").Value, 1, satu) If dira.JumlanBaris > 0 Then '(menampilkan nama barang jika kolom kode barang ditemukan oleh proses di atas dgv.CurrentRow.Cells("NAMABARANG").Value = dira.DataTablenya.Rows(0).Item("NAMABARANG") Else dgv.CurrentRow.Cells("NAMABARANG").Value = "" If Latihan38_39_40_034.ShowDialog = Windows.Forms.DialogResult.OK Then dgv.CurrentRow.Cells("KODEBARANG").Value = Latihan_38_39_40_034.dgv.CurrentRow.Cells("KODEBARANG").Value dgv.CurrentRow.Cells("NAMABARANG").Value = Latihan_38_39_40_034.dgv.CurrentRow.Cells("NAMABARANG").Value End If End If ElseIf dgv.Columns(e.ColumnIndex).Name = "UNIT" Or dgv.Columns(e.ColumnIndex).Name = "HARGA" Then dgv.CurrentRow.Cells("JUMLAH").Value = dgv.CurrentRow.Cells("UNIT").Value * dgv.CurrentRow.Cells("HARGA").Value dira3() End If End Sub
Private Sub ee_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ee_034.Click If ff_034.Text = "-" Then tambah() Else edit() End If End Sub
Private Sub dgv_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles dgv.DataError MsgBox("Terjadi sedikit kesalahan...") End Sub end class
Public Class LATIHAN40A_46109005 Dim fahrul As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=arul") Dim april As New DataTable Dim april1 As New DataTable Dim dset As New DataSet Dim barru As New BindingSource Dim barru2 As New BindingSource Public Sub fahrulaa()
april1.Rows.Clear() april.Rows.Clear()
Dim B1 As New OleDb.OleDbDataAdapter B1 = New OleDb.OleDbDataAdapter("Select * From MASTERTRANSAKSI", fahrul) B1.Fill(april)
B1 = New OleDb.OleDbDataAdapter("Select DETAILTRANSAKSI.NOTRANS, DETAILTRANSAKSI.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG", fahrul) B1.Fill(april1)
B1.Dispose() End Sub
Private Sub LATIHAN40A_46109005_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load fahrulaa()
Private Sub EDIT_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EDIT_46109005.Click If LATIHAN40B_46109005.Visible = False Then LATIHAN40B_46109005.Show() Else LATIHAN40B_46109005.Activate() End If
LATIHAN40B_46109005.MANIS() LATIHAN40B_46109005.TOTALJUMLAH() End Sub
Private Sub TAMBAH_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH_46109005.Click If LATIHAN40B_46109005.Visible = False Then LATIHAN40B_46109005.Show() Else LATIHAN40B_46109005.Activate() End If
Private Sub HAPUS_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HAPUS_46109005.Click Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS='" & DG1_46109005.CurrentRow.Cells("NOTRANS").Value & "'", fahrul) fahrul.Open() T.ExecuteNonQuery() fahrul.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS='" & DG1_46109005.CurrentRow.Cells("NOTRANS").Value & "'", fahrul) fahrul.Open() T.ExecuteNonQuery() fahrul.Close()
Public Class LATIHAN40B_46109005 Dim arul As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=arul") Dim DATA As New DataTable
Public Sub MANIS() Dim X As New OleDb.OleDbDataAdapter X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NT_46109005.Text & "'", arul) DATA.Rows.Clear() X.Fill(DATA) End Sub
Private Sub Latihan40B46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim dataPrimary(1) As DataColumn dataPrimary(0) = DATA.Columns("NOTRANS") DATA.PrimaryKey = dataPrimary
DG_46109005.DataSource = DATA
TOTALJUMLAH() End Sub Public Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In DATA.Rows TOT = TOT + x("JUMLAH") Next TOT_46109005.Text = TOT End Sub Private Sub dg_46109005_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DG_46109005.CellContentClick If DG_46109005.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", DG_46109005.CurrentRow.Cells("KODEBARANG").Value, 1, arul)
If Pencari.JumlanBaris > 0 Then DG_46109005.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else DG_46109005.CurrentRow.Cells("KODEBARANG").Value = "" If Latihan383940_46109005.ShowDialog = Windows.Forms.DialogResult.OK Then DG_46109005.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109005.DATA46109005.CurrentRow.Cells("KODEBARANG").Value DG_46109005.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109005.DATA46109005.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf DG_46109005.Columns(e.ColumnIndex).Name = "UNIT" Or DG_46109005.Columns(e.ColumnIndex).Name = "HARGA" Then
DG_46109005.CurrentRow.Cells("JUMLAH").Value = DG_46109005.CurrentRow.Cells("UNIT").Value * DG_46109005.CurrentRow.Cells("HARGA").Value End If
TOTALJUMLAH() End Sub
Private Sub Button1_Button2() If NT_46109005.Text.Length = 0 Then MsgBox("Maaf, Nomor transaksi harus diisi dulu") Exit Sub End If
If JT_46109005.Text.Length = 0 Then MsgBox("Maaf, Jenis transaksi harus diisi dulu") Exit Sub End If
If DATA.Rows.Count() = 0 Then MsgBox("Maaf, Proses tidak dapat dilanjutkan") Exit Sub End If
If StatusStrip1.Text <> NT_46109005.Text Then Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109005.Text, 1, arul) If pencari.JumlanBaris > 0 Then MsgBox("Nomor transaksi sudah ada") Exit Sub End If End If
Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI(NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109005.Text & "', #" & DT_46109005.Value.Month & "/" & DT_46109005.Value.Day & "/" & DT_46109005.Value.Year & "#, '" & JT_46109005.Text & "')", arul)
arul.Open()
T.ExecuteNonQuery()
arul.Close()
For Each X As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109005.Text & "', '" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", arul) arul.Open() T.ExecuteNonQuery() arul.Close() T.Dispose() Next
ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109005.Text, 1, arul) If pencari.JumlanBaris > 0 Then MsgBox("Nomor transaksi sudah ada") Exit Sub End If End If
Dim T As New OleDb.OleDbCommand T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS= '" & NT_46109005.Text & "'", arul) arul.Open() T.ExecuteNonQuery() arul.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS= '" & NT_46109005.Text & "'", arul) arul.Open() T.ExecuteNonQuery() arul.Close()
For Each XX As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109005.Text & "', '" & XX("KODEBARANG") & "', " & XX("UNIT") & ", " & XX("HARGA") & ")", arul) arul.Open() T.ExecuteNonQuery() arul.Close() T.Dispose() Next
TOTALJUMLAH() LATIHAN40A_46109005.fahrulaa() End Sub
Private Sub save_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_46109005.Click If StatusStrip1.Text = "-" Then Button1_Button2() Else edit_46109005() End If End Sub
Private Sub TOT_46109005_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOT_46109005.TextChanged
Public Sub EDIT() KOREA3() If NT_46109021.Text <> DTP_46109021.Text Then CARI.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109021.Text, 1, KONEKSI) If CARI.JumlanBaris > 0 Then MsgBox("GANTI NO TRANS") Exit Sub End If End If
PERINTAH = New OleDb.OleDbCommand("DELETE *FROM MASTERTRANSAKSI WHERE NOTRANS = '" & DTP_46109021.Text & "'", KONEKSI) KONEKSI.Open() PERINTAH.ExecuteNonQuery() KONEKSI.Close()
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=wew") Dim joice As New DataTable Dim natalina As New ByIskandar.CariKeDataBaseByIskandar Dim seunggi As New OleDb.OleDbCommand
Public Sub natalina2() Dim j As New OleDb.OleDbDataAdapter j = 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_041.Text & "'", conect) joice.Rows.Clear() j.Fill(joice) End Sub Public Sub natalina3() Dim total As Integer = 0 For Each x As DataRow In joice.Rows total += x("Jumlah") Next tot_041.Text = total End Sub
Private Sub natalina4() If nt_041.Text.Length = 0 Then MsgBox("Isi Notransnya..") Exit Sub End If
If jt_041.Text.Length = 0 Then MsgBox("Isi Jenis Transaksinya..") Exit Sub End If
If joice.Rows.Count = 0 Then MsgBox("Isi datatable..") Exit Sub End If End Sub
Private Sub tambah() natalina4() natalina.AturPencarianDataBase("mastertransaksi", "notrans", nt_041.Text, 1, conect) If natalina.JumlanBaris > 0 Then MsgBox("maaf, sudah ada") Exit Sub End If
For Each x As DataRow In joice.Rows seunggi = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt_041.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", conect) conect.Open() seunggi.ExecuteNonQuery() conect.Close() Next seunggi.Dispose()
Private Sub wonga_041_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles wonga_041.CellEndEdit If wonga_041.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
natalina.AturPencarianDataBase("barang", "kodebarang", wonga_041.CurrentRow.Cells("KODEBARANG").Value, 1, conect) If natalina.JumlanBaris > 0 Then wonga_041.CurrentRow.Cells("NAMABARANG").Value = natalina.DataTablenya.Rows(0).Item("NAMABARANG") Else wonga_041.CurrentRow.Cells("NAMABARANG").Value = "" If Latihan383940_46109041.ShowDialog = Windows.Forms.DialogResult.OK Then wonga_041.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109041.wonga_041.CurrentRow.Cells("KODEBARANG").Value wonga_041.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109041.wonga_041.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf
wonga_041.Columns(e.ColumnIndex).Name = "UNIT" Or wonga_041.Columns(e.ColumnIndex).Name = "HARGA" Then wonga_041.CurrentRow.Cells("JUMLAH").Value = wonga_041.CurrentRow.Cells("UNIT").Value * wonga_041.CurrentRow.Cells("HARGA").Value natalina3() End If End Sub
Private Sub s_041_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_041.Click If ts_041.Text = "-" Then tambah() Else edit() End If End Sub
Private Sub wonga_041_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles wonga_041.DataError MsgBox("Terjadi sedikit kesalahan...") End Sub End Class
Public Class Latihan040A_46109001
BalasHapusDim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=ngekngek")
Dim ngek1 As New DataTable
Dim ngek2 As New DataTable
Dim wiwi As New DataSet
Dim ngok1 As New BindingSource
Dim ngok2 As New BindingSource
Public Sub saadah1()
Dim a As New OleDb.OleDbDataAdapter
ngek2.Rows.Clear()
ngek1.Rows.Clear()
a = New OleDb.OleDbDataAdapter("select * from mastertransaksi", conect)
a.Fill(ngek1)
a = 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", conect)
a.Fill(ngek2)
End Sub
Private Sub Latihan40A_46109001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
saadah1()
wiwi.Tables.Add(ngek1)
wiwi.Tables.Add(ngek2)
ngek1.TableName = "ical"
ngek2.TableName = "ical2"
wiwi.Relations.Add(New DataRelation("a", wiwi.Tables("ical").Columns("notrans"), wiwi.Tables("ical2").Columns("notrans")))
ngok1.DataSource = wiwi
ngok1.DataMember = "ical"
ngok2.DataSource = ngok1
ngok2.DataMember = "a"
Dim dc(1) As DataColumn
dc(0) = ngek1.Columns("notrans")
ngek1.PrimaryKey = dc
DATA146109001.DataSource = ngok1
DATA246109001.DataSource = ngok2
End Sub
Private Sub H46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles H46109001.Click
Dim cm As New OleDb.OleDbCommand
cm = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & DATA146109001.CurrentRow.Cells("notrans").Value & "'", conect)
conect.Open()
cm.ExecuteNonQuery()
conect.Close()
cm = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & DATA146109001.CurrentRow.Cells("notrans").Value & "'", conect)
conect.Open()
cm.ExecuteNonQuery()
conect.Close()
cm.Dispose()
saadah1()
End Sub
Private Sub TM46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM46109001.Click
If LATIHAN040B_46109001.Visible = False Then
LATIHAN040B_46109001.Show()
Else
LATIHAN040B_46109001.Activate()
End If
LATIHAN040B_46109001.NT46109001.Text = ""
LATIHAN040B_46109001.JT46109001.Text = ""
LATIHAN040B_46109001.TS46109001.Text = "-"
LATIHAN040B_46109001.saadah2()
LATIHAN040B_46109001.saadah3()
End Sub
Private Sub E46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles E46109001.Click
If LATIHAN040B_46109001.Visible = False Then
LATIHAN040B_46109001.Show()
Else
LATIHAN040B_46109001.Activate()
End If
LATIHAN040B_46109001.NT46109001.Text = DATA146109001.CurrentRow.Cells("notrans").Value
LATIHAN040B_46109001.T46109001.Value = DATA146109001.CurrentRow.Cells("tanggaltransaksi").Value
LATIHAN040B_46109001.JT46109001.Text = DATA146109001.CurrentRow.Cells("jenistransaksi").Value
LATIHAN040B_46109001.TS46109001.Text = DATA146109001.CurrentRow.Cells("notrans").Value
LATIHAN040B_46109001.saadah2()
LATIHAN040B_46109001.saadah3()
End Sub
End Class
Public Class LATIHAN040B_46109001
BalasHapusDim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=ngekngek")
Dim dwitya As New DataTable
Dim saadah As New ByIskandar.CariKeDataBaseByIskandar
Dim wiwi As New OleDb.OleDbCommand
Public Sub saadah2()
Dim a As New OleDb.OleDbDataAdapter
a = 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 = '" & NT46109001.Text & "'", conect)
dwitya.Rows.Clear()
a.Fill(dwitya)
End Sub
Public Sub saadah3()
BalasHapusDim total As Integer = 0
For Each x As DataRow In dwitya.Rows
total += x("Jumlah")
Next
TOT46109001.Text = total
End Sub
Private Sub saadah4()
If NT46109001.Text.Length = 0 Then
MsgBox("Isi rong itu Notransnya..")
Exit Sub
End If
If JT46109001.Text.Length = 0 Then
MsgBox("Isi rong itu Jenis Transaksinya..")
Exit Sub
End If
If dwitya.Rows.Count = 0 Then
MsgBox("Isi rong itu datatable k..")
Exit Sub
End If
End Sub
Private Sub tambah()
saadah4()
saadah.AturPencarianDataBase("mastertransaksi", "notrans", NT46109001.Text, 1, conect)
If saadah.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu..")
Exit Sub
End If
wiwi = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT46109001.Text & "',#" & T46109001.Value.Month & "/" & T46109001.Value.Day & "/" & T46109001.Value.Year & "#, '" & JT46109001.Text & "')", conect)
conect.Open()
wiwi.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In dwitya.Rows
wiwi = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT46109001.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", conect)
conect.Open()
wiwi.ExecuteNonQuery()
conect.Close()
Next
wiwi.Dispose()
NT46109001.Text = ""
JT46109001.Text = ""
TOT46109001.Text = ""
TS46109001.Text = "-"
dwitya.Rows.Clear()
Latihan040A_46109001.saadah1()
End Sub
Public Sub edit()
saadah4()
If NT46109001.Text <> TS46109001.Text Then
saadah.AturPencarianDataBase("mastertransaksi", "notrans", NT46109001.Text, 1, conect)
If saadah.JumlanBaris > 0 Then
MsgBox("Adami Notrans seperti itu,,mohon ganti..")
Exit Sub
End If
End If
wiwi = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & TS46109001.Text & "'", conect)
BalasHapusconect.Open()
wiwi.ExecuteNonQuery()
conect.Close()
wiwi = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & NT46109001.Text & "',#" & T46109001.Value.Month & "/" & T46109001.Value.Day & "/" & T46109001.Value.Year & "#, '" & JT46109001.Text & "')", conect)
conect.Open()
wiwi.ExecuteNonQuery()
conect.Close()
wiwi = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & TS46109001.Text & "'", conect)
conect.Open()
wiwi.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In dwitya.Rows
wiwi = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & NT46109001.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", conect)
conect.Open()
wiwi.ExecuteNonQuery()
conect.Close()
Next
wiwi.Dispose()
NT46109001.Text = ""
JT46109001.Text = ""
TOT46109001.Text = ""
TS46109001.Text = "-"
dwitya.Rows.Clear()
Latihan040A_46109001.saadah1()
End Sub
Private Sub Latihan040A_46109001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
saadah2()
Dim dc(1) As DataColumn
dc(0) = dwitya.Columns("kodebarang")
dwitya.PrimaryKey = dc
dwitya.Columns("unit").DefaultValue = 0
dwitya.Columns("harga").DefaultValue = 0
dwitya.Columns("jumlah").DefaultValue = 0
DATA46109001.DataSource = dwitya
End Sub
Private Sub DATA46109001_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DATA46109001.CellEndEdit
If DATA46109001.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
DATA46109001.CurrentRow.Cells("NAMABARANG").Value = ""
DATA46109001.CurrentRow.Cells("UNIT").Value = 0
DATA46109001.CurrentRow.Cells("HARGA").Value = 0
DATA46109001.CurrentRow.Cells("JUMLAH").Value = 0
saadah.AturPencarianDataBase("barang", "kodebarang", DATA46109001.CurrentRow.Cells("KODEBARANG").Value, 1, conect)
If saadah.JumlanBaris > 0 Then
DATA46109001.CurrentRow.Cells("NAMABARANG").Value = saadah.DataTablenya.Rows(0).Item("NAMABARANG")
Else
DATA46109001.CurrentRow.Cells("NAMABARANG").Value = ""
If Latihan383940_46109001.ShowDialog = Windows.Forms.DialogResult.OK Then
DATA46109001.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("KODEBARANG").Value
DATA46109001.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf
DATA46109001.Columns(e.ColumnIndex).Name = "UNIT" Or DATA46109001.Columns(e.ColumnIndex).Name = "HARGA" Then
BalasHapusDATA46109001.CurrentRow.Cells("JUMLAH").Value = DATA46109001.CurrentRow.Cells("UNIT").Value * DATA46109001.CurrentRow.Cells("HARGA").Value
saadah3()
End If
End Sub
Private Sub S46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles S46109001.Click
If TS46109001.Text = "-" Then
tambah()
Else
edit()
End If
End Sub
Private Sub DATA46109001_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DATA46109001.DataError
MsgBox("Terjadi sedikit kesalahan...")
End Sub
End Class
Public Class LATIHAN40A_46109051
BalasHapusDim Wahda As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=thepinkers29")
Dim niah As New DataTable
Dim niah1 As New DataTable
Dim dset As New DataSet
Dim MMM1 As New BindingSource
Dim MMM2 As New BindingSource
Public Sub wahdaaa()
niah1.Rows.Clear()
niah.Rows.Clear()
Dim B1 As New OleDb.OleDbDataAdapter
B1 = New OleDb.OleDbDataAdapter("Select * From MASTERTRANSAKSI", Wahda)
B1.Fill(niah)
B1 = New OleDb.OleDbDataAdapter("Select DETAILTRANSAKSI.NOTRANS, DETAILTRANSAKSI.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG", Wahda)
B1.Fill(niah1)
B1.Dispose()
End Sub
Private Sub LATIHAN40A_46109051_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
wahdaaa()
dset.Tables.Add(niah)
dset.Tables.Add(niah1)
niah.TableName = "T01"
niah1.TableName = "T02"
dset.Relations.Add(New DataRelation("X", dset.Tables("T01").Columns("NOTRANS"), dset.Tables("T02").Columns("NOTRANS")))
MMM1.DataSource = dset
MMM1.DataMember = "T01"
MMM2.DataSource = MMM1
MMM2.DataMember = "X"
DG1_46109051.DataSource = MMM1
DG2_46109051.DataSource = MMM2
End Sub
Private Sub EDIT_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EDIT_46109051.Click
If LATIHAN40B_46109051.Visible = False Then
LATIHAN40B_46109051.Show()
Else
LATIHAN40B_46109051.Activate()
End If
LATIHAN40B_46109051.StatusStrip1.Text = DG1_46109051.CurrentRow.Cells("NOTRANS").Value
LATIHAN40B_46109051.NT_46109051.Text = DG1_46109051.CurrentRow.Cells("NOTRANS").Value
LATIHAN40B_46109051.JT_46109051.Text = DG1_46109051.CurrentRow.Cells("JENISTRANSAKSI").Value
LATIHAN40B_46109051.MANIS()
LATIHAN40B_46109051.TOTALJUMLAH()
End Sub
LANJUTAN.....
BalasHapusPrivate Sub TAMBAH_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH_46109051.Click
If LATIHAN40B_46109051.Visible = False Then
LATIHAN40B_46109051.Show()
Else
LATIHAN40B_46109051.Activate()
End If
LATIHAN40B_46109051.StatusStrip1.Text = "-"
LATIHAN40B_46109051.NT_46109051.Text = ""
LATIHAN40B_46109051.JT_46109051.Text = ""
LATIHAN40B_46109051.MANIS()
LATIHAN40B_46109051.TOTALJUMLAH()
End Sub
Private Sub HAPUS_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HAPUS_46109051.Click
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS='" & DG1_46109051.CurrentRow.Cells("NOTRANS").Value & "'", Wahda)
Wahda.Open()
T.ExecuteNonQuery()
Wahda.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS='" & DG1_46109051.CurrentRow.Cells("NOTRANS").Value & "'", Wahda)
Wahda.Open()
T.ExecuteNonQuery()
Wahda.Close()
T.Dispose()
wahdaaa()
End Sub
End Class
Public Class LATIHAN40B_46109051
BalasHapusDim Wahda As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=thepinkers29")
Dim DATA As New DataTable
Public Sub MANIS()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NT_46109051.Text & "'", Wahda)
DATA.Rows.Clear()
X.Fill(DATA)
End Sub
Private Sub Latihan40B46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = DATA.Columns("NOTRANS")
DATA.PrimaryKey = dataPrimary
dg_46109051.DataSource = DATA
TOTALJUMLAH()
End Sub
Public Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In DATA.Rows
TOT = TOT + x("JUMLAH")
Next
TOT_46109051.Text = TOT
End Sub
Private Sub dg_46109051_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DG_46109051.CellContentClick
If dg_46109051.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
dg_46109051.CurrentRow.Cells("NAMABARANG").Value = ""
dg_46109051.CurrentRow.Cells("UNIT").Value = 0
dg_46109051.CurrentRow.Cells("HARGA").Value = 0
dg_46109051.CurrentRow.Cells("JUMLAH").Value = 0
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", dg_46109051.CurrentRow.Cells("KODEBARANG").Value, 1, Wahda)
If Pencari.JumlanBaris > 0 Then
dg_46109051.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
dg_46109051.CurrentRow.Cells("KODEBARANG").Value = ""
If LATIHAN383940_46109051.ShowDialog = Windows.Forms.DialogResult.OK Then
DG_46109051.CurrentRow.Cells("KODEBARANG").Value = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("KODEBARANG").Value
DG_46109051.CurrentRow.Cells("NAMABARANG").Value = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf dg_46109051.Columns(e.ColumnIndex).Name = "UNIT" Or dg_46109051.Columns(e.ColumnIndex).Name = "HARGA" Then
dg_46109051.CurrentRow.Cells("JUMLAH").Value = dg_46109051.CurrentRow.Cells("UNIT").Value * dg_46109051.CurrentRow.Cells("HARGA").Value
End If
TOTALJUMLAH()
End Sub
Public Class LATIHAN40B_46109051
BalasHapusDim Wahda As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=thepinkers29")
Dim DATA As New DataTable
Public Sub MANIS()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NT_46109051.Text & "'", Wahda)
DATA.Rows.Clear()
X.Fill(DATA)
End Sub
Private Sub Latihan40B46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = DATA.Columns("NOTRANS")
DATA.PrimaryKey = dataPrimary
dg_46109051.DataSource = DATA
TOTALJUMLAH()
End Sub
Public Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In DATA.Rows
TOT = TOT + x("JUMLAH")
Next
TOT_46109051.Text = TOT
End Sub
Private Sub dg_46109051_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DG_46109051.CellContentClick
If dg_46109051.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
dg_46109051.CurrentRow.Cells("NAMABARANG").Value = ""
dg_46109051.CurrentRow.Cells("UNIT").Value = 0
dg_46109051.CurrentRow.Cells("HARGA").Value = 0
dg_46109051.CurrentRow.Cells("JUMLAH").Value = 0
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", dg_46109051.CurrentRow.Cells("KODEBARANG").Value, 1, Wahda)
If Pencari.JumlanBaris > 0 Then
dg_46109051.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
dg_46109051.CurrentRow.Cells("KODEBARANG").Value = ""
If LATIHAN383940_46109051.ShowDialog = Windows.Forms.DialogResult.OK Then
DG_46109051.CurrentRow.Cells("KODEBARANG").Value = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("KODEBARANG").Value
DG_46109051.CurrentRow.Cells("NAMABARANG").Value = LATIHAN383940_46109051.DG_46109051.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf dg_46109051.Columns(e.ColumnIndex).Name = "UNIT" Or dg_46109051.Columns(e.ColumnIndex).Name = "HARGA" Then
dg_46109051.CurrentRow.Cells("JUMLAH").Value = dg_46109051.CurrentRow.Cells("UNIT").Value * dg_46109051.CurrentRow.Cells("HARGA").Value
End If
TOTALJUMLAH()
End Sub
Private Sub Button1_Button2()
BalasHapusIf NT_46109051.Text.Length = 0 Then
MsgBox("Maaf, Nomor transaksi harus diisi dulu")
Exit Sub
End If
If JT_46109051.Text.Length = 0 Then
MsgBox("Maaf, Jenis transaksi harus diisi dulu")
Exit Sub
End If
If DATA.Rows.Count() = 0 Then
MsgBox("Maaf, Proses tidak dapat dilanjutkan")
Exit Sub
End If
If StatusStrip1.Text <> NT_46109051.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109051.Text, 1, Wahda)
If pencari.JumlanBaris > 0 Then
MsgBox("Nomor transaksi sudah ada")
Exit Sub
End If
End If
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI(NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109051.Text & "', #" & DT_46109051.Value.Month & "/" & DT_46109051.Value.Day & "/" & DT_46109051.Value.Year & "#, '" & JT_46109051.Text & "')", Wahda)
Wahda.Open()
T.ExecuteNonQuery()
Wahda.Close()
For Each X As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109051.Text & "', '" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Wahda)
Wahda.Open()
T.ExecuteNonQuery()
Wahda.Close()
T.Dispose()
Next
StatusStrip1.Text = "-"
NT_46109051.Text = ""
JT_46109051.Text = ""
DATA.Rows.Clear()
TOTALJUMLAH()
LATIHAN40A_46109051.wahdaaa()
End Sub
Private Sub edit_46109051()
BalasHapusIf NT_46109051.Text.Length = 0 Then
MsgBox("Maaf, Nomor transaksi harus diisi dulu nah !!!")
Exit Sub
End If
If JT_46109051.Text.Length = 0 Then
MsgBox("Maaf, Jenis transaksi harus diisi dulu nah !!!")
Exit Sub
End If
If DATA.Rows.Count() = 0 Then
MsgBox("Maaf, Proses tidak dapat dilanjutkan gang....")
Exit Sub
End If
If StatusStrip1.Text <> NT_46109051.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109051.Text, 1, Wahda)
If pencari.JumlanBaris > 0 Then
MsgBox("Nomor transaksi sudah ada")
Exit Sub
End If
End If
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS= '" & NT_46109051.Text & "'", Wahda)
Wahda.Open()
T.ExecuteNonQuery()
Wahda.Close()
T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109051.Text & "', #" & DT_46109051.Value.Month & "/" & DT_46109051.Value.Day & "/" & DT_46109051.Value.Year & "#, '" & JT_46109051.Text & "')", Wahda)
Wahda.Open()
T.ExecuteNonQuery()
Wahda.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS= '" & NT_46109051.Text & "'", Wahda)
Wahda.Open()
T.ExecuteNonQuery()
Wahda.Close()
For Each XX As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109051.Text & "', '" & XX("KODEBARANG") & "', " & XX("UNIT") & ", " & XX("HARGA") & ")", Wahda)
Wahda.Open()
T.ExecuteNonQuery()
Wahda.Close()
T.Dispose()
Next
StatusStrip1.Text = "-"
NT_46109051.Text = ""
JT_46109051.Text = ""
DATA.Rows.Clear()
TOTALJUMLAH()
LATIHAN40A_46109051.wahdaaa()
End Sub
Private Sub save_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_46109051.Click
If StatusStrip1.Text = "-" Then
Button1_Button2()
Else
edit_46109051()
End If
End Sub
End Class
Public Class Form40B
BalasHapusDim DILA As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=240991")
Dim DATA As New DataTable
Public Sub MANIS()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & DILA1_059.Text & "'", DILA)
DATA.Rows.Clear()
X.Fill(DATA)
End Sub
Private Sub Form40B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = DATA.Columns("NOTRANS")
DATA.PrimaryKey = dataPrimary
DATA_059.DataSource = DATA
TOTALJUMLAH()
End Sub
Public Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In DATA.Rows
TOT = TOT + x("JUMLAH")
Next
TOTAL_059.Text = TOT
End Sub
Private Sub EDIT_059()
BalasHapusIf DILA1_059.Text.Length = 0 Then
MsgBox("Maaf, Nomor transaksi harus diisi dulu nah !!!")
Exit Sub
End If
If DILA2_059.Text.Length = 0 Then
MsgBox("Maaf, Jenis transaksi harus diisi dulu nah !!!")
Exit Sub
End If
If DATA.Rows.Count() = 0 Then
MsgBox("Maaf, Proses tidak dapat dilanjutkan gang....")
Exit Sub
End If
If StatusStrip1.Text <> DILA1_059.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", DILA1_059.Text, 1, DILA)
If pencari.JumlanBaris > 0 Then
MsgBox("Nomor transaksi sudah ada")
Exit Sub
End If
End If
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS= '" & DILA1_059.Text & "'", DILA)
DILA.Open()
T.ExecuteNonQuery()
DILA.Close()
T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & DILA1_059.Text & "', #" & TGL_059.Value.Month & "/" & TGL_059.Value.Day & "/" & TGL_059.Value.Year & "#, '" & DILA2_059.Text & "')", DILA)
DILA.Open()
T.ExecuteNonQuery()
DILA.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS= '" & DILA1_059.Text & "'", DILA)
DILA.Open()
T.ExecuteNonQuery()
DILA.Close()
For Each XX As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & DILA1_059.Text & "', '" & XX("KODEBARANG") & "', " & XX("UNIT") & ", " & XX("HARGA") & ")", DILA)
DILA.Open()
T.ExecuteNonQuery()
DILA.Close()
T.Dispose()
Next
StatusStrip1.Text = "-"
DILA1_059.Text = ""
DILA2_059.Text = ""
DATA.Rows.Clear()
TOTALJUMLAH()
Form40A.DILAaa()
End Sub
Private Sub SAVE_059_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN_059.Click
If StatusStrip1.Text = "-" Then
Button1_Button2()
Else
EDIT_059()
End If
End Sub
Private Sub DILA1_059_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DILA1_059.TextChanged
End Sub
End Class
LATIHAN 40A
BalasHapusPublic Class LATIHAN040A_46109030
Dim ainun As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=ainun")
Dim ainun1 As New DataTable
Dim ainun2 As New DataTable
Dim nun As New DataSet
Dim nun1 As New BindingSource
Dim nun2 As New BindingSource
Public Sub ainunas()
Dim ai As New OleDb.OleDbDataAdapter
ainun1.Rows.Clear()
ainun2.Rows.Clear()
ai = New OleDb.OleDbDataAdapter("select * from mastertransaksi", ainun)
ai.Fill(ainun1)
ai = 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", ainun)
ai.Fill(ainun2)
End Sub
Private Sub LATIHAN040A_46109030_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ainunas()
nun.Tables.Add(ainun1)
nun.Tables.Add(ainun2)
ainun1.TableName = "nunun1"
ainun2.TableName = "nunun2"
nun.Relations.Add(New DataRelation("a", nun.Tables("nunun1").Columns("NOTRANS"), nun.Tables("nunun2").Columns("NOTRANS")))
nun1.DataSource = nun
nun2.DataMember = "nunun1"
nun2.DataSource = nun1
nun2.DataMember = "a"
Dim dc(1) As DataColumn
dc(0) = ainun1.Columns("NOTRANS")
ainun1.PrimaryKey = dc
dg1_46109030.DataSource = nun1
dg2_46109030.DataSource = nun2
End Sub
Private Sub h_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles h_46109030.Click
BalasHapusDim h As New OleDb.OleDbCommand
h = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & dg1_46109030.CurrentRow.Cells("notrans").Value & "'", ainun)
ainun.Open()
h.ExecuteNonQuery()
ainun.Close()
h = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & dg1_46109030.CurrentRow.Cells("notrans").Value & "'", ainun)
ainun.Open()
h.ExecuteNonQuery()
ainun.Close()
h.Dispose()
ainunas()
End Sub
Private Sub t_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t_46109030.Click
If LATIHAN_040B_46109030.Visible = False Then
LATIHAN_040B_46109030.Show()
Else
LATIHAN_040B_46109030.Activate()
End If
LATIHAN_040B_46109030.nt_46109030.Text = ""
LATIHAN_040B_46109030.jt_46109030.Text = ""
LATIHAN_040B_46109030.StatusStrip46109030.Text = "-"
LATIHAN_040B_46109030.ainunas1()
LATIHAN_040B_46109030.ainunas2()
End Sub
Private Sub e_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles e_46109030.Click
If LATIHAN_040B_46109030.Visible = False Then
LATIHAN_040B_46109030.Show()
Else
LATIHAN_040B_46109030.Activate()
End If
LATIHAN_040B_46109030.nt_46109030.Text = dg1_46109030.CurrentRow.Cells("notrans").Value
LATIHAN_040B_46109030.dtp_46109030.Value = dg1_46109030.CurrentRow.Cells("tanggaltransaksi").Value
LATIHAN_040B_46109030.jt_46109030.Text = dg1_46109030.CurrentRow.Cells("jenistransaksi").Value
LATIHAN_040B_46109030.StatusStrip46109030.Text = dg1_46109030.CurrentRow.Cells("notrans").Value
LATIHAN_040B_46109030.ainunas1()
LATIHAN_040B_46109030.ainunas2()
End Sub
End Class
LATIHAN 40B
BalasHapusPublic Class LATIHAN_040B_46109030
Dim ainun As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=ainun")
Dim nun As New DataTable
Dim telusur As New ByIskandar.CariKeDataBaseByIskandar
Dim ai As New OleDb.OleDbCommand
Public Sub ainunas1()
Dim na As New OleDb.OleDbDataAdapter
na = 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_46109030.Text & "'", ainun)
nun.Rows.Clear()
na.Fill(nun)
End Sub
Public Sub ainunas2()
Dim total As Integer = 0
For Each x As DataRow In nun.Rows
total += x("Jumlah")
Next
Tot_46109030.Text = total
End Sub
Private Sub ainunas3()
If nt_46109030.Text.Length = 0 Then
MsgBox("Isi Notransnya..")
Exit Sub
End If
If jt_46109030.Text.Length = 0 Then
MsgBox("Isi Jenis Transaksinya..")
Exit Sub
End If
If nun.Rows.Count = 0 Then
MsgBox("Isi datatable k..")
Exit Sub
End If
End Sub
Private Sub tambah()
ainunas3()
telusur.AturPencarianDataBase("mastertransaksi", "notrans", nt_46109030.Text, 1, ainun)
If telusur.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu..")
Exit Sub
End If
ai = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_46109030.Text & "',#" & dtp_46109030.Value.Month & "/" & dtp_46109030.Value.Day & "/" & dtp_46109030.Value.Year & "#, '" & jt_46109030.Text & "')", ainun)
BalasHapusainun.Open()
ai.ExecuteNonQuery()
ainun.Close()
For Each x As DataRow In nun.Rows
ai = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt_46109030.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", ainun)
ainun.Open()
ai.ExecuteNonQuery()
ainun.Close()
Next
ai.Dispose()
nt_46109030.Text = ""
jt_46109030.Text = ""
Tot_46109030.Text = ""
StatusStrip46109030.Text = "-"
nun.Rows.Clear()
LATIHAN040A_46109030.ainunas()
End Sub
Private Sub edit()
ainunas3()
If nt_46109030.Text <> StatusStrip46109030.Text Then
telusur.AturPencarianDataBase("mastertransaksi", "notrans", nt_46109030.Text, 1, ainun)
If telusur.JumlanBaris > 0 Then
MsgBox("Adami Notrans seperti itu,,mohon ganti..")
Exit Sub
End If
End If
ai = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & StatusStrip46109030.Text & "'", ainun)
ainun.Open()
ai.ExecuteNonQuery()
ainun.Close()
ai = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_46109030.Text & "',#" & dtp_46109030.Value.Month & "/" & dtp_46109030.Value.Day & "/" & dtp_46109030.Value.Year & "#, '" & jt_46109030.Text & "')", ainun)
ainun.Open()
ai.ExecuteNonQuery()
ainun.Close()
ai = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & StatusStrip46109030.Text & "'", ainun)
ainun.Open()
ai.ExecuteNonQuery()
ainun.Close()
For Each x As DataRow In nun.Rows
ai = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & nt_46109030.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", ainun)
ainun.Open()
ai.ExecuteNonQuery()
ainun.Close()
Next
ai.Dispose()
nt_46109030.Text = ""
BalasHapusjt_46109030.Text = ""
Tot_46109030.Text = ""
StatusStrip46109030.Text = "-"
nun.Rows.Clear()
LATIHAN040A_46109030.ainunas()
End Sub
Private Sub LATIHAN_040B_46109030_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ainunas1()
Dim dc(1) As DataColumn
dc(0) = nun.Columns("kodebarang")
nun.PrimaryKey = dc
nun.Columns("unit").DefaultValue = 0
nun.Columns("harga").DefaultValue = 0
nun.Columns("jumlah").DefaultValue = 0
dg_46109030.DataSource = nun
End Sub
Private Sub dg_46109030_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dg_46109030.CellContentClick
If dg_46109030.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
dg_46109030.CurrentRow.Cells("NAMABARANG").Value = ""
dg_46109030.CurrentRow.Cells("UNIT").Value = 0
dg_46109030.CurrentRow.Cells("HARGA").Value = 0
dg_46109030.CurrentRow.Cells("JUMLAH").Value = 0
telusur.AturPencarianDataBase("barang", "kodebarang", dg_46109030.CurrentRow.Cells("KODEBARANG").Value, 1, ainun)
If telusur.JumlanBaris > 0 Then
dg_46109030.CurrentRow.Cells("NAMABARANG").Value = telusur.DataTablenya.Rows(0).Item("NAMABARANG")
Else
dg_46109030.CurrentRow.Cells("NAMABARANG").Value = ""
If Latihan383940_46109030.ShowDialog = Windows.Forms.DialogResult.OK Then
dg_46109030.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109030.dg_46109030.CurrentRow.Cells("KODEBARANG").Value
dg_46109030.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109030.dg_46109030.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf dg_46109030.Columns(e.ColumnIndex).Name = "UNIT" Or dg_46109030.Columns(e.ColumnIndex).Name = "HARGA" Then
dg_46109030.CurrentRow.Cells("JUMLAH").Value = dg_46109030.CurrentRow.Cells("UNIT").Value * dg_46109030.CurrentRow.Cells("HARGA").Value
ainunas2()
End If
End Sub
Private Sub s_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109030.Click
If StatusStrip46109030.Text = "-" Then
tambah()
Else
edit()
End If
End Sub
Private Sub dg_46109030_DataError(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles dg_46109030.DataError
MsgBox("Terjadi sedikit kesalahan...")
End Sub
End Class
LATIHAN040A_46109017
BalasHapushttp://ayuwandikaputriutami.blogspot.com/2012/01/latihan040a46109017.html
LATIHAN040B_46109017
http://ayuwandikaputriutami.blogspot.com/2012/01/latihan040b46109017.html
Public Class Latihan040A_46109045
BalasHapusDim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=chiko")
Dim chiko1 As New DataTable
Dim chiko2 As New DataTable
Dim ikha As New DataSet
Dim dewi1 As New BindingSource
Dim dewi2 As New BindingSource
Public Sub sartika1()
Dim a As New OleDb.OleDbDataAdapter
chiko2.Rows.Clear()
chiko1.Rows.Clear()
a = New OleDb.OleDbDataAdapter("select * from mastertransaksi", conect)
a.Fill(chiko1)
a = 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", conect)
a.Fill(chiko2)
End Sub
Private Sub Latihan40A_46109045_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sartika1()
ikha.Tables.Add(chiko1)
ikha.Tables.Add(chiko2)
chiko1.TableName = "dede"
chiko2.TableName = "dede2"
ikha.Relations.Add(New DataRelation("a", ikha.Tables("dede").Columns("notrans"), ikha.Tables("dede2").Columns("notrans")))
dewi1.DataSource = ikha
dewi1.DataMember = "dede"
dewi2.DataSource = dewi1
dewi2.DataMember = "a"
Dim dc(1) As DataColumn
dc(0) = chiko1.Columns("notrans")
chiko1.PrimaryKey = dc
DATA146109045.DataSource = dewi1
DATA246109045.DataSource = dewi2
End Sub
Private Sub H46109045_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles H46109045.Click
Dim cm As New OleDb.OleDbCommand
cm = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & DATA146109045.CurrentRow.Cells("notrans").Value & "'", conect)
conect.Open()
cm.ExecuteNonQuery()
conect.Close()
cm = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & DATA146109045.CurrentRow.Cells("notrans").Value & "'", conect)
conect.Open()
cm.ExecuteNonQuery()
conect.Close()
cm.Dispose()
sartika1()
End Sub
Private Sub TM46109045_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TM46109045.Click
If LATIHAN040B_46109045.Visible = False Then
LATIHAN040B_46109045.Show()
Else
LATIHAN040B_46109045.Activate()
End If
LATIHAN040B_46109045.NT46109045.Text = ""
LATIHAN040B_46109045.JT46109045.Text = ""
LATIHAN040B_46109045.TS46109045.Text = "-"
LATIHAN040B_46109045.kawai1()
LATIHAN040B_46109045.kawai3()
End Sub
Private Sub E46109045_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles E46109045.Click
If LATIHAN040B_46109045.Visible = False Then
LATIHAN040B_46109045.Show()
Else
LATIHAN040B_46109045.Activate()
End If
LATIHAN040B_46109045.NT46109045.Text = DATA146109045.CurrentRow.Cells("notrans").Value
LATIHAN040B_46109045.T46109045.Value = DATA146109045.CurrentRow.Cells("tanggaltransaksi").Value
LATIHAN040B_46109045.JT46109045.Text = DATA146109045.CurrentRow.Cells("jenistransaksi").Value
LATIHAN040B_46109045.TS46109045.Text = DATA146109045.CurrentRow.Cells("notrans").Value
LATIHAN040B_46109045.kawai1()
LATIHAN040B_46109045.kawai3()
End Sub
End Class
Public Class LATIHAN040B_46109045
BalasHapusDim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=chiko")
Dim dewi As New DataTable
Dim sartika As New ByIskandar.CariKeDataBaseByIskandar
Dim dede As New OleDb.OleDbCommand
Public Sub sartika2()
Dim a As New OleDb.OleDbDataAdapter
a = 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 = '" & NT46109045.Text & "'", conect)
dewi.Rows.Clear()
a.Fill(dewi)
End Sub
Public Sub sartika3()
BalasHapusDim total As Integer = 0
For Each x As DataRow In dewi.Rows
total += x("Jumlah")
Next
TOT46109045.Text = total
End Sub
Private Sub sartika4()
If NT46109045.Text.Length = 0 Then
MsgBox("Isi rong itu Notransnya..")
Exit Sub
End If
If JT46109045.Text.Length = 0 Then
MsgBox("Isi rong itu Jenis Transaksinya..")
Exit Sub
End If
If dewi.Rows.Count = 0 Then
MsgBox("Isi rong itu datatable k..")
Exit Sub
End If
End Sub
Private Sub tambah()
sartika4()
sartika.AturPencarianDataBase("mastertransaksi", "notrans", NT46109045.Text, 1, conect)
If sartika.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu..")
Exit Sub
End If
dede = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT46109045.Text & "',#" & T46109045.Value.Month & "/" & T46109045.Value.Day & "/" & T46109045.Value.Year & "#, '" & JT46109045.Text & "')", conect)
conect.Open()
dede.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In dewi.Rows
dede = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT46109045.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", conect)
conect.Open()
dede.ExecuteNonQuery()
conect.Close()
Next
dede.Dispose()
NT46109045.Text = ""
JT46109045.Text = ""
TOT46109045.Text = ""
TS46109045.Text = "-"
dewi.Rows.Clear()
Latihan040A_46109045.sartika1()
End Sub
Public Sub edit()
sartika4()
If NT46109045.Text <> TS46109045.Text Then
sartika.AturPencarianDataBase("mastertransaksi", "notrans", NT46109045.Text, 1, conect)
If sartika.JumlanBaris > 0 Then
MsgBox("Adami Notrans seperti itu,,mohon ganti..")
Exit Sub
End If
End If
dede = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & TS46109045.Text & "'", conect)
BalasHapusconect.Open()
dede.ExecuteNonQuery()
conect.Close()
dede = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & NT46109045.Text & "',#" & T46109045.Value.Month & "/" & T46109045.Value.Day & "/" & T46109045.Value.Year & "#, '" & JT46109045.Text & "')", conect)
conect.Open()
dede.ExecuteNonQuery()
conect.Close()
dede = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & TS46109045.Text & "'", conect)
conect.Open()
dede.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In dewi.Rows
dede = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & NT46109045.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", conect)
conect.Open()
dede.ExecuteNonQuery()
conect.Close()
Next
dede.Dispose()
NT46109045.Text = ""
JT46109045.Text = ""
TOT46109045.Text = ""
TS46109045.Text = "-"
dewi.Rows.Clear()
Latihan040A_46109045.sartika1()
End Sub
Private Sub Latihan040A_46109045_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
sartika2()
Dim dc(1) As DataColumn
dc(0) = dewi.Columns("kodebarang")
dewi.PrimaryKey = dc
dewi.Columns("unit").DefaultValue = 0
dewi.Columns("harga").DefaultValue = 0
dewi.Columns("jumlah").DefaultValue = 0
DATA46109045.DataSource = dewi
End Sub
Private Sub DATA46109045_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DATA46109045.CellEndEdit
If DATA46109045.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
DATA46109045.CurrentRow.Cells("NAMABARANG").Value = ""
DATA46109045.CurrentRow.Cells("UNIT").Value = 0
DATA46109045.CurrentRow.Cells("HARGA").Value = 0
DATA46109045.CurrentRow.Cells("JUMLAH").Value = 0
sartika.AturPencarianDataBase("barang", "kodebarang", DATA46109045.CurrentRow.Cells("KODEBARANG").Value, 1, conect)
If sartika.JumlanBaris > 0 Then
DATA46109045.CurrentRow.Cells("NAMABARANG").Value = sartika.DataTablenya.Rows(0).Item("NAMABARANG")
Else
DATA46109045.CurrentRow.Cells("NAMABARANG").Value = ""
If Latihan383940_46109045.ShowDialog = Windows.Forms.DialogResult.OK Then
DATA46109045.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109045.DATA46109045.CurrentRow.Cells("KODEBARANG").Value
DATA46109045.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109045.DATA46109045.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf
DATA46109045.Columns(e.ColumnIndex).Name = "UNIT" Or DATA46109045.Columns(e.ColumnIndex).Name = "HARGA" Then
BalasHapusDATA46109045.CurrentRow.Cells("JUMLAH").Value = DATA46109045.CurrentRow.Cells("UNIT").Value * DATA46109045.CurrentRow.Cells("HARGA").Value
sartika3()
End If
End Sub
Private Sub S46109045_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles S46109045.Click
If TS46109045.Text = "-" Then
tambah()
Else
edit()
End If
End Sub
Private Sub DATA46109045_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DATA46109045.DataError
MsgBox("Terjadi sedikit kesalahan...")
End Sub
End Class
Komentar ini telah dihapus oleh pengarang.
BalasHapusERRI MURNIASI
BalasHapus46109056
http://er-murniasih.blogspot.com/
http://ismisriwahyuni.blogspot.com/2012/01/public-class-form040a46109023-dim.html
BalasHapusPublic Class LATIHAN040A_46109054
BalasHapusDim cantik As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=wiwi")
Dim MUSTIKA As New DataTable
Dim CHAERUNNISA As New DataTable
Dim dset As New DataSet
Dim WWW1 As New BindingSource
Dim WWW2 As New BindingSource
Public Sub cantikI()
CHAERUNNISA.Rows.Clear()
MUSTIKA.Rows.Clear()
Dim B1 As New OleDb.OleDbDataAdapter
B1 = New OleDb.OleDbDataAdapter("Select * From MASTERTRANSAKSI", cantik)
B1.Fill(MUSTIKA)
B1 = New OleDb.OleDbDataAdapter("Select DETAILTRANSAKSI.NOTRANS, DETAILTRANSAKSI.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG", cantik)
B1.Fill(CHAERUNNISA)
B1.Dispose()
End Sub
Private Sub LATIHAN040A_46109054_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cantikI()
dset.Tables.Add(MUSTIKA)
dset.Tables.Add(CHAERUNNISA)
MUSTIKA.TableName = "T01"
CHAERUNNISA.TableName = "T02"
dset.Relations.Add(New DataRelation("X", dset.Tables("T01").Columns("NOTRANS"), dset.Tables("T02").Columns("NOTRANS")))
WWW1.DataSource = dset
WWW1.DataMember = "T01"
WWW2.DataSource = WWW1
WWW2.DataMember = "X"
DGV1_46109054.DataSource = WWW1
DGV2_46109054.DataSource = WWW2
End Sub
Private Sub cantik3_46109054_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi1_46109054.Click
If LATIHAN_040B_46109054.Visible = False Then
LATIHAN_040B_46109054.Show()
Else
LATIHAN_040B_46109054.Activate()
End If
LATIHAN_040B_46109054.StatusStrip1.Text = DGV1_46109054.CurrentRow.Cells("NOTRANS").Value
LATIHAN_040B_46109054.ww1_46109054.Text = DGV1_46109054.CurrentRow.Cells("NOTRANS").Value
LATIHAN_040B_46109054.ww2_46109054.Text = DGV1_46109054.CurrentRow.Cells("JENISTRANSAKSI").Value
LATIHAN_040B_46109054.mustika()
LATIHAN_040B_46109054.TOTALJUMLAH()
End Sub
Private Sub TAMBAH_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi2_46109054.Click
If LATIHAN_040B_46109054.Visible = False Then
LATIHAN_040B_46109054.Show()
Else
LATIHAN_040B_46109054.Activate()
End If
LATIHAN_040B_46109054.StatusStrip1.Text = "-"
LATIHAN_040B_46109054.ww1_46109054.Text = ""
LATIHAN_040B_46109054.ww2_46109054.Text = ""
LATIHAN_040B_46109054.mustika()
LATIHAN_040B_46109054.TOTALJUMLAH()
End Sub
Private Sub HAPUS_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi3_46109054.Click
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS='" & DGV1_46109054.CurrentRow.Cells("NOTRANS").Value & "'", cantik)
cantik.Open()
T.ExecuteNonQuery()
cantik.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS='" & DGV1_46109054.CurrentRow.Cells("NOTRANS").Value & "'", cantik)
cantik.Open()
T.ExecuteNonQuery()
cantik.Close()
T.Dispose()
cantikI()
End Sub
End Class
Public Class LATIHAN_040B_46109054
BalasHapusDim cantik As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=wiwi")
Dim DATA As New DataTable
Public Sub mustika()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & ww1_46109054.Text & "'", cantik)
DATA.Rows.Clear()
X.Fill(DATA)
End Sub
Private Sub Latihan40B46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = DATA.Columns("NOTRANS")
DATA.PrimaryKey = dataPrimary
DGV1_46109054.DataSource = DATA
TOTALJUMLAH()
End Sub
Public Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In DATA.Rows
TOT = TOT + x("JUMLAH")
Next
ww3_46109054.Text = TOT
End Sub
Private Sub DGV1_46109054_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV1_46109054.CellContentClick
If DGV1_46109054.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
DGV1_46109054.CurrentRow.Cells("NAMABARANG").Value = ""
DGV1_46109054.CurrentRow.Cells("UNIT").Value = 0
DGV1_46109054.CurrentRow.Cells("HARGA").Value = 0
DGV1_46109054.CurrentRow.Cells("JUMLAH").Value = 0
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", DGV1_46109054.CurrentRow.Cells("KODEBARANG").Value, 1, cantik)
If Pencari.JumlanBaris > 0 Then
DGV1_46109054.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
DGV1_46109054.CurrentRow.Cells("KODEBARANG").Value = ""
If Latihan383940_46109054.ShowDialog = Windows.Forms.DialogResult.OK Then
DGV1_46109054.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109054.DGV_46109054.CurrentRow.Cells("KODEBARANG").Value
DGV1_46109054.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109054.DGV_46109054.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf DGV1_46109054.Columns(e.ColumnIndex).Name = "UNIT" Or DGV1_46109054.Columns(e.ColumnIndex).Name = "HARGA" Then
DGV1_46109054.CurrentRow.Cells("JUMLAH").Value = DGV1_46109054.CurrentRow.Cells("UNIT").Value * DGV1_46109054.CurrentRow.Cells("HARGA").Value
End If
TOTALJUMLAH()
End Sub
Private Sub Button1_Button2()
BalasHapusIf ww1_46109054.Text.Length = 0 Then
MsgBox("Maaf, Nomor transaksi harus diisi dulu")
Exit Sub
End If
If ww2_46109054.Text.Length = 0 Then
MsgBox("Maaf, Jenis transaksi harus diisi dulu")
Exit Sub
End If
If DATA.Rows.Count() = 0 Then
MsgBox("Maaf, Proses tidak dapat dilanjutkan")
Exit Sub
End If
If StatusStrip1.Text <> ww1_46109054.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", ww1_46109054.Text, 1, cantik)
If pencari.JumlanBaris > 0 Then
MsgBox("Nomor transaksi sudah ada")
Exit Sub
End If
End If
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI(NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & ww1_46109054.Text & "', #" & DTP1_46109054.Value.Month & "/" & DTP1_46109054.Value.Day & "/" & DTP1_46109054.Value.Year & "#, '" & ww2_46109054.Text & "')", cantik)
cantik.Open()
T.ExecuteNonQuery()
cantik.Close()
For Each X As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & ww1_46109054.Text & "', '" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", cantik)
cantik.Open()
T.ExecuteNonQuery()
cantik.Close()
T.Dispose()
Next
StatusStrip1.Text = "-"
ww1_46109054.Text = ""
ww2_46109054.Text = ""
DATA.Rows.Clear()
TOTALJUMLAH()
LATIHAN040A_46109054.cantikI()
End Sub
Private Sub edit_46109051()
BalasHapusIf ww1_46109054.Text.Length = 0 Then
MsgBox("Maaf, Nomor transaksi harus diisi dulu nah !!!")
Exit Sub
End If
If ww2_46109054.Text.Length = 0 Then
MsgBox("Maaf, Jenis transaksi harus diisi dulu nah !!!")
Exit Sub
End If
If DATA.Rows.Count() = 0 Then
MsgBox("Maaf, Proses tidak dapat dilanjutkan gang....")
Exit Sub
End If
If StatusStrip1.Text <> ww1_46109054.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", ww1_46109054.Text, 1, cantik)
If pencari.JumlanBaris > 0 Then
MsgBox("Nomor transaksi sudah ada")
Exit Sub
End If
End If
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS= '" & ww1_46109054.Text & "'", cantik)
cantik.Open()
T.ExecuteNonQuery()
cantik.Close()
T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & ww1_46109054.Text & "', #" & DTP1_46109054.Value.Month & "/" & DTP1_46109054.Value.Day & "/" & DTP1_46109054.Value.Year & "#, '" & ww2_46109054.Text & "')", cantik)
cantik.Open()
T.ExecuteNonQuery()
cantik.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS= '" & ww1_46109054.Text & "'", cantik)
cantik.Open()
T.ExecuteNonQuery()
cantik.Close()
For Each XX As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & ww1_46109054.Text & "', '" & XX("KODEBARANG") & "', " & XX("UNIT") & ", " & XX("HARGA") & ")", cantik)
cantik.Open()
T.ExecuteNonQuery()
cantik.Close()
T.Dispose()
Next
StatusStrip1.Text = "-"
ww1_46109054.Text = ""
ww2_46109054.Text = ""
DATA.Rows.Clear()
TOTALJUMLAH()
LATIHAN040A_46109054.cantikI()
End Sub
Private Sub save_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi_46109054.Click
If StatusStrip1.Text = "-" Then
Button1_Button2()
Else
edit_46109051()
End If
End Sub
End Class
Public Class LATIHAN040B_46109027
BalasHapusDim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=eby")
Dim feby As New DataTable
Dim ana As New ByIskandar.CfransKeDataBaseByIskandar
Dim eby As New OleDb.OleDbCommand
Public Sub ana2()
Dim sayang As New OleDb.OleDbDataAdapter
sayang = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detffltransaksi.UNIT, detffltransaksi.HARGA, detffltransaksi.unit * detffltransaksi.harga as JUMLAH from barang inner join detffltransaksi on barang.kodebarang = detffltransaksi.kodebarang where notrans = '" & tl_46109027.Text & "'", conect)
feby.Rows.Clear()
sayang.Fill(feby)
End Sub
Public Sub ana3()
Dim total As Integer = 0
For Each x As DataRow In feby.Rows
total += x("Jumlah")
Next
tgl_46109027.Text = total
End Sub
Private Sub ana4()
If tl_46109027.Text.Length = 0 Then
MsgBox("Isi rong itu Notransnya..")
Exit Sub
End If
If tl_46109027.Text.Length = 0 Then
MsgBox("Isi rong itu Jenis Transaksinya..")
Exit Sub
End If
If feby.Rows.Count = 0 Then
MsgBox("Isi rong itu datatable k..")
Exit Sub
End If
End Sub
Private Sub tambah()
BalasHapusana4()
ana.AturPencfransanDataBase("mastertransaksi", "notrans", tl_46109027.Text, 1, conect)
If ana.JumlanBfranss > 0 Then
MsgBox("Adami notrans seperti itu..")
Exit Sub
End If
eby = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & tl_46109027.Text & "',#" & tgl_46109027.Value.Month & "/" & tgl_46109027.Value.Day & "/" & tgl_46109027.Value.Year & "#, '" & tl_46109027.Text & "')", conect)
conect.Open()
eby.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In feby.Rows
eby = New OleDb.OleDbCommand("insert into detffltransaksi (notrans, kodebarang, unit, harga) values ('" & tl_46109027.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", conect)
conect.Open()
eby.ExecuteNonQuery()
conect.Close()
Next
eby.Dispose()
tl_46109027.Text = ""
tl_46109027.Text = ""
tgl_46109027.Text = ""
tl_46109027.Text = "-"
feby.Rows.Clear()
Latihan383940012.ana1()
End Sub
Public Sub edit()
ana4()
If tl_46109027.Text <> tl_46109027.Text Then
ana.AturPencfransanDataBase("mastertransaksi", "notrans", tl_46109027.Text, 1, conect)
If ana.JumlanBfranss > 0 Then
MsgBox("Adami Notrans seperti itu,,mohon ganti..")
Exit Sub
End If
End If
eby = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & tl_46109027.Text & "'", conect)
conect.Open()
eby.ExecuteNonQuery()
conect.Close()
eby = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & tl_46109027.Text & "',#" & tgl_46109027.Value.Month & "/" & tgl_46109027.Value.Day & "/" & tgl_46109027.Value.Year & "#, '" & tl_46109027.Text & "')", conect)
conect.Open()
eby.ExecuteNonQuery()
conect.Close()
eby = New OleDb.OleDbCommand("delete * from detffltransaksi where notrans = '" & tl_46109027.Text & "'", conect)
conect.Open()
eby.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In feby.Rows
eby = New OleDb.OleDbCommand("insert into detffltransaksi(notrans, kodebarang, unit, harga) values ('" & tl_46109027.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", conect)
conect.Open()
eby.ExecuteNonQuery()
conect.Close()
Next
eby.Dispose()
tl_46109027.Text = ""
BalasHapustl_46109027.Text = ""
tgl_46109027.Text = ""
tl_46109027.Text = "-"
feby.Rows.Clear()
Latihan383940012.ana1()
End Sub
Private Sub LATIHAN040B_46109027_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ana2()
Dim dc(1) As DataColumn
dc(0) = feby.Columns("kodebarang")
feby.PrimaryKey = dc
feby.Columns("unit").DefaultValue = 0
feby.Columns("harga").DefaultValue = 0
feby.Columns("jumlah").DefaultValue = 0
dg_46109027.DataSource = feby
End Sub
Private Sub dg_46109027_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dg_46109027.CellEndEdit
If dg_46109027.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
dg_46109027.CurrentRow.Cells("NAMABARANG").Value = ""
dg_46109027.CurrentRow.Cells("UNIT").Value = 0
dg_46109027.CurrentRow.Cells("HARGA").Value = 0
dg_46109027.CurrentRow.Cells("JUMLAH").Value = 0
ana.AturPencfransanDataBase("barang", "kodebarang", dg_46109027.CurrentRow.Cells("KODEBARANG").Value, 1, conect)
If ana.JumlanBfranss > 0 Then
dg_46109027.CurrentRow.Cells("NAMABARANG").Value = ana.DataTablenya.Rows(0).Item("NAMABARANG")
Else
dg_46109027.CurrentRow.Cells("NAMABARANG").Value = ""
If Latihan383940012.ShowDialog = Windows.Forms.DialogResult.OK Then
dg_46109027.CurrentRow.Cells("KODEBARANG").Value = Latihan383940012.dg_46109027.CurrentRow.Cells("KODEBARANG").Value
dg_46109027.CurrentRow.Cells("NAMABARANG").Value = Latihan383940012.dg_46109027.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf dg_46109027.Columns(e.ColumnIndex).Name = "UNIT" Or dg_46109027.Columns(e.ColumnIndex).Name = "HARGA" Then
dg_46109027.CurrentRow.Cells("JUMLAH").Value = dg_46109027.CurrentRow.Cells("UNIT").Value * dg_46109027.CurrentRow.Cells("HARGA").Value
ana3()
End If
End Sub
Private Sub S46109027_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109027.Click
If s_46109027.Text = "-" Then
tambah()
Else
edit()
End If
End Sub
Private Sub dg_46109027_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles dg_46109027.DataError
MsgBox("Terjadi sedikit kesalahan...")
End Sub
Private Sub s_46109027_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109027.Click
End Sub
End Class
Public Class LATIHAN_040A_46109053
BalasHapusDim Indah As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=thepinkers29")
Dim DT As New DataTable
Dim DT1 As New DataTable
Dim dset As New DataSet
Dim MMM1 As New BindingSource
Dim MMM2 As New BindingSource
Public Sub saenong()
DT1.Rows.Clear()
DT.Rows.Clear()
Dim B1 As New OleDb.OleDbDataAdapter
B1 = New OleDb.OleDbDataAdapter("Select * From MASTERTRANSAKSI", Indah)
B1.Fill(DT)
B1 = New OleDb.OleDbDataAdapter("Select DETAILTRANSAKSI.NOTRANS, DETAILTRANSAKSI.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG", Indah)
B1.Fill(DT1)
B1.Dispose()
End Sub
Private Sub LATIHAN40A_053_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
saenong()
dset.Tables.Add(DT)
dset.Tables.Add(DT1)
DT.TableName = "T01"
DT1.TableName = "T02"
dset.Relations.Add(New DataRelation("X", dset.Tables("T01").Columns("NOTRANS"), dset.Tables("T02").Columns("NOTRANS")))
MMM1.DataSource = dset
MMM1.DataMember = "T01"
MMM2.DataSource = MMM1
MMM2.DataMember = "X"
DGV1_053.DataSource = MMM1
DGV2_053.DataSource = MMM2
End Sub
Private Sub EDIT_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EDIT_053.Click
If LATIHAN_040B_46109053.Visible = False Then
LATIHAN_040B_46109053.Show()
Else
LATIHAN_040B_46109053.Activate()
End If
LATIHAN_040B_46109053.StatusStrip1.Text = DGV1_053.CurrentRow.Cells("NOTRANS").Value
LATIHAN_040B_46109053.NT_053.Text = DGV1_053.CurrentRow.Cells("NOTRANS").Value
LATIHAN_040B_46109053.JT_053.Text = DGV1_053.CurrentRow.Cells("JENISTRANSAKSI").Value
LATIHAN_040B_46109053.MANIS()
LATIHAN_040B_46109053.TOTALJUMLAH()
End Sub
Private Sub TAMBAH_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH_053.Click
If LATIHAN_040B_46109053.Visible = False Then
LATIHAN_040B_46109053.Show()
Else
LATIHAN_040B_46109053.Activate()
End If
LATIHAN_040B_46109053.StatusStrip1.Text = "-"
LATIHAN_040B_46109053.NT_053.Text = ""
LATIHAN_040B_46109053.JT_053.Text = ""
LATIHAN_040B_46109053.MANIS()
LATIHAN_040B_46109053.TOTALJUMLAH()
End Sub
Private Sub DEL_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DEL_053.Click
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS='" & DGV1_053.CurrentRow.Cells("NOTRANS").Value & "'", Indah)
Indah.Open()
T.ExecuteNonQuery()
Indah.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS='" & DGV1_053.CurrentRow.Cells("NOTRANS").Value & "'", Indah)
Indah.Open()
T.ExecuteNonQuery()
Indah.Close()
T.Dispose()
saenong()
End Sub
End Class
Public Class LATIHAN_040B_46109053
BalasHapusDim Indah As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=thepinkers29")
Dim DATA As New DataTable
Public Sub MANIS()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NT_053.Text & "'", Indah)
DATA.Rows.Clear()
X.Fill(DATA)
End Sub
Private Sub Latihan40B46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = DATA.Columns("NOTRANS")
DATA.PrimaryKey = dataPrimary
DATA_053.DataSource = DATA
TOTALJUMLAH()
End Sub
Public Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In DATA.Rows
TOT = TOT + x("JUMLAH")
Next
TOT_053.Text = TOT
End Sub
Private Sub data_053_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DATA_053.CellContentClick
If DATA_053.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
DATA_053.CurrentRow.Cells("NAMABARANG").Value = ""
DATA_053.CurrentRow.Cells("UNIT").Value = 0
DATA_053.CurrentRow.Cells("HARGA").Value = 0
DATA_053.CurrentRow.Cells("JUMLAH").Value = 0
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", DATA_053.CurrentRow.Cells("KODEBARANG").Value, 1, Indah)
If Pencari.JumlanBaris > 0 Then
DATA_053.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
DATA_053.CurrentRow.Cells("KODEBARANG").Value = ""
If LATIHAN_383940_46109053.ShowDialog = Windows.Forms.DialogResult.OK Then
DATA_053.CurrentRow.Cells("KODEBARANG").Value = LATIHAN_383940_46109053.DGV_053.CurrentRow.Cells("KODEBARANG").Value
BalasHapusDATA_053.CurrentRow.Cells("NAMABARANG").Value = LATIHAN_383940_46109053.DGV_053.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf DATA_053.Columns(e.ColumnIndex).Name = "UNIT" Or DATA_053.Columns(e.ColumnIndex).Name = "HARGA" Then
DATA_053.CurrentRow.Cells("JUMLAH").Value = DATA_053.CurrentRow.Cells("UNIT").Value * DATA_053.CurrentRow.Cells("HARGA").Value
End If
TOTALJUMLAH()
End Sub
Private Sub Button1_Button2()
If NT_053.Text.Length = 0 Then
MsgBox("Maaf, Nomor transaksi harus diisi dulu")
Exit Sub
End If
If JT_053.Text.Length = 0 Then
MsgBox("Maaf, Jenis transaksi harus diisi dulu")
Exit Sub
End If
If DATA.Rows.Count() = 0 Then
MsgBox("Maaf, Proses tidak dapat dilanjutkan")
Exit Sub
End If
If StatusStrip1.Text <> NT_053.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_053.Text, 1, Indah)
If pencari.JumlanBaris > 0 Then
MsgBox("Nomor transaksi sudah ada")
Exit Sub
End If
End If
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI(NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_053.Text & "', #" & TGL_053.Value.Month & "/" & TGL_053.Value.Day & "/" & TGL_053.Value.Year & "#, '" & JT_053.Text & "')", Indah)
Indah.Open()
T.ExecuteNonQuery()
Indah.Close()
For Each X As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_053.Text & "', '" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Indah)
Indah.Open()
T.ExecuteNonQuery()
Indah.Close()
T.Dispose()
Next
StatusStrip1.Text = "-"
NT_053.Text = ""
JT_053.Text = ""
DATA.Rows.Clear()
TOTALJUMLAH()
LATIHAN_040A_46109053.indah()
End Sub
Private Sub edit_053()
If NT_053.Text.Length = 0 Then
MsgBox("Maaf, Nomor transaksi harus diisi dulu nah !!!")
Exit Sub
End If
If JT_053.Text.Length = 0 Then
MsgBox("Maaf, Jenis transaksi harus diisi dulu nah !!!")
Exit Sub
End If
If DATA.Rows.Count() = 0 Then
BalasHapusMsgBox("Maaf, Proses tidak dapat dilanjutkan gang....")
Exit Sub
End If
If StatusStrip1.Text <> NT_053.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_053.Text, 1, Indah)
If pencari.JumlanBaris > 0 Then
MsgBox("Nomor transaksi sudah ada")
Exit Sub
End If
End If
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS= '" & NT_053.Text & "'", Indah)
Indah.Open()
T.ExecuteNonQuery()
Indah.Close()
T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_053.Text & "', #" & DT_053.Value.Month & "/" & DT_053.Value.Day & "/" & DT_053.Value.Year & "#, '" & JT_053.Text & "')", Indah)
Indah.Open()
T.ExecuteNonQuery()
Indah.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS= '" & NT_053.Text & "'", Indah)
Indah.Open()
T.ExecuteNonQuery()
Indah.Close()
For Each XX As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_053.Text & "', '" & XX("KODEBARANG") & "', " & XX("UNIT") & ", " & XX("HARGA") & ")", Indah)
Indah.Open()
T.ExecuteNonQuery()
Indah.Close()
T.Dispose()
Next
StatusStrip1.Text = "-"
NT_053.Text = ""
JT_053.Text = ""
DATA.Rows.Clear()
TOTALJUMLAH()
LATIHAN40A_053.indah()
End Sub
Private Sub save_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_053.Click
If StatusStrip1.Text = "-" Then
Button1_Button2()
Else
edit_053()
End If
End Sub
End Class
ARYANDIRA(46109034)
BalasHapusPublic Class Latihan40A_034
Dim satu 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 dira1()
Dim a As New OleDb.OleDbDataAdapter
dt2.Rows.Clear()
dt1.Rows.Clear()
a = New OleDb.OleDbDataAdapter("select * from mastertransaksi", satu)
a.Fill(dt1)
a = 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", satu)
a.Fill(dt2)
End Sub
Private Sub Latihan40A_034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dira1()
ds.Tables.Add(dt1)
ds.Tables.Add(dt2)
dt1.TableName = "ira"
dt2.TableName = "ira2"
ds.Relations.Add(New DataRelation("a", ds.Tables("ira").Columns("notrans"), ds.Tables("ira2").Columns("notrans")))
bs1.DataSource = ds
bs1.DataMember = "ira"
bs2.DataSource = bs1
bs2.DataMember = "a"
Dim dc(1) As DataColumn
dc(0) = dt1.Columns("notrans")
dt1.PrimaryKey = dc
dgv1.DataSource = bs1
dgv2.DataSource = bs2
End Sub
Private Sub aa_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles aa_034.Click
Dim cm As New OleDb.OleDbCommand
cm = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & dgv1.CurrentRow.Cells("notrans").Value & "'", satu)
satu.Open()
cm.ExecuteNonQuery()
satu.Close()
cm = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & dgv1.CurrentRow.Cells("notrans").Value & "'", satu)
satu.Open()
cm.ExecuteNonQuery()
satu.Close()
cm.Dispose()
dira1()
End Sub
Private Sub bb_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bb_034.Click
If Latihan40B_034.Visible = False Then
Latihan40B_034.Show()
Else
Latihan40B_034.Activate()
End If
Latihan40B_034.aa_034.Text = ""
Latihan40B_034.cc_034.Text = ""
Latihan40B_034.ff_034.Text = "-"
Latihan40B_034.dira2()
Latihan40B_034.dira3()
End Sub
Private Sub cc_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cc_034.Click
If Latihan40B_034.Visible = False Then
Latihan40B_034.Show()
Else
Latihan40B_034.Activate()
End If
Latihan40B_034.aa_034.Text = dgv1.CurrentRow.Cells("notrans").Value
Latihan40B_034.bb_034.Value = dgv1.CurrentRow.Cells("tanggaltransaksi").Value
Latihan40B_034.cc_034.Text = dgv1.CurrentRow.Cells("jenistransaksi").Value
Latihan40B_034.ff_034.Text = dgv1.CurrentRow.Cells("notrans").Value
Latihan40B_034.dira2()
Latihan40B_034.dira3()
End Sub
End Class
ARYANDIRA(46109034)
BalasHapusLat.40B
Public Class Latihan_40B_034
Dim satu As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/dataMajemuk.accdb")
Dim dt As New DataTable
Dim dira As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Public Sub dira2()
Dim a As New OleDb.OleDbDataAdapter
a = 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 = '" & aa_034.Text & "'", satu)
dt.Rows.Clear()
a.Fill(dt)
End Sub
Public Sub dira3()
Dim total As Integer = 0
For Each x As DataRow In dt.Rows
total += x("Jumlah")
Next
Dd_034.Text = total
End Sub
Private Sub dira4()
If aa_034.Text.Length = 0 Then
MsgBox("Isi rong itu Notransnya..")
Exit Sub
End If
If cc_034.Text.Length = 0 Then
MsgBox("Isi rong itu Jenis Transaksinya..")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Isi rong itu datatable k..")
Exit Sub
End If
End Sub
Private Sub tambah()
dira4()
dira.AturPencarianDataBase("mastertransaksi", "notrans", aa_034.Text, 1, satu)
If dira.JumlanBaris > 0 Then
MsgBox("Ada notrans seperti itu..")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & aa_034.Text & "',#" & bb_034.Value.Month & "/" & bb_034.Value.Day & "/" & bb_034.Value.Year & "#, '" & cc_034.Text & "')", satu)
satu.Open()
cm.ExecuteNonQuery()
satu.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & aa_034.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", satu)
satu.Open()
cm.ExecuteNonQuery()
satu.Close()
Next
cm.Dispose()
aa_034.Text = ""
cc_034.Text = ""
dd_034.Text = ""
ff_034.Text = "-"
dt.Rows.Clear()
Latihan40A_034.dira1()
End Sub
Public Sub edit()
dira4()
If aa_034.Text <> ff_034.Text Then
dira.AturPencarianDataBase("mastertransaksi", "notrans", aa_034.Text, 1, satu)
If dira.JumlanBaris > 0 Then
MsgBox("Ada Notrans seperti itu,,mohon ganti..")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & ff_034.Text & "'",satu)
BalasHapussatu.Open()
cm.ExecuteNonQuery()
satu.Close()
cm = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & aa_034.Text & "',#" & bb_034.Value.Month & "/" & bb_034.Value.Day & "/" & bb_034.Value.Year & "#, '" & cc_034.Text & "')", satu)
satu.Open()
cm.ExecuteNonQuery()
satu.Close()
cm = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & ff_034.Text & "'", satu)
satu.Open()
cm.ExecuteNonQuery()
satu.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & aa_034.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", satu)
satu.Open()
cm.ExecuteNonQuery()
satu.Close()
Next
cm.Dispose()
aa_034.Text = ""
cc_034.Text = ""
dd_034.Text = ""
ff_034.Text = "-"
dt.Rows.Clear()
Latihan40A_034.dira1()
End Sub
Private Sub Latihan40B_034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dira2()
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.DataSource = dt
End Sub
Private Sub dgv_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellEndEdit
If dgv.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
'If dgv.CurrentRow.Cells(0) = "KODEBARANG" Then (rumus lain)
'untuk mencari nama barang
dgv.CurrentRow.Cells("NAMABARANG").Value = ""
dgv.CurrentRow.Cells("UNIT").Value = 0
dgv.CurrentRow.Cells("HARGA").Value = 0
dgv.CurrentRow.Cells("JUMLAH").Value = 0
dira.AturPencarianDataBase("barang", "kodebarang", dgv.CurrentRow.Cells("KODEBARANG").Value, 1, satu)
If dira.JumlanBaris > 0 Then '(menampilkan nama barang jika kolom kode barang ditemukan oleh proses di atas
dgv.CurrentRow.Cells("NAMABARANG").Value = dira.DataTablenya.Rows(0).Item("NAMABARANG")
Else
dgv.CurrentRow.Cells("NAMABARANG").Value = ""
If Latihan38_39_40_034.ShowDialog = Windows.Forms.DialogResult.OK Then
dgv.CurrentRow.Cells("KODEBARANG").Value = Latihan_38_39_40_034.dgv.CurrentRow.Cells("KODEBARANG").Value
dgv.CurrentRow.Cells("NAMABARANG").Value = Latihan_38_39_40_034.dgv.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf dgv.Columns(e.ColumnIndex).Name = "UNIT" Or dgv.Columns(e.ColumnIndex).Name = "HARGA" Then
dgv.CurrentRow.Cells("JUMLAH").Value = dgv.CurrentRow.Cells("UNIT").Value * dgv.CurrentRow.Cells("HARGA").Value
dira3()
End If
End Sub
Private Sub ee_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ee_034.Click
BalasHapusIf ff_034.Text = "-" Then
tambah()
Else
edit()
End If
End Sub
Private Sub dgv_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles dgv.DataError
MsgBox("Terjadi sedikit kesalahan...")
End Sub
end class
Public Class LATIHAN40A_46109005
BalasHapusDim fahrul As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=arul")
Dim april As New DataTable
Dim april1 As New DataTable
Dim dset As New DataSet
Dim barru As New BindingSource
Dim barru2 As New BindingSource
Public Sub fahrulaa()
april1.Rows.Clear()
april.Rows.Clear()
Dim B1 As New OleDb.OleDbDataAdapter
B1 = New OleDb.OleDbDataAdapter("Select * From MASTERTRANSAKSI", fahrul)
B1.Fill(april)
B1 = New OleDb.OleDbDataAdapter("Select DETAILTRANSAKSI.NOTRANS, DETAILTRANSAKSI.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG", fahrul)
B1.Fill(april1)
B1.Dispose()
End Sub
Private Sub LATIHAN40A_46109005_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
fahrulaa()
dset.Tables.Add(april)
dset.Tables.Add(april1)
april.TableName = "T01"
april1.TableName = "T02"
dset.Relations.Add(New DataRelation("X", dset.Tables("T01").Columns("NOTRANS"), dset.Tables("T02").Columns("NOTRANS")))
barru.DataSource = dset
barru.DataMember = "T01"
barru2.DataSource = barru
barru2.DataMember = "X"
DG1_46109005.DataSource = barru
DG2_46109005.DataSource = barru2
End Sub
Private Sub EDIT_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles EDIT_46109005.Click
If LATIHAN40B_46109005.Visible = False Then
LATIHAN40B_46109005.Show()
Else
LATIHAN40B_46109005.Activate()
End If
LATIHAN40B_46109005.StatusStrip1.Text = DG1_46109005.CurrentRow.Cells("NOTRANS").Value
LATIHAN40B_46109005.NT_46109005.Text = DG1_46109005.CurrentRow.Cells("NOTRANS").Value
LATIHAN40B_46109005.JT_46109005.Text = DG1_46109005.CurrentRow.Cells("JENISTRANSAKSI").Value
LATIHAN40B_46109005.MANIS()
LATIHAN40B_46109005.TOTALJUMLAH()
End Sub
Private Sub TAMBAH_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH_46109005.Click
If LATIHAN40B_46109005.Visible = False Then
LATIHAN40B_46109005.Show()
Else
LATIHAN40B_46109005.Activate()
End If
LATIHAN40B_46109005.StatusStrip1.Text = "-"
LATIHAN40B_46109005.NT_46109005.Text = ""
LATIHAN40B_46109005.JT_46109005.Text = ""
LATIHAN40B_46109005.MANIS()
LATIHAN40B_46109005.TOTALJUMLAH()
End Sub
Private Sub HAPUS_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HAPUS_46109005.Click
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS='" & DG1_46109005.CurrentRow.Cells("NOTRANS").Value & "'", fahrul)
fahrul.Open()
T.ExecuteNonQuery()
fahrul.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS='" & DG1_46109005.CurrentRow.Cells("NOTRANS").Value & "'", fahrul)
fahrul.Open()
T.ExecuteNonQuery()
fahrul.Close()
T.Dispose()
fahrulaa()
End Sub
End Class
Public Class LATIHAN40B_46109005
BalasHapusDim arul As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=arul")
Dim DATA As New DataTable
Public Sub MANIS()
Dim X As New OleDb.OleDbDataAdapter
X = New OleDb.OleDbDataAdapter("Select BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NT_46109005.Text & "'", arul)
DATA.Rows.Clear()
X.Fill(DATA)
End Sub
Private Sub Latihan40B46109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = DATA.Columns("NOTRANS")
DATA.PrimaryKey = dataPrimary
DG_46109005.DataSource = DATA
TOTALJUMLAH()
End Sub
Public Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In DATA.Rows
TOT = TOT + x("JUMLAH")
Next
TOT_46109005.Text = TOT
End Sub
Private Sub dg_46109005_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DG_46109005.CellContentClick
If DG_46109005.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
DG_46109005.CurrentRow.Cells("NAMABARANG").Value = ""
DG_46109005.CurrentRow.Cells("UNIT").Value = 0
DG_46109005.CurrentRow.Cells("HARGA").Value = 0
DG_46109005.CurrentRow.Cells("JUMLAH").Value = 0
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", DG_46109005.CurrentRow.Cells("KODEBARANG").Value, 1, arul)
If Pencari.JumlanBaris > 0 Then
DG_46109005.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
DG_46109005.CurrentRow.Cells("KODEBARANG").Value = ""
If Latihan383940_46109005.ShowDialog = Windows.Forms.DialogResult.OK Then
DG_46109005.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109005.DATA46109005.CurrentRow.Cells("KODEBARANG").Value
DG_46109005.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109005.DATA46109005.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf DG_46109005.Columns(e.ColumnIndex).Name = "UNIT" Or DG_46109005.Columns(e.ColumnIndex).Name = "HARGA" Then
DG_46109005.CurrentRow.Cells("JUMLAH").Value = DG_46109005.CurrentRow.Cells("UNIT").Value * DG_46109005.CurrentRow.Cells("HARGA").Value
End If
TOTALJUMLAH()
End Sub
Private Sub Button1_Button2()
If NT_46109005.Text.Length = 0 Then
MsgBox("Maaf, Nomor transaksi harus diisi dulu")
Exit Sub
End If
If JT_46109005.Text.Length = 0 Then
MsgBox("Maaf, Jenis transaksi harus diisi dulu")
Exit Sub
End If
If DATA.Rows.Count() = 0 Then
BalasHapusMsgBox("Maaf, Proses tidak dapat dilanjutkan")
Exit Sub
End If
If StatusStrip1.Text <> NT_46109005.Text Then
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109005.Text, 1, arul)
If pencari.JumlanBaris > 0 Then
MsgBox("Nomor transaksi sudah ada")
Exit Sub
End If
End If
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI(NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109005.Text & "', #" & DT_46109005.Value.Month & "/" & DT_46109005.Value.Day & "/" & DT_46109005.Value.Year & "#, '" & JT_46109005.Text & "')", arul)
arul.Open()
T.ExecuteNonQuery()
arul.Close()
For Each X As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109005.Text & "', '" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", arul)
arul.Open()
T.ExecuteNonQuery()
arul.Close()
T.Dispose()
Next
StatusStrip1.Text = "-"
NT_46109005.Text = ""
JT_46109005.Text = ""
DATA.Rows.Clear()
TOTALJUMLAH()
LATIHAN40A_46109005.fahrulaa()
End Sub
Private Sub edit_46109005()
If NT_46109005.Text.Length = 0 Then
MsgBox("Maaf, Nomor transaksi harus diisi dulu nah !!!")
Exit Sub
End If
If JT_46109005.Text.Length = 0 Then
MsgBox("Maaf, Jenis transaksi harus diisi dulu nah !!!")
Exit Sub
End If
If DATA.Rows.Count() = 0 Then
MsgBox("Maaf, Proses tidak dapat dilanjutkan gang....")
Exit Sub
End If
If StatusStrip1.Text <> NT_46109005.Text Then
Dim pencari As New
ByIskandar.CariKeDataBaseByIskandar
BalasHapuspencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109005.Text, 1, arul)
If pencari.JumlanBaris > 0 Then
MsgBox("Nomor transaksi sudah ada")
Exit Sub
End If
End If
Dim T As New OleDb.OleDbCommand
T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS= '" & NT_46109005.Text & "'", arul)
arul.Open()
T.ExecuteNonQuery()
arul.Close()
T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109005.Text & "', #" & DT_46109005.Value.Month & "/" & DT_46109005.Value.Day & "/" & DT_46109005.Value.Year & "#, '" & JT_46109005.Text & "')", arul)
arul.Open()
T.ExecuteNonQuery()
arul.Close()
T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS= '" & NT_46109005.Text & "'", arul)
arul.Open()
T.ExecuteNonQuery()
arul.Close()
For Each XX As DataRow In DATA.Rows
T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109005.Text & "', '" & XX("KODEBARANG") & "', " & XX("UNIT") & ", " & XX("HARGA") & ")", arul)
arul.Open()
T.ExecuteNonQuery()
arul.Close()
T.Dispose()
Next
StatusStrip1.Text = "-"
NT_46109005.Text = ""
JT_46109005.Text = ""
DATA.Rows.Clear()
TOTALJUMLAH()
LATIHAN40A_46109005.fahrulaa()
End Sub
Private Sub save_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_46109005.Click
If StatusStrip1.Text = "-" Then
Button1_Button2()
Else
edit_46109005()
End If
End Sub
Private Sub TOT_46109005_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOT_46109005.TextChanged
End Sub
End Class
Public Sub EDIT()
BalasHapusKOREA3()
If NT_46109021.Text <> DTP_46109021.Text Then
CARI.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109021.Text, 1, KONEKSI)
If CARI.JumlanBaris > 0 Then
MsgBox("GANTI NO TRANS")
Exit Sub
End If
End If
PERINTAH = New OleDb.OleDbCommand("DELETE *FROM MASTERTRANSAKSI WHERE NOTRANS = '" & DTP_46109021.Text & "'", KONEKSI)
KONEKSI.Open()
PERINTAH.ExecuteNonQuery()
KONEKSI.Close()
PERINTAH = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109021.Text & "', #" & DTP_46109021.Value.Month & "/" & DTP_46109021.Value.Year & "#, '" & JT_46109021.Text & "')", KONEKSI)
KONEKSI.Open()
PERINTAH.ExecuteNonQuery()
KONEKSI.Close()
PERINTAH = New OleDb.OleDbCommand("DELETE *FROM DETAILTRANSAKSI WHERE NOTRANS = '" & DTP_46109021.Text & "'", KONEKSI)
KONEKSI.Open()
PERINTAH.ExecuteNonQuery()
KONEKSI.Close()
PERINTAH = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG,UNIT, HARGA) VALUES ('" & NT_46109021.Text & "','" & X("KODEBARANG") & "', '" & X("UNIT") & "','" & X("HARGA") & "')", KONEKSI)
KONEKSI.Open()
PERINTAH.ExecuteNonQuery()
KONEKSI.Close()
NEXT
PERINTAH.Dispose()
NT_46109021.Text = " "
JT_46109021.Text = " "
TOT_46109021.Text = ""
DTP_46109021.Text = ""
DT.Rows.Clear()
latihan40_46109021.KONEKSIaa()
End Sub
End Class
Public Class LATIHAN040B_46109041
BalasHapusDim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=wew")
Dim joice As New DataTable
Dim natalina As New ByIskandar.CariKeDataBaseByIskandar
Dim seunggi As New OleDb.OleDbCommand
Public Sub natalina2()
Dim j As New OleDb.OleDbDataAdapter
j = 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_041.Text & "'", conect)
joice.Rows.Clear()
j.Fill(joice)
End Sub
Public Sub natalina3()
Dim total As Integer = 0
For Each x As DataRow In joice.Rows
total += x("Jumlah")
Next
tot_041.Text = total
End Sub
Private Sub natalina4()
If nt_041.Text.Length = 0 Then
MsgBox("Isi Notransnya..")
Exit Sub
End If
If jt_041.Text.Length = 0 Then
MsgBox("Isi Jenis Transaksinya..")
Exit Sub
End If
If joice.Rows.Count = 0 Then
MsgBox("Isi datatable..")
Exit Sub
End If
End Sub
Private Sub tambah()
natalina4()
natalina.AturPencarianDataBase("mastertransaksi", "notrans", nt_041.Text, 1, conect)
If natalina.JumlanBaris > 0 Then
MsgBox("maaf, sudah ada")
Exit Sub
End If
seunggi = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_041.Text & "',#" & t_041.Value.Month & "/" & t_041.Value.Day & "/" & t_041.Value.Year & "#, '" & jt_041.Text & "')", conect)
conect.Open()
seunggi.ExecuteNonQuery()
conect.Close()
For Each x As DataRow In joice.Rows
seunggi = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt_041.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", conect)
conect.Open()
seunggi.ExecuteNonQuery()
conect.Close()
Next
seunggi.Dispose()
nt_041.Text = ""
jt_041.Text = ""
tot_041.Text = ""
ts_041.Text = "-"
joice.Rows.Clear()
Latihan040A_46109041.natalina1()
End Sub
Private Sub wonga_041_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles wonga_041.CellEndEdit
BalasHapusIf wonga_041.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
wonga_041.CurrentRow.Cells("NAMABARANG").Value = ""
wonga_041.CurrentRow.Cells("UNIT").Value = 0
wonga_041.CurrentRow.Cells("HARGA").Value = 0
wonga_041.CurrentRow.Cells("JUMLAH").Value = 0
natalina.AturPencarianDataBase("barang", "kodebarang", wonga_041.CurrentRow.Cells("KODEBARANG").Value, 1, conect)
If natalina.JumlanBaris > 0 Then
wonga_041.CurrentRow.Cells("NAMABARANG").Value = natalina.DataTablenya.Rows(0).Item("NAMABARANG")
Else
wonga_041.CurrentRow.Cells("NAMABARANG").Value = ""
If Latihan383940_46109041.ShowDialog = Windows.Forms.DialogResult.OK Then
wonga_041.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109041.wonga_041.CurrentRow.Cells("KODEBARANG").Value
wonga_041.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109041.wonga_041.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf
wonga_041.Columns(e.ColumnIndex).Name = "UNIT" Or wonga_041.Columns(e.ColumnIndex).Name = "HARGA" Then
wonga_041.CurrentRow.Cells("JUMLAH").Value = wonga_041.CurrentRow.Cells("UNIT").Value * wonga_041.CurrentRow.Cells("HARGA").Value
natalina3()
End If
End Sub
Private Sub s_041_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_041.Click
If ts_041.Text = "-" Then
tambah()
Else
edit()
End If
End Sub
Private Sub wonga_041_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles wonga_041.DataError
MsgBox("Terjadi sedikit kesalahan...")
End Sub
End Class
http://cacalisa.blogspot.com/2012/11/latihan40a46110038.html
BalasHapushttp://cacalisa.blogspot.com/2012/11/atihan40b46110038.html
http://rafidashaleh.blogspot.com/2012/11/latihan40a46110041.html
BalasHapushttp://rafidashaleh.blogspot.com/2012/11/latihan40b46110041.html
http://mulyawarman039.blogspot.com/2012/11/latihan40a46110039_3.html
BalasHapushttp://mulyawarman039.blogspot.com/2012/11/latihan40b46110039.html
http://wahyunirachman.blogspot.com/2012/11/latihan40a46110020.html
BalasHapushttp://wahyunirachman.blogspot.com/2012/11/latihan40b46110020.html
http://srikartikafanty.blogspot.com/2012/11/latihan40a46110007.html
BalasHapushttp://srikartikafanty.blogspot.com/2012/11/latihan40b46110007.html
http://dianmegariski.blogspot.com/2012/11/latihan40a46110023.html
BalasHapushttp://dianmegariski.blogspot.com/2012/11/latihan40b46110023.html
http://bahrizj.blogspot.com/2012/11/latihan40a46110001.html
BalasHapushttp://bahrizj.blogspot.com/2012/11/latihan40b46110001.html
http://restyaccounting.blogspot.com/2012/11/latihan40a46110027.html
BalasHapushttp://restyaccounting.blogspot.com/2012/11/latihan40b46110027.html
http://idhamsyaam.blogspot.com/2012/11/latihan4046110021.html
BalasHapushttp://sulhihusni.blogspot.com/2012/11/latihan40a46110004_9.html
BalasHapushttp://sulhihusni.blogspot.com/2012/11/latihan40b46110004.html
http://alfaega.blogspot.com/2012/11/latihan40a46110022.html
BalasHapushttp://alfaega.blogspot.com/2012/11/latihan40b46110022.html
http://fitrianihamka.blogspot.com/2012/11/latihan40a46110006.html
BalasHapushttp://fitrianihamka.blogspot.com/2012/11/latihan40b46110006.html
http://ildayani.blogspot.com/2012/11/latihan4046110002.html
BalasHapusKomentar ini telah dihapus oleh pengarang.
BalasHapushttp://hanihasan07.blogspot.com/2012/12/latihan4046110044.html
BalasHapusKomentar ini telah dihapus oleh pengarang.
BalasHapushttp://bothbon.blogspot.com/2013/01/latihan40b46110043.html
BalasHapushttp://bothbon.blogspot.com/2013/01/latihan40b46110043.html
http://muthmil8.blogspot.com/2012/11/latihan40a-dan-40b46110037.html
BalasHapushttp://amalmaulana92.blogspot.com/2013/01/latihan40a46110003.html
BalasHapushttp://amalmaulana92.blogspot.com/2013/01/latihan40b46110003.html
http://aardianzah2.blogspot.com/2013/01/latihan-40a.html
BalasHapushttp://aardianzah2.blogspot.com/2013/01/latihan-40b.html
BalasHapushttp://feibyfrycilia.blogspot.com/2013/01/latihan40a46110055.html
BalasHapushttp://feibyfrycilia.blogspot.com/2013/01/latihan40b46110055.html
http://diyanahdina.blogspot.com/2013/01/latihan40a46110045_26.html
BalasHapushttp://diyanahdina.blogspot.com/2013/01/latihan40a46110045.html
http://deodns.blogspot.com/#!/2013/01/latihan40a46110040.html
BalasHapushttp://deodns.blogspot.com/#!/2013/01/latihan40a.html