Public Class Form35_36109013
Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=25")
Dim DT As New DataTable
Dim cari As New ByIskandar.CariKeDataBaseByIskandar
Dim com As New OleDb.OleDbCommand
Private Sub Form35_36109013_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim nisa As New OleDb.OleDbDataAdapter
nisa = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA FROM DETAILTRANSAKSI WHERE NOTRANS= '" & kb36109013.Text & "'", CONECT)
DT.Rows.Clear()
nisa.Fill(DT)
dgv36109013.DataSource = DT
nisa.Dispose()
End Sub
Private Sub tambah36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah36109013.Click
If kb36109013.Text.Length = 0 Then
MsgBox("kode barang belum terisi")
Exit Sub
End If
If Val(unit36109013.Text) = 0 Then
MsgBox("UNIT belum terisi")
Exit Sub
End If
If Val(harga36109013.Text) = 0 Then
MsgBox("HARGA belum terisi")
Exit Sub
End If
Dim drzany As DataRow
drzany = DT.NewRow
drzany("KODEBARANG") = kb36109013.Text
drzany("UNIT") = unit36109013.Text
drzany("HARGA") = harga36109013.Text
DT.Rows.Add(drzany)
kb36109013.Text = ""
unit36109013.Text = ""
harga36109013.Text = ""
End Sub
Private Sub simpan36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109013.Click
If no36109013.Text.Length = 0 Then
MsgBox("no.transaksi belum terisi")
Exit Sub
End If
If jt36109013.Text.Length = 0 Then
MsgBox("jenis transaksi belum terisi")
Exit Sub
End If
cari.AturPencarianDataBase("mastertransaksi", "notrans", no36109013.Text, 1, CONECT)
If cari.JumlanBaris > 0 Then
MsgBox("NO.TRANS sudah ada")
Exit Sub
End If
If DT.Rows.Count = 0 Then
MsgBox("data tidak tersedia")
End If
com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & no36109013.Text & "',#" & tgl36109013.Value.Day & "/" & tgl36109013.Value.Month & "/" & tgl36109013.Value.Year & "#, '" & jt36109013.Text & "')", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
For Each r As DataRow In DT.Rows
com = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga ) values ('" & no36109013.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
CONECT.Open()
com.ExecuteNonQuery()
CONECT.Close()
Next
com.Dispose()
no36109013.Text = ""
jt36109013.Text = ""
DT.Rows.Clear()
End Sub
End Class
Public Class Form36_36109013
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim fa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/datamajemuk.ACCDB")
Private Sub Form36_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("select KODEBARANG, UNIT, HARGA from detailtransaksi where notrans = '" & no36109013.Text & "'", fa)
a.Fill(dt)
a.Dispose()
dgv36109013.DataSource = dt
Dim dc(1) As DataColumn
dc(0) = dt.Columns("kodebarang")
dt.PrimaryKey = dc
End Sub
Private Sub tambah36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah36109013.Click
If kb36109013.Text.Length = 0 Then
MsgBox("Isi rong itu Kode Barang na..")
Exit Sub
End If
If Val(unit36109013.Text) = 0 Then
MsgBox("Isi rong itu Unit na..")
Exit Sub
End If
If Val(harga36109013.Text) = 0 Then
MsgBox("Isi rong itu Harga na..")
Exit Sub
End If
Dim dr As DataRow
dr = dt.Rows.Find(kb36109013.Text)
If dr Is Nothing Then
dr = dt.NewRow
dr("KODEBARANG") = kb36109013.Text
dr("UNIT") = unit36109013.Text
dr("HARGA") = harga36109013.Text
dt.Rows.Add(dr)
kb36109013.Text = ""
unit36109013.Text = ""
harga36109013.Text = ""
Else
MsgBox("Kode barang itu sudah ada, mohon ganti dengan kode barang yang lain")
End If
End Sub
Private Sub simpan36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109013.Click
If no36109013.Text.Length = 0 Then
MsgBox("Isi rong No Transaksi na..")
Exit Sub
End If
If jt36109013.Text.Length = 0 Then
MsgBox("Isi rong Jenis Transaksi na..")
Exit Sub
End If
If dt.Rows.Count = 0 Then
MsgBox("Maaf...Isi rong itu datatable na..")
Exit Sub
End If
fany.AturPencarianDataBase("mastertransaksi", "notrans", no36109013.Text, 1, fa)
If fany.JumlanBaris > 0 Then
MsgBox("Adami notrans seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & no36109013.Text & "',#" & tgl36109013.Value.Month & "/" & tgl36109013.Value.Day & "/" & tgl36109013.Value.Year & "#,'" & jt36109013.Text & "')", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
For Each x As DataRow In dt.Rows
cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & no36109013.Text & "', '" & x("kodebarang") & "','" & x("unit") & "','" & x("harga") & "')", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
Next
cm.Dispose()
no36109013.Text = ""
jt36109013.Text = ""
dt.Rows.Clear()
End Sub
End Class
Saturday, December 3, 2011
Wednesday, November 30, 2011
form 31-34
Public Class Form31A_36109013
Dim dt As New DataTable
Dim ny As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub fany()
Dim fa As New OleDb.OleDbDataAdapter
fa = New OleDb.OleDbDataAdapter("select * from barang", ny)
dt.Rows.Clear()
fa.Fill(dt)
fa.Dispose()
End Sub
Private Sub Form31A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
fany()
dgv.DataSource = dt
End Sub
Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click
If Form31B_36109013.Visible = False Then
Form31B_36109013.Show()
Else
Form31B_36109013.Activate()
End If
Form31B_36109013.KBlama36109013.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form31B_36109013.kb36109013.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form31B_36109013.nb36109013.Text = dgv.CurrentRow.Cells("namabarang").Value
Form31B_36109013.hj36109013.Text = dgv.CurrentRow.Cells("hargajual").Value
Form31B_36109013.jb36109013.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form31B_36109013.Show()
End Sub
End Class
Public Class Form31B_36109013
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim fa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109013.Click
If kb36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If kb36109013.Text <> KBlama36109013.Text Then
fany.AturPencarianDataBase("Barang", "KodeBarang", kb36109013.Text, 1, fa)
If fany.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb36109013.Text & "', namabarang = '" & nb36109013.Text & "', hargajual = " & Val(hj36109013.Text) & ", jumlahbarang = " & Val(jb36109013.Text) & " where kodebarang = '" & KBlama36109013.Text & "'", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
cm.Dispose()
kb36109013.Text = ""
nb36109013.Text = ""
hj36109013.Text = ""
jb36109013.Text = ""
KBlama36109013.Text = "-"
Form31A_36109013.fany()
End Sub
End Class
Public Class Form32A_36109013
Dim dt As New DataTable
Dim fa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub fany()
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("select * from barang", fa)
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
End Sub
Private Sub Form32A_36109013_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
fany()
dgv36109013.DataSource = dt
End Sub
Private Sub tambah36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah36109013.Click
If Form32B_36109013.Visible = False Then
Form32B_36109013.Show()
Else
Form32B_36109013.Activate()
End If
End Sub
Private Sub edit36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit36109013.Click
If Form32C_36109013.Visible = False Then
Form32C_36109013.Show()
Else
Form32C_36109013.Activate()
End If
Form32C_36109013.kb36109013.Text = dgv36109013.CurrentRow.Cells("kodebarang").Value
Form32C_36109013.nb36109013.Text = dgv36109013.CurrentRow.Cells("namabarang").Value
Form32C_36109013.hj36109013.Text = dgv36109013.CurrentRow.Cells("hargajual").Value
Form32C_36109013.jb36109013.Text = dgv36109013.CurrentRow.Cells("jumlahbarang").Value
Form32C_36109013.kblama36109013.Text = dgv36109013.CurrentRow.Cells("kodebarang").Value
Form32C_36109013.Show()
End Sub
End Class
Public Class Form32B_36109013
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim fa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109013.Click
If kb36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
fany.AturPencarianDataBase("Barang", "KodeBarang", kb36109013.Text, 1, fa)
If fany.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb36109013.Text & "','" & nb36109013.Text & "'," & Val(hj36109013.Text) & "," & Val(jb36109013.Text) & ")", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
cm.Dispose()
kb36109013.Text = ""
nb36109013.Text = ""
hj36109013.Text = ""
jb36109013.Text = ""
Form32A_36109013.fany()
End Sub
End Class
Public Class Form32C_36109013
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim fa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub simpan36109013_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan36109013.Click
If kblama36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb36109013.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb36109013.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If kb36109013.Text <> kblama36109013.Text Then
fany.AturPencarianDataBase("Barang", "KodeBarang", kb36109013.Text, 1, fa)
If fany.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & kb36109013.Text & "', namabarang = '" & nb36109013.Text & "', hargajual = " & Val(hj36109013.Text) & ", jumlahbarang = " & Val(jb36109013.Text) & " where kodebarang = '" & kblama36109013.Text & "'", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
cm.Dispose()
kb36109013.Text = ""
nb36109013.Text = ""
hj36109013.Text = ""
jb36109013.Text = ""
kblama36109013.Text = ""
Form32A_36109013.fany()
End Sub
End Class
Public Class Form33A_36109013
Dim dt As New DataTable
Dim cm As New OleDb.OleDbCommand
Dim fah As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub fany()
Dim a As New OleDb.OleDbDataAdapter
a = New OleDb.OleDbDataAdapter("select * from barang", fah)
dt.Rows.Clear()
a.Fill(dt)
a.Dispose()
End Sub
Private Sub Form33A_36109013_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
fany()
dgv.DataSource = dt
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
cm = New OleDb.OleDbCommand("delete * from barang where kodebarang = '" & dgv.CurrentRow.Cells("kodebarang").Value & "'", fah)
fah.Open()
cm.ExecuteNonQuery()
fah.Close()
cm.Dispose()
fany()
End Sub
Private Sub tambah_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tambah.Click
If Form33B_36109013.Visible = False Then
Form33B_36109013.Show()
Else
Form33B_36109013.Activate()
End If
Form33B_36109013.KDB.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form33B_36109013.NB.Text = dgv.CurrentRow.Cells("namabarang").Value
Form33B_36109013.HJ.Text = dgv.CurrentRow.Cells("hargajual").Value
Form33B_36109013.JB.Text = dgv.CurrentRow.Cells("jumlahbarang").Value
Form33B_36109013.KBlama36109013.Text = dgv.CurrentRow.Cells("kodebarang").Value
Form33B_36109013.Show()
End Sub
Private Sub edit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles edit.Click
If Form33B_36109013.Visible = False Then
Form33B_36109013.Show()
Else
Form33B_36109013.Activate()
End If
Form33B_36109013.KDB.Text = ""
Form33B_36109013.NB.Text = ""
Form33B_36109013.HJ.Text = ""
Form33B_36109013.JB.Text = ""
Form33B_36109013.KBlama36109013.Text = "-"
End Sub
End Class
Public Class Form33B_36109013
Dim fany As New ByIskandar.CariKeDataBaseByIskandar
Dim cm As New OleDb.OleDbCommand
Dim fa As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub indonesia()
If KDB.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If NB.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(HJ.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(JB.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
End Sub
Private Sub tambah()
indonesia()
fany.AturPencarianDataBase("Barang", "KodeBarang", KDB.Text, 1, fa)
If fany.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
cm = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & KDB.Text & "','" & NB.Text & "'," & Val(HJ.Text) & "," & Val(JB.Text) & ")", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
cm.Dispose()
KDB.Text = ""
NB.Text = ""
HJ.Text = ""
JB.Text = ""
Form33A_36109013.fany()
End Sub
Private Sub edit()
indonesia()
If KDB.Text <> KBlama36109013.Text Then
fany.AturPencarianDataBase("Barang", "KodeBarang", KDB.Text, 1, fa)
If fany.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
End If
cm = New OleDb.OleDbCommand("update barang set kodebarang = '" & KDB.Text & "', namabarang = '" & NB.Text & "', hargajual = " & Val(HJ.Text) & ", jumlahbarang = " & Val(JB.Text) & " where kodebarang = '" & KBlama36109013.Text & "'", fa)
fa.Open()
cm.ExecuteNonQuery()
fa.Close()
cm.Dispose()
KDB.Text = ""
NB.Text = ""
HJ.Text = ""
JB.Text = ""
KBlama36109013.Text = "-"
Form33A_36109013.fany()
End Sub
Private Sub SIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN.Click
If KBlama36109013.Text = "-" Then
Subscribe to:
Posts (Atom)