Dim Diahasrini As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=07") Dim diaz As New DataTable Dim jhe As DataRow
Private Sub Latihan38_46109035_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nt_46109035.Text & "'", Diahasrini) X.Fill(diaz) X.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = diaz.Columns("KODEBARANG") diaz.PrimaryKey = dataPrimary
dgv_46109035.DataSource = diaz End Sub
Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In diaz.Rows TOT = TOT + x("JUMLAH") Next Tot_46109035.Text = TOT
End Sub
Private Sub kb_46109035_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb_46109035.Leave If kb_46109035.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_46109035.Text, 1, Diahasrini) If Pencari.JumlanBaris > 0 Then kb_46109035.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") nb_46109035.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If Latihan3839400035.ShowDialog = Windows.Forms.DialogResult.OK Then kb_46109035.Text = Latihan3839400035.DGV_46109035.CurrentRow.Cells("KodeBarang").Value nb_46109035.Text = Latihan3839400035.DGV_46109035.CurrentRow.Cells("NamaBarang").Value Else kb_46109035.Text = "" End If End If End Sub
Private Sub kb_46109035_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_46109035.TextChanged nb_46109035.Text = "" un_46109035.Text = "" hr_46109035.Text = "" End Sub
Private Sub un_46109035_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_46109035.TextChanged, hr_46109035.TextChanged jm_46109035.Text = Val(un_46109035.Text) * Val(hr_46109035.Text) End Sub Private Sub Bt1_46109035_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt1_46109035.Click
If kb_46109035.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If nb_46109035.Text.Length = 0 Then MsgBox("Nama barang sudah ada") End If
If Val(un_46109035.Text) = 0 Then MsgBox("Masukkan unit barang") Exit Sub End If
If Val(hr_46109035.Text) = 0 Then MsgBox("Masukkan harga barang barang") Exit Sub End If
jhe = diaz.Rows.Find(kb_46109035.Text)
If jhe Is Nothing Then jhe = diaz.NewRow jhe("KODEBARANG") = kb_46109035.Text Else MsgBox("Maaf kodebarang sudah ada") Exit Sub End If
Dim faradillah As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=46") Dim rivai As DataRow Dim fara As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN038_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= '" & kb46109010.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 KB46109010_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109010.Leave If kb46109010.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109010.Text, 1, faradillah) If Pencari.JumlanBaris > 0 Then kb46109010.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") nb46109010.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If Latihan383940_46109010.ShowDialog = Windows.Forms.DialogResult.OK Then kb46109010.Text = Latihan383940_46109010.DGV46109010.CurrentRow.Cells("KodeBarang").Value
LANJUTAN 38 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 Latihan038_46109015 Dim qayyimah As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=015") Dim imah As DataRow Dim data As New DataTable Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan038_46109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim ima As New OleDb.OleDbDataAdapter ima = 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= '" & kb46109015.Text & "'", qayyimah) data.Rows.Clear() ima.Fill(data) dgv46109015.DataSource = data
ima.Dispose()
Dim datah(1) As DataColumn datah(0) = data.Columns("KODEBARANG") data.PrimaryKey = datah End Sub
Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In data.Rows TOT = TOT + x("JUMLAH") Next Tot46109015.Text = TOT End Sub
Private Sub kb46109015_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109015.Leave If kb46109015.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109015.Text, 1, qayyimah) If Pencari.JumlanBaris > 0 Then kb46109015.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") nb46109015.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else
MsgBox("Kode barang tersebut tidak ada") If Latihan383940_46109015.ShowDialog = Windows.Forms.DialogResult.OK Then kb46109015.Text = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("KodeBarang").Value nb46109015.Text = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("NamaBarang").Value Else kb46109015.Text = "" End If End If End Sub
Private Sub kb46109015_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109015.TextChanged nb46109015.Text = "" un46109015.Text = "" hr46109015.Text = "" End Sub
Private Sub U46109015_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un46109015.TextChanged, hr46109015.TextChanged jm46109015.Text = Val(un46109015.Text) * Val(hr46109015.Text) End Sub
Private Sub T46109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t46109015.Click If kb46109015.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If nb46109015.Text.Length = 0 Then MsgBox("Nama barang sudah ada") End If
If Val(un46109015.Text) = 0 Then MsgBox("Masukkan unit barang") Exit Sub End If
If Val(hr46109015.Text) = 0 Then MsgBox("Masukkan harga barang barang") Exit 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("No. transaksi sudah ada") Exit Sub End If
If jt46109015.Text.Length = 0 Then MsgBox("Jenis transaksi sudah ada") Exit Sub End If
If data.Rows.Count = 0 Then MsgBox("Jumlah baris tidak terisi") Exit Sub End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109015.Text, 1, qayyimah) 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 ('" & nt46109015.Text & "', #" & tgl46109015.Value.Month & "/" & tgl46109015.Value.Day & "/" & tgl46109015.Value.Year & "#, '" & jt46109015.Text & "')", qayyimah) qayyimah.Open() CM.ExecuteNonQuery() qayyimah.Close()
For Each X As DataRow In data.Rows CM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109015.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", qayyimah) qayyimah.Open() CM.ExecuteNonQuery() qayyimah.Close() CM.Dispose() Next
Dim Nurmuhitha As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=12345") Dim itha As New DataTable Dim tha As DataRow
Private Sub Latihan3846109047_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nt46109047.Text & "'", Nurmuhitha) X.Fill(itha) X.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = itha.Columns("KODEBARANG") itha.PrimaryKey = dataPrimary
dgv46109047.DataSource = itha End Sub
Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In itha.Rows TOT = TOT + x("JUMLAH") Next Tot46109047.Text = TOT
End Sub
Private Sub KB_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109047.Leave If kb46109047.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109047.Text, 1, Nurmuhitha) If Pencari.JumlanBaris > 0 Then kb46109047.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") nb46109047.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If Latihan3839400047.ShowDialog = Windows.Forms.DialogResult.OK Then kb46109047.Text = Latihan3839400047.DGV46109047.CurrentRow.Cells("KodeBarang").Value nb46109047.Text = Latihan3839400047.DGV46109047.CurrentRow.Cells("NamaBarang").Value Else kb46109047.Text = "" End If End If End Sub
Public Class TUGAS38 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 TUGAS38_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 TOT.Text = KIKIE1 End Sub
Private Sub HR_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HR.TextChanged JM.Text = Val(HR.Text) * Val(UN.Text) End Sub
Private Sub KB_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB.Leave If KB.Text.Length = 0 Then Exit Sub End If CARI.AturPencarianDataBase("barang", "kodebarang", KB.Text, 1, SRY) If CARI.JumlanBaris > 0 Then KB.Text = CARI.DataTablenya.Rows(0).Item("KODEBARANG") NB.Text = CARI.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang itu tidak ada..") If TUGAS383940.ShowDialog = Windows.Forms.DialogResult.OK Then KB.Text = TUGAS383940.DGV46109006.CurrentRow.Cells("KODEBARANG").Value NB.Text = TUGAS383940.DGV46109006.CurrentRow.Cells("NAMABARANG").Value Else KB.Text = "" End If End If End Sub
Private Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB.TextChanged NB.Text = "" UN.Text = "" HR.Text = "" End Sub
Private Sub TOMBOL1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOMBOL1.Click If KB.Text.Length = 0 Then MsgBox("Kode Barang belum terisi") Exit Sub End If
If Val(UN.Text) = 0 Then MsgBox("UNIT belum terisi") Exit Sub End If
If Val(HR.Text) = 0 Then MsgBox("HARGA belum terisi") Exit Sub End If
Dim KI2 As DataRow KI2 = REJEKI.Rows.Find(KB.Text) If KI2 Is Nothing Then KI2 = REJEKI.NewRow KI2("KODEBARANG") = KB.Text KI2("NAMABARANG") = NB.Text KI2("UNIT") = UN.Text KI2("HARGA") = HR.Text KI2("JUMLAH") = JM.Text
REJEKI.Rows.Add(KI2)
KB.Text = "" UN.Text = "" HR.Text = "" Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...") End If KIKIE() End Sub
Private Sub TOMBOL2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOMBOL2.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
Private Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109047.TextChanged nb46109047.Text = "" un46109047.Text = "" hr46109047.Text = "" End Sub
Private Sub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un46109047.TextChanged, hr46109047.TextChanged jm46109047.Text = Val(un46109047.Text) * Val(hr46109047.Text) End Sub Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If kb46109047.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If nb46109047.Text.Length = 0 Then MsgBox("Nama barang sudah ada") End If
If Val(un46109047.Text) = 0 Then MsgBox("Masukkan unit barang") Exit Sub End If
If Val(hr46109047.Text) = 0 Then MsgBox("Masukkan harga barang barang") Exit Sub End If
tha = itha.Rows.Find(kb46109047.Text)
If tha Is Nothing Then tha = itha.NewRow tha("KODEBARANG") = kb46109047.Text Else MsgBox("Maaf kodebarang sudah ada") Exit Sub End If
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.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 itha.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 NN As New OleDb.OleDbCommand NN = 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() NN.ExecuteNonQuery() Nurmuhitha.Close()
For Each X As DataRow In itha.Rows NN = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109047.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Nurmuhitha) Nurmuhitha.Open() NN.ExecuteNonQuery() Nurmuhitha.Close() NN.Dispose() Next
Dim CONECT AsNew OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= "& Application.StartupPath &"\DATAMAJEMUK.accdb;jet oledb:database Password=KYKY") Dim DT AsNew DataTable Dim DR As DataRow
PrivateSub Latihan38_46109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load Dim X AsNew 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_46109050.Text &"'", CONECT) X.Fill(DT) X.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dataPrimary
DGV_46109050.DataSource = DT EndSub
PrivateSub TOTALJUMLAH() Dim TOT AsDouble = 0 ForEach x As DataRow In DT.Rows TOT = TOT + x("JUMLAH") Next TOT_46109050.Text = TOT
EndSub
PrivateSub KB_46109050_Leave(ByVal sender AsObject, ByVal e As System.EventArgs) Handles KB_46109050.Leave If KB_46109050.Text.Length = 0 Then ExitSub EndIf
Dim Pencari AsNew ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB_46109050.Text, 1, CONECT) If Pencari.JumlanBaris > 0 Then KB_46109050.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") NB_46109050.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If Latihan383940_46109050.ShowDialog = Windows.Forms.DialogResult.OK Then KB_46109050.Text = Latihan383940_46109050.DGV_46109050.CurrentRow.Cells("KodeBarang").Value NB_46109050.Text = Latihan383940_46109050.DGV_46109050.CurrentRow.Cells("NamaBarang").Value Else KB_46109050.Text = "" EndIf EndIf EndSub
PrivateSub kb_46109050_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_46109050.TextChanged NB_46109050.Text = "" UNT_46109050.Text = "" HRG_46109050.Text = "" EndSub
PrivateSub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UNT_46109050.TextChanged, HRG_46109050.TextChanged JMLH_46109050.Text = Val(UNT_46109050.Text) * Val(HRG_46109050.Text) EndSub PrivateSub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BUTTON1_46109050.Click
If KB_46109050.Text.Length = 0 Then MsgBox("Kode barang sudah ada") ExitSub EndIf
If NB_46109050.Text.Length = 0 Then MsgBox("Nama barang sudah ada") EndIf
If Val(UNT_46109050.Text) = 0 Then MsgBox("Masukkan unit barang") ExitSub EndIf
If Val(HRG_46109050.Text) = 0 Then MsgBox("Masukkan harga barang barang") ExitSub EndIf
DR = DT.Rows.Find(KB_46109050.Text)
If DR IsNothingThen DR = DT.NewRow DR("KODEBARANG") = KB_46109050.Text Else MsgBox("Maaf kodebarang sudah ada") ExitSub EndIf
PrivateSub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BUTTON2_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 DT.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 NN AsNew OleDb.OleDbCommand NN = 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() NN.ExecuteNonQuery() CONECT.Close()
ForEach X As DataRow In DT.Rows NN = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('"& NT_46109050.Text &"','"& X("KODEBARANG") &"',"& X("UNIT") &", "& X("HARGA") &")", CONECT) CONECT.Open() NN.ExecuteNonQuery() CONECT.Close() NN.Dispose() Next
Dim yayu As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=12345") Dim tabel As New DataTable Dim ayu As DataRow
Private Sub Latihan38_46109004_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nt46109004.Text & "'", yayu) X.Fill(tabel) X.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = tabel.Columns("KODEBARANG") tabel.PrimaryKey = dataPrimary
dgv46109004.DataSource = tabel End Sub
Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In tabel.Rows TOT = TOT + x("JUMLAH") Next Tot46109004.Text = TOT
End Sub
Private Sub KB_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109004.Leave If kb46109004.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109004.Text, 1, yayu) If Pencari.JumlanBaris > 0 Then kb46109004.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") nb46109004.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If Latihan38_46109004.ShowDialog = Windows.Forms.DialogResult.OK Then kb46109004.Text = Latihan38_46109004.DGV46109047.CurrentRow.Cells("KodeBarang").Value nb46109004.Text = Latihan38_46109004.DGV46109047.CurrentRow.Cells("NamaBarang").Value Else kb46109004.Text = "" End If End If End Sub
Private Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109047.TextChanged nb46109004.Text = "" un46109004.Text = "" hr46109004.Text = "" End Sub
Private Sub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un46109004.TextChanged, hr46109004.TextChanged jm46109004.Text = Val(un46109004.Text) * Val(hr46109004.Text) End Sub
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.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 tabel.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 NN As New OleDb.OleDbCommand NN = 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() NN.ExecuteNonQuery() yayu.Close()
For Each X As DataRow In tabel.Rows NN = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109004.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", yayu) yayu.Open() NN.ExecuteNonQuery() yayu.Close() NN.Dispose() Next
Dim Conect As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=yusri") Dim DT As New DataTable Dim DR As DataRow
Private Sub Latihan38_46109038_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI ICommandER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NoTrans_46109038.Text & "'", Conect) X.Fill(DT) X.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dataPrimary
DGV_46109038.DataSource = DT End Sub
Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In DT.Rows TOT = TOT + x("JUMLAH") Next Total_46109038.Text = TOT
End Sub
Private Sub KB_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Kobar_46109038.Leave If Kobar_46109038.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", Kobar_46109038.Text, 1, Conect) If Pencari.JumlanBaris > 0 Then Kobar_46109038.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") Nambar_46109038.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If Latihan38_39_40_46109038.ShowDialog = Windows.Forms.DialogResult.OK Then Kobar_46109038.Text = Latihan38_39_40_46109038.DGV_46109038.CurrentRow.Cells("KodeBarang").Value Nambar_46109038.Text = Latihan38_39_40_46109038.DGV46109047.CurrentRow.Cells("NamaBarang").Value Else Kobar_46109038.Text = "" End If End If End Sub
Private Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kobar_46109038.TextChanged Nambar_46109038.Text = "" Unit_46109038.Text = "" Harga_46109038.Text = "" End Sub
Private Sub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Unit_46109038.TextChanged, Harga_46109038.TextChanged Jumlah_46109038.Text = Val(Unit_46109038.Text) * Val(Harga_46109038.Text) End Sub Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah_46109038.Click
If Kobar_46109038.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If Nambar_46109038.Text.Length = 0 Then MsgBox("Nama barang sudah ada") End If
If Val(Unit_46109038.Text) = 0 Then MsgBox("Masukkan unit barang") Exit Sub End If
If Val(Harga_46109038.Text) = 0 Then MsgBox("Masukkan harga barang barang") Exit Sub End If
DR = DT.Rows.Find(Kobar_46109038.Text)
If DR Is Nothing Then DR = DT.NewRow DR("KODEBARANG") = Kobar_46109038.Text Else MsgBox("Maaf kodebarang sudah ada") Exit Sub End If
Private Sub Simpan_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 DT.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 Command As New OleDb.OleDbCommand Command = 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() Command.ExecuteNonQuery() Conect.Close()
For Each X As DataRow In DT.Rows Command = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NoTrans_46109038.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Conect) Conect.Open() Command.ExecuteNonQuery() Conect.Close() Command.Dispose() Next
Dim Vero As New OleDb.OleDbCoVDection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=allah swt") Dim vesa As New DataTable Dim deka As DataRow
Private Sub Latihan3846109052_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI IVDER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nt46109052.Text & "'", Vero) X.Fill(vesa) X.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = vesa.Columns("KODEBARANG") vesa.PrimaryKey = dataPrimary
dgv46109052.DataSource = vesa End Sub
Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In vesa.Rows TOT = TOT + x("JUMLAH") Next Tot46109052.Text = TOT
End Sub
Private Sub KB_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109052.Leave If kb46109052.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109052.Text, 1, Vero) If Pencari.JumlanBaris > 0 Then kb46109052.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") nb46109052.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If Latihan3839400052.ShowDialog = Windows.Forms.DialogResult.OK Then kb46109052.Text = Latihan3839400052.DGV46109052.CurrentRow.Cells("KodeBarang").Value nb46109052.Text = Latihan3839400052.DGV46109052.CurrentRow.Cells("NamaBarang").Value Else kb46109052.Text = "" End If End If End Sub Private Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109052.TextChanged nb46109052.Text = "" un46109052.Text = "" hr46109052.Text = "" End Sub
Private Sub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un46109052.TextChanged, hr46109052.TextChanged jm46109052.Text = Val(un46109052.Text) * Val(hr46109052.Text) End Sub Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If kb46109052.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If nb46109052.Text.Length = 0 Then MsgBox("Nama barang sudah ada") End If
If Val(un46109052.Text) = 0 Then MsgBox("Masukkan unit barang") Exit Sub End If
If Val(hr46109052.Text) = 0 Then MsgBox("Masukkan harga barang barang") Exit Sub End If
TOTALJUMLAH() End Sub Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.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 vesa.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 VD As New OleDb.OleDbCommand VD = 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() VD.ExecuteNonQuery() Vero.Close()
For Each X As DataRow In vesa.Rows VD = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109052.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Vero) Vero.Open() VD.ExecuteNonQuery() Vero.Close() VD.Dispose() Next
Public Class LATIHAN038_46109020 Dim HUBUNG As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=46") Dim TARI As New DataTable Dim tata As DataRow
Private Sub LATIHAN038_46109020_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NT46109020.Text & "'", HUBUNG) X.Fill(TARI) X.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = TARI.Columns("KODEBARANG") TARI.PrimaryKey = dataPrimary
DGV46109020.DataSource = TARI End Sub
Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In TARI.Rows TOT = TOT + x("JUMLAH") Next TOT46109020.Text = TOT
End Sub
Private Sub KB46109020_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB46109020.Leave If KB46109020.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB46109020.Text, 1, HUBUNG) If Pencari.JumlanBaris > 0 Then KB46109020.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") NB46109020.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If Latihan383940_46109020.ShowDialog = Windows.Forms.DialogResult.OK Then KB46109020.Text = Latihan383940_46109020.DGV46109020.CurrentRow.Cells("KodeBarang").Value NB46109020.Text = Latihan383940_46109020.DGV46109020.CurrentRow.Cells("NamaBarang").Value Else KB46109020.Text = "" End If End If End Sub
Private Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB46109020.TextChanged NB46109020.Text = "" UN46109020.Text = "" HR46109020.Text = "" End Sub
Private Sub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UN46109020.TextChanged, HR46109020.TextChanged JM46109020.Text = Val(UN46109020.Text) * Val(HR46109020.Text) End Sub Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH46109020.Click
If KB46109020.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If NB46109020.Text.Length = 0 Then MsgBox("Nama barang sudah ada") End If
If Val(UN46109020.Text) = 0 Then MsgBox("Masukkan unit barang") Exit Sub End If
If Val(HR46109020.Text) = 0 Then MsgBox("Masukkan harga barang barang") Exit Sub End If
tata = TARI.Rows.Find(KB46109020.Text)
If tata Is Nothing Then tata = TARI.NewRow tata("KODEBARANG") = KB46109020.Text Else MsgBox("Maaf kodebarang sudah ada") Exit Sub End If
Private Sub Simpan_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 TARI.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, HUBUNG) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim NN As New OleDb.OleDbCommand NN = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT46109020.Text & "', #" & DT46109020.Value.Month & "/" & DT46109020.Value.Day & "/" & DT46109020.Value.Year & "#, '" & JT46109020.Text & "')", HUBUNG) HUBUNG.Open() NN.ExecuteNonQuery() HUBUNG.Close()
For Each X As DataRow In TARI.Rows NN = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT46109020.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", HUBUNG) HUBUNG.Open() NN.ExecuteNonQuery() HUBUNG.Close() NN.Dispose() Next
Dim n As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=8") Dim dt As New DataTable Dim dr As DataRow
Private Sub Form37_46109042_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nt46109042.Text & "'", n) X.Fill(dt) X.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = dt.Columns("KODEBARANG") dt.PrimaryKey = dataPrimary
dgv46109042.DataSource = dt End Sub
Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In dt.Rows TOT = TOT + x("JUMLAH") Next Tot46109042.Text = TOT End Sub
Private Sub kb46109042_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109042.Leave If kb46109042.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109042.Text, 1, n) If Pencari.JumlanBaris > 0 Then kb46109042.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") nb46109042.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") Exit Sub End If End Sub
Dim dt As New DataTable 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 Form38_39_40_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 * FROM BARANG", batari) dt.Rows.Clear() a.Fill(dt) a.Dispose()
Private Sub kb46109043_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109043.TextChanged nb46109043.Text = "" un46109043.Text = "" hr46109043.Text = "" End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109043.Click If kb46109043.Text.Length = 0 Then MsgBox("Isi Kode Barang nya") Exit Sub End If
If Val(un46109043.Text) = 0 Then MsgBox("Isi Unit nya") Exit Sub End If
If Val(hr46109043.Text) = 0 Then MsgBox("Isi Harga nya") Exit Sub End If
Dim dr As DataRow dr = dt.Rows.Find(kb46109043.Text) If dr Is Nothing Then dr = dt.NewRow dr("KODEBARANG") = kb46109043.Text dr("NAMABARANG") = nb46109043.Text dr("UNIT") = un46109043.Text dr("HARGA") = hr46109043.Text dr("JUMLAH") = jm46109043.Text
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain") End If andiva() End Sub
Private Sub Button246109043_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109043.Click If nt46109043.Text.Length = 0 Then MsgBox("Isi rong itu No Transaksi na..") Exit Sub End If
If jt46109043.Text.Length = 0 Then MsgBox("Isi rong itu Jenis Transaksi na..") Exit Sub End If
If dt.Rows.Count = 0 Then MsgBox("Isi rong itu datatable na..") Exit Sub End If
diva.AturPencarianDataBase("mastertransaksi", "notrans", nt46109043.Text, 1, fara) If diva.JumlanBaris > 0 Then MsgBox("Adami No Transaksi 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 cm.Dispose()
Dim dt As New DataTable Dim fara As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.ajt46109043db;jet OLEDB:database password=21")
Private Sub Form38_39_40_46109043_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 * FROM BARANG", fara) dt.Rows.Clear() a.Fill(dt) a.Dispose()
Private Sub TH46109044_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TH46109044.Click If KB46109044.Text.Length = 0 Then MsgBox("Isi rong itu Kode Barang na..") Exit Sub End If
If Val(U46109044.Text) = 0 Then MsgBox("Isi rong itu Unit na..") Exit Sub End If
If Val(H46109044.Text) = 0 Then MsgBox("Isi rong itu Harga na..") Exit Sub End If
Dim dr As DataRow dr = dt.Rows.Find(KB46109044.Text) If dr Is Nothing Then dr = dt.NewRow dr("KODEBARANG") = KB46109044.Text dr("NAMABARANG") = NB46109044.Text dr("UNIT") = U46109044.Text dr("HARGA") = H46109044.Text dr("JUMLAH") = J46109044.Text
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain") End If lirhas() End Sub
Private Sub S46109044_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles S46109044.Click If NT46109044.Text.Length = 0 Then MsgBox("Isi rong itu No Transaksi na..") Exit Sub End If
If JT46109044.Text.Length = 0 Then MsgBox("Isi rong itu Jenis Transaksi na..") Exit Sub End If
If dt.Rows.Count = 0 Then MsgBox("Isi rong itu datatable na..") Exit Sub End If
syahril.AturPencarianDataBase("mastertransaksi", "notrans", NT46109044.Text, 1, hma) If syahril.JumlanBaris > 0 Then MsgBox("Adami No Transaksi 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 ('" & NT46109044.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", hma) hma.Open() cm.ExecuteNonQuery() hma.Close() Next cm.Dispose()
Private Sub Button146109046_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109046.Click If kb46109046.Text.Length = 0 Then MsgBox("Isi Kode Barang nya") Exit Sub End If
If Val(un46109046.Text) = 0 Then MsgBox("Isi Unit nya") Exit Sub End If
If Val(hr46109046.Text) = 0 Then MsgBox("Isi Harga nya") Exit Sub End If
Dim dr As DataRow dr = dt.Rows.Find(kb46109046.Text) If dr Is Nothing Then dr = dt.NewRow dr("KODEBARANG") = kb46109046.Text dr("NAMABARANG") = nb46109046.Text dr("UNIT") = un46109046.Text dr("HARGA") = hr46109046.Text dr("JUMLAH") = jm46109046.Text
Else MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain") End If asmianti() End Sub
Private Sub Button246109046_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109046.Click If nt46109046.Text.Length = 0 Then MsgBox("Isi rong itu No Transaksi na..") Exit Sub End If
If jt46109046.Text.Length = 0 Then MsgBox("Isi rong itu Jenis Transaksi na..") Exit Sub End If
If dt.Rows.Count = 0 Then MsgBox("Isi rong itu datatable na..") Exit Sub End If
amhy.AturPencarianDataBase("mastertransaksi", "notrans", nt46109046.Text, 1, asmi) If amhy.JumlanBaris > 0 Then MsgBox("Adami No Transaksi 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 cm.Dispose()
Dim ibeng As New DataTable Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=26")
Private Sub Latihan383940026_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim ibhe As New OleDb.OleDbDataAdapter ibhe = New OleDb.OleDbDataAdapter("SELECT * FROM BARANG", conect) ibeng.Rows.Clear() ibhe.Fill(ibeng) ibhe.Dispose()
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 DR As DataRow Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN038012_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nomor46109026.Text & "'", CONECT) DT.Rows.Clear() X.Fill(DT) data46109026.DataSource = DT
X.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dataPrimary End Sub Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In DT.Rows TOT = TOT + x("JUMLAH") Next jumlah46109026.Text = TOT End Sub Private Sub kode46109026_leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode46109026.Leave If kode46109026.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kode46109026.Text, 1, CONECT) If Pencari.JumlanBaris > 0 Then kode46109026.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") nama46109026.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If latihan3839400026.ShowDialog = Windows.Forms.DialogResult.OK Then kode46109026.Text = latihan3839400026.DATA46109026.CurrentRow.Cells("kodebarang").Value nama46109026.Text = latihan3839400026.DATA46109026.CurrentRow.Cells("namabarang").Value Else kode46109026.Text = "" End If End If End Sub Private Sub kode46109026_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode46109026.TextChanged nama46109026.Text = "" unit46109026.Text = "" harga46109026.Text = "" End Sub Private Sub unit46109026_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles unit46109026.TextChanged, harga46109026.TextChanged jumlah46109026.Text = Val(unit46109026.Text) * Val(harga46109026.Text) End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If kode46109026.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If nama46109026.Text.Length = 0 Then MsgBox("Nama barang sudah ada") End If
If Val(unit46109026.Text) = 0 Then MsgBox("Masukkan unit barang") Exit Sub End If
If Val(harga46109026.Text) = 0 Then MsgBox("Masukkan harga barang barang") Exit Sub End If
DR = DT.Rows.Find(kode46109026.Text)
If DT Is Nothing Then DR = DT.NewRow DR("KODEBARANG") = kode46109026.Text Else MsgBox("Maaf kodebarang sudah ada") Exit Sub End If
TOTALJUMLAH() End Sub 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 ibeng As New OleDb.OleDbCommand ibeng = 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() ibeng.ExecuteNonQuery() CONECT.Close()
For Each X As DataRow In DT.Rows ibeng = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nomor46109026.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", CONECT) CONECT.Open() ibeng.ExecuteNonQuery() CONECT.Close() ibeng.Dispose() Next
Public Class tugas3846109033 Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=033") Dim DT As New DataTable Dim DR As DataRow Dim cari As New ByIskandar.CariKeDataBaseByIskandar Private Sub tugas3846109033_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & no46109033.Text & "'", CONECT) DT.Rows.Clear() X.Fill(DT) DataGridView1.DataSource = DT
X.Dispose()
Dim dataPrimary(1) As DataColumn dataPrimary(0) = DT.Columns("KODEBARANG") DT.PrimaryKey = dataPrimary End Sub Private Sub TOTALJUMLAH() Dim TOT As Double = 0 For Each x As DataRow In DT.Rows TOT = TOT + x("JUMLAH") Next Tot46109033.Text = TOT End Sub Private Sub kb46109033_leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109033.Leave If kb46109033.Text.Length = 0 Then Exit Sub End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109033.Text, 1, CONECT) If Pencari.JumlanBaris > 0 Then kb46109033.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG") nb46109033.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG") Else MsgBox("Kode barang tersebut tidak ada") If tugas38394046109033.ShowDialog = Windows.Forms.DialogResult.OK Then kb46109033.Text = tugas38394046109033.DataGridView146109033.CurrentRow.Cells("KodeBarang").Value nb46109033.Text = tugas38394046109033.DataGridView146109033.CurrentRow.Cells("NamaBarang").Value Else kb46109033.Text = "" End If End If End Sub Private Sub kb46109033_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109033.TextChanged nb46109033.Text = "" un46109033.Text = "" hr46109033.Text = "" End Sub Private Sub un46109033_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un46109033.TextChanged, hr46109033.TextChanged jm46109033.Text = Val(un46109033.Text) * Val(hr46109033.Text) End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click If kb46109033.Text.Length = 0 Then MsgBox("Kode barang sudah ada") Exit Sub End If
If nb46109033.Text.Length = 0 Then MsgBox("Nama barang sudah ada") End If
If Val(un46109033.Text) = 0 Then MsgBox("Masukkan unit barang") Exit Sub End If
If Val(hr46109033.Text) = 0 Then MsgBox("Masukkan harga barang barang") Exit Sub End If
DR = DT.Rows.Find(kb46109033.Text)
If DT Is Nothing Then DR = DT.NewRow DR("KODEBARANG") = kb46109033.Text Else MsgBox("Maaf kodebarang sudah ada") Exit Sub End If
TOTALJUMLAH() End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click If nt.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", nt.Text, 1, CONECT) If pencari.JumlanBaris > 0 Then MsgBox("data tersebut sudah ada") Exit Sub End If
Dim tm As New OleDb.OleDbCommand tm = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt.Text & "', #" & DateTimePicker1.Value.Month & "/" & DateTimePicker1.Value.Day & "/" & DateTimePicker1.Value.Year & "#, '" & jt46109033.Text & "')", CONECT) CONECT.Open() tm.ExecuteNonQuery() CONECT.Close()
For Each X As DataRow In DT.Rows tm = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", CONECT) CONECT.Open() tm.ExecuteNonQuery() CONECT.Close() tm.Dispose() Next
maaf.. salah posting.. hehe :-D
BalasHapusKomentar ini telah dihapus oleh pengarang.
BalasHapusKomentar ini telah dihapus oleh pengarang.
BalasHapusPublic Class Latihan38_46109035
BalasHapusDim Diahasrini As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=07")
Dim diaz As New DataTable
Dim jhe As DataRow
Private Sub Latihan38_46109035_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nt_46109035.Text & "'", Diahasrini)
X.Fill(diaz)
X.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = diaz.Columns("KODEBARANG")
diaz.PrimaryKey = dataPrimary
dgv_46109035.DataSource = diaz
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In diaz.Rows
TOT = TOT + x("JUMLAH")
Next
Tot_46109035.Text = TOT
End Sub
Private Sub kb_46109035_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb_46109035.Leave
If kb_46109035.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb_46109035.Text, 1, Diahasrini)
If Pencari.JumlanBaris > 0 Then
kb_46109035.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
nb_46109035.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan3839400035.ShowDialog = Windows.Forms.DialogResult.OK Then
kb_46109035.Text = Latihan3839400035.DGV_46109035.CurrentRow.Cells("KodeBarang").Value
nb_46109035.Text = Latihan3839400035.DGV_46109035.CurrentRow.Cells("NamaBarang").Value
Else
kb_46109035.Text = ""
End If
End If
End Sub
Private Sub kb_46109035_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb_46109035.TextChanged
BalasHapusnb_46109035.Text = ""
un_46109035.Text = ""
hr_46109035.Text = ""
End Sub
Private Sub un_46109035_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un_46109035.TextChanged, hr_46109035.TextChanged
jm_46109035.Text = Val(un_46109035.Text) * Val(hr_46109035.Text)
End Sub
Private Sub Bt1_46109035_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Bt1_46109035.Click
If kb_46109035.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb_46109035.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(un_46109035.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(hr_46109035.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
Exit Sub
End If
jhe = diaz.Rows.Find(kb_46109035.Text)
If jhe Is Nothing Then
jhe = diaz.NewRow
jhe("KODEBARANG") = kb_46109035.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
FARADILLAH AMALIA RIVAI
BalasHapusPublic Class LATIHAN038_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 rivai As DataRow
Dim fara As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN038_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= '" & kb46109010.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 KB46109010_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109010.Leave
If kb46109010.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109010.Text, 1, faradillah)
If Pencari.JumlanBaris > 0 Then
kb46109010.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
nb46109010.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan383940_46109010.ShowDialog = Windows.Forms.DialogResult.OK Then
kb46109010.Text = Latihan383940_46109010.DGV46109010.CurrentRow.Cells("KodeBarang").Value
nb46109010.Text = Latihan383940_46109010.DGV46109010.CurrentRow.Cells("NamaBarang").Value
Else
kb46109010.Text = ""
End If
End If
End Sub
LANJUTAN LATIHAN 38 BY FARADILLAH AMALIA RIVAI
BalasHapusPrivate Sub KB46109010_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109010.TextChanged
nb46109010.Text = ""
un46109010.Text = ""
hr46109010.Text = ""
End Sub
Private Sub UN46109010_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un46109010.TextChanged, hr46109010.TextChanged
jm46109010.Text = Val(un46109010.Text) * Val(hr46109010.Text)
End Sub
Private Sub button146109010_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109010.Click
If kb46109010.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb46109010.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(un46109010.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(hr46109010.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
Exit Sub
End If
rivai = fara.Rows.Find(kb46109010.Text)
If rivai Is Nothing Then
rivai = fara.NewRow
rivai("KODEBARANG") = kb46109010.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
rivai = fara.NewRow
rivai("KODEBARANG") = kb46109010.Text
rivai("NAMABARANG") = nb46109010.Text
rivai("UNIT") = un46109010.Text
rivai("HARGA") = hr46109010.Text
rivai("JUMLAH") = jm46109010.Text
fara.Rows.Add(rivai)
kb46109010.Text = ""
nb46109010.Text = ""
un46109010.Text = ""
hr46109010.Text = ""
TOTALJUMLAH()
End Sub
LANJUTAN 38 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 = ""
jm46109010.Text = ""
fara.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
Public Class Latihan038_46109015
BalasHapusDim qayyimah As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=015")
Dim imah As DataRow
Dim data As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub Latihan038_46109015_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ima As New OleDb.OleDbDataAdapter
ima = 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= '" & kb46109015.Text & "'", qayyimah)
data.Rows.Clear()
ima.Fill(data)
dgv46109015.DataSource = data
ima.Dispose()
Dim datah(1) As DataColumn
datah(0) = data.Columns("KODEBARANG")
data.PrimaryKey = datah
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In data.Rows
TOT = TOT + x("JUMLAH")
Next
Tot46109015.Text = TOT
End Sub
Private Sub kb46109015_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109015.Leave
If kb46109015.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109015.Text, 1, qayyimah)
If Pencari.JumlanBaris > 0 Then
kb46109015.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
nb46109015.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan383940_46109015.ShowDialog = Windows.Forms.DialogResult.OK Then
kb46109015.Text = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("KodeBarang").Value
nb46109015.Text = Latihan383940_46109015.dgv46109015.CurrentRow.Cells("NamaBarang").Value
Else
kb46109015.Text = ""
End If
End If
End Sub
Private Sub kb46109015_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109015.TextChanged
nb46109015.Text = ""
un46109015.Text = ""
hr46109015.Text = ""
End Sub
Private Sub U46109015_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un46109015.TextChanged, hr46109015.TextChanged
jm46109015.Text = Val(un46109015.Text) * Val(hr46109015.Text)
End Sub
Private Sub T46109015_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles t46109015.Click
If kb46109015.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb46109015.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(un46109015.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(hr46109015.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
Exit Sub
Lanjutan.......
BalasHapusimah = data.Rows.Find(kb46109015.Text)
If imah Is Nothing Then
imah = data.NewRow
imah("KODEBARANG") = kb46109015.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
imah = data.NewRow
imah("KODEBARANG") = kb46109015.Text
imah("NAMABARANG") = nb46109015.Text
imah("UNIT") = un46109015.Text
imah("HARGA") = hr46109015.Text
imah("JUMLAH") = jm46109015.Text
data.Rows.Add(imah)
kb46109015.Text = ""
nb46109015.Text = ""
un46109015.Text = ""
hr46109015.Text = ""
TOTALJUMLAH()
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("No. transaksi sudah ada")
Exit Sub
End If
If jt46109015.Text.Length = 0 Then
MsgBox("Jenis transaksi sudah ada")
Exit Sub
End If
If data.Rows.Count = 0 Then
MsgBox("Jumlah baris tidak terisi")
Exit Sub
End If
Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", nt46109015.Text, 1, qayyimah)
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 ('" & nt46109015.Text & "', #" & tgl46109015.Value.Month & "/" & tgl46109015.Value.Day & "/" & tgl46109015.Value.Year & "#, '" & jt46109015.Text & "')", qayyimah)
qayyimah.Open()
CM.ExecuteNonQuery()
qayyimah.Close()
For Each X As DataRow In data.Rows
CM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109015.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", qayyimah)
qayyimah.Open()
CM.ExecuteNonQuery()
qayyimah.Close()
CM.Dispose()
Next
nt46109015.Text = ""
jt46109015.Text = ""
jm46109015.Text = ""
data.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
Public Class Latihan3846109047
BalasHapusDim Nurmuhitha As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=12345")
Dim itha As New DataTable
Dim tha As DataRow
Private Sub Latihan3846109047_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nt46109047.Text & "'", Nurmuhitha)
X.Fill(itha)
X.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = itha.Columns("KODEBARANG")
itha.PrimaryKey = dataPrimary
dgv46109047.DataSource = itha
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In itha.Rows
TOT = TOT + x("JUMLAH")
Next
Tot46109047.Text = TOT
End Sub
Private Sub KB_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109047.Leave
If kb46109047.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109047.Text, 1, Nurmuhitha)
If Pencari.JumlanBaris > 0 Then
kb46109047.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
nb46109047.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan3839400047.ShowDialog = Windows.Forms.DialogResult.OK Then
kb46109047.Text = Latihan3839400047.DGV46109047.CurrentRow.Cells("KodeBarang").Value
nb46109047.Text = Latihan3839400047.DGV46109047.CurrentRow.Cells("NamaBarang").Value
Else
kb46109047.Text = ""
End If
End If
End Sub
Public Class TUGAS38
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 TUGAS38_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
TOT.Text = KIKIE1
End Sub
Private Sub HR_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HR.TextChanged
JM.Text = Val(HR.Text) * Val(UN.Text)
End Sub
Private Sub KB_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB.Leave
If KB.Text.Length = 0 Then
Exit Sub
End If
CARI.AturPencarianDataBase("barang", "kodebarang", KB.Text, 1, SRY)
If CARI.JumlanBaris > 0 Then
KB.Text = CARI.DataTablenya.Rows(0).Item("KODEBARANG")
NB.Text = CARI.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang itu tidak ada..")
If TUGAS383940.ShowDialog = Windows.Forms.DialogResult.OK Then
KB.Text = TUGAS383940.DGV46109006.CurrentRow.Cells("KODEBARANG").Value
NB.Text = TUGAS383940.DGV46109006.CurrentRow.Cells("NAMABARANG").Value
Else
KB.Text = ""
End If
End If
End Sub
LANJUTAN TUGAS 38
BalasHapusPrivate Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB.TextChanged
NB.Text = ""
UN.Text = ""
HR.Text = ""
End Sub
Private Sub TOMBOL1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOMBOL1.Click
If KB.Text.Length = 0 Then
MsgBox("Kode Barang belum terisi")
Exit Sub
End If
If Val(UN.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(HR.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
Dim KI2 As DataRow
KI2 = REJEKI.Rows.Find(KB.Text)
If KI2 Is Nothing Then
KI2 = REJEKI.NewRow
KI2("KODEBARANG") = KB.Text
KI2("NAMABARANG") = NB.Text
KI2("UNIT") = UN.Text
KI2("HARGA") = HR.Text
KI2("JUMLAH") = JM.Text
REJEKI.Rows.Add(KI2)
KB.Text = ""
UN.Text = ""
HR.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain...")
End If
KIKIE()
End Sub
Private Sub TOMBOL2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TOMBOL2.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()
QI.Dispose()
Next
REJEKI.Rows.Clear()
KIKIE()
T146109006.Text = ""
T246109006.Text = ""
End Sub
End Class
Private Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109047.TextChanged
BalasHapusnb46109047.Text = ""
un46109047.Text = ""
hr46109047.Text = ""
End Sub
Private Sub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un46109047.TextChanged, hr46109047.TextChanged
jm46109047.Text = Val(un46109047.Text) * Val(hr46109047.Text)
End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If kb46109047.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb46109047.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(un46109047.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(hr46109047.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
Exit Sub
End If
tha = itha.Rows.Find(kb46109047.Text)
If tha Is Nothing Then
tha = itha.NewRow
tha("KODEBARANG") = kb46109047.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
tha = itha.NewRow
tha("KODEBARANG") = kb46109047.Text
tha("NAMABARANG") = nb46109047.Text
tha("UNIT") = un46109047.Text
tha("HARGA") = hr46109047.Text
tha("JUMLAH") = jm46109047.Text
itha.Rows.Add(tha)
kb46109047.Text = ""
nb46109047.Text = ""
un46109047.Text = ""
hr46109047.Text = ""
TOTALJUMLAH()
End Sub
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
BalasHapusIf 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 itha.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 NN As New OleDb.OleDbCommand
NN = 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()
NN.ExecuteNonQuery()
Nurmuhitha.Close()
For Each X As DataRow In itha.Rows
NN = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109047.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Nurmuhitha)
Nurmuhitha.Open()
NN.ExecuteNonQuery()
Nurmuhitha.Close()
NN.Dispose()
Next
nt46109047.Text = ""
jt46109047.Text = ""
jm46109047.Text = ""
itha.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
PublicClass Latihan38_46109050
BalasHapusDim CONECT AsNew OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= "& Application.StartupPath &"\DATAMAJEMUK.accdb;jet oledb:database Password=KYKY")
Dim DT AsNew DataTable
Dim DR As DataRow
PrivateSub Latihan38_46109050_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) HandlesMyBase.Load
Dim X AsNew 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_46109050.Text &"'", CONECT)
X.Fill(DT)
X.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dataPrimary
DGV_46109050.DataSource = DT
EndSub
PrivateSub TOTALJUMLAH()
Dim TOT AsDouble = 0
ForEach x As DataRow In DT.Rows
TOT = TOT + x("JUMLAH")
Next
TOT_46109050.Text = TOT
EndSub
PrivateSub KB_46109050_Leave(ByVal sender AsObject, ByVal e As System.EventArgs) Handles KB_46109050.Leave
If KB_46109050.Text.Length = 0 Then
ExitSub
EndIf
Dim Pencari AsNew ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB_46109050.Text, 1, CONECT)
If Pencari.JumlanBaris > 0 Then
KB_46109050.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
NB_46109050.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan383940_46109050.ShowDialog = Windows.Forms.DialogResult.OK Then
KB_46109050.Text = Latihan383940_46109050.DGV_46109050.CurrentRow.Cells("KodeBarang").Value
NB_46109050.Text = Latihan383940_46109050.DGV_46109050.CurrentRow.Cells("NamaBarang").Value
Else
KB_46109050.Text = ""
EndIf
EndIf
EndSub
Lanjutan Latihan38:
BalasHapusPrivateSub kb_46109050_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB_46109050.TextChanged
NB_46109050.Text = ""
UNT_46109050.Text = ""
HRG_46109050.Text = ""
EndSub
PrivateSub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UNT_46109050.TextChanged, HRG_46109050.TextChanged
JMLH_46109050.Text = Val(UNT_46109050.Text) * Val(HRG_46109050.Text)
EndSub
PrivateSub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BUTTON1_46109050.Click
If KB_46109050.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
ExitSub
EndIf
If NB_46109050.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
EndIf
If Val(UNT_46109050.Text) = 0 Then
MsgBox("Masukkan unit barang")
ExitSub
EndIf
If Val(HRG_46109050.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
ExitSub
EndIf
DR = DT.Rows.Find(KB_46109050.Text)
If DR IsNothingThen
DR = DT.NewRow
DR("KODEBARANG") = KB_46109050.Text
Else
MsgBox("Maaf kodebarang sudah ada")
ExitSub
EndIf
DR = DT.NewRow
DR("KODEBARANG") = KB_46109050.Text
DR("NAMABARANG") = NB_46109050.Text
DR("UNIT") = UNT_46109050.Text
DR("HARGA") = HRG_46109050.Text
DR("JUMLAH") = JMLH_46109050.Text
DT.Rows.Add(DR)
KB_46109050.Text = ""
NB_46109050.Text = ""
UNT_46109050.Text = ""
HRG_46109050.Text = ""
TOTALJUMLAH()
EndSub
PrivateSub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BUTTON2_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 DT.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 NN AsNew OleDb.OleDbCommand
NN = 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()
NN.ExecuteNonQuery()
CONECT.Close()
ForEach X As DataRow In DT.Rows
NN = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('"& NT_46109050.Text &"','"& X("KODEBARANG") &"',"& X("UNIT") &", "& X("HARGA") &")", CONECT)
CONECT.Open()
NN.ExecuteNonQuery()
CONECT.Close()
NN.Dispose()
Next
NT_46109050.Text = ""
JT_46109050.Text = ""
JMLH_46109050.Text = ""
DT.Rows.Clear()
TOTALJUMLAH()
EndSub
EndClass
Public Class Latihan38_46109004
BalasHapusDim yayu As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=12345")
Dim tabel As New DataTable
Dim ayu As DataRow
Private Sub Latihan38_46109004_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nt46109004.Text & "'", yayu)
X.Fill(tabel)
X.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = tabel.Columns("KODEBARANG")
tabel.PrimaryKey = dataPrimary
dgv46109004.DataSource = tabel
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In tabel.Rows
TOT = TOT + x("JUMLAH")
Next
Tot46109004.Text = TOT
End Sub
Private Sub KB_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109004.Leave
If kb46109004.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109004.Text, 1, yayu)
If Pencari.JumlanBaris > 0 Then
kb46109004.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
nb46109004.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan38_46109004.ShowDialog = Windows.Forms.DialogResult.OK Then
kb46109004.Text = Latihan38_46109004.DGV46109047.CurrentRow.Cells("KodeBarang").Value
nb46109004.Text = Latihan38_46109004.DGV46109047.CurrentRow.Cells("NamaBarang").Value
Else
kb46109004.Text = ""
End If
End If
End Sub
Private Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109047.TextChanged
nb46109004.Text = ""
un46109004.Text = ""
hr46109004.Text = ""
End Sub
Private Sub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un46109004.TextChanged, hr46109004.TextChanged
jm46109004.Text = Val(un46109004.Text) * Val(hr46109004.Text)
End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
BalasHapusIf kb46109004.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb46109004.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(un46109004.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(hr46109004.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
Exit Sub
End If
ayu = tabel.Rows.Find(kb46109004.Text)
If ayu Is Nothing Then
ayu = tabel.NewRow
ayu("KODEBARANG") = kb46109004.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
ayu = tabel.NewRow
ayu("KODEBARANG") = kb46109004.Text
ayu("NAMABARANG") = nb46109004.Text
ayu("UNIT") = un46109004.Text
ayu("HARGA") = hr46109004.Text
ayu("JUMLAH") = jm46109004.Text
tabel.Rows.Add(ayu)
kb46109004.Text = ""
nb46109004.Text = ""
un46109004.Text = ""
hr46109004.Text = ""
TOTALJUMLAH()
End Sub
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.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 tabel.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 NN As New OleDb.OleDbCommand
NN = 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()
NN.ExecuteNonQuery()
yayu.Close()
For Each X As DataRow In tabel.Rows
NN = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109004.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", yayu)
yayu.Open()
NN.ExecuteNonQuery()
yayu.Close()
NN.Dispose()
Next
nt46109004.Text = ""
jt46109004.Text = ""
jm46109004.Text = ""
tabel.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
andi muh yusri
BalasHapusPublic Class Latihan38_46109038
Dim Conect As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=yusri")
Dim DT As New DataTable
Dim DR As DataRow
Private Sub Latihan38_46109038_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI ICommandER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NoTrans_46109038.Text & "'", Conect)
X.Fill(DT)
X.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dataPrimary
DGV_46109038.DataSource = DT
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In DT.Rows
TOT = TOT + x("JUMLAH")
Next
Total_46109038.Text = TOT
End Sub
Private Sub KB_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Kobar_46109038.Leave
If Kobar_46109038.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", Kobar_46109038.Text, 1, Conect)
If Pencari.JumlanBaris > 0 Then
Kobar_46109038.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
Nambar_46109038.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan38_39_40_46109038.ShowDialog = Windows.Forms.DialogResult.OK Then
Kobar_46109038.Text = Latihan38_39_40_46109038.DGV_46109038.CurrentRow.Cells("KodeBarang").Value
Nambar_46109038.Text = Latihan38_39_40_46109038.DGV46109047.CurrentRow.Cells("NamaBarang").Value
Else
Kobar_46109038.Text = ""
End If
End If
End Sub
sambungan1
BalasHapusandi muh. yusri
Private Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kobar_46109038.TextChanged
Nambar_46109038.Text = ""
Unit_46109038.Text = ""
Harga_46109038.Text = ""
End Sub
Private Sub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Unit_46109038.TextChanged, Harga_46109038.TextChanged
Jumlah_46109038.Text = Val(Unit_46109038.Text) * Val(Harga_46109038.Text)
End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tambah_46109038.Click
If Kobar_46109038.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If Nambar_46109038.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(Unit_46109038.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(Harga_46109038.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
Exit Sub
End If
DR = DT.Rows.Find(Kobar_46109038.Text)
If DR Is Nothing Then
DR = DT.NewRow
DR("KODEBARANG") = Kobar_46109038.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
DR = DT.NewRow
DR("KODEBARANG") = Kobar_46109038.Text
DR("NAMABARANG") = Nambar_46109038.Text
DR("UNIT") = Unit_46109038.Text
DR("HARGA") = Harga_46109038.Text
DR("JUMLAH") = Jumlah_46109038.Text
DT.Rows.Add(DR)
Kobar_46109038.Text = ""
Nambar_46109038.Text = ""
Unit_46109038.Text = ""
Harga_46109038.Text = ""
TOTALJUMLAH()
End Sub
sambungan2
BalasHapusandi muh. yusri
Private Sub Simpan_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 DT.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 Command As New OleDb.OleDbCommand
Command = 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()
Command.ExecuteNonQuery()
Conect.Close()
For Each X As DataRow In DT.Rows
Command = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NoTrans_46109038.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Conect)
Conect.Open()
Command.ExecuteNonQuery()
Conect.Close()
Command.Dispose()
Next
NoTrans_46109038.Text = ""
JenTrans_46109038.Text = ""
Jumlah_46109038.Text = ""
DT.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
Public Class Latihan3846109052
BalasHapusDim Vero As New OleDb.OleDbCoVDection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=allah swt")
Dim vesa As New DataTable
Dim deka As DataRow
Private Sub Latihan3846109052_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI IVDER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nt46109052.Text & "'", Vero)
X.Fill(vesa)
X.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = vesa.Columns("KODEBARANG")
vesa.PrimaryKey = dataPrimary
dgv46109052.DataSource = vesa
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In vesa.Rows
TOT = TOT + x("JUMLAH")
Next
Tot46109052.Text = TOT
End Sub
Private Sub KB_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109052.Leave
If kb46109052.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109052.Text, 1, Vero)
If Pencari.JumlanBaris > 0 Then
kb46109052.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
nb46109052.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan3839400052.ShowDialog = Windows.Forms.DialogResult.OK Then
kb46109052.Text = Latihan3839400052.DGV46109052.CurrentRow.Cells("KodeBarang").Value
nb46109052.Text = Latihan3839400052.DGV46109052.CurrentRow.Cells("NamaBarang").Value
Else
kb46109052.Text = ""
End If
End If
End Sub
Private Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109052.TextChanged
nb46109052.Text = ""
un46109052.Text = ""
hr46109052.Text = ""
End Sub
Private Sub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un46109052.TextChanged, hr46109052.TextChanged
jm46109052.Text = Val(un46109052.Text) * Val(hr46109052.Text)
End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If kb46109052.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb46109052.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(un46109052.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(hr46109052.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
Exit Sub
End If
deka = vesa.Rows.Find(kb46109052.Text)
BalasHapusIf deka Is Nothing Then
deka = vesa.NewRow
deka("KODEBARANG") = kb46109052.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
deka = vesa.NewRow
deka("KODEBARANG") = kb46109052.Text
deka("NAMABARANG") = nb46109052.Text
deka("UNIT") = un46109052.Text
deka("HARGA") = hr46109052.Text
deka("JUMLAH") = jm46109052.Text
vesa.Rows.Add(deka)
kb46109052.Text = ""
nb46109052.Text = ""
un46109052.Text = ""
hr46109052.Text = ""
TOTALJUMLAH()
End Sub
Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.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 vesa.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 VD As New OleDb.OleDbCommand
VD = 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()
VD.ExecuteNonQuery()
Vero.Close()
For Each X As DataRow In vesa.Rows
BalasHapusVD = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt46109052.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", Vero)
Vero.Open()
VD.ExecuteNonQuery()
Vero.Close()
VD.Dispose()
Next
nt46109052.Text = ""
jt46109052.Text = ""
jm46109052.Text = ""
vesa.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
Public Class LATIHAN038_46109020
BalasHapusDim HUBUNG As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=46")
Dim TARI As New DataTable
Dim tata As DataRow
Private Sub LATIHAN038_46109020_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & NT46109020.Text & "'", HUBUNG)
X.Fill(TARI)
X.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = TARI.Columns("KODEBARANG")
TARI.PrimaryKey = dataPrimary
DGV46109020.DataSource = TARI
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In TARI.Rows
TOT = TOT + x("JUMLAH")
Next
TOT46109020.Text = TOT
End Sub
Private Sub KB46109020_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles KB46109020.Leave
If KB46109020.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", KB46109020.Text, 1, HUBUNG)
If Pencari.JumlanBaris > 0 Then
KB46109020.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
NB46109020.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If Latihan383940_46109020.ShowDialog = Windows.Forms.DialogResult.OK Then
KB46109020.Text = Latihan383940_46109020.DGV46109020.CurrentRow.Cells("KodeBarang").Value
NB46109020.Text = Latihan383940_46109020.DGV46109020.CurrentRow.Cells("NamaBarang").Value
Else
KB46109020.Text = ""
End If
End If
End Sub
Private Sub KB_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KB46109020.TextChanged
NB46109020.Text = ""
UN46109020.Text = ""
HR46109020.Text = ""
End Sub
Lanjutannya.....
BalasHapusPrivate Sub UNIT_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UN46109020.TextChanged, HR46109020.TextChanged
JM46109020.Text = Val(UN46109020.Text) * Val(HR46109020.Text)
End Sub
Private Sub Tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TAMBAH46109020.Click
If KB46109020.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If NB46109020.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(UN46109020.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(HR46109020.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
Exit Sub
End If
tata = TARI.Rows.Find(KB46109020.Text)
If tata Is Nothing Then
tata = TARI.NewRow
tata("KODEBARANG") = KB46109020.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
tata = TARI.NewRow
tata("KODEBARANG") = KB46109020.Text
tata("NAMABARANG") = NB46109020.Text
tata("UNIT") = UN46109020.Text
tata("HARGA") = HR46109020.Text
tata("JUMLAH") = JM46109020.Text
TARI.Rows.Add(tata)
KB46109020.Text = ""
NB46109020.Text = ""
UN46109020.Text = ""
HR46109020.Text = ""
TOTALJUMLAH()
End Sub
Lanjutannya.....
BalasHapusPrivate Sub Simpan_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 TARI.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, HUBUNG)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim NN As New OleDb.OleDbCommand
NN = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT46109020.Text & "', #" & DT46109020.Value.Month & "/" & DT46109020.Value.Day & "/" & DT46109020.Value.Year & "#, '" & JT46109020.Text & "')", HUBUNG)
HUBUNG.Open()
NN.ExecuteNonQuery()
HUBUNG.Close()
For Each X As DataRow In TARI.Rows
NN = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT46109020.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", HUBUNG)
HUBUNG.Open()
NN.ExecuteNonQuery()
HUBUNG.Close()
NN.Dispose()
Next
NT46109020.Text = ""
JT46109020.Text = ""
JM46109020.Text = ""
TARI.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
Public Class Form37_46109042
BalasHapusDim n As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=8")
Dim dt As New DataTable
Dim dr As DataRow
Private Sub Form37_46109042_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nt46109042.Text & "'", n)
X.Fill(dt)
X.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = dt.Columns("KODEBARANG")
dt.PrimaryKey = dataPrimary
dgv46109042.DataSource = dt
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In dt.Rows
TOT = TOT + x("JUMLAH")
Next
Tot46109042.Text = TOT
End Sub
Private Sub kb46109042_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles kb46109042.Leave
If kb46109042.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109042.Text, 1, n)
If Pencari.JumlanBaris > 0 Then
kb46109042.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
nb46109042.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
Exit Sub
End If
End Sub
Public Class Form38_39_40_46109042
BalasHapusDim dt As New DataTable
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 Form38_39_40_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 * FROM BARANG", batari)
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
dgv46109042.DataSource = dt
End Sub
End Class
sambungan 38
BalasHapusPrivate Sub kb46109043_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109043.TextChanged
nb46109043.Text = ""
un46109043.Text = ""
hr46109043.Text = ""
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109043.Click
If kb46109043.Text.Length = 0 Then
MsgBox("Isi Kode Barang nya")
Exit Sub
End If
If Val(un46109043.Text) = 0 Then
MsgBox("Isi Unit nya")
Exit Sub
End If
If Val(hr46109043.Text) = 0 Then
MsgBox("Isi Harga nya")
Exit Sub
End If
Dim dr As DataRow
dr = dt.Rows.Find(kb46109043.Text)
If dr Is Nothing Then
dr = dt.NewRow
dr("KODEBARANG") = kb46109043.Text
dr("NAMABARANG") = nb46109043.Text
dr("UNIT") = un46109043.Text
dr("HARGA") = hr46109043.Text
dr("JUMLAH") = jm46109043.Text
dt.Rows.Add(dr)
kb46109043.Text = ""
un46109043.Text = ""
hr46109043.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain")
End If
andiva()
End Sub
Private Sub Button246109043_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109043.Click
If nt46109043.Text.Length = 0 Then
MsgBox("Isi rong itu No Transaksi na..")
Exit Sub
End If
If jt46109043.Text.Length = 0 Then
MsgBox("Isi rong itu Jenis Transaksi na..")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Isi rong itu datatable na..")
Exit Sub
End If
diva.AturPencarianDataBase("mastertransaksi", "notrans", nt46109043.Text, 1, fara)
If diva.JumlanBaris > 0 Then
MsgBox("Adami No Transaksi seperti itu..")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanhr46109043altransaksi, 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 = ""
dt.Rows.Clear()
andiva()
End Sub
End Class
Public Class Form38_39_40_46109043
BalasHapusDim dt As New DataTable
Dim fara As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.ajt46109043db;jet OLEDB:database password=21")
Private Sub Form38_39_40_46109043_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 * FROM BARANG", fara)
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
dgv46109043.DataSource = dt
End Sub
End Class
Private Sub TH46109044_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TH46109044.Click
BalasHapusIf KB46109044.Text.Length = 0 Then
MsgBox("Isi rong itu Kode Barang na..")
Exit Sub
End If
If Val(U46109044.Text) = 0 Then
MsgBox("Isi rong itu Unit na..")
Exit Sub
End If
If Val(H46109044.Text) = 0 Then
MsgBox("Isi rong itu Harga na..")
Exit Sub
End If
Dim dr As DataRow
dr = dt.Rows.Find(KB46109044.Text)
If dr Is Nothing Then
dr = dt.NewRow
dr("KODEBARANG") = KB46109044.Text
dr("NAMABARANG") = NB46109044.Text
dr("UNIT") = U46109044.Text
dr("HARGA") = H46109044.Text
dr("JUMLAH") = J46109044.Text
dt.Rows.Add(dr)
KB46109044.Text = ""
U46109044.Text = ""
H46109044.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain")
End If
lirhas()
End Sub
Private Sub S46109044_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles S46109044.Click
If NT46109044.Text.Length = 0 Then
MsgBox("Isi rong itu No Transaksi na..")
Exit Sub
End If
If JT46109044.Text.Length = 0 Then
MsgBox("Isi rong itu Jenis Transaksi na..")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Isi rong itu datatable na..")
Exit Sub
End If
syahril.AturPencarianDataBase("mastertransaksi", "notrans", NT46109044.Text, 1, hma)
If syahril.JumlanBaris > 0 Then
MsgBox("Adami No Transaksi seperti itu..")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & NT46109044.Text & "',#" & T46109044.Value.Month & "/" & T46109044.Value.Day & "/" & T46109044.Value.Year & "#,'" & JT46109044.Text & "')", hma)
hma.Open()
cm.ExecuteNonQuery()
hma.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT46109044.Text & "','" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", hma)
hma.Open()
cm.ExecuteNonQuery()
hma.Close()
Next
cm.Dispose()
NT46109044.Text = ""
JT46109044.Text = ""
dt.Rows.Clear()
lirhas()
End Sub
End Class
Private Sub Button146109046_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button146109046.Click
BalasHapusIf kb46109046.Text.Length = 0 Then
MsgBox("Isi Kode Barang nya")
Exit Sub
End If
If Val(un46109046.Text) = 0 Then
MsgBox("Isi Unit nya")
Exit Sub
End If
If Val(hr46109046.Text) = 0 Then
MsgBox("Isi Harga nya")
Exit Sub
End If
Dim dr As DataRow
dr = dt.Rows.Find(kb46109046.Text)
If dr Is Nothing Then
dr = dt.NewRow
dr("KODEBARANG") = kb46109046.Text
dr("NAMABARANG") = nb46109046.Text
dr("UNIT") = un46109046.Text
dr("HARGA") = hr46109046.Text
dr("JUMLAH") = jm46109046.Text
dt.Rows.Add(dr)
kb46109046.Text = ""
un46109046.Text = ""
hr46109046.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain")
End If
asmianti()
End Sub
Private Sub Button246109046_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button246109046.Click
If nt46109046.Text.Length = 0 Then
MsgBox("Isi rong itu No Transaksi na..")
Exit Sub
End If
If jt46109046.Text.Length = 0 Then
MsgBox("Isi rong itu Jenis Transaksi na..")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Isi rong itu datatable na..")
Exit Sub
End If
amhy.AturPencarianDataBase("mastertransaksi", "notrans", nt46109046.Text, 1, asmi)
If amhy.JumlanBaris > 0 Then
MsgBox("Adami No Transaksi seperti itu..")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanhr46109043altransaksi, 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 = ""
dt.Rows.Clear()
asmianti()
End Sub
End Class
Public Class latihan3839400026
BalasHapusDim ibeng As New DataTable
Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=26")
Private Sub Latihan383940026_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ibhe As New OleDb.OleDbDataAdapter
ibhe = New OleDb.OleDbDataAdapter("SELECT * FROM BARANG", conect)
ibeng.Rows.Clear()
ibhe.Fill(ibeng)
ibhe.Dispose()
DATA46109026.DataSource = ibeng
End Sub
End Class
Public Class LATIHAN3846109026
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 DR As DataRow
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub LATIHAN038012_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & nomor46109026.Text & "'", CONECT)
DT.Rows.Clear()
X.Fill(DT)
data46109026.DataSource = DT
X.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dataPrimary
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In DT.Rows
TOT = TOT + x("JUMLAH")
Next
jumlah46109026.Text = TOT
End Sub
Private Sub kode46109026_leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode46109026.Leave
If kode46109026.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kode46109026.Text, 1, CONECT)
If Pencari.JumlanBaris > 0 Then
kode46109026.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
nama46109026.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If latihan3839400026.ShowDialog = Windows.Forms.DialogResult.OK Then
kode46109026.Text = latihan3839400026.DATA46109026.CurrentRow.Cells("kodebarang").Value
nama46109026.Text = latihan3839400026.DATA46109026.CurrentRow.Cells("namabarang").Value
Else
kode46109026.Text = ""
End If
End If
End Sub
Private Sub kode46109026_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode46109026.TextChanged
nama46109026.Text = ""
unit46109026.Text = ""
harga46109026.Text = ""
End Sub
Private Sub unit46109026_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles unit46109026.TextChanged, harga46109026.TextChanged
jumlah46109026.Text = Val(unit46109026.Text) * Val(harga46109026.Text)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
BalasHapusIf kode46109026.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nama46109026.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(unit46109026.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(harga46109026.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
Exit Sub
End If
DR = DT.Rows.Find(kode46109026.Text)
If DT Is Nothing Then
DR = DT.NewRow
DR("KODEBARANG") = kode46109026.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
DR = DT.NewRow
DR("KODEBARANG") = kode46109026.Text
DR("NAMABARANG") = nama46109026.Text
DR("UNIT") = unit46109026.Text
DR("HARGA") = harga46109026.Text
DR("JUMLAH") = jumlah46109026.Text
DT.Rows.Add(DR)
kode46109026.Text = ""
nama46109026.Text = ""
unit46109026.Text = ""
harga46109026.Text = ""
TOTALJUMLAH()
End Sub
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 ibeng As New OleDb.OleDbCommand
ibeng = 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()
ibeng.ExecuteNonQuery()
CONECT.Close()
For Each X As DataRow In DT.Rows
ibeng = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nomor46109026.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", CONECT)
CONECT.Open()
ibeng.ExecuteNonQuery()
CONECT.Close()
ibeng.Dispose()
Next
nomor46109026.Text = ""
jenis46109026.Text = ""
jumlah46109026.Text = ""
DT.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class
Public Class tugas3846109033
BalasHapusDim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=033")
Dim DT As New DataTable
Dim DR As DataRow
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Private Sub tugas3846109033_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*DETAILTRANSAKSI.HARGA AS JUMLAH from DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG WHERE NOTRANS= '" & no46109033.Text & "'", CONECT)
DT.Rows.Clear()
X.Fill(DT)
DataGridView1.DataSource = DT
X.Dispose()
Dim dataPrimary(1) As DataColumn
dataPrimary(0) = DT.Columns("KODEBARANG")
DT.PrimaryKey = dataPrimary
End Sub
Private Sub TOTALJUMLAH()
Dim TOT As Double = 0
For Each x As DataRow In DT.Rows
TOT = TOT + x("JUMLAH")
Next
Tot46109033.Text = TOT
End Sub
Private Sub kb46109033_leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109033.Leave
If kb46109033.Text.Length = 0 Then
Exit Sub
End If
Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", kb46109033.Text, 1, CONECT)
If Pencari.JumlanBaris > 0 Then
kb46109033.Text = Pencari.DataTablenya.Rows(0).Item("KODEBARANG")
nb46109033.Text = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
Else
MsgBox("Kode barang tersebut tidak ada")
If tugas38394046109033.ShowDialog = Windows.Forms.DialogResult.OK Then
kb46109033.Text = tugas38394046109033.DataGridView146109033.CurrentRow.Cells("KodeBarang").Value
nb46109033.Text = tugas38394046109033.DataGridView146109033.CurrentRow.Cells("NamaBarang").Value
Else
kb46109033.Text = ""
End If
End If
End Sub
Private Sub kb46109033_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kb46109033.TextChanged
nb46109033.Text = ""
un46109033.Text = ""
hr46109033.Text = ""
End Sub
Private Sub un46109033_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles un46109033.TextChanged, hr46109033.TextChanged
jm46109033.Text = Val(un46109033.Text) * Val(hr46109033.Text)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
BalasHapusIf kb46109033.Text.Length = 0 Then
MsgBox("Kode barang sudah ada")
Exit Sub
End If
If nb46109033.Text.Length = 0 Then
MsgBox("Nama barang sudah ada")
End If
If Val(un46109033.Text) = 0 Then
MsgBox("Masukkan unit barang")
Exit Sub
End If
If Val(hr46109033.Text) = 0 Then
MsgBox("Masukkan harga barang barang")
Exit Sub
End If
DR = DT.Rows.Find(kb46109033.Text)
If DT Is Nothing Then
DR = DT.NewRow
DR("KODEBARANG") = kb46109033.Text
Else
MsgBox("Maaf kodebarang sudah ada")
Exit Sub
End If
DR = DT.NewRow
DR("KODEBARANG") = kb46109033.Text
DR("NAMABARANG") = nb46109033.Text
DR("UNIT") = un46109033.Text
DR("HARGA") = hr46109033.Text
DR("JUMLAH") = jm46109033.Text
DT.Rows.Add(DR)
kb46109033.Text = ""
nb46109033.Text = ""
un46109033.Text = ""
hr46109033.Text = ""
TOTALJUMLAH()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If nt.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", nt.Text, 1, CONECT)
If pencari.JumlanBaris > 0 Then
MsgBox("data tersebut sudah ada")
Exit Sub
End If
Dim tm As New OleDb.OleDbCommand
tm = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & nt.Text & "', #" & DateTimePicker1.Value.Month & "/" & DateTimePicker1.Value.Day & "/" & DateTimePicker1.Value.Year & "#, '" & jt46109033.Text & "')", CONECT)
CONECT.Open()
tm.ExecuteNonQuery()
CONECT.Close()
For Each X As DataRow In DT.Rows
tm = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & nt.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", CONECT)
CONECT.Open()
tm.ExecuteNonQuery()
CONECT.Close()
tm.Dispose()
Next
nt.Text = ""
jt46109033.Text = ""
jm46109033.Text = ""
DT.Rows.Clear()
TOTALJUMLAH()
End Sub
End Class