Jumat, 18 November 2011

Latihan 39 APKOM 4 D4A

49 komentar:

  1. Public Class LATIHAN039_46109001

    Dim dwitya As New DataTable
    Dim saadah As New OleDb.OleDbCommand
    Dim wiwi As New ByIskandar.CariKeDataBaseByIskandar
    Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=ngekngek")

    Private Sub Latihan_039_46109001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim dwityasaadahsuaib As New OleDb.OleDbDataAdapter
    dwityasaadahsuaib = 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 = '" & NT46109001.Text & "'", conect)
    dwityasaadahsuaib.Fill(dwitya)
    dwityasaadahsuaib.Dispose()

    Dim dpc(1) As DataColumn
    dpc(0) = dwitya.Columns("kodebarang")
    dwitya.PrimaryKey = dpc

    DATA46109001.DataSource = dwitya
    End Sub

    Private Sub DATA46109001_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DATA46109001.CellEndEdit
    If DATA46109001.Columns(e.ColumnIndex).Name = "KODEBARANG" Then

    DATA46109001.CurrentRow.Cells("NAMABARANG").Value = ""
    DATA46109001.CurrentRow.Cells("UNIT").Value = 0
    DATA46109001.CurrentRow.Cells("HARGA").Value = 0
    DATA46109001.CurrentRow.Cells("JUMLAH").Value = 0

    wiwi.AturPencarianDataBase("barang", "kodebarang", DATA46109001.CurrentRow.Cells("KODEBARANG").Value, 1, conect)
    If wiwi.JumlanBaris > 0 Then
    DATA46109001.CurrentRow.Cells("NAMABARANG").Value = wiwi.DataTablenya.Rows(0).Item("NAMABARANG")
    Else
    DATA46109001.CurrentRow.Cells("NAMABARANG").Value = ""
    If Latihan383940_46109001.ShowDialog = Windows.Forms.DialogResult.OK Then
    DATA46109001.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("KODEBARANG").Value
    DATA46109001.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("NAMABARANG").Value
    End If
    End If

    ElseIf DATA46109001.Columns(e.ColumnIndex).Name = "UNIT" Or DATA46109001.Columns(e.ColumnIndex).Name = "HARGA" Then
    DATA46109001.CurrentRow.Cells("JUMLAH").Value = DATA46109001.CurrentRow.Cells("UNIT").Value * DATA46109001.CurrentRow.Cells("HARGA").Value
    ting()
    End If
    End Sub

    BalasHapus
  2. Private Sub ting()
    Dim ting1 As Integer = 0
    For Each ting2 As DataRow In dwitya.Rows
    ting1 += ting2("JUMLAH")
    Next
    TOT46109001.Text = ting1
    End Sub

    Private Sub S46109001_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles S46109001.Click
    If NT46109001.Text.Length = 0 Then
    MsgBox("Isi No Transaksinya")
    Exit Sub
    End If

    If JT46109001.Text.Length = 0 Then
    MsgBox("Isi Jenis Transaksinya")
    Exit Sub
    End If

    If dwitya.Rows.Count = 0 Then
    MsgBox("Isi datatable")
    Exit Sub
    End If

    wiwi.AturPencarianDataBase("mastertransaksi", "notrans", NT46109001.Text, 1, conect)
    If wiwi.JumlanBaris > 0 Then
    MsgBox("notrans sudah ada")
    Exit Sub
    End If

    saadah = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT46109001.Text & "',#" & T46109001.Value.Month & "/" & T46109001.Value.Day & "/" & T46109001.Value.Year & "#,'" & JT46109001.Text & "')", conect)
    conect.Open()
    saadah.ExecuteNonQuery()
    conect.Close()

    For Each x As DataRow In dwitya.Rows
    saadah = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT46109001.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", conect)
    conect.Open()
    saadah.ExecuteNonQuery()
    conect.Close()
    Next

    saadah.Dispose()

    NT46109001.Text = ""
    JT46109001.Text = ""
    TOT46109001.Text = ""

    dwitya.Rows.Clear()
    ting()
    End Sub
    End Class

    BalasHapus
  3. Public Class Latihan383940_46109001
    Dim dwitya 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=ngekngek")

    Private Sub Latihan383940012_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim wiwi As New OleDb.OleDbDataAdapter
    wiwi = New OleDb.OleDbDataAdapter("SELECT * FROM BARANG", conect)
    dwitya.Rows.Clear()
    wiwi.Fill(dwitya)
    wiwi.Dispose()

    DATA46109001.DataSource = dwitya

    End Sub
    End Class

    BalasHapus
  4. Komentar ini telah dihapus oleh pengarang.

    BalasHapus
  5. Komentar ini telah dihapus oleh pengarang.

    BalasHapus
  6. Public Class LATIHAN39_46109051

    Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=thepinkers29")
    Dim DT As New DataTable
    Dim cari As New ByIskandar.CariKeDataBaseByIskandar

    Private Sub Latih39_46109051_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    DT.Columns.Add(New DataColumn("KODEBARANG", GetType(String)))
    DT.Columns.Add(New DataColumn("NAMABARANG", GetType(String)))
    DT.Columns.Add(New DataColumn("UNIT", GetType(Double)))
    DT.Columns.Add(New DataColumn("HARGA", GetType(Integer)))
    DT.Columns.Add(New DataColumn("JUMLAH", GetType(Double)))
    DG_46109051.DataSource = DT

    Dim dcp(1) As DataColumn
    dcp(0) = DT.Columns("KODEBARANG")
    DT.PrimaryKey = dcp

    DT.Columns("UNIT").DefaultValue = 0
    DT.Columns("HARGA").DefaultValue = 0
    DT.Columns("JUMLAH").DefaultValue = 0

    End Sub
    Private Sub hitung()
    Dim wahda As Integer
    For Each r As DataGridViewRow In DG_46109051.Rows
    wahda = wahda + r.Cells("JUMLAH").Value
    Next
    Tot_46109051.Text = wahda

    End Sub

    Private Sub DG_46109051_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DG_46109051.CellEndEdit
    If e.ColumnIndex = 0 Then
    cari.AturPencarianDataBase("BARANG", "kodebarang", DG_46109051.CurrentRow.Cells("kodebarang").Value, 1, CONECT) '1 untuk huruf
    If cari.JumlanBaris > 0 Then
    DG_46109051.CurrentRow.Cells("KODEBARANG").Value = cari.DataTablenya.Rows(0).Item("KODEBARANG")
    DG_46109051.CurrentRow.Cells("NAMABARANG").Value = cari.DataTablenya.Rows(0).Item("NamaBarang")
    Else
    MsgBox("kode barang tidak tersedia")
    If Latihan383940_46109051.ShowDialog = Windows.Forms.DialogResult.OK Then
    DG_46109051.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109051.DG_46109051.CurrentRow.Cells("KodeBarang").Value
    DG_46109051.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109051.DG_46109051.CurrentRow.Cells("namabarang").Value
    DG_46109051.CurrentRow.Cells("HARGA").Value = Latihan383940_46109051.DG_46109051.CurrentRow.Cells("HARGAJUAL").Value
    Else
    DG_46109051.CurrentRow.Cells("KODEBARANG").Value = ""
    DG_46109051.CurrentRow.Cells("NAMABARANG").Value = ""
    End If
    End If
    End If
    If e.ColumnIndex = 2 Or e.ColumnIndex = 3 Then
    DG_46109051.CurrentRow.Cells("JUMLAH").Value = DG_46109051.CurrentRow.Cells("UNIT").Value * DG_46109051.CurrentRow.Cells("HARGA").Value

    End If

    hitung()

    BalasHapus
  7. LANJUTAN.....


    End Sub
    Private Sub SAVE_46109051_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_46109051.Click

    If NT_46109051.Text.Length = 0 Then
    MsgBox("no transaksi belum terisi")
    Exit Sub
    End If


    If JT_46109051.Text.Length = 0 Then
    MsgBox("jenis transaksi belum terisi")
    Exit Sub
    End If

    If DT.Rows.Count = 0 Then
    MsgBox("data tidak tersedia")
    End If

    cari.AturPencarianDataBase("mastertransaksi", "notrans", NT_46109051.Text, 1, CONECT)

    If cari.JumlanBaris > 0 Then
    MsgBox("kode sudah ada")
    Exit Sub
    End If

    Dim com As New OleDb.OleDbCommand
    com = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT_46109051.Text & "',#" & DT_46109051.Value.Date & "#," & Val(JT_46109051.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 ('" & NT_46109051.Text & "','" & r("kodebarang") & "'," & r("unit") & "," & r("harga") & ")", CONECT)
    CONECT.Open()
    com.ExecuteNonQuery()
    CONECT.Close()

    com.Dispose()

    Next

    NT_46109051.Text = ""
    jt_46109051.Text = ""
    Tot_46109051.Text = ""

    DT.Rows.Clear()
    hitung()
    End Sub
    End Class

    BalasHapus
  8. Public Class LATIHAN383940_46109051

    Dim CONECT As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=thepinkers29")
    Dim DT As New DataTable
    Dim BARIS As DataRow
    Dim cari As New ByIskandar.CariKeDataBaseByIskandar

    Private Sub Latihan383940_46109051_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    'deklarasi adapter
    Dim wahda As New OleDb.OleDbDataAdapter
    wahda = New OleDb.OleDbDataAdapter("select KODEBARANG, NAMABARANG FROM BARANG ", CONECT)
    DT.Rows.Clear()
    wahda.Fill(DT)
    DG_46109051.DataSource = DT
    wahda.Dispose()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    BARIS = DT.DefaultView(BindingContext(DT).Position).Row
    LATIHAN38_46109051.NB_46109051.Text = BARIS("NAMABARANG")
    End Sub


    End Class

    BalasHapus
  9. Public Class Form39
    Dim FADILLAH As New DataTable
    Dim SAGENA As New OleDb.OleDbCommand
    Dim DILA As New ByIskandar.CariKeDataBaseByIskandar
    Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=240991")

    Private Sub Form39_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim FADILLAHSAGENADAUDE As New OleDb.OleDbDataAdapter
    FADILLAHSAGENADAUDE = 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 = '" & DILA_059.Text & "'", conect)
    FADILLAHSAGENADAUDE.Fill(FADILLAH)
    FADILLAHSAGENADAUDE.Dispose()

    Dim IPIN(1) As DataColumn
    IPIN(0) = FADILLAH.Columns("kodebarang")
    FADILLAH.PrimaryKey = IPIN

    DATA_059.DataSource = FADILLAH
    End Sub

    Private Sub DATA_059_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DATA_059.CellEndEdit
    If DATA_059.Columns(e.ColumnIndex).Name = "KODEBARANG" Then

    DATA_059.CurrentRow.Cells("NAMABARANG").Value = ""
    DATA_059.CurrentRow.Cells("UNIT").Value = 0
    DATA_059.CurrentRow.Cells("HARGA").Value = 0
    DATA_059.CurrentRow.Cells("JUMLAH").Value = 0

    DILA.AturPencarianDataBase("barang", "kodebarang", DATA_059.CurrentRow.Cells("KODEBARANG").Value, 1, conect)
    If DILA.JumlanBaris > 0 Then
    DATA_059.CurrentRow.Cells("NAMABARANG").Value = DILA.DataTablenya.Rows(0).Item("NAMABARANG")
    Else
    DATA_059.CurrentRow.Cells("NAMABARANG").Value = ""
    If Form383940.ShowDialog = Windows.Forms.DialogResult.OK Then
    DATA_059.CurrentRow.Cells("KODEBARANG").Value = Form383940.DATA_059.CurrentRow.Cells("KODEBARANG").Value
    DATA_059.CurrentRow.Cells("NAMABARANG").Value = Form383940.DATA_059.CurrentRow.Cells("NAMABARANG").Value
    End If
    End If

    ElseIf DATA_059.Columns(e.ColumnIndex).Name = "UNIT" Or DATA_059.Columns(e.ColumnIndex).Name = "HARGA" Then
    DATA_059.CurrentRow.Cells("JUMLAH").Value = DATA_059.CurrentRow.Cells("UNIT").Value * DATA_059.CurrentRow.Cells("HARGA").Value
    IPIN()
    End If
    End Sub

    Private Sub IPIN()
    Dim IPIN1 As Integer = 0
    For Each IPIN2 As DataRow In FADILLAH.Rows
    IPIN1 += IPIN2("JUMLAH")
    Next
    TOTAL_059.Text = IPIN1
    End Sub

    BalasHapus
  10. Private Sub SIMPAN_059_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SIMPAN_059.Click
    If DILA_059.Text.Length = 0 Then
    MsgBox("Isi No Transaksinya")
    Exit Sub
    End If

    If DILA2_059.Text.Length = 0 Then
    MsgBox("Isi Jenis Transaksinya")
    Exit Sub
    End If

    If FADILLAH.Rows.Count = 0 Then
    MsgBox("Isi datatable")
    Exit Sub
    End If

    DILA.AturPencarianDataBase("mastertransaksi", "notrans", DILA_059.Text, 1, conect)
    If DILA.JumlanBaris > 0 Then
    MsgBox("notrans sudah ada")
    Exit Sub
    End If

    SAGENA = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & DILA_059.Text & "',#" & TGL_059.Value.Month & "/" & TGL_059.Value.Day & "/" & TGL_059.Value.Year & "#,'" & DILA2_059.Text & "')", conect)
    conect.Open()
    SAGENA.ExecuteNonQuery()
    conect.Close()

    For Each x As DataRow In FADILLAH.Rows
    SAGENA = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & DILA_059.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", conect)
    conect.Open()
    SAGENA.ExecuteNonQuery()
    conect.Close()
    Next

    SAGENA.Dispose()

    DILA_059.Text = ""
    DILA2_059.Text = ""
    TOTAL_059.Text = ""

    FADILLAH.Rows.Clear()
    IPIN()
    End Sub

    Private Sub DILA_059_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DILA_059.TextChanged

    End Sub
    End Class

    BalasHapus
  11. Public Class Form40A
    Dim DILA As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;Jet OLEDB:Database Password=240991")
    Dim FADILLAH As New DataTable
    Dim SAGENA As New DataTable
    Dim DAUDE As New DataSet
    Dim ARIFIN As New BindingSource
    Dim PUTRA As New BindingSource
    Public Sub DILAaa()

    SAGENA.Rows.Clear()
    FADILLAH.Rows.Clear()

    Dim B1 As New OleDb.OleDbDataAdapter
    B1 = New OleDb.OleDbDataAdapter("Select * From MASTERTRANSAKSI", DILA)
    B1.Fill(FADILLAH)

    B1 = New OleDb.OleDbDataAdapter("Select DETAILTRANSAKSI.NOTRANS, DETAILTRANSAKSI.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*DETAILTRANSAKSI.HARGA AS JUMLAH FROM DETAILTRANSAKSI INNER JOIN BARANG ON DETAILTRANSAKSI.KODEBARANG=BARANG.KODEBARANG", DILA)
    B1.Fill(SAGENA)

    B1.Dispose()
    End Sub

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


    DAUDE.Tables.Add(FADILLAH)
    DAUDE.Tables.Add(SAGENA)


    FADILLAH.TableName = "T01"
    SAGENA.TableName = "T02"


    DAUDE.Relations.Add(New DataRelation("X", DAUDE.Tables("T01").Columns("NOTRANS"), DAUDE.Tables("T02").Columns("NOTRANS")))


    ARIFIN.DataSource = DAUDE
    ARIFIN.DataMember = "T01"
    PUTRA.DataSource = ARIFIN
    PUTRA.DataMember = "X"


    DATA1_059.DataSource = ARIFIN
    DATA2_059.DataSource = PUTRA
    End Sub

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

    FORM40B.StatusStrip1.Text = DATA1_059.CurrentRow.Cells("NOTRANS").Value
    Form40B.DILA1_059.Text = DATA1_059.CurrentRow.Cells("NOTRANS").Value
    Form40B.DILA2_059.Text = DATA1_059.CurrentRow.Cells("JENISTRANSAKSI").Value

    FORM40B.MANIS()
    FORM40B.TOTALJUMLAH()
    End Sub

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

    FORM40B.StatusStrip1.Text = "-"
    Form40B.DILA1_059.Text = ""
    Form40B.DILA2_059.Text = ""

    FORM40B.MANIS()
    FORM40B.TOTALJUMLAH()

    End Sub

    Private Sub HAPUS_059_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles HAPUS_059.Click
    Dim T As New OleDb.OleDbCommand
    T = New OleDb.OleDbCommand("DELETE * FROM MASTERTRANSAKSI WHERE NOTRANS='" & DATA1_059.CurrentRow.Cells("NOTRANS").Value & "'", DILA)
    DILA.Open()
    T.ExecuteNonQuery()
    DILA.Close()

    T = New OleDb.OleDbCommand("DELETE * FROM DETAILTRANSAKSI WHERE NOTRANS='" & DATA1_059.CurrentRow.Cells("NOTRANS").Value & "'", DILA)
    DILA.Open()
    T.ExecuteNonQuery()
    DILA.Close()

    T.Dispose()

    DILAaa()
    End Sub

    Private Sub DATA1_059_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DATA1_059.CellContentClick

    End Sub
    End Class

    BalasHapus
  12. Public Class Form383940
    Dim FADILLAH 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=240991")

    Private Sub Form383940_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim DILA As New OleDb.OleDbDataAdapter
    DILA = New OleDb.OleDbDataAdapter("SELECT * FROM BARANG", conect)
    FADILLAH.Rows.Clear()
    DILA.Fill(FADILLAH)
    DILA.Dispose()

    DATA_059.DataSource = FADILLAH

    End Sub

    Private Sub DATA_059_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DATA_059.CellContentClick

    End Sub
    End Class

    BalasHapus
  13. Private Sub DILA_059_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DATA_059.CellContentClick
    If DATA_059.Columns(e.ColumnIndex).Name = "KODEBARANG" Then

    DATA_059.CurrentRow.Cells("NAMABARANG").Value = ""
    DATA_059.CurrentRow.Cells("UNIT").Value = 0
    DATA_059.CurrentRow.Cells("HARGA").Value = 0
    DATA_059.CurrentRow.Cells("JUMLAH").Value = 0

    Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
    Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", DATA_059.CurrentRow.Cells("KODEBARANG").Value, 1, DILA)

    If Pencari.JumlanBaris > 0 Then
    DATA_059.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
    Else
    DATA_059.CurrentRow.Cells("KODEBARANG").Value = ""
    If Form383940.ShowDialog = Windows.Forms.DialogResult.OK Then
    DATA_059.CurrentRow.Cells("KODEBARANG").Value = Form383940.DATA_059.CurrentRow.Cells("KODEBARANG").Value
    DATA_059.CurrentRow.Cells("NAMABARANG").Value = Form383940.DATA_059.CurrentRow.Cells("NAMABARANG").Value
    End If
    End If

    ElseIf DATA_059.Columns(e.ColumnIndex).Name = "UNIT" Or DATA_059.Columns(e.ColumnIndex).Name = "HARGA" Then

    DATA_059.CurrentRow.Cells("JUMLAH").Value = DATA_059.CurrentRow.Cells("UNIT").Value * DATA_059.CurrentRow.Cells("HARGA").Value
    End If

    TOTALJUMLAH()
    End Sub

    Private Sub Button1_Button2()
    If DILA1_059.Text.Length = 0 Then
    MsgBox("Maaf, Nomor transaksi harus diisi dulu")
    Exit Sub
    End If

    If DILA2_059.Text.Length = 0 Then
    MsgBox("Maaf, Jenis transaksi harus diisi dulu")
    Exit Sub
    End If

    If DATA.Rows.Count() = 0 Then
    MsgBox("Maaf, Proses tidak dapat dilanjutkan")
    Exit Sub
    End If

    If StatusStrip1.Text <> DILA1_059.Text Then
    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", DILA1_059.Text, 1, DILA)
    If pencari.JumlanBaris > 0 Then
    MsgBox("Nomor transaksi sudah ada")
    Exit Sub
    End If
    End If

    Dim T As New OleDb.OleDbCommand
    T = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI(NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & DILA1_059.Text & "', #" & TGL_059.Value.Month & "/" & TGL_059.Value.Day & "/" & TGL_059.Value.Year & "#, '" & DILA2_059.Text & "')", DILA)

    DILA.Open()

    T.ExecuteNonQuery()

    DILA.Close()


    For Each X As DataRow In DATA.Rows

    T = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & DILA1_059.Text & "', '" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", DILA)
    DILA.Open()
    T.ExecuteNonQuery()
    DILA.Close()
    T.Dispose()
    Next

    StatusStrip1.Text = "-"
    DILA1_059.Text = ""
    DILA2_059.Text = ""

    DATA.Rows.Clear()

    TOTALJUMLAH()

    Form40A.DILAaa()

    End Sub

    BalasHapus
  14. NUR AINUN A.SADIK
    3 D4 A
    461 09 030


    LATIHAN 39
    Public Class LATIHAN039_46109030
    Dim ai As New DataTable
    Dim nun As New OleDb.OleDbCommand
    Dim ainun As New ByIskandar.CariKeDataBaseByIskandar
    Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=ainun")
    Private Sub LATIHAN039_46109030_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim ainunasadik As New OleDb.OleDbDataAdapter
    ainunasadik = 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 = '" & nt_46109030.Text & "'", conect)
    ainunasadik.Fill(ai)
    ainunasadik.Dispose()

    Dim dpc(1) As DataColumn
    dpc(0) = ai.Columns("kodebarang")
    ai.PrimaryKey = dpc

    dg_46109030.DataSource = ai
    End Sub

    Private Sub dg_46109030_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dg_46109030.CellEndEdit
    If dg_46109030.Columns(e.ColumnIndex).Name = "KODEBARANG" Then

    dg_46109030.CurrentRow.Cells("NAMABARANG").Value = ""
    dg_46109030.CurrentRow.Cells("UNIT").Value = 0
    dg_46109030.CurrentRow.Cells("HARGA").Value = 0
    dg_46109030.CurrentRow.Cells("JUMLAH").Value = 0

    ainun.AturPencarianDataBase("barang", "kodebarang", dg_46109030.CurrentRow.Cells("KODEBARANG").Value, 1, conect)
    If ainun.JumlanBaris > 0 Then
    dg_46109030.CurrentRow.Cells("NAMABARANG").Value = ainun.DataTablenya.Rows(0).Item("NAMABARANG")
    Else
    dg_46109030.CurrentRow.Cells("NAMABARANG").Value = ""
    If Latihan383940_46109030.ShowDialog = Windows.Forms.DialogResult.OK Then
    dg_46109030.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109030.dg_46109030.CurrentRow.Cells("KODEBARANG").Value
    dg_46109030.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109030.dg_46109030.CurrentRow.Cells("NAMABARANG").Value
    End If
    End If

    ElseIf dg_46109030.Columns(e.ColumnIndex).Name = "UNIT" Or dg_46109030.Columns(e.ColumnIndex).Name = "HARGA" Then
    dg_46109030.CurrentRow.Cells("JUMLAH").Value = dg_46109030.CurrentRow.Cells("UNIT").Value * dg_46109030.CurrentRow.Cells("HARGA").Value
    ari()
    End If
    End Sub

    Private Sub ari()
    Dim ari1 As Integer = 0
    For Each ari2 As DataRow In ai.Rows
    ari1 += ari2("JUMLAH")
    Next
    Tot_46109030.Text = ari1

    End Sub

    Private Sub s_46109030_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109030.Click
    If nt_46109030.Text.Length = 0 Then
    MsgBox("Isi No Transaksinya")
    Exit Sub
    End If

    If jt_46109030.Text.Length = 0 Then
    MsgBox("Isi Jenis Transaksinya")
    Exit Sub
    End If

    If ai.Rows.Count = 0 Then
    MsgBox("Isi datatable")
    Exit Sub
    End If

    ainun.AturPencarianDataBase("mastertransaksi", "notrans", nt_46109030.Text, 1, conect)
    If ainun.JumlanBaris > 0 Then
    MsgBox("notrans sudah ada")
    Exit Sub
    End If

    BalasHapus
  15. nun = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_46109030.Text & "',#" & dtp_46109030.Value.Month & "/" & dtp_46109030.Value.Day & "/" & dtp_46109030.Value.Year & "#,'" & jt_46109030.Text & "')", conect)
    conect.Open()
    nun.ExecuteNonQuery()
    conect.Close()


    For Each x As DataRow In ai.Rows
    nun = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & nt_46109030.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", conect)
    conect.Open()
    nun.ExecuteNonQuery()
    conect.Close()
    Next

    nun.Dispose()

    nt_46109030.Text = ""
    jt_46109030.Text = ""
    Tot_46109030.Text = ""

    ai.Rows.Clear()
    ari()
    End Sub
    End Class

    BalasHapus
  16. http://ayuwandikaputriutami.blogspot.com/2012/01/latihan03946109017.html

    BalasHapus
  17. Public Class LATIHAN39_46109021
    Dim KONEKSI As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet OLEDB:database password=46109021")
    Dim NOVI As New DataTable
    Dim CARI As New ByIskandar.CariKeDataBaseByIskandar
    Dim SERU As New OleDb.OleDbCommand

    Private Sub LATIHAN39_46109021_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim KUDA As New OleDb.OleDbDataAdapter
    KUDA = 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 = '" & NT_46109021.Text & "'", KONEKSI)
    KUDA.Fill(NOVI)
    KUDA.Dispose()

    Dim DC(1) As DataColumn
    DC(0) = NOVI.Columns("kodebarang")
    NOVI.PrimaryKey = DC

    DGV_46109021.DataSource = NOVI
    End Sub
    Private Sub DGV_46109021_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV_46109021.CellEndEdit
    If DGV_46109021.Columns(e.ColumnIndex).Name = "KODEBARANG" Then

    DGV_46109021.CurrentRow.Cells("NAMABARANG").Value = ""
    DGV_46109021.CurrentRow.Cells("UNIT").Value = 0
    DGV_46109021.CurrentRow.Cells("HARGA").Value = 0
    DGV_46109021.CurrentRow.Cells("JUMLAH").Value = 0

    CARI.AturPencarianDataBase("barang", "kodebarang", DGV_46109021.CurrentRow.Cells("KODEBARANG").Value, 1, KONEKSI)
    If CARI.JumlanBaris > 0 Then
    DGV_46109021.CurrentRow.Cells("NAMABARANG").Value = CARI.DataTablenya.Rows(0).Item("NAMABARANG")
    Else
    DGV_46109021.CurrentRow.Cells("NAMABARANG").Value = ""
    If Latihan383940_46109001.ShowDialog = Windows.Forms.DialogResult.OK Then
    DATA46109001.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("KODEBARANG").Value
    DATA46109001.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("NAMABARANG").Value
    End If
    End If

    ElseIf DATA46109001.Columns(e.ColumnIndex).Name = "UNIT" Or DATA46109001.Columns(e.ColumnIndex).Name = "HARGA" Then
    DATA46109001.CurrentRow.Cells("JUMLAH").Value = DATA46109001.CurrentRow.Cells("UNIT").Value * DATA46109001.CurrentRow.Cells("HARGA").Value
    ting()
    End If

    End Sub
    End Class

    BalasHapus
  18. http://ismisriwahyuni.blogspot.com/2012/01/public-class-form39-dim-ismi-as-new.html

    BalasHapus
  19. http://ismisriwahyuni.blogspot.com/2012/01/public-class-form38394046109023-dim.html

    BalasHapus
  20. Public Class LATIHAN_039_46109054
    Dim DWI As New DataTable
    Dim MUSTIKA As New OleDb.OleDbCommand
    Dim CHAERUNNISA As New ByIskandar.CariKeDataBaseByIskandar
    Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=wiwi")

    Private Sub Latihan_039_46109001_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim DWIMUSTIKAMULYADI As New OleDb.OleDbDataAdapter
    DWIMUSTIKAMULYADI = 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 = '" & ww1_46109054.Text & "'", conect)
    DWIMUSTIKAMULYADI.Fill(DWI)
    DWIMUSTIKAMULYADI.Dispose()

    Dim dpc(1) As DataColumn
    dpc(0) = DWI.Columns("kodebarang")
    DWI.PrimaryKey = dpc

    DGV_46109054.DataSource = DWI
    End Sub

    Private Sub DGV_46109054_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV_46109054.CellEndEdit
    If DGV_46109054.Columns(e.ColumnIndex).Name = "KODEBARANG" Then

    DGV_46109054.CurrentRow.Cells("NAMABARANG").Value = ""
    DGV_46109054.CurrentRow.Cells("UNIT").Value = 0
    DGV_46109054.CurrentRow.Cells("HARGA").Value = 0
    DGV_46109054.CurrentRow.Cells("JUMLAH").Value = 0

    CHAERUNNISA.AturPencarianDataBase("barang", "kodebarang", DGV_46109054.CurrentRow.Cells("KODEBARANG").Value, 1, conect)
    If CHAERUNNISA.JumlanBaris > 0 Then
    DGV_46109054.CurrentRow.Cells("NAMABARANG").Value = CHAERUNNISA.DataTablenya.Rows(0).Item("NAMABARANG")
    Else
    DGV_46109054.CurrentRow.Cells("NAMABARANG").Value = ""
    If Latihan383940_46109054.ShowDialog = Windows.Forms.DialogResult.OK Then
    DGV_46109054.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109054.DGV_46109054.CurrentRow.Cells("KODEBARANG").Value
    DGV_46109054.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109054.DGV_46109054.CurrentRow.Cells("NAMABARANG").Value
    End If
    End If

    ElseIf DGV_46109054.Columns(e.ColumnIndex).Name = "UNIT" Or DGV_46109054.Columns(e.ColumnIndex).Name = "HARGA" Then
    DGV_46109054.CurrentRow.Cells("JUMLAH").Value = DGV_46109054.CurrentRow.Cells("UNIT").Value * DGV_46109054.CurrentRow.Cells("HARGA").Value
    WHY_WHY()
    End If
    End Sub

    BalasHapus
  21. Private Sub WHY_WHY()
    Dim WHY_WHY1 As Integer = 0
    For Each WHY_WHY2 As DataRow In DWI.Rows
    WHY_WHY1 += WHY_WHY2("JUMLAH")
    Next
    ww3_46109054.Text = WHY_WHY1
    End Sub

    Private Sub Dwi_46109054_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Dwi_46109054.Click
    If ww1_46109054.Text.Length = 0 Then
    MsgBox("Isi No Transaksinya")
    Exit Sub
    End If

    If ww2_46109054.Text.Length = 0 Then
    MsgBox("Isi Jenis Transaksinya")
    Exit Sub
    End If

    If DWI.Rows.Count = 0 Then
    MsgBox("Isi datatable")
    Exit Sub
    End If

    CHAERUNNISA.AturPencarianDataBase("mastertransaksi", "notrans", ww1_46109054.Text, 1, conect)
    If CHAERUNNISA.JumlanBaris > 0 Then
    MsgBox("notrans sudah ada")
    Exit Sub
    End If

    MUSTIKA = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & ww1_46109054.Text & "',#" & DTP_46109054.Value.Month & "/" & DTP_46109054.Value.Day & "/" & DTP_46109054.Value.Year & "#,'" & ww2_46109054.Text & "')", conect)
    conect.Open()
    MUSTIKA.ExecuteNonQuery()
    conect.Close()

    For Each x As DataRow In DWI.Rows
    MUSTIKA = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & ww1_46109054.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", conect)
    conect.Open()
    MUSTIKA.ExecuteNonQuery()
    conect.Close()
    Next

    MUSTIKA.Dispose()

    ww1_46109054.Text = ""
    ww2_46109054.Text = ""
    ww3_46109054.Text = ""

    DWI.Rows.Clear()
    WHY_WHY()
    End Sub
    End Class

    BalasHapus
  22. Public Class LATIHAN039_46109027
    Dim ff As New DataTable
    Dim bhe As New OleDb.OleDbCommand
    Dim bheku As New ByIskandar.CfransKeDataBaseByIskandar
    Dim conect As New OleDb.OleDbConnection("provider = microsoft.ace.oledb.12.0;data source=" & Application.StartupPath & "\datamajemuk.accdb;Jet OLEDB:Database Password=bheku")
    Private Sub LATIHAN039_46109027_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim febianafransiskus As New OleDb.OleDbDataAdapter
    febianafransiskus = New OleDb.OleDbDataAdapter("SELECT BARANG.KODEBARANG, BARANG.NAMABARANG, DETFFLTRANSAKSI.UNIT, DETFFLTRANSAKSI.HARGA, DETFFLTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETFFLTRANSAKSI ON BARANG.KODEBARANG = DETFFLTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & nt_46109027.Text & "'", conect)
    febianafransiskus.Fill(ff)
    febianafransiskus.Dispose()

    Dim dpc(1) As DataColumn
    dpc(0) = ff.Columns("kodebarang")
    ff.PrimaryKey = dpc

    dg_46109027.DataSource = ff
    End Sub

    Private Sub dg_46109027_CellEndEdit(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dg_46109027.CellEndEdit
    If dg_46109027.Columns(e.ColumnIndex).Name = "KODEBARANG" Then

    dg_46109027.CurrentRow.Cells("NAMABARANG").Value = ""
    dg_46109027.CurrentRow.Cells("UNIT").Value = 0
    dg_46109027.CurrentRow.Cells("HARGA").Value = 0
    dg_46109027.CurrentRow.Cells("JUMLAH").Value = 0

    bheku.AturPencfransanDataBase("barang", "kodebarang", dg_46109027.CurrentRow.Cells("KODEBARANG").Value, 1, conect)
    If bheku.JumlanBfranss > 0 Then
    dg_46109027.CurrentRow.Cells("NAMABARANG").Value = bheku.DataTablenya.Rows(0).Item("NAMABARANG")
    Else
    dg_46109027.CurrentRow.Cells("NAMABARANG").Value = ""
    If Latihan383940_46109001.ShowDialog = Windows.Forms.DialogResult.OK Then
    dg_46109027.CurrentRow.Cells("KODEBARANG").Value = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("KODEBARANG").Value
    dg_46109027.CurrentRow.Cells("NAMABARANG").Value = Latihan383940_46109001.DATA46109001.CurrentRow.Cells("NAMABARANG").Value
    End If
    End If

    ElseIf dg_46109027.Columns(e.ColumnIndex).Name = "UNIT" Or dg_46109027.Columns(e.ColumnIndex).Name = "HARGA" Then
    dg_46109027.CurrentRow.Cells("JUMLAH").Value = dg_46109027.CurrentRow.Cells("UNIT").Value * dg_46109027.CurrentRow.Cells("HARGA").Value
    frans()
    End If
    End Sub

    BalasHapus
  23. Private Sub frans()
    Dim frans1 As Integer = 0
    For Each frans2 As DataRow In ff.Rows
    frans1 += frans2("JUMLAH")
    Next
    Tot_46109027.Text = frans1

    End Sub

    Private Sub s46109027_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles s_46109027.Click
    If nt_46109027.Text.Length = 0 Then
    MsgBox("Isi No Transaksinya")
    Exit Sub
    End If

    If jt_46109027.Text.Length = 0 Then
    MsgBox("Isi Jenis Transaksinya")
    Exit Sub
    End If

    If ff.Rows.Count = 0 Then
    MsgBox("Isi datatable")
    Exit Sub
    End If

    bheku.AturPencfransanDataBase("mastertransaksi", "notrans", nt_46109027.Text, 1, conect)
    If bheku.JumlanBfranss > 0 Then
    MsgBox("notrans sudah ada")
    Exit Sub
    End If

    bhe = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & nt_46109027.Text & "',#" & dtp_46109027.Value.Month & "/" & dtp_46109027.Value.Day & "/" & dtp_46109027.Value.Year & "#,'" & jt_46109027.Text & "')", conect)
    conect.Open()
    bhe.ExecuteNonQuery()
    conect.Close()

    For Each x As DataRow In ff.Rows
    bhe = New OleDb.OleDbCommand("insert into detffltransaksi (notrans, kodebarang, unit, harga) values ('" & nt_46109027.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", conect)
    conect.Open()
    bhe.ExecuteNonQuery()
    conect.Close()
    Next

    bhe.Dispose()

    nt_46109027.Text = ""
    jt_46109027.Text = ""
    Tot_46109027.Text = ""

    ff.Rows.Clear()
    frans()
    End Sub
    End Class

    BalasHapus
  24. Public Class LATIHAN_039_46109053
    Dim SAE As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet oledb:database Password=thepinkers29")

    Private Sub SAVE_053_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_053.Click
    If NT_053.Text.Length = 0 Then
    MsgBox("No. transaksi sudah ada nah!!! GANTI MII....")
    Exit Sub
    End If

    If JT_053.Text.Length = 0 Then
    MsgBox("Jenis Transtaksi itu sudah ada nah !!! GANTI MII....")
    Exit Sub
    End If

    If DATA_053.Rows.Count = 0 Then
    MsgBox("Jumlah baris tidak terisi")
    Exit Sub
    End If

    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_053.Text, 1, SAE)
    If pencari.JumlanBaris > 0 Then
    MsgBox("data itu sudah ada nah !!! GANTI MIII....")
    Exit Sub
    End If

    Dim MMM As New OleDb.OleDbCommand
    MMM = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_053.Text & "', #" & TGL_053.Value.Month & "/" & TGL_053.Value.Day & "/" & TGL_053.Value.Year & "#, '" & JT_053.Text & "')", SAE)
    SAE.Open()
    MMM.ExecuteNonQuery()
    SAE.Close()

    For Each X As DataRow In DATA_053.Rows
    MMM = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_053.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", SAE)
    SAE.Open()
    MMM.ExecuteNonQuery()
    SAE.Close()
    MMM.Dispose()
    Next

    NT_053.Text = ""
    JT_053.Text = ""

    DATA_053.Rows.Clear()

    End Sub
    End Class

    BalasHapus
  25. Public Class Latihan39_034
    Dim dt As New DataTable
    Dim cm As New OleDb.OleDbCommand
    Dim dira As New ByIskandar.CariKeDataBaseByIskandar
    Dim satu As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Datamajemuk.ACCDB")

    Private Sub Latihan39_034_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Dim a As New OleDb.OleDbDataAdapter
    a = New OleDb.OleDbDataAdapter("SELECT BARANG.KODEBARANG, BARANG.NAMABARANG, DETAILTRANSAKSI.UNIT, DETAILTRANSAKSI.HARGA, DETAILTRANSAKSI.UNIT*HARGA AS JUMLAH FROM BARANG INNER JOIN DETAILTRANSAKSI ON BARANG.KODEBARANG = DETAILTRANSAKSI.KODEBARANG WHERE NOTRANS = '" & aa_034.Text & "'", satu)
    a.Fill(dt)
    a.Dispose()

    Dim dc(1) As DataColumn
    dc(0) = dt.Columns("kodebarang")
    dt.PrimaryKey = dc


    dgv.DataSource = dt
    End Sub

    Private Sub dgv_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dgv.CellEndEdit
    If dgv.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
    'If dgv.CurrentRow.Cells(0) = "KODEBARANG" Then (rumus lain)

    'untuk mencari nama barang
    dgv.CurrentRow.Cells("NAMABARANG").Value = ""
    dgv.CurrentRow.Cells("UNIT").Value = 0
    dgv.CurrentRow.Cells("HARGA").Value = 0
    dgv.CurrentRow.Cells("JUMLAH").Value = 0
    dira.AturPencarianDataBase("barang", "kodebarang", dgv.CurrentRow.Cells("KODEBARANG").Value, 1, satu)
    If dira.JumlanBaris > 0 Then '(menampilkan nama barang jika kolom kode barang ditemukan oleh proses di atas
    dgv.CurrentRow.Cells("NAMABARANG").Value = dira.DataTablenya.Rows(0).Item("NAMABARANG")
    Else
    dgv.CurrentRow.Cells("NAMABARANG").Value = ""
    If Latihan38_39_40_034.ShowDialog = Windows.Forms.DialogResult.OK Then
    dgv.CurrentRow.Cells("KODEBARANG").Value = Latihan_38_39_40_034.dgv.CurrentRow.Cells("KODEBARANG").Value
    dgv.CurrentRow.Cells("NAMABARANG").Value = Latihan_38_39_40_034.dgv.CurrentRow.Cells("NAMABARANG").Value
    End If
    End If

    ElseIf dgv.Columns(e.ColumnIndex).Name = "UNIT" Or dgv.Columns(e.ColumnIndex).Name = "HARGA" Then
    dgv.CurrentRow.Cells("JUMLAH").Value = dgv.CurrentRow.Cells("UNIT").Value * dgv.CurrentRow.Cells("HARGA").Value
    ira()
    End If
    End Sub

    Private Sub ira()
    Dim ira1 As Integer = 0
    For Each ira2 As DataRow In dt.Rows
    ira1 += ira2("JUMLAH")
    Next
    Dd_034.Text = ira1
    End Sub

    BalasHapus
  26. Private Sub dd_034_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dd_034.Click
    If aa_034.Text.Length = 0 Then
    MsgBox("Isi rong itu No Transaksinya")
    Exit Sub
    End If

    If cc_034.Text.Length = 0 Then
    MsgBox("Isi rong itu Jenis Transaksinya")
    Exit Sub
    End If

    If dt.Rows.Count = 0 Then
    MsgBox("Isi rong itu datatable ")
    Exit Sub
    End If

    diral.AturPencarianDataBase("mastertransaksi", "notrans", aa_034.Text, 1, satu)
    If dira.JumlanBaris > 0 Then
    MsgBox("Adami notrans seperti itu")
    Exit Sub
    End If
    cm = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & aa_034.Text & "',#" & bb_034.Value.Month & "/" & bb_034.Value.Day & "/" & bb_034.Value.Year & "#,'" & cc_034.Text & "')", satu)
    satu.Open()
    cm.ExecuteNonQuery()
    satu.Close()

    For Each x As DataRow In dt.Rows
    cm = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & aa_034.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", satu)
    satu.Open()
    cm.ExecuteNonQuery()
    satu.Close()
    Next

    cm.Dispose()

    aa_034.Text = ""
    cc_034.Text = ""
    dd_034.Text = ""
    dt.Rows.Clear()
    ira()
    End Sub

    end class

    BalasHapus
  27. Public Class LATIHAN39_46109005

    Dim fahrul As New OleDb.OleDbConnection("provider=microsoft.ace.oledb.12.0;data source= " & Application.StartupPath & "\DATAMAJEMUK.accdb;jet oledb:database Password=arul")

    Private Sub SAVE_46109005_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SAVE_46109005.Click
    If NT_46109005.Text.Length = 0 Then
    MsgBox("No. transaksi sudah ada nah!!! GANTIQI....")
    Exit Sub
    End If

    If JT_46109005.Text.Length = 0 Then
    MsgBox("Jenis Transtaksi itu sudah ada nah !!! GANTIQI....")
    Exit Sub
    End If

    If DG_46109005.Rows.Count = 0 Then
    MsgBox("Jumlah baris tidak terisi")
    Exit Sub
    End If

    Dim pencari As New ByIskandar.CariKeDataBaseByIskandar
    pencari.AturPencarianDataBase("MASTERTRANSAKSI", "NOTRANS", NT_46109005.Text, 1, fahrul)
    If pencari.JumlanBaris > 0 Then
    MsgBox("data itu sudah ada nah !!! GANTIQI....")
    Exit Sub
    End If

    Dim barru As New OleDb.OleDbCommand
    barru = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & NT_46109005.Text & "', #" & DT_46109005.Value.Month & "/" & DT_46109005.Value.Day & "/" & DT_46109005.Value.Year & "#, '" & JT_46109005.Text & "')", fahrul)
    fahrul.Open()
    barru.ExecuteNonQuery()
    fahrul.Close()

    For Each X As DataRow In DG_46109005.Rows
    barru = New OleDb.OleDbCommand("INSERT INTO DETAILTRANSAKSI (NOTRANS, KODEBARANG, UNIT, HARGA) VALUES ('" & NT_46109005.Text & "','" & X("KODEBARANG") & "'," & X("UNIT") & ", " & X("HARGA") & ")", fahrul)
    fahrul.Open()
    barru.ExecuteNonQuery()
    fahrul.Close()
    barru.Dispose()
    Next

    NT_46109005.Text = ""
    JT_46109005.Text = ""

    DG_46109005.Rows.Clear()

    End Sub
    End Class

    BalasHapus
  28. http://cacalisa.blogspot.com/2012/11/latihan3946110038.html

    BalasHapus
  29. http://rafidashaleh.blogspot.com/2012/11/latihan3946110041.html

    BalasHapus
  30. http://mulyawarman039.blogspot.com/2012/11/latihan3946110039.html

    BalasHapus
  31. http://wahyunirachman.blogspot.com/2012/11/latihan3946110020.html

    BalasHapus
  32. http://srikartikafanty.blogspot.com/2012/11/latihan3946110007.html

    BalasHapus
    Balasan
    1. Komentar ini telah dihapus oleh pengarang.

      Hapus
  33. http://dianmegariski.blogspot.com/2012/11/latihan3946110023.html

    BalasHapus
  34. http://bahrizj.blogspot.com/2012/11/latihan3946110001.html

    BalasHapus
  35. http://restyaccounting.blogspot.com/2012/11/latihan3946110027.html

    BalasHapus
  36. http://idhamsyaam.blogspot.com/2012/11/latihan3946110021.html

    BalasHapus
  37. http://sulhihusni.blogspot.com/2012/11/latihan3946110004.html

    BalasHapus
  38. http://alfaega.blogspot.com/2012/11/latihan3946110022.html

    BalasHapus
  39. http://fitrianihamka.blogspot.com/2012/11/latihan3946110006.html

    BalasHapus
  40. http://ildayani.blogspot.com/2012/11/latihan3946110002.html

    BalasHapus
  41. http://hanihasan07.blogspot.com/2012/12/latihan3946110044.html

    BalasHapus
  42. http://bothbon.blogspot.com/2013/01/latihan3946110043.html

    BalasHapus
  43. http://muthmil8.blogspot.com/2012/11/latihan3946110037.html

    BalasHapus
  44. http://amalmaulana92.blogspot.com/2013/01/latihan3946110003.html

    BalasHapus
  45. http://aardianzah2.blogspot.com/2013/01/latihan-39.html

    BalasHapus
  46. http://feibyfrycilia.blogspot.com/2013/01/latihan3946110055.html

    BalasHapus
  47. http://diyanahdina.blogspot.com/2013/01/latihan3946110045.html

    BalasHapus
  48. http://deodns.blogspot.com/#!/2013/01/latihan3946110040_1702.html

    BalasHapus