Public Class Form26a
Dim koneksi As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
Dim tabel As New DataTable
Private Sub Form26a_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim adapter As New OleDb.OleDbDataAdapter
adapter = New OleDb.OleDbDataAdapter("select*from barang", koneksi)
adapter.Fill(tabel)
adapter.Dispose()
dgv5_36109028.DataSource = tabel
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If Form26b.Visible = False Then
Form26b.Show()
Else : Form26b.Activate()
End If
Form26B.kb1_36109028.Text = dgv5_36109028.CurrentRow.Cells("KODEBARANG").Value
Form26B.nb1_36109028.Text = dgv5_36109028.CurrentRow.Cells("namabarang").Value
Form26B.hj1_36109028.Text = dgv5_36109028.CurrentRow.Cells("persediaanawal").Value
Form26B.jb1_36109028.Text = dgv5_36109028.CurrentRow.Cells("hargajual").Value
Form26B.veny(Form26B.kb1_36109028.Text)
End Sub
End Class
Public Class Form26B
Dim koneksi As New OleDb.OleDbConnection("provider=microsoft.ACE.oledb.12.0;data source=" & Application.StartupPath & "\datatransaksijualbeli.accdb")
Dim tabel As New DataTable
Public Sub veny(ByVal A As String)
Dim adapter As New OleDb.OleDbDataAdapter
adapter = New OleDb.OleDbDataAdapter("select MASTERTRANSAKSI.NOTRANS, MASTERTRANSAKSI.TANGGALTRANSAKSI, MASTERTRANSAKSI.JENISTRANSAKSI, MASTERTRANSAKSI.KETERANGAN, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, [DETAILTRANSAKSI]![UNIT]*[DETAILTRANSAKSI]![HARGA] AS Jumlah FROM MASTERTRANSAKSI INNER JOIN DETAILTRANSAKSI ON MASTERTRANSAKSI.NOTRANS = DETAILTRANSAKSI.NOTRANS WHERE KODEBARANG = '" & A & "'", koneksi)
tabel.Rows.Clear()
adapter.Fill(tabel)
dgv6_36109028.DataSource = tabel
End Sub
Private Sub dgv6_36109028_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv6_36109028.CellContentClick
Dim tu, total As Integer
For Each x As DataRow In tabel.Rows
tu = tu + x("unit")
total = total + x("jumlah")
Next
tu_36109028.Text = tu
tj_36109028.Text = total
End Sub
End Class
Public Class Form27_36109028
Dim Tumim As New ByIskandar.CariKeDataBaseByIskandar
Dim veny As New OleDb.OleDbCommand
Dim vetom As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub s_36109028_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_36109028.Click
If kb_36109028.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If nb_36109028.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(hj_36109028.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(jb_36109028.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
Tumim.AturPencarianDataBase("Barang", "KodeBarang", kb_36109028.Text, 1, vetom)
If Tumim.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
veny = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & kb_36109028.Text & "','" & nb_36109028.Text & "'," & Val(hj_36109028.Text) & "," & Val(jb_36109028.Text) & ")", vetom)
vetom.Open()
veny.ExecuteNonQuery()
vetom.Close()
veny.Dispose()
kb_36109028.Text = ""
nb_36109028.Text = ""
hj_36109028.Text = ""
jb_36109028.Text = ""
End Sub
Private Sub Form27_36109028_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Public Class Form28a_36109028
Dim dt As New DataTable
Dim veny As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Public Sub cv()
Dim vetom As New OleDb.OleDbDataAdapter
vetom = New OleDb.OleDbDataAdapter("select * from barang", veny)
dt.Rows.Clear()
vetom.Fill(dt)
vetom.Dispose()
End Sub
Private Sub Form28a_36109028_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
cv()
dgv_36109028.DataSource = dt
End Sub
Private Sub a_36109028_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles a_36109028.Click
If Form28b_36109028.Visible = False Then
Form28b_36109028.Show()
Else
Form28b_36109028.Activate()
End If
End Sub
Private Sub b_36109028_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles b_36109028.Click
Close()
End Sub
End Class
Public Class Form28b_36109028
Dim Tumim As New ByIskandar.CariKeDataBaseByIskandar
Dim veny As New OleDb.OleDbCommand
Dim vetom As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Databarang.ACCDB")
Private Sub s2_36109028_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s2_36109028.Click
If t1_36109028.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If t2_36109028.Text.Length = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t3_36109028.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
If Val(t4_36109028.Text) = 0 Then
MsgBox("Isi rong itu yang kosong")
Exit Sub
End If
Tumim.AturPencarianDataBase("Barang", "KodeBarang", t1_36109028.Text, 1, vetom)
If Tumim.JumlanBaris > 0 Then
MsgBox("Adami kode barang seperti itu")
Exit Sub
End If
veny = New OleDb.OleDbCommand("insert into barang (kodebarang, namabarang, hargajual, jumlahbarang) values ('" & t1_36109028.Text & "','" & t2_36109028.Text & "'," & Val(t3_36109028.Text) & "," & Val(t4_36109028.Text) & ")", vetom)
vetom.Open()
veny.ExecuteNonQuery()
vetom.Close()
veny.Dispose()
t1_36109028.Text = ""
t2_36109028.Text = ""
t3_36109028.Text = ""
t4_36109028.Text = ""
Form28a_36109028.cv()
End Sub
Private Sub Form28b_36109028_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
End Sub
End Class
Tidak ada komentar:
Posting Komentar