Kamis, 21 Juni 2012

download anggaran

Silahkan download
Maaf beribu maaf kawan, telat sharenya... di bawah
Silahkan download

Rabu, 11 Januari 2012

Script Visual Basic Apkomp 4 PNUP -FORM40-


Public Class Form40A_36109006
    Dim HARUN As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/DataMajemuk.accdb")
    Dim DT1 As New DataTable
    Dim DT2 As New DataTable
    Dim DS As New DataSet
    Dim BS1 As New BindingSource
    Dim BS2 As New BindingSource
    Public Sub MIKKY1()
        Dim S As New OleDb.OleDbDataAdapter
        DT2.Rows.Clear()
        DT1.Rows.Clear()
        S = New OleDb.OleDbDataAdapter("select * from mastertransaksi", HARUN)
        S.Fill(DT1)
        S = New OleDb.OleDbDataAdapter("select detailtransaksi.notrans, barang.kodebarang, barang.namabarang, detailtransaksi.unit, detailtransaksi.harga, detailtransaksi.unit*harga as jumlah from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang", HARUN)
        S.Fill(DT2)
    End Sub
    Private Sub Form40A_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MIKKY1()

        DS.Tables.Add(DT1)
        DS.Tables.Add(DT2)

        DT1.TableName = "immy"
        DT2.TableName = "immy2"

        DS.Relations.Add(New DataRelation("S", DS.Tables("immy").Columns("notrans"), DS.Tables("immy2").Columns("notrans")))

        BS1.DataSource = DS
        BS1.DataMember = "immy"

        BS2.DataSource = BS1
        BS2.DataMember = "S"

        Dim DC(1) As DataColumn
        DC(0) = DT1.Columns("notrans")
        DT1.PrimaryKey = DC

        DGV1_36109006.DataSource = BS1
        DGV2_36109006.DataSource = BS2
    End Sub
    Private Sub Hapus_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus_36109006.Click
        Dim COM As New OleDb.OleDbCommand
        COM = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & DGV1_36109006.CurrentRow.Cells("notrans").Value & "'", HARUN)
        HARUN.Open()
        COM.ExecuteNonQuery()
        HARUN.Close()

        COM = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & DGV1_36109006.CurrentRow.Cells("notrans").Value & "'", HARUN)
        HARUN.Open()
        COM.ExecuteNonQuery()
        HARUN.Close()
        COM.Dispose()
        MIKKY1()
    End Sub

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

        Form40B_36109006.NT_36109006.Text = ""
        Form40B_36109006.JT_36109006.Text = ""
        Form40B_36109006.NO_36109006.Text = "-"

        Form40B_36109006.MIKKY2()
        Form40B_36109006.MIKKY3()

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

        Form40B_36109006.NT_36109006.Text = DGV1_36109006.CurrentRow.Cells("notrans").Value
        Form40B_36109006.T_36109006.Value = DGV1_36109006.CurrentRow.Cells("tanggaltransaksi").Value
        Form40B_36109006.JT_36109006.Text = DGV1_36109006.CurrentRow.Cells("jenistransaksi").Value
        Form40B_36109006.NO_36109006.Text = DGV1_36109006.CurrentRow.Cells("notrans").Value

        Form40B_36109006.MIKKY2()
        Form40B_36109006.MIKKY3()
    End Sub


End Class

__________________________________________________________________________________
Public Class Form40B_36109006
    Dim HARUN As New OleDb.OleDbConnection("PROVIDER = MICROSOFT.ACE.OLEDB.12.0; DATA SOURCE =" & Application.StartupPath & "/dataMajemuk.accdb")
    Dim DT As New DataTable
    Dim MHH As New ByIskandar.CariKeDataBaseByIskandar
    Dim COM As New OleDb.OleDbCommand
    Public Sub MIKKY2()
        Dim S As New OleDb.OleDbDataAdapter
        S = New OleDb.OleDbDataAdapter("select barang.KODEBARANG, barang.NAMABARANG, detailtransaksi.UNIT, detailtransaksi.HARGA, detailtransaksi.unit * detailtransaksi.harga as JUMLAH from barang inner join detailtransaksi on barang.kodebarang = detailtransaksi.kodebarang where notrans = '" & NT_36109006.Text & "'", HARUN)
        DT.Rows.Clear()
        S.Fill(DT)
    End Sub
    Public Sub MIKKY3()
        Dim Manis1 As Integer
        For Each Manis2 As DataGridViewRow In DGV_36109006.Rows
            Manis1 = Manis1 + Manis2.Cells("JUMLAH").Value
        Next
        TO_36109006.Text = Manis1
    End Sub
    Private Sub MIKKY4()
        If NT_36109006.Text.Length = 0 Then
            MsgBox("No Transaksi Belum Di isi")
            Exit Sub
        End If

        If JT_36109006.Text.Length = 0 Then
            MsgBox("Jenis Transaksi Belum Di isi")
            Exit Sub
        End If

        If DT.Rows.Count = 0 Then
            MsgBox("Datatable Bulum Di isi")
            Exit Sub
        End If
    End Sub
    Private Sub Febriani()
        MIKKY4()
        MHH.AturPencarianDataBase("mastertransaksi", "notrans", NT_36109006.Text, 1, HARUN)
        If MHH.JumlanBaris > 0 Then
            MsgBox("No Transaksi Seperti Itu Sudah Ada")
            Exit Sub
        End If

        COM = New OleDb.OleDbCommand("insert into mastertransaksi (notrans, tanggaltransaksi, jenistransaksi) values ('" & NT_36109006.Text & "',#" & T_36109006.Value.Month & "/" & T_36109006.Value.Day & "/" & T_36109006.Value.Year & "#,'" & JT_36109006.Text & "')", HARUN)
        HARUN.Open()
        COM.ExecuteNonQuery()
        HARUN.Close()

        For Each x As DataRow In DT.Rows
            COM = New OleDb.OleDbCommand("insert into detailtransaksi (notrans, kodebarang, unit, harga) values ('" & NT_36109006.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "') ", HARUN)
            HARUN.Open()
            COM.ExecuteNonQuery()
            HARUN.Close()
        Next
        COM.Dispose()

        NT_36109006.Text = ""
        JT_36109006.Text = ""
        TO_36109006.Text = ""
        NO_36109006.Text = "-"

        DT.Rows.Clear()
        Form40A_36109006.MIKKY1()
    End Sub
    Public Sub Edit()
        MIKKY4()
        If NT_36109006.Text <> NO_36109006.Text Then
            MHH.AturPencarianDataBase("mastertransaksi", "notrans", NT_36109006.Text, 1, HARUN)
            If MHH.JumlanBaris > 0 Then
                MsgBox("No Transaksi Seperti Itu Sudah Ada")
                Exit Sub
            End If
        End If

        COM = New OleDb.OleDbCommand("delete * from mastertransaksi where notrans = '" & NO_36109006.Text & "'", HARUN)
        HARUN.Open()
        COM.ExecuteNonQuery()
        HARUN.Close()

        COM = New OleDb.OleDbCommand("insert into mastertransaksi(notrans, tanggaltransaksi, jenistransaksi) values ('" & NT_36109006.Text & "',#" & T_36109006.Value.Month & "/" & T_36109006.Value.Day & "/" & T_36109006.Value.Year & "#,'" & JT_36109006.Text & "')", HARUN)
        HARUN.Open()
        COM.ExecuteNonQuery()
        HARUN.Close()

        COM = New OleDb.OleDbCommand("delete * from detailtransaksi where notrans = '" & NO_36109006.Text & "'", HARUN)
        HARUN.Open()
        COM.ExecuteNonQuery()
        HARUN.Close()

        For Each x As DataRow In DT.Rows
            COM = New OleDb.OleDbCommand("insert into detailtransaksi(notrans, kodebarang, unit, harga) values ('" & NT_36109006.Text & "', '" & x("kodebarang") & "', '" & x("unit") & "', '" & x("harga") & "')", HARUN)
            HARUN.Open()
            COM.ExecuteNonQuery()
            HARUN.Close()
        Next
        COM.Dispose()

        NT_36109006.Text = ""
        JT_36109006.Text = ""
        TO_36109006.Text = ""
        NO_36109006.Text = "-"

        DT.Rows.Clear()
        Form40A_36109006.MIKKY1()
    End Sub
    Private Sub Form40B_36109006_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        MIKKY2()

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

        DT.Columns("unit").DefaultValue = 0
        DT.Columns("harga").DefaultValue = 0
        DT.Columns("jumlah").DefaultValue = 0

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

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

            MHH.AturPencarianDataBase("barang", "kodebarang", DGV_36109006.CurrentRow.Cells("KODEBARANG").Value, 1, HARUN)
            If MHH.JumlanBaris > 0 Then
                DGV_36109006.CurrentRow.Cells("NAMABARANG").Value = MHH.DataTablenya.Rows(0).Item("NAMABARANG")
            Else
                DGV_36109006.CurrentRow.Cells("NAMABARANG").Value = ""
                If Form383940_36109006.ShowDialog = Windows.Forms.DialogResult.OK Then
                    DGV_36109006.CurrentRow.Cells("KODEBARANG").Value = Form383940_36109006.DGV_36109006.CurrentRow.Cells("KODEBARANG").Value
                    DGV_36109006.CurrentRow.Cells("NAMABARANG").Value = Form383940_36109006.DGV_36109006.CurrentRow.Cells("NAMABARANG").Value
                End If
            End If

        ElseIf DGV_36109006.Columns(e.ColumnIndex).Name = "UNIT" Or DGV_36109006.Columns(e.ColumnIndex).Name = "HARGA" Then
            DGV_36109006.CurrentRow.Cells("JUMLAH").Value = DGV_36109006.CurrentRow.Cells("UNIT").Value * DGV_36109006.CurrentRow.Cells("HARGA").Value
            MIKKY3()
        End If
    End Sub
    Private Sub Simpan_36109006_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Simpan_36109006.Click
        If NO_36109006.Text = "-" Then
            Febriani()
        Else
            Edit()
        End If
    End Sub
    Private Sub DGV_36109006_DataError(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewDataErrorEventArgs) Handles DGV_36109006.DataError
        MsgBox("Terjadi sedikit kesalahan...")
    End Sub
End Class
Diberdayakan oleh Blogger.

BTricks