Powered By Blogger

Kamis, 24 November 2011

Latihan 26

Latihan 26A

Public Class Latihan26A

Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Private Sub Latihan26A_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim np_36109008 As New OleDb.OleDbDataAdapter
np_36109008 = New OleDb.OleDbDataAdapter("select * From BARANG", NINI_36109008)
NINI_DT.Rows.Clear()
np_36109008.Fill(NINI_DT)
np_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT
End Sub

Private Sub button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button_36109008.Click
If Latihan26B.Visible = False Then
Latihan26B.Show()
Else
Latihan26B.Activate()
End If

Latihan26B.KB_36109008.Text = DGV_36109008.CurrentRow.Cells("KODEBARANG").Value
Latihan26B.NB_36109008.Text = DGV_36109008.CurrentRow.Cells("NAMABARANG").Value
Latihan26B.HJ_36109008.Text = DGV_36109008.CurrentRow.Cells("HARGAJUAL").Value
Latihan26B.JB_36109008.Text = DGV_36109008.CurrentRow.Cells("PERSEDIAANAWAL").Value

Latihan26B.ANISA(Latihan26B.KB_36109008.Text)
End Sub
End Class

Latihan 26B

Public Class Latihan26B

Dim NINI_DT As New DataTable
Dim NINI_36109008 As New OleDb.OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source='" & Application.StartupPath & "\DataTransaksiJualBeli.accdb'")

Public Sub ANISA(ByVal NISA As String)
Dim np1_36109008 As New OleDb.OleDbDataAdapter
np1_36109008 = New OleDb.OleDbDataAdapter("select MASTERTRANSAKSI.NOTRANS, MASTERTRANSAKSI.TANGGALTRANSAKSI, MASTERTRANSAKSI.JENISTRANSAKSI, MASTERTRANSAKSI.KETERANGAN, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, [DETAILTRANSAKSI]![UNIT]*[DETAILTRANSAKSI]![HARGA] AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN MASTERTRANSAKSI ON DETAILTRANSAKSI.NOTRANS = MASTERTRANSAKSI.NOTRANS WHERE KODEBARANG = '" & NISA & "'", NINI_36109008)
NINI_DT.Rows.Clear()
np1_36109008.Fill(NINI_DT)
np1_36109008.Dispose()
DGV_36109008.DataSource = NINI_DT

Dim nini1_36109008 As Integer
Dim nini2_36109008 As Integer
For Each queen As DataRow In NINI_DT.Rows
nini1_36109008 = nini1_36109008 + queen("Unit")
nini2_36109008 = nini2_36109008 + queen("Jumlah")
Next
TU_36109008.Text = nini1_36109008
TJ_36109008.Text = nini2_36109008
End Sub

Private Sub Latihan26B_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

End Sub
End Class

Tidak ada komentar:

Posting Komentar