Dim Diahasrini As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=07") Private Sub bt1_46109035_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt1_46109035.Click If nt_46109035.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") Exit Sub End If
If jt_46109035.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If dgv_46109035.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt_46109035.Text, 1, Diahasrini) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim z As New OleDb.OleDbCommand z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt_46109035.Text & "', #" & dtp_46109035.Value.Month & "/" & dtp_46109035.Value.Day & "/" & dtp_46109035.Value.Year & "#, '" & jt_46109035.Text & "')", Diahasrini) Diahasrini.Open() z.ExecuteNonQuery() Diahasrini.Close()
For Each X As DataRow In dgv_46109035.Rows z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt_46109035.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Diahasrini) Diahasrini.Open() z.ExecuteNonQuery() Diahasrini.Close() z.Dispose() Next
FARADILLAH AMALIA RIVAI Public Class LATIHAN039_46109010 Dim faradillah As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=46") Dim fara As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN039_46109010_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rossi As New OleDb.OleDbDataAdapter rossi = 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= '" & nt46109010.Text & "'", faradillah)
fara.Rows.Clear() rossi.Fill(fara) dgv46109010.DataSource = fara
rossi.Dispose()
Dim farah(1) As DataColumn farah(0) = fara.Columns("KODEBARANG") fara.PrimaryKey = farah
End Sub Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In fara.Rows
TOT = TOT + x("JUMLAH") Next Tot46109010.Text = TOT
End Sub
Private Sub DGV46109010_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv46109010.CellEndEdit
If dgv46109010.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", dgv46109010.CurrentRow.Cells("KODEBARANG").Value, 1, faradillah)
If Pencari.JumlanBaris > 0 Then dgv46109010.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else dgv46109010.CurrentRow.Cells("KODEBARANG").Value = "" If Latihan383940_46109010.ShowDialog = Windows.Forms.DialogResult.OK Then dgv46109010.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109010.DGV46109010.CurrentRow.Cells("KODEBARANG").Value dgv46109010.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109010.DGV46109010.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf dgv46109010.Columns(e.ColumnIndex).Name = "UNIT" Or dgv46109010.Columns(e.ColumnIndex).Name = "HARGA" Then dgv46109010.CurrentRow.Cells("JUMLAH").Value = dgv46109010.CurrentRow.Cells("UNIT").Value * dgv46109010.CurrentRow.Cells("HARGA").Value
LANJUTAN LATIHAN 39 BY FARADILLAH AMALIA RIVAI Private Sub button246109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109010.Click
If nt46109010.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") Exit Sub End If
If jt46109010.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If fara.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109010.Text, 1, faradillah) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt46109010.Text & "', #" & dtp46109010.Value.Month & "/" & dtp46109010.Value.Day & "/" & dtp46109010.Value.Year & "#, '" & jt46109010.Text & "')", faradillah) faradillah.Open() CM.ExecuteNonQuery() faradillah.Close()
For Each X As DataRow In fara.Rows CM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109010.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", faradillah)
faradillah.Open() CM.ExecuteNonQuery() faradillah.Close() CM.Dispose() Next
Public Class Latihan039_46109015 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb") Dim DATA As New DataTable Dim imah As DataRow Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan039_46109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load DATA.Columns.Add(New DataColumn("KODEBARANG", GetType(String))) DATA.Columns.Add(New DataColumn("NAMABARANG", GetType(String))) DATA.Columns.Add(New DataColumn("UNIT", GetType(Double))) DATA.Columns.Add(New DataColumn("HARGA", GetType(Integer))) DATA.Columns.Add(New DataColumn("JUMLAH", GetType(Double))) Dgv46109015 = DATA
Dim dcp(1) As DataColumn dcp(0) = DATA.Columns("KODEBARANG") DATA.PrimaryKey = dcp
DATA.Columns("UNIT").DefaultValue = 0 DATA.Columns("HARGA").DefaultValue = 0 DATA.Columns("JUMLAH").DefaultValue = 0 End Sub
Private Sub hitung() Dim IMAH As Integer For Each r As DataGridViewRow In DATA.Rows IMAH = IMAH + r.Cells("JUMLAH").Value Next Tot46109015.Text = IMAH End Sub
Private Sub dgv46109015_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Dgv46109015.CellEndEdit If e.ColumnIndex = 0 Then cari.AturPencarianDataBase("BARANG", "kodebarang", Dgv46109015.CurrentRow.Cells("kodebarang").Value, 1, CONECT) Dgv46109015.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG") Dgv46109015.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang") Else MsgBox("kode barang tidak tersedia") If Latihan383940_46109015.ShowDialog = Windows.Forms.DialogResult.OK Then Dgv46109015.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("KodeBarang").Value Dgv46109015.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("namabarang").Value Dgv46109015.CurrentRow.Cells("HARGA").Value = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("HARGAJUAL").Value Else Dgv46109015.CurrentRow.Cells("KODEBARANG").Value = "" Dgv46109015.CurrentRow.Cells("NAMABARANG").Value = "" End If End If If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then Dgv46109015.CurrentRow.Cells("JUMLAH").Value = Dgv46109015.CurrentRow.Cells("UNIT").Value * Dgv46109015.CurrentRow.Cells("HARGA").Value
lanjutan..... Private Sub s46109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s46109015.Click If nt46109015.Text.Length = 0 Then MsgBox("no transaksi belum terisi") Exit Sub End If If jt46109015.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub End If
If DATA.Rows.Count = 0 Then MsgBox("data tidak tersedia") End If
If cari.JumlanBaris > 0 Then MsgBox("kode sudah ada") Exit Sub End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt46109015.Text & "',#" & tgl46109015.Value.Date & "#," & Val(jt46109015.Text) & ")", CONECT)
Public Class TUGAS39 Dim SRY As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DataMajemuk.accdb;Jet OLEDB:Database Password=11") Dim REJEKI As New DataTable Dim CARI As New ByIskandar.CariKeDataBaseByIskandar
Private Sub TUGAS39_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim Q As New OleDb.OleDbDataAdapter Q = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & T146109006.Text & "'", SRY) Q.Fill(REJEKI) Q.Dispose()
DGV46109006.DataSource = REJEKI
Dim KIKI(1) As DataColumn KIKI(0) = REJEKI.Columns("KODEBARANG") REJEKI.PrimaryKey = KIKI End Sub
Private Sub KIKIE() Dim KIKIE1 As Integer = 0 For Each KIKIE2 As DataRow In REJEKI.Rows KIKIE1 += KIKIE2("JUMLAH") Next TOT46109006.Text = KIKIE1 End Sub
Private Sub DGV46109006_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV46109006.CellEndEdit If DGV46109006.Columns(e.ColumnIndex).Name = "KODEBARANG" Then 'If DGV46109006.CurrentRow.Cells(0) = "KODEBARANG" Then (rumus lain)
'untuk mencari nama barang DGV46109006.CurrentRow.Cells("NAMABARANG").Value = "" DGV46109006.CurrentRow.Cells("UNIT").Value = 0 DGV46109006.CurrentRow.Cells("HARGA").Value = 0 DGV46109006.CurrentRow.Cells("JUMLAH").Value = 0
CARI.AturPencarianDataBase("barang", "kodebarang", DGV46109006.CurrentRow.Cells("KODEBARANG").Value, 1, SRY) If CARI.JumlanBaris > 0 Then '(menampilkan nama barang jika kolom kode barang ditemukan oleh proses di atas DGV46109006.CurrentRow.Cells("NAMABARANG").Value = CARI.DataTablenya.Rows(0).Item("NAMABARANG") Else DGV46109006.CurrentRow.Cells("NAMABARANG").Value = "" If TUGAS383940.ShowDialog = Windows.Forms.DialogResult.OK Then DGV46109006.CurrentRow.Cells("KODEBARANG").Value = TUGAS383940.DGV46109006.CurrentRow.Cells("KODEBARANG").Value DGV46109006.CurrentRow.Cells("NAMABARANG").Value = TUGAS383940.DGV46109006.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf DGV46109006.Columns(e.ColumnIndex).Name = "UNIT" Or DGV46109006.Columns(e.ColumnIndex).Name = "HARGA" Then DGV46109006.CurrentRow.Cells("JUMLAH").Value = DGV46109006.CurrentRow.Cells("UNIT").Value * DGV46109006.CurrentRow.Cells("HARGA").Value KIKIE() End If End Sub
Private Sub TOMBOL1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOMBOL1.Click If T146109006.Text.Length = 0 Then MsgBox("no.transaksi belum terisi") Exit Sub End If
If T246109006.Text.Length = 0 Then MsgBox("jenis transaksi belum terisi") Exit Sub End If
Dim Nurmuhitha As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=12345") Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If nt46109047.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") Exit Sub End If
If jt46109047.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If dgv46109047.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109047.Text, 1, Nurmuhitha) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim z As New OleDb.OleDbCommand z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt46109047.Text & "', #" & dtp46109047.Value.Month & "/" & dtp46109047.Value.Day & "/" & dtp46109047.Value.Year & "#, '" & jt46109047.Text & "')", Nurmuhitha) Nurmuhitha.Open() z.ExecuteNonQuery() Nurmuhitha.Close()
For Each X As DataRow In dgv46109047.Rows z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109047.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Nurmuhitha) Nurmuhitha.Open() z.ExecuteNonQuery() Nurmuhitha.Close() z.Dispose() Next
nt46109047.Text = "" jt46109047.Text = ""
dgv46109047.Rows.Clear()
End Sub
Private Sub Latihan3946109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim CONECT AsNew OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= "& Application.StartupPath &"\DATAMAJEMUK.accdb;jet oledb:database Password=KYKY") PrivateSub Button1_46109050_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BUTTON1_46109050.Click If NT_46109050.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") ExitSub EndIf
If JT_46109050.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") ExitSub EndIf
If DGV_46109050.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") ExitSub EndIf
Dim pencari AsNew ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109050.Text, 1, CONECT) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") ExitSub EndIf
Dim z AsNew OleDb.OleDbCommand z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('"& NT_46109050.Text &"', #"& TGL_46109050.Value.Month &"/"& TGL_46109050.Value.Day &"/"& TGL_46109050.Value.Year &"#, '"& JT_46109050.Text &"')", CONECT) CONECT.Open() z.ExecuteNonQuery() CONECT.Close()
ForEach X As DataRow In DGV_46109050.Rows z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('"& NT_46109050.Text &"','"& X("KODEBARANG") &"',"& X("UNIT") &", "& X("HARGA") &")", CONECT) CONECT.Open() z.ExecuteNonQuery() CONECT.Close() z.Dispose() Next
Dim yayu As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=Parandangi") Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If nt46109004.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") Exit Sub End If
If jt46109004.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If dgv46109004.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109004.Text, 1, yayu) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim z As New OleDb.OleDbCommand z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt46109004.Text & "', #" & dtp46109004.Value.Month & "/" & dtp46109004.Value.Day & "/" & dtp46109004.Value.Year & "#, '" & jt46109004.Text & "')", yayu) yayu.Open() z.ExecuteNonQuery() yayu.Close()
For Each X As DataRow In dgv46109004.Rows z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109004.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", yayu) yayu.Open() z.ExecuteNonQuery() yayu.Close() z.Dispose() Next
nt46109004.Text = "" jt46109004.Text = ""
dgv46109004.Rows.Clear()
End Sub
Private Sub Latihan39_46109004_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conect As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=yusri") Private Sub Simpan_46109038_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_46109038.Click If NoTrans_46109038.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") Exit Sub End If
If JenTrans_46109038.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If DGV_46109038.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NoTrans_46109038.Text, 1, conect) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim z As New OleDb.OleDbCommand z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NoTrans_46109038.Text & "', #" & Tgl_46109038.Value.Month & "/" & Tgl_46109038.Value.Day & "/" & Tgl_46109038.Value.Year & "#, '" & JenTrans_46109038.Text & "')", conect) conect.Open() z.ExecuteNonQuery() conect.Close()
For Each X As DataRow In DGV_46109038.Rows z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NoTrans_46109038.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", conect) conect.Open() z.ExecuteNonQuery() conect.Close() z.Dispose() Next
Dim Vero As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=allah swt") Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If nt46109052.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") Exit Sub End If
If jt46109052.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If dgv46109052.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109052.Text, 1, Vero) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim z As New OleDb.OleDbCommand z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt46109052.Text & "', #" & dtp46109052.Value.Month & "/" & dtp46109052.Value.Day & "/" & dtp46109052.Value.Year & "#, '" & jt46109052.Text & "')", Vero) Vero.Open() z.ExecuteNonQuery() Vero.Close()
For Each X As DataRow In dgv46109052.Rows z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109052.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Vero) Vero.Open() z.ExecuteNonQuery() Vero.Close() z.Dispose() Next
nt46109052.Text = "" jt46109052.Text = ""
dgv46109052.Rows.Clear()
End Sub
Private Sub Latihan3946109052_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim mentari As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=46") Dim tabel As New DataTable
Private Sub SIMPAN46109020_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN46109020.Click If NT46109020.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") Exit Sub End If
If JT46109020.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If DGV46109020.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT46109020.Text, 1, mentari) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim com As New OleDb.OleDbCommand com = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT46109020.Text & "', #" & DT46109020.Value.Month & "/" & DT46109020.Value.Day & "/" & DT46109020.Value.Year & "#, '" & JT46109020.Text & "')", mentari) mentari.Open() com.ExecuteNonQuery() mentari.Close()
For Each X As DataRow In DGV46109020.Rows com = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT46109020.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", mentari) mentari.Open() com.ExecuteNonQuery() mentari.Close() com.Dispose() Next
Private Sub LATIHAN039_46109020_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim adapter As New OleDb.OleDbDataAdapter adapter = New OleDb.OleDbDataAdapter("Select 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= '" & NT46109020.Text & "'", mentari)
Dim tari(1) As DataColumn tari(0) = tabel.Columns("KODEBARANG") tabel.PrimaryKey = tari End Sub Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In tabel.Rows
TOT = TOT + x("JUMLAH") Next TOT46109020.Text = TOT
End Sub Private Sub DGV46109020_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV46109020.CellEndEdit
If DGV46109020.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", DGV46109020.CurrentRow.Cells("KODEBARANG").Value, 1, mentari)
If Pencari.JumlanBaris > 0 Then DGV46109020.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else DGV46109020.CurrentRow.Cells("KODEBARANG").Value = "" If Latihan383940_46109020.ShowDialog = Windows.Forms.DialogResult.OK Then DGV46109020.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109020.DGV46109020.CurrentRow.Cells("KODEBARANG").Value DGV46109020.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109020.DGV46109020.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf DGV46109020.Columns(e.ColumnIndex).Name = "UNIT" Or DGV46109020.Columns(e.ColumnIndex).Name = "HARGA" Then DGV46109020.CurrentRow.Cells("JUMLAH").Value = DGV46109020.CurrentRow.Cells("UNIT").Value * DGV46109020.CurrentRow.Cells("HARGA").Value
Dim dt As New DataTable Dim cm As New OleDb.OleDbCommand Dim novi As New ByIskandar.CariKeDataBaseByIskandar Dim batari As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=8")
Private Sub Form39_46109042_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim a As New OleDb.OleDbDataAdapter a = New OleDb.OleDbDataAdapter("SELECT BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETAILTRANSAKSI ON BARANG.KODEBARANG = DETAILTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & nt46109042.Text & "'", batari) a.Fill(dt) a.Dispose()
Dim dv(1) As DataColumn dv(0) = dt.Columns("kodebarang") dt.PrimaryKey = dv
dgv46109042.DataSource = dt End Sub
Private Sub dgv46109042_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv46109042.CellEndEdit If dgv46109042.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
novi.AturPencarianDataBase("barang", "kodebarang", dgv46109042.CurrentRow.Cells("KODEBARANG").Value, 1, batari) If novi.JumlanBaris > 0 Then dgv46109042.CurrentRow.Cells("NAMABARANG").Value = novi.DataTablenya.Rows(0).Item("NAMABARANG") Else dgv46109042.CurrentRow.Cells("NAMABARANG").Value = "" If Form38_39_40_46109042.ShowDialog = Windows.Forms.DialogResult.OK Then dgv46109042.CurrentRow.Cells("KODEBARANG").Value = Form38_39_40_46109042.dgv46109042.CurrentRow.Cells("KODEBARANG").Value dgv46109042.CurrentRow.Cells("NAMABARANG").Value = Form38_39_40_46109042.dgv46109042.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf dgv46109042.Columns(e.ColumnIndex).Name = "UNIT" Or dgv46109042.Columns(e.ColumnIndex).Name = "HARGA" Then dgv46109042.CurrentRow.Cells("JUMLAH").Value = dgv46109042.CurrentRow.Cells("UNIT").Value * dgv46109042.CurrentRow.Cells("HARGA").Value indra() End If End Sub
Private Sub indra() Dim indra1 As Integer = 0 For Each indra2 As DataRow In dt.Rows indra1 += indra2("JUMLAH") Next Tot46109042.Text = indra1 End Sub
Private Sub Button146109042_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109042.Click If nt46109042.Text.Length = 0 Then MsgBox("Isi No Transaksinya") Exit Sub End If
If jt46109042.Text.Length = 0 Then MsgBox("Isi Jenis Transaksinya") Exit Sub End If
If dt.Rows.Count = 0 Then MsgBox("Isi datatable k") Exit Sub End If
novi.AturPencarianDataBase("mastertransaksi", "notrans", nt46109042.Text, 1, batari) If novi.JumlanBaris > 0 Then MsgBox("Adami notrans seperti itu") Exit Sub End If
For Each x As DataRow In dt.Rows cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt46109042.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", batari) batari.Open() cm.ExecuteNonQuery() batari.Close() Next
Dim dt As New DataTable Dim cm As New OleDb.OleDbCommand Dim imah As New ByIskandar.CariKeDataBaseByIskandar Dim ana As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;jet OLEDB:database password=015")
Private Sub Latihan039_46109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim a As New OleDb.OleDbDataAdapter a = New OleDb.OleDbDataAdapter("SELECT BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETAILTRANSAKSI ON BARANG.KODEBARANG = DETAILTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & nt46109015.Text & "'", ana) a.Fill(dt) a.Dispose()
Dim dv(1) As DataColumn dv(0) = dt.Columns("kodebarang") dt.PrimaryKey = dv
dgv46109015.DataSource = dt End Sub
Private Sub dgv46109015_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv46109015.CellEndEdit If dgv46109015.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
imah.AturPencarianDataBase("barang", "kodebarang", dgv46109015.CurrentRow.Cells("KODEBARANG").Value, 1, ana) If imah.JumlanBaris > 0 Then dgv46109015.CurrentRow.Cells("NAMABARANG").Value = imah.DataTablenya.Rows(0).Item("NAMABARANG") Else dgv46109015.CurrentRow.Cells("NAMABARANG").Value = "" If Latihan383940_46109015.ShowDialog = Windows.Forms.DialogResult.OK Then dgv46109015.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("KODEBARANG").Value dgv46109015.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf dgv46109015.Columns(e.ColumnIndex).Name = "UNIT" Or dgv46109015.Columns(e.ColumnIndex).Name = "HARGA" Then dgv46109015.CurrentRow.Cells("JUMLAH").Value = dgv46109015.CurrentRow.Cells("UNIT").Value * dgv46109015.CurrentRow.Cells("HARGA").Value animah() End If End Sub
Private Sub animah() Dim animah1 As Integer = 0 For Each animah2 As DataRow In dt.Rows animah1 += animah2("JUMLAH") Next Tot46109015.Text = animah1 End Sub
Private Sub s46109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s46109015.Click If nt46109015.Text.Length = 0 Then MsgBox("Isi No Transaksinya") Exit Sub End If
If jt46109015.Text.Length = 0 Then MsgBox("Isi Jenis Transaksinya") Exit Sub End If
If dt.Rows.Count = 0 Then MsgBox("Isi datatable k") Exit Sub End If
imah.AturPencarianDataBase("mastertransaksi", "notrans", nt46109015.Text, 1, ana) If imah.JumlanBaris > 0 Then MsgBox("Adami notrans seperti itu") Exit Sub End If
For Each x As DataRow In dt.Rows cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt46109015.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", ana) ana.Open() cm.ExecuteNonQuery() ana.Close() Next
Private Sub Button146109043_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109043.Click If nt46109043.Text.Length = 0 Then MsgBox("Isi No Transaksinya") Exit Sub End If
If jt46109043.Text.Length = 0 Then MsgBox("Isi Jenis Transaksinya") Exit Sub End If
If dt.Rows.Count = 0 Then MsgBox("Isi datatable k") Exit Sub End If
diva.AturPencarianDataBase("mastertransaksi", "notrans", nt46109043.Text, 1, fara) If diva.JumlanBaris > 0 Then MsgBox("Adami notrans seperti itu") Exit Sub End If
For Each x As DataRow In dt.Rows cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt46109043.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", fara) fara.Open() cm.ExecuteNonQuery() fara.Close() Next
Dim dt As New DataTable Dim cm As New OleDb.OleDbCommand Dim amhy As New ByIskandar.CariKeDataBaseByIskandar Dim asmi As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;jet OLEDB:database password=amhy2")
Private Sub latihan39_46109046_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim x As New OleDb.OleDbDataAdapter x = New OleDb.OleDbDataAdapter("SELECT BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETAILTRANSAKSI ON BARANG.KODEBARANG = DETAILTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & nt46109046.Text & "'", asmi) x.Fill(dt) x.Dispose()
Dim dv(1) As DataColumn dv(0) = dt.Columns("kodebarang") dt.PrimaryKey = dv
dgv46109046.DataSource = dt End Sub
Private Sub dgv46109046_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv46109046.CellEndEdit If dgv46109046.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
amhy.AturPencarianDataBase("barang", "kodebarang", dgv46109046.CurrentRow.Cells("KODEBARANG").Value, 1, asmi) If amhy.JumlanBaris > 0 Then dgv46109046.CurrentRow.Cells("NAMABARANG").Value = amhy.DataTablenya.Rows(0).Item("NAMABARANG") Else dgv46109046.CurrentRow.Cells("NAMABARANG").Value = "" If latihan38_39_40_46109046.ShowDialog = Windows.Forms.DialogResult.OK Then dgv46109046.CurrentRow.Cells("KODEBARANG").Value = latihan38_39_40_46109046.dgv46109046.CurrentRow.Cells("KODEBARANG").Value dgv46109046.CurrentRow.Cells("NAMABARANG").Value = latihan38_39_40_46109046.dgv46109046.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf dgv46109046.Columns(e.ColumnIndex).Name = "UNIT" Or dgv46109046.Columns(e.ColumnIndex).Name = "HARGA" Then dgv46109046.CurrentRow.Cells("JUMLAH").Value = dgv46109046.CurrentRow.Cells("UNIT").Value * dgv46109046.CurrentRow.Cells("HARGA").Value asmianti() End If End Sub
Private Sub asmianti() Dim asmianti1 As Integer = 0 For Each asmianti2 As DataRow In dt.Rows asmianti1 += asmianti2("JUMLAH") Next Tot46109046.Text = asmianti1 End Sub
Private Sub Button146109043_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109046.Click If nt46109046.Text.Length = 0 Then MsgBox("Isi No Transaksinya") Exit Sub End If
If jt46109046.Text.Length = 0 Then MsgBox("Isi Jenis Transaksinya") Exit Sub End If
If dt.Rows.Count = 0 Then MsgBox("Isi datatable k") Exit Sub End If
amhy.AturPencarianDataBase("mastertransaksi", "notrans", nt46109046.Text, 1, asmi) If amhy.JumlanBaris > 0 Then MsgBox("Adami notrans seperti itu") Exit Sub End If
For Each x As DataRow In dt.Rows cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt46109046.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", asmi) asmi.Open() cm.ExecuteNonQuery() asmi.Close() Next
Public Class LATIHAN3946109026 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=26")
Dim DT As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub LATIHAN039012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim ibeng As New OleDb.OleDbDataAdapter ibeng = 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= '" & nomor46109026.Text & "'", CONECT)
Dim farah(1) As DataColumn farah(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = farah End Sub Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In DT.Rows TOT = TOT + x("JUMLAH") Next total46109026.Text = TOT End Sub Private Sub Data46109026_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles data46109026.CellEndEdit If data46109026.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", data46109026.CurrentRow.Cells("KODEBARANG").Value, 1, CONECT)
If Pencari.JumlanBaris > 0 Then data46109026.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else data46109026.CurrentRow.Cells("KODEBARANG").Value = "" If latihan3839400026.ShowDialog = Windows.Forms.DialogResult.OK Then data46109026.CurrentRow.Cells("KODEBARANG").Value = latihan3839400026.DATA46109026.CurrentRow.Cells("KODEBARANG").Value data46109026.CurrentRow.Cells("NAMABARANG").Value = latihan3839400026.DATA46109026.CurrentRow.Cells("NAMABARANG").Value End If End If
ElseIf data46109026.Columns(e.ColumnIndex).Name = "UNIT" Or data46109026.Columns(e.ColumnIndex).Name = "HARGA" Then data46109026.CurrentRow.Cells("JUMLAH").Value = data46109026.CurrentRow.Cells("UNIT").Value * data46109026.CurrentRow.Cells("HARGA").Value
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If nomor46109026.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") Exit Sub End If
If jenis46109026.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nomor46109026.Text, 1, CONECT) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nomor46109026.Text & "', #" & tanggal46109026.Value.Month & "/" & tanggal46109026.Value.Day & "/" & tanggal46109026.Value.Year & "#, '" & jenis46109026.Text & "')", CONECT) CONECT.Open() CM.ExecuteNonQuery() CONECT.Close()
For Each X As DataRow In DT.Rows CM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nomor46109026.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", CONECT)
CONECT.Open() CM.ExecuteNonQuery() CONECT.Close() CM.Dispose() Next
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If nt46109033.Text.Length = 0 Then MsgBox("No. transaksi sudah ada") Exit Sub End If
If jt46109033.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If DT.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109033.Text, 1, CONECT) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim CM As New OleDb.OleDbCommand CM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt46109033.Text & "', #" & DateTimePicker1.Value.Month & "/" & DateTimePicker1.Value.Day & "/" & DateTimePicker1.Value.Year & "#, '" & jt46109033.Text & "')", CONECT) CONECT.Open() CM.ExecuteNonQuery() CONECT.Close()
For Each X As DataRow In DT.Rows CM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109033.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", CONECT)
CONECT.Open() CM.ExecuteNonQuery() CONECT.Close() CM.Dispose() Next
Public Class Latihan39_46109035
BalasHapusDim Diahasrini As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=07")
Private Sub bt1_46109035_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bt1_46109035.Click
If nt_46109035.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If jt_46109035.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If dgv_46109035.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt_46109035.Text, 1, Diahasrini)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim z As New OleDb.OleDbCommand
z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt_46109035.Text & "', #" & dtp_46109035.Value.Month & "/" & dtp_46109035.Value.Day & "/" & dtp_46109035.Value.Year & "#, '" & jt_46109035.Text & "')", Diahasrini)
Diahasrini.Open()
z.ExecuteNonQuery()
Diahasrini.Close()
For Each X As DataRow In dgv_46109035.Rows
z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt_46109035.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Diahasrini)
Diahasrini.Open()
z.ExecuteNonQuery()
Diahasrini.Close()
z.Dispose()
Next
nt_46109035.Text = ""
jt_46109035.Text = ""
dgv_46109035.Rows.Clear()
End Sub
End Class
FARADILLAH AMALIA RIVAI
BalasHapusPublic Class LATIHAN039_46109010
Dim faradillah As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=46")
Dim fara As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN039_46109010_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim rossi As New OleDb.OleDbDataAdapter
rossi = 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= '" & nt46109010.Text & "'", faradillah)
fara.Rows.Clear()
rossi.Fill(fara)
dgv46109010.DataSource = fara
rossi.Dispose()
Dim farah(1) As DataColumn
farah(0) = fara.Columns("KODEBARANG")
fara.PrimaryKey = farah
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In fara.Rows
TOT = TOT + x("JUMLAH")
Next
Tot46109010.Text = TOT
End Sub
Private Sub DGV46109010_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv46109010.CellEndEdit
If dgv46109010.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
dgv46109010.CurrentRow.Cells("NAMABARANG").Value = ""
dgv46109010.CurrentRow.Cells("UNIT").Value = 0
dgv46109010.CurrentRow.Cells("HARGA").Value = 0
dgv46109010.CurrentRow.Cells("JUMLAH").Value = 0
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", dgv46109010.CurrentRow.Cells("KODEBARANG").Value, 1, faradillah)
If Pencari.JumlanBaris > 0 Then
dgv46109010.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
dgv46109010.CurrentRow.Cells("KODEBARANG").Value = ""
If Latihan383940_46109010.ShowDialog = Windows.Forms.DialogResult.OK Then
dgv46109010.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109010.DGV46109010.CurrentRow.Cells("KODEBARANG").Value
dgv46109010.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109010.DGV46109010.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf dgv46109010.Columns(e.ColumnIndex).Name = "UNIT" Or dgv46109010.Columns(e.ColumnIndex).Name = "HARGA" Then
dgv46109010.CurrentRow.Cells("JUMLAH").Value = dgv46109010.CurrentRow.Cells("UNIT").Value * dgv46109010.CurrentRow.Cells("HARGA").Value
TOTALJUMLAH()
End If
End Sub
LANJUTAN LATIHAN 39 BY FARADILLAH AMALIA RIVAI
BalasHapusPrivate Sub button246109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109010.Click
If nt46109010.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If jt46109010.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If fara.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109010.Text, 1, faradillah)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt46109010.Text & "', #" & dtp46109010.Value.Month & "/" & dtp46109010.Value.Day & "/" & dtp46109010.Value.Year & "#, '" & jt46109010.Text & "')", faradillah)
faradillah.Open()
CM.ExecuteNonQuery()
faradillah.Close()
For Each X As DataRow In fara.Rows
CM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109010.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", faradillah)
faradillah.Open()
CM.ExecuteNonQuery()
faradillah.Close()
CM.Dispose()
Next
nt46109010.Text = ""
jt46109010.Text = ""
fara.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
Public Class Latihan039_46109015
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb")
Dim DATA As New DataTable
Dim imah As DataRow
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan039_46109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
DATA.Columns.Add(New DataColumn("KODEBARANG", GetType(String)))
DATA.Columns.Add(New DataColumn("NAMABARANG", GetType(String)))
DATA.Columns.Add(New DataColumn("UNIT", GetType(Double)))
DATA.Columns.Add(New DataColumn("HARGA", GetType(Integer)))
DATA.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
Dgv46109015 = DATA
Dim dcp(1) As DataColumn
dcp(0) = DATA.Columns("KODEBARANG")
DATA.PrimaryKey = dcp
DATA.Columns("UNIT").DefaultValue = 0
DATA.Columns("HARGA").DefaultValue = 0
DATA.Columns("JUMLAH").DefaultValue = 0
End Sub
Private Sub hitung()
Dim IMAH As Integer
For Each r As DataGridViewRow In DATA.Rows
IMAH = IMAH + r.Cells("JUMLAH").Value
Next
Tot46109015.Text = IMAH
End Sub
Private Sub dgv46109015_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles Dgv46109015.CellEndEdit
If e.ColumnIndex = 0 Then
cari.AturPencarianDataBase("BARANG", "kodebarang", Dgv46109015.CurrentRow.Cells("kodebarang").Value, 1, CONECT)
Dgv46109015.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
Dgv46109015.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
Else
MsgBox("kode barang tidak tersedia")
If Latihan383940_46109015.ShowDialog = Windows.Forms.DialogResult.OK Then
Dgv46109015.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("KodeBarang").Value
Dgv46109015.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("namabarang").Value
Dgv46109015.CurrentRow.Cells("HARGA").Value = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("HARGAJUAL").Value
Else
Dgv46109015.CurrentRow.Cells("KODEBARANG").Value = ""
Dgv46109015.CurrentRow.Cells("NAMABARANG").Value = ""
End If
End If
If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
Dgv46109015.CurrentRow.Cells("JUMLAH").Value = Dgv46109015.CurrentRow.Cells("UNIT").Value * Dgv46109015.CurrentRow.Cells("HARGA").Value
End If
hitung()
End Sub
lanjutan.....
BalasHapusPrivate Sub s46109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s46109015.Click
If nt46109015.Text.Length = 0 Then
MsgBox("no transaksi belum terisi")
Exit Sub
End If
If jt46109015.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
If DATA.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", nt46109015.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("kode sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt46109015.Text & "',#" & tgl46109015.Value.Date & "#," & Val(jt46109015.Text) & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DATA.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & nt46109015.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
com.Dispose()
Next
nt46109015.Text = ""
jt46109015.Text = ""
Tot46109015.Text = ""
DATA.Rows.Clear()
hitung()
End Sub
End Class
Public Class TUGAS39
BalasHapusDim SRY As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DataMajemuk.accdb;Jet OLEDB:Database Password=11")
Dim REJEKI As New DataTable
Dim CARI As New ByIskandar.CariKeDataBaseByIskandar
Private Sub TUGAS39_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim Q As New OleDb.OleDbDataAdapter
Q = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit*harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans ='" & T146109006.Text & "'", SRY)
Q.Fill(REJEKI)
Q.Dispose()
DGV46109006.DataSource = REJEKI
Dim KIKI(1) As DataColumn
KIKI(0) = REJEKI.Columns("KODEBARANG")
REJEKI.PrimaryKey = KIKI
End Sub
Private Sub KIKIE()
Dim KIKIE1 As Integer = 0
For Each KIKIE2 As DataRow In REJEKI.Rows
KIKIE1 += KIKIE2("JUMLAH")
Next
TOT46109006.Text = KIKIE1
End Sub
Private Sub DGV46109006_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV46109006.CellEndEdit
If DGV46109006.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
'If DGV46109006.CurrentRow.Cells(0) = "KODEBARANG" Then (rumus lain)
'untuk mencari nama barang
DGV46109006.CurrentRow.Cells("NAMABARANG").Value = ""
DGV46109006.CurrentRow.Cells("UNIT").Value = 0
DGV46109006.CurrentRow.Cells("HARGA").Value = 0
DGV46109006.CurrentRow.Cells("JUMLAH").Value = 0
CARI.AturPencarianDataBase("barang", "kodebarang", DGV46109006.CurrentRow.Cells("KODEBARANG").Value, 1, SRY)
If CARI.JumlanBaris > 0 Then '(menampilkan nama barang jika kolom kode barang ditemukan oleh proses di atas
DGV46109006.CurrentRow.Cells("NAMABARANG").Value = CARI.DataTablenya.Rows(0).Item("NAMABARANG")
Else
DGV46109006.CurrentRow.Cells("NAMABARANG").Value = ""
If TUGAS383940.ShowDialog = Windows.Forms.DialogResult.OK Then
DGV46109006.CurrentRow.Cells("KODEBARANG").Value = TUGAS383940.DGV46109006.CurrentRow.Cells("KODEBARANG").Value
DGV46109006.CurrentRow.Cells("NAMABARANG").Value = TUGAS383940.DGV46109006.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf DGV46109006.Columns(e.ColumnIndex).Name = "UNIT" Or DGV46109006.Columns(e.ColumnIndex).Name = "HARGA" Then
DGV46109006.CurrentRow.Cells("JUMLAH").Value = DGV46109006.CurrentRow.Cells("UNIT").Value * DGV46109006.CurrentRow.Cells("HARGA").Value
KIKIE()
End If
End Sub
LANJUTAN 39
BalasHapusPrivate Sub TOMBOL1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOMBOL1.Click
If T146109006.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
Exit Sub
End If
If T246109006.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
CARI.AturPencarianDataBase("mastertransaksi", "notrans", T146109006.Text, 1, SRY)
If CARI.JumlanBaris > 0 Then
MsgBox("NO.TRANSAKSI sudah ada")
Exit Sub
End If
If REJEKI.Rows.Count = 0 Then
MsgBox("Data tidak tersedia")
End If
Dim QI As New OleDb.OleDbCommand
QI = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & T146109006.Text & "',#" & DATE46109006.Value.Date & "#," & Val(T246109006.Text) & ")", SRY)
SRY.Open()
QI.ExecuteNonQuery()
SRY.Close()
For Each r As DataRow In REJEKI.Rows
QI = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & T146109006.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", SRY)
SRY.Open()
QI.ExecuteNonQuery()
SRY.Close()
Next
QI.Dispose()
REJEKI.Rows.Clear()
KIKIE()
T146109006.Text = ""
T246109006.Text = ""
TOT46109006.Text = ""
End Sub
End Class
Public Class Latihan3946109047
BalasHapusDim Nurmuhitha As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=12345")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If nt46109047.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If jt46109047.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If dgv46109047.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109047.Text, 1, Nurmuhitha)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim z As New OleDb.OleDbCommand
z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt46109047.Text & "', #" & dtp46109047.Value.Month & "/" & dtp46109047.Value.Day & "/" & dtp46109047.Value.Year & "#, '" & jt46109047.Text & "')", Nurmuhitha)
Nurmuhitha.Open()
z.ExecuteNonQuery()
Nurmuhitha.Close()
For Each X As DataRow In dgv46109047.Rows
z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109047.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Nurmuhitha)
Nurmuhitha.Open()
z.ExecuteNonQuery()
Nurmuhitha.Close()
z.Dispose()
Next
nt46109047.Text = ""
jt46109047.Text = ""
dgv46109047.Rows.Clear()
End Sub
Private Sub Latihan3946109047_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
PublicClass Latihan39_46109050
BalasHapusDim CONECT AsNew OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= "& Application.StartupPath &"\DATAMAJEMUK.accdb;jet oledb:database Password=KYKY")
PrivateSub Button1_46109050_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BUTTON1_46109050.Click
If NT_46109050.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
ExitSub
EndIf
If JT_46109050.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
ExitSub
EndIf
If DGV_46109050.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
ExitSub
EndIf
Dim pencari AsNew ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109050.Text, 1, CONECT)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
ExitSub
EndIf
Dim z AsNew OleDb.OleDbCommand
z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('"& NT_46109050.Text &"', #"& TGL_46109050.Value.Month &"/"& TGL_46109050.Value.Day &"/"& TGL_46109050.Value.Year &"#, '"& JT_46109050.Text &"')", CONECT)
CONECT.Open()
z.ExecuteNonQuery()
CONECT.Close()
ForEach X As DataRow In DGV_46109050.Rows
z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('"& NT_46109050.Text &"','"& X("KODEBARANG") &"',"& X("UNIT") &", "& X("HARGA") &")", CONECT)
CONECT.Open()
z.ExecuteNonQuery()
CONECT.Close()
z.Dispose()
Next
NT_46109050.Text = ""
JT_46109050.Text = ""
DGV_46109050.Rows.Clear()
EndSub
EndClass
Public Class Latihan39_46109004
BalasHapusDim yayu As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=Parandangi")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If nt46109004.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If jt46109004.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If dgv46109004.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109004.Text, 1, yayu)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim z As New OleDb.OleDbCommand
z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt46109004.Text & "', #" & dtp46109004.Value.Month & "/" & dtp46109004.Value.Day & "/" & dtp46109004.Value.Year & "#, '" & jt46109004.Text & "')", yayu)
yayu.Open()
z.ExecuteNonQuery()
yayu.Close()
For Each X As DataRow In dgv46109004.Rows
z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109004.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", yayu)
yayu.Open()
z.ExecuteNonQuery()
yayu.Close()
z.Dispose()
Next
nt46109004.Text = ""
jt46109004.Text = ""
dgv46109004.Rows.Clear()
End Sub
Private Sub Latihan39_46109004_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
andi muh. yusri
BalasHapusPublic Class Latihan39_46109038
Dim conect As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=yusri")
Private Sub Simpan_46109038_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_46109038.Click
If NoTrans_46109038.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If JenTrans_46109038.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If DGV_46109038.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NoTrans_46109038.Text, 1, conect)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim z As New OleDb.OleDbCommand
z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NoTrans_46109038.Text & "', #" & Tgl_46109038.Value.Month & "/" & Tgl_46109038.Value.Day & "/" & Tgl_46109038.Value.Year & "#, '" & JenTrans_46109038.Text & "')", conect)
conect.Open()
z.ExecuteNonQuery()
conect.Close()
For Each X As DataRow In DGV_46109038.Rows
z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NoTrans_46109038.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", conect)
conect.Open()
z.ExecuteNonQuery()
conect.Close()
z.Dispose()
Next
NoTrans_46109038.Text = ""
JenTrans_46109038.Text = ""
DGV_46109038.Rows.Clear()
End Sub
End Class
Public Class Latihan3946109052
BalasHapusDim Vero As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=allah swt")
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If nt46109052.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If jt46109052.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If dgv46109052.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109052.Text, 1, Vero)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim z As New OleDb.OleDbCommand
z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt46109052.Text & "', #" & dtp46109052.Value.Month & "/" & dtp46109052.Value.Day & "/" & dtp46109052.Value.Year & "#, '" & jt46109052.Text & "')", Vero)
Vero.Open()
z.ExecuteNonQuery()
Vero.Close()
For Each X As DataRow In dgv46109052.Rows
z = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109052.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Vero)
Vero.Open()
z.ExecuteNonQuery()
Vero.Close()
z.Dispose()
Next
nt46109052.Text = ""
jt46109052.Text = ""
dgv46109052.Rows.Clear()
End Sub
Private Sub Latihan3946109052_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class LATIHAN039_46109020
BalasHapusDim mentari As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=46")
Dim tabel As New DataTable
Private Sub SIMPAN46109020_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN46109020.Click
If NT46109020.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If JT46109020.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If DGV46109020.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT46109020.Text, 1, mentari)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim com As New OleDb.OleDbCommand
com = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT46109020.Text & "', #" & DT46109020.Value.Month & "/" & DT46109020.Value.Day & "/" & DT46109020.Value.Year & "#, '" & JT46109020.Text & "')", mentari)
mentari.Open()
com.ExecuteNonQuery()
mentari.Close()
For Each X As DataRow In DGV46109020.Rows
com = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT46109020.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", mentari)
mentari.Open()
com.ExecuteNonQuery()
mentari.Close()
com.Dispose()
Next
NT46109020.Text = ""
JT46109020.Text = ""
DGV46109020.Rows.Clear()
TOTALJUMLAH()
End Sub
Lanjutannya...
BalasHapusPrivate Sub LATIHAN039_46109020_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim adapter As New OleDb.OleDbDataAdapter
adapter = New OleDb.OleDbDataAdapter("Select 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= '" & NT46109020.Text & "'", mentari)
tabel.Rows.Clear()
adapter.Fill(tabel)
DGV46109020.DataSource = tabel
adapter.Dispose()
Dim tari(1) As DataColumn
tari(0) = tabel.Columns("KODEBARANG")
tabel.PrimaryKey = tari
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In tabel.Rows
TOT = TOT + x("JUMLAH")
Next
TOT46109020.Text = TOT
End Sub
Private Sub DGV46109020_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV46109020.CellEndEdit
If DGV46109020.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
DGV46109020.CurrentRow.Cells("NAMABARANG").Value = ""
DGV46109020.CurrentRow.Cells("UNIT").Value = 0
DGV46109020.CurrentRow.Cells("HARGA").Value = 0
DGV46109020.CurrentRow.Cells("JUMLAH").Value = 0
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", DGV46109020.CurrentRow.Cells("KODEBARANG").Value, 1, mentari)
If Pencari.JumlanBaris > 0 Then
DGV46109020.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
DGV46109020.CurrentRow.Cells("KODEBARANG").Value = ""
If Latihan383940_46109020.ShowDialog = Windows.Forms.DialogResult.OK Then
DGV46109020.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109020.DGV46109020.CurrentRow.Cells("KODEBARANG").Value
DGV46109020.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109020.DGV46109020.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf DGV46109020.Columns(e.ColumnIndex).Name = "UNIT" Or DGV46109020.Columns(e.ColumnIndex).Name = "HARGA" Then
DGV46109020.CurrentRow.Cells("JUMLAH").Value = DGV46109020.CurrentRow.Cells("UNIT").Value * DGV46109020.CurrentRow.Cells("HARGA").Value
TOTALJUMLAH()
End If
End Sub
End Class
Public Class Form39_46109042
BalasHapusDim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim novi As New ByIskandar.CariKeDataBaseByIskandar
Dim batari As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=8")
Private Sub Form39_46109042_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("SELECT BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETAILTRANSAKSI ON BARANG.KODEBARANG = DETAILTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & nt46109042.Text & "'", batari)
a.Fill(dt)
a.Dispose()
Dim dv(1) As DataColumn
dv(0) = dt.Columns("kodebarang")
dt.PrimaryKey = dv
dgv46109042.DataSource = dt
End Sub
Private Sub dgv46109042_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv46109042.CellEndEdit
If dgv46109042.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
dgv46109042.CurrentRow.Cells("NAMABARANG").Value = ""
dgv46109042.CurrentRow.Cells("UNIT").Value = 0
dgv46109042.CurrentRow.Cells("HARGA").Value = 0
dgv46109042.CurrentRow.Cells("JUMLAH").Value = 0
novi.AturPencarianDataBase("barang", "kodebarang", dgv46109042.CurrentRow.Cells("KODEBARANG").Value, 1, batari)
If novi.JumlanBaris > 0 Then
dgv46109042.CurrentRow.Cells("NAMABARANG").Value = novi.DataTablenya.Rows(0).Item("NAMABARANG")
Else
dgv46109042.CurrentRow.Cells("NAMABARANG").Value = ""
If Form38_39_40_46109042.ShowDialog = Windows.Forms.DialogResult.OK Then
dgv46109042.CurrentRow.Cells("KODEBARANG").Value = Form38_39_40_46109042.dgv46109042.CurrentRow.Cells("KODEBARANG").Value
dgv46109042.CurrentRow.Cells("NAMABARANG").Value = Form38_39_40_46109042.dgv46109042.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf dgv46109042.Columns(e.ColumnIndex).Name = "UNIT" Or dgv46109042.Columns(e.ColumnIndex).Name = "HARGA" Then
dgv46109042.CurrentRow.Cells("JUMLAH").Value = dgv46109042.CurrentRow.Cells("UNIT").Value * dgv46109042.CurrentRow.Cells("HARGA").Value
indra()
End If
End Sub
Private Sub indra()
BalasHapusDim indra1 As Integer = 0
For Each indra2 As DataRow In dt.Rows
indra1 += indra2("JUMLAH")
Next
Tot46109042.Text = indra1
End Sub
Private Sub Button146109042_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109042.Click
If nt46109042.Text.Length = 0 Then
MsgBox("Isi No Transaksinya")
Exit Sub
End If
If jt46109042.Text.Length = 0 Then
MsgBox("Isi Jenis Transaksinya")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Isi datatable k")
Exit Sub
End If
novi.AturPencarianDataBase("mastertransaksi", "notrans", nt46109042.Text, 1, batari)
If novi.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt46109042.Text & "',#" & dtp46109042.Value.Month & "/" & dtp46109042.Value.Day & "/" & dtp46109042.Value.Year & "#,'" & jt46109042.Text & "')", batari)
batari.Open()
cm.ExecuteNonQuery()
batari.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt46109042.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", batari)
batari.Open()
cm.ExecuteNonQuery()
batari.Close()
Next
cm.Dispose()
nt46109042.Text = ""
jt46109042.Text = ""
Tot46109042.Text = ""
dt.Rows.Clear()
indra()
End Sub
End Class
Public Class Latihan039_46109015
BalasHapusDim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim imah As New ByIskandar.CariKeDataBaseByIskandar
Dim ana As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;jet OLEDB:database password=015")
Private Sub Latihan039_46109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("SELECT BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETAILTRANSAKSI ON BARANG.KODEBARANG = DETAILTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & nt46109015.Text & "'", ana)
a.Fill(dt)
a.Dispose()
Dim dv(1) As DataColumn
dv(0) = dt.Columns("kodebarang")
dt.PrimaryKey = dv
dgv46109015.DataSource = dt
End Sub
Private Sub dgv46109015_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv46109015.CellEndEdit
If dgv46109015.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
dgv46109015.CurrentRow.Cells("NAMABARANG").Value = ""
dgv46109015.CurrentRow.Cells("UNIT").Value = 0
dgv46109015.CurrentRow.Cells("HARGA").Value = 0
dgv46109015.CurrentRow.Cells("JUMLAH").Value = 0
imah.AturPencarianDataBase("barang", "kodebarang", dgv46109015.CurrentRow.Cells("KODEBARANG").Value, 1, ana)
If imah.JumlanBaris > 0 Then
dgv46109015.CurrentRow.Cells("NAMABARANG").Value = imah.DataTablenya.Rows(0).Item("NAMABARANG")
Else
dgv46109015.CurrentRow.Cells("NAMABARANG").Value = ""
If Latihan383940_46109015.ShowDialog = Windows.Forms.DialogResult.OK Then
dgv46109015.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("KODEBARANG").Value
dgv46109015.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf dgv46109015.Columns(e.ColumnIndex).Name = "UNIT" Or dgv46109015.Columns(e.ColumnIndex).Name = "HARGA" Then
dgv46109015.CurrentRow.Cells("JUMLAH").Value = dgv46109015.CurrentRow.Cells("UNIT").Value * dgv46109015.CurrentRow.Cells("HARGA").Value
animah()
End If
End Sub
Private Sub animah()
Dim animah1 As Integer = 0
For Each animah2 As DataRow In dt.Rows
animah1 += animah2("JUMLAH")
Next
Tot46109015.Text = animah1
End Sub
Private Sub s46109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s46109015.Click
If nt46109015.Text.Length = 0 Then
MsgBox("Isi No Transaksinya")
Exit Sub
End If
If jt46109015.Text.Length = 0 Then
MsgBox("Isi Jenis Transaksinya")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Isi datatable k")
Exit Sub
End If
imah.AturPencarianDataBase("mastertransaksi", "notrans", nt46109015.Text, 1, ana)
If imah.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt46109015.Text & "',#" & tgl46109015.Value.Month & "/" & tgl46109015.Value.Day & "/" & tgl46109015.Value.Year & "#,'" & jt46109015.Text & "')", ana)
BalasHapusana.Open()
cm.ExecuteNonQuery()
ana.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt46109015.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", ana)
ana.Open()
cm.ExecuteNonQuery()
ana.Close()
Next
cm.Dispose()
nt46109015.Text = ""
jt46109015.Text = ""
Tot46109015.Text = ""
dt.Rows.Clear()
animah()
End Sub
End Class
sambungan 39
BalasHapusPrivate Sub Button146109043_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109043.Click
If nt46109043.Text.Length = 0 Then
MsgBox("Isi No Transaksinya")
Exit Sub
End If
If jt46109043.Text.Length = 0 Then
MsgBox("Isi Jenis Transaksinya")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Isi datatable k")
Exit Sub
End If
diva.AturPencarianDataBase("mastertransaksi", "notrans", nt46109043.Text, 1, fara)
If diva.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt46109043.Text & "',#" & dtp46109043.Value.Month & "/" & dtp46109043.Value.Day & "/" & dtp46109043.Value.Year & "#,'" & jt46109043.Text & "')", fara)
fara.Open()
cm.ExecuteNonQuery()
fara.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt46109043.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", fara)
fara.Open()
cm.ExecuteNonQuery()
fara.Close()
Next
cm.Dispose()
nt46109043.Text = ""
jt46109043.Text = ""
Tot46109043.Text = ""
dt.Rows.Clear()
andiva()
End Sub
End Class
Public Class latihan39_46109046
BalasHapusDim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim amhy As New ByIskandar.CariKeDataBaseByIskandar
Dim asmi As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;jet OLEDB:database password=amhy2")
Private Sub latihan39_46109046_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim x As New OleDb.OleDbDataAdapter
x = New OleDb.OleDbDataAdapter("SELECT BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETAILTRANSAKSI ON BARANG.KODEBARANG = DETAILTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & nt46109046.Text & "'", asmi)
x.Fill(dt)
x.Dispose()
Dim dv(1) As DataColumn
dv(0) = dt.Columns("kodebarang")
dt.PrimaryKey = dv
dgv46109046.DataSource = dt
End Sub
Private Sub dgv46109046_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv46109046.CellEndEdit
If dgv46109046.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
dgv46109046.CurrentRow.Cells("NAMABARANG").Value = ""
dgv46109046.CurrentRow.Cells("UNIT").Value = 0
dgv46109046.CurrentRow.Cells("HARGA").Value = 0
dgv46109046.CurrentRow.Cells("JUMLAH").Value = 0
amhy.AturPencarianDataBase("barang", "kodebarang", dgv46109046.CurrentRow.Cells("KODEBARANG").Value, 1, asmi)
If amhy.JumlanBaris > 0 Then
dgv46109046.CurrentRow.Cells("NAMABARANG").Value = amhy.DataTablenya.Rows(0).Item("NAMABARANG")
Else
dgv46109046.CurrentRow.Cells("NAMABARANG").Value = ""
If latihan38_39_40_46109046.ShowDialog = Windows.Forms.DialogResult.OK Then
dgv46109046.CurrentRow.Cells("KODEBARANG").Value = latihan38_39_40_46109046.dgv46109046.CurrentRow.Cells("KODEBARANG").Value
dgv46109046.CurrentRow.Cells("NAMABARANG").Value = latihan38_39_40_46109046.dgv46109046.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf dgv46109046.Columns(e.ColumnIndex).Name = "UNIT" Or dgv46109046.Columns(e.ColumnIndex).Name = "HARGA" Then
dgv46109046.CurrentRow.Cells("JUMLAH").Value = dgv46109046.CurrentRow.Cells("UNIT").Value * dgv46109046.CurrentRow.Cells("HARGA").Value
asmianti()
End If
End Sub
Private Sub asmianti()
BalasHapusDim asmianti1 As Integer = 0
For Each asmianti2 As DataRow In dt.Rows
asmianti1 += asmianti2("JUMLAH")
Next
Tot46109046.Text = asmianti1
End Sub
Private Sub Button146109043_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109046.Click
If nt46109046.Text.Length = 0 Then
MsgBox("Isi No Transaksinya")
Exit Sub
End If
If jt46109046.Text.Length = 0 Then
MsgBox("Isi Jenis Transaksinya")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Isi datatable k")
Exit Sub
End If
amhy.AturPencarianDataBase("mastertransaksi", "notrans", nt46109046.Text, 1, asmi)
If amhy.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt46109046.Text & "',#" & dtp46109046.Value.Month & "/" & dtp46109046.Value.Day & "/" & dtp46109046.Value.Year & "#,'" & jt46109046.Text & "')", asmi)
asmi.Open()
cm.ExecuteNonQuery()
asmi.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt46109046.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", asmi)
asmi.Open()
cm.ExecuteNonQuery()
asmi.Close()
Next
cm.Dispose()
nt46109046.Text = ""
jt46109046.Text = ""
Tot46109046.Text = ""
dt.Rows.Clear()
asmianti()
End Sub
End Class
Public Class LATIHAN3946109026
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=26")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN039012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ibeng As New OleDb.OleDbDataAdapter
ibeng = 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= '" & nomor46109026.Text & "'", CONECT)
DT.Rows.Clear()
ibeng.Fill(DT)
data46109026.DataSource = DT
ibeng.Dispose()
Dim farah(1) As DataColumn
farah(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = farah
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In DT.Rows
TOT = TOT + x("JUMLAH")
Next
total46109026.Text = TOT
End Sub
Private Sub Data46109026_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles data46109026.CellEndEdit
If data46109026.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
data46109026.CurrentRow.Cells("NAMABARANG").Value = ""
data46109026.CurrentRow.Cells("UNIT").Value = 0
data46109026.CurrentRow.Cells("HARGA").Value = 0
data46109026.CurrentRow.Cells("JUMLAH").Value = 0
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", data46109026.CurrentRow.Cells("KODEBARANG").Value, 1, CONECT)
If Pencari.JumlanBaris > 0 Then
data46109026.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
data46109026.CurrentRow.Cells("KODEBARANG").Value = ""
If latihan3839400026.ShowDialog = Windows.Forms.DialogResult.OK Then
data46109026.CurrentRow.Cells("KODEBARANG").Value = latihan3839400026.DATA46109026.CurrentRow.Cells("KODEBARANG").Value
data46109026.CurrentRow.Cells("NAMABARANG").Value = latihan3839400026.DATA46109026.CurrentRow.Cells("NAMABARANG").Value
End If
End If
ElseIf data46109026.Columns(e.ColumnIndex).Name = "UNIT" Or data46109026.Columns(e.ColumnIndex).Name = "HARGA" Then
data46109026.CurrentRow.Cells("JUMLAH").Value = data46109026.CurrentRow.Cells("UNIT").Value * data46109026.CurrentRow.Cells("HARGA").Value
TOTALJUMLAH()
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
BalasHapusIf nomor46109026.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If jenis46109026.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nomor46109026.Text, 1, CONECT)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nomor46109026.Text & "', #" & tanggal46109026.Value.Month & "/" & tanggal46109026.Value.Day & "/" & tanggal46109026.Value.Year & "#, '" & jenis46109026.Text & "')", CONECT)
CONECT.Open()
CM.ExecuteNonQuery()
CONECT.Close()
For Each X As DataRow In DT.Rows
CM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nomor46109026.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", CONECT)
CONECT.Open()
CM.ExecuteNonQuery()
CONECT.Close()
CM.Dispose()
Next
nomor46109026.Text = ""
jenis46109026.Text = ""
DT.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
BalasHapusIf nt46109033.Text.Length = 0 Then
MsgBox("No. transaksi sudah ada")
Exit Sub
End If
If jt46109033.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109033.Text, 1, CONECT)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim CM As New OleDb.OleDbCommand
CM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt46109033.Text & "', #" & DateTimePicker1.Value.Month & "/" & DateTimePicker1.Value.Day & "/" & DateTimePicker1.Value.Year & "#, '" & jt46109033.Text & "')", CONECT)
CONECT.Open()
CM.ExecuteNonQuery()
CONECT.Close()
For Each X As DataRow In DT.Rows
CM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109033.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", CONECT)
CONECT.Open()
CM.ExecuteNonQuery()
CONECT.Close()
CM.Dispose()
Next
nt46109033.Text = ""
jt46109033.Text = ""
DT.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class