Jumat, 18 November 2011

Latihan 39 APKOM 4 D3C

18 komentar:

  1. Private Sub simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles simpan.Click
    If a058.Text.Length = 0 Then
    MsgBox("No. transaksi sudah ada")
    Exit Sub
    End If

    If b058.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", a058.Text, 1, yunha)
    If pencari.JumlanBaris > 0 Then
    MsgBox("data tersebut sudah ada")
    Exit Sub
    End If

    Dim z As New OleDb.OleDbCommand
    z = New OleDb.OleDbCommand("INSERT INTO MASTERTRANSAKSI (NOTRANS, TANGGALTRANSAKSI, JENISTRANSAKSI) VALUES ('" & a058.Text & "', #" & DateTimePicker1.Value.Month & "/" & DateTimePicker1.Value.Day & "/" & DateTimePicker1.Value.Year & "#, '" & b058.Text & "')", yunha)
    yunha.Open()
    z.ExecuteNonQuery()
    yunha.Close()

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

    a058.Text = ""
    b058.Text = ""

    dt.Rows.Clear()

    End Sub

    End Class

    BalasHapus
  2. Public Class Latihan_39_09081
    Dim dt As New DataTable
    Dim OLc As New OleDb.OleDbCommand
    Dim yusri As New ByIskandar.CariKeDataBaseByIskandar
    Dim ian As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/Datamajemuk.ACCDB")

    Private Sub Latihan_39_09081_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 = '" & notr081.Text & "'", ian)
    a.Fill(dt)
    a.Dispose()

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

    dgv081.DataSource = dt
    End Sub

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

    'untuk mencari nama barang
    dgv081.CurrentRow.Cells("NAMABARANG").Value = ""
    dgv081.CurrentRow.Cells("UNIT").Value = 0
    dgv081.CurrentRow.Cells("HARGA").Value = 0
    dgv081.CurrentRow.Cells("JUMLAH").Value = 0

    yusri.AturPencarianDataBase("barang", "kodebarang", dgv081.CurrentRow.Cells("KODEBARANG").Value, 1, ian)
    If yusri.JumlanBaris > 0 Then '(menampilkan nama barang jika kolom kode barang ditemukan oleh proses di atas
    dgv081.CurrentRow.Cells("NAMABARANG").Value = yusri.DataTablenya.Rows(0).Item("NAMABARANG")
    Else
    dgv081.CurrentRow.Cells("NAMABARANG").Value = ""
    If Latihan_38_39_40_09081.ShowDialog = Windows.Forms.DialogResult.OK Then
    dgv081.CurrentRow.Cells("KODEBARANG").Value = Latihan_38_39_40_09081.dgv081.CurrentRow.Cells("KODEBARANG").Value
    dgv081.CurrentRow.Cells("NAMABARANG").Value = Latihan_38_39_40_09081.dgv081.CurrentRow.Cells("NAMABARANG").Value
    End If
    End If

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

    BalasHapus
  3. Private Sub yusrian()
    Dim yusrian1 As Integer = 0
    For Each yusrian2 As DataRow In dt.Rows
    yusrian1 += yusrian2("JUMLAH")
    Next
    tot081.Text = yusrian1
    End Sub

    Private Sub save081_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles save081.Click
    If notr081.Text.Length = 0 Then
    MsgBox("Isi rong itu No Transaksinya")
    Exit Sub
    End If

    If jetr081.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 k")
    Exit Sub
    End If

    yusri.AturPencarianDataBase("mastertransaksi", "notrans", notr081.Text, 1, ian)
    If yusri.JumlanBaris > 0 Then
    MsgBox("Adami notrans seperti itu")
    Exit Sub
    End If

    OLc = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & notr081.Text & "',#" & tgl081.Value.Month & "/" & tgl081.Value.Day & "/" & tgl081.Value.Year & "#,'" & jetr081.Text & "')", ian)
    ian.Open()
    OLc.ExecuteNonQuery()
    ian.Close()

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

    OLc.Dispose()

    notr081.Text = ""
    jetr081.Text = ""
    tot081.Text = ""

    dt.Rows.Clear()
    yusrian()
    End Sub
    End Class

    BalasHapus
  4. http://krisnasaman-teddybear.blogspot.com/2011/12/latihan39.html

    BalasHapus
  5. Muhammad Nur


    Public Class Latihan039077

    Dim n As New OleDb.OleDbConnection("Provider=microsoft.ACE.OLEDB.12.0;data source=" & Application.StartupPath & "\DATAMAJEMUK.accdb")
    Dim dt As New DataTable

    Private Sub Latihan039077_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= '" & NOTRANS077.Text & "'", n)
    X.Fill(dt)
    X.Dispose()

    Dim dataPrimary(1) As DataColumn
    dataPrimary(0) = dt.Columns("KODEBARANG")
    dt.PrimaryKey = dataPrimary

    DGV39.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
    TOTAL077.Text = TOT

    End Sub

    Private Sub DGV39_CellEndEdit(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DGV39.CellEndEdit
    If DGV39.Columns(e.ColumnIndex).Name = "KODEBARANG" Then
    'Cari nama barang'
    DGV39.CurrentRow.Cells("NAMABARANG").Value = ""
    DGV39.CurrentRow.Cells("UNIT").Value = 0
    DGV39.CurrentRow.Cells("HARGA").Value = 0
    DGV39.CurrentRow.Cells("JUMLAH").Value = 0

    Dim Pencari As New ByIskandar.CariKeDataBaseByIskandar
    Pencari.AturPencarianDataBase("BARANG", "KODEBARANG", DGV39.CurrentRow.Cells("KODEBARANG").Value, 1, n)
    'Menampilkan nama barang jika isi kolom kodebarang ditemukan oleh proses diatas'
    If Pencari.JumlanBaris > 0 Then
    DGV39.CurrentRow.Cells("NAMABARANG").Value = Pencari.DataTablenya.Rows(0).Item("NAMABARANG")
    Else
    DGV39.CurrentRow.Cells("KODEBARANG").Value = ""
    If Latihan0383940077.ShowDialog = Windows.Forms.DialogResult.OK Then
    DGV39.CurrentRow.Cells("KODEBARANG").Value = Latihan0383940077.DGV38.CurrentRow.Cells("KODEBARANG").Value
    DGV39.CurrentRow.Cells("NAMABARANG").Value = Latihan0383940077.DGV38.CurrentRow.Cells("NAMABARANG").Value
    End If
    End If

    ElseIf DGV39.Columns(e.ColumnIndex).Name = "UNIT" Or DGV39.Columns(e.ColumnIndex).Name = "HARGA" Then
    DGV39.CurrentRow.Cells("JUMLAH").Value = DGV39.CurrentRow.Cells("UNIT").Value * DGV39.CurrentRow.Cells("HARGA").Value

    TOTALJUMLAH()
    End If
    End Sub

    BalasHapus
  6. Private Sub Simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan.Click
    If NOTRANS077.Text.Length = 0 Then
    MsgBox("No. transaksi sudah ada")
    Exit Sub
    End If

    If JT077.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", NOTRANS077.Text, 1, n)
    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 ('" & NOTRANS077.Text & "', #" & DateTimePicker.Value.Month & "/" & DateTimePicker.Value.Day & "/" & DateTimePicker.Value.Year & "#, '" & JT077.Text & "')", n)
    n.Open()
    CM.ExecuteNonQuery()
    n.Close()

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

    NOTRANS077.Text = ""
    JT077.Text = ""

    dt.Rows.Clear()

    End Sub
    End Class

    BalasHapus
  7. http://winnymatarru.blogspot.com/2011/12/latihan-39.html

    BalasHapus
  8. http://valenndut.blogspot.com/2011/12/latihan-39.html

    BalasHapus
  9. http://elayuck.blogspot.com/2011/12/latihan-39.html

    BalasHapus
  10. http://meylin-meylanierlangga.blogspot.com/2011/12/latihan-39.html

    BalasHapus
  11. http://urimoktaviana.blogspot.com/2011/12/latihan-39.html

    BalasHapus
  12. http://derielrangers.blogspot.com/2011/12/form-39.html

    BalasHapus
  13. http://pute991.blogspot.com/2011/12/latihan-39.html

    BalasHapus
  14. http://sarshe-sarshe.blogspot.com/2011/12/latihan-03936109060.html

    BalasHapus
  15. (36109057)
    fatma sari
    latihan 39
    http://fatmacmr.blogspot.com/2011/12/latihan-39.html

    campur (38_39_40)
    http://fatmacmr.blogspot.com/2011/12/latihan-3839.html

    BalasHapus
  16. http://parubakcatherine.blogspot.com/2011/12/latihan-39.html

    BalasHapus
  17. http://hantualis.blogspot.com/2011/12/form-39-apkom-4.html

    BalasHapus
  18. http://gunawanmustari.blogspot.com/2011/12/latihan-39.html

    BalasHapus