Minggu, 29 Januari 2012

Jawaban Soal No. 3

LISTING PROGRAM
Public Class PEGAWAI

    Private Sub PEGAWAI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        BuatTabel()
        JABATAN.Items.Add("MANDOR")
        JABATAN.Items.Add("KEPALA BAGIAN")
        JABATAN.Items.Add("STAFF")
        STATUS.Items.Add("MENIKAH")
        STATUS.Items.Add("TIDAK MENIKAH")
    End Sub
    Sub BANDING()
        If JABATAN.Text = "MANDOR" Then
            GAJI.Text = "1750000"
            PAJAK.Text = 15 * Val(GAJI.Text) / 100
        ElseIf JABATAN.Text = "KEPALA BAGIAN" Then
            GAJI.Text = "2500000"
            PAJAK.Text = 15 * Val(GAJI.Text) / 100
        ElseIf JABATAN.Text = "STAFF" Then
            GAJI.Text = "1250000"
            PAJAK.Text = 15 * Val(GAJI.Text) / 100
        End If
        Select Case STATUS.Text
            Case "MENIKAH" : TUNJANGANISTRI.Text = 9 * Val(GAJI.Text) / 100
            Case "BELUM MENIKAH" : TUNJANGANANAK.Text = 0
        End Select
        If JLHANAK.Text = "1" Then
            TUNJANGANANAK.Text = 3 * Val(GAJI.Text) / 100
        ElseIf JLHANAK.Text = "2" Then
            TUNJANGANANAK.Text = 7 * Val(GAJI.Text) / 100
        ElseIf JLHANAK.Text >= "2" Then
            TUNJANGANANAK.Text = 7 * Val(GAJI.Text) / 100
        ElseIf JLHANAK.Text <= "1" Then
            TUNJANGANANAK.Text = 0
        End If
        If JABATAN.Text = "MANDOR" Then
            If JAM.Text = "0" Then
                LEMBUR.Text = 0
            ElseIf JAM.Text = "1" Then
                LEMBUR.Text = 7500
            ElseIf JAM.Text >= "1" Then
                LEMBUR.Text = 7500 * Val(JAM.Text)
            End If
        ElseIf JABATAN.Text = "KEPALA BAGIAN" Then
            If JAM.Text = "0" Then
                LEMBUR.Text = 0
            ElseIf JAM.Text = "1" Then
                LEMBUR.Text = 10000
            ElseIf JAM.Text >= "1" Then
                LEMBUR.Text = 10000 * Val(JAM.Text)
            End If
        ElseIf JABATAN.Text = "STAFF" Then
            If JAM.Text = "0" Then
                LEMBUR.Text = 0
            ElseIf JAM.Text = "1" Then
                LEMBUR.Text = 5000
            ElseIf JAM.Text >= "1" Then
                LEMBUR.Text = 5000 * Val(JAM.Text)
            End If
        End If
        TTLGAJI.Text = Val(GAJI.Text) + Val(TUNJANGANISTRI.Text) + Val(TUNJANGANANAK.Text) + Val(LEMBUR.Text) - Val(PAJAK.Text)
    End Sub
    Sub BuatTabel()
        With LV()
            .Columns.Add("NAMA", 100, HorizontalAlignment.Center)
            .Columns.Add("JABATAN", 120, HorizontalAlignment.Left)
            .Columns.Add("GAJI", 100, HorizontalAlignment.Left)
            .Columns.Add("STATUS", 100, HorizontalAlignment.Left)
            .Columns.Add("JLH ANAK", 80, HorizontalAlignment.Left)
            .Columns.Add("TNJGN ANAK", 120, HorizontalAlignment.Left)
            .Columns.Add("JAM", 80, HorizontalAlignment.Left)
            .Columns.Add("LEMBUR", 110, HorizontalAlignment.Left)
            .Columns.Add("TNJGN ISTRI", 120, HorizontalAlignment.Left)
            .Columns.Add("PAJAK", 80, HorizontalAlignment.Left)
            .Columns.Add("TOTAL GAJI", 80, HorizontalAlignment.Left)
            .GridLines = True
            .FullRowSelect = True
            .View = View.Details
        End With
    End Sub
    Sub IsiTabel()
        Dim Lst As New ListViewItem
        With Lst
            .Text = NAMA.Text
            .SubItems.Add(JABATAN.Text)
            .SubItems.Add(GAJI.Text)
            .SubItems.Add(STATUS.Text)
            .SubItems.Add(JLHANAK.Text)
            .SubItems.Add(TUNJANGANANAK.Text)
            .SubItems.Add(JAM.Text)
            .SubItems.Add(LEMBUR.Text)
            .SubItems.Add(TUNJANGANISTRI.Text)
            .SubItems.Add(PAJAK.Text)
            .SubItems.Add(TTLGAJI.Text)
            LV.Items.Add(Lst)
        End With
    End Sub

    Private Sub JABATAN_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JABATAN.SelectedIndexChanged
        Call BANDING()
    End Sub

    Private Sub STATUS_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles STATUS.SelectedIndexChanged
        Call BANDING()
    End Sub
   
    Private Sub JAM_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JAM.TextChanged
        Call BANDING()
    End Sub

    Private Sub JLANAK_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JLHANAK.TextChanged
        Call BANDING()
    End Sub
   

    Private Sub BTNSIMPAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNSIMPAN.Click
        IsiTabel()
    End Sub

    Private Sub BTNHAPUS_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNHAPUS.Click
        LV.Items.Clear()
    End Sub

    Private Sub BTNDATA_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNDATA.Click
        LV.Items.Remove(LV.SelectedItems(0))
    End Sub

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

    Private Sub BTNBERSIH_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNBERSIH.Click
        NAMA.Text = ""
        JABATAN.Text = ""
        STATUS.Text = ""
        GAJI.Text = ""
        JLHANAK.Text = ""
        TUNJANGANANAK.Text = ""
        JAM.Text = ""
        LEMBUR.Text = ""
        TUNJANGANISTRI.Text = ""
        PAJAK.Text = ""
        TTLGAJI.Text = ""
    End Sub

End Class
HASIL PROGRAM


Jawab Soal No.2 Modul Hal. 33

LISTING PROGRAM

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        BuatTabel()
        KdBarang.Items.Add("TS001")
        KdBarang.Items.Add("TS002")
        KdBarang.Items.Add("VG001")
        KdBarang.Items.Add("VG002")
    End Sub
    Sub barang()
        Dim x As String
        x = Microsoft.VisualBasic.Left(KdBarang.Text, 2)
        If x = "TS" Then
            Merk.Text = "Toshiba"
        ElseIf x = "VG" Then
            Merk.Text = "V-Gen"
        End If
        x = Microsoft.VisualBasic.Mid(KdBarang.Text, 3, 3)
        If x = "001" Then
            NmBarang.Text = "Flasdisk 4GB"
        ElseIf x = "002" Then
            NmBarang.Text = "Flasdisk 2GB"
        End If
        If KdBarang.Text = "TS001" Then
            Harga.Text = 105000
        ElseIf KdBarang.Text = "TS002" Then
            Harga.Text = 75000
        End If
        If KdBarang.Text = "VG001" Then
            Harga.Text = 90000
        ElseIf KdBarang.Text = "VG002" Then
            Harga.Text = 60000
        End If
    End Sub
    Sub BuatTabel()
        With LV
            .Columns.Add("No Pembelian", 80, HorizontalAlignment.Center)
            .Columns.Add("Kode Barang", 120, HorizontalAlignment.Left)
            .Columns.Add("Nama Barang", 100, HorizontalAlignment.Left)
            .Columns.Add("Merk", 100, HorizontalAlignment.Left)
            .Columns.Add("Harga", 100, HorizontalAlignment.Left)
            .Columns.Add("Jumlah Beli", 80, HorizontalAlignment.Left)
            .Columns.Add("Total Harga", 80, HorizontalAlignment.Left)
            .GridLines = True
            .FullRowSelect = True
            .View = View.Details
        End With
    End Sub
    Sub IsiTabel()
        Dim Lst As New ListViewItem
        With Lst
            .Text = Pembelian.Text()
            .SubItems.Add(KdBarang.Text)
            .SubItems.Add(NmBarang.Text)
            .SubItems.Add(Merk.Text)
            .SubItems.Add(Harga.Text)
            .SubItems.Add(JlhBeli.Text)
            .SubItems.Add(TotalHarga.Text)
            LV.Items.Add(Lst)
        End With
    End Sub

    Private Sub kodbrg_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles KdBarang.SelectedIndexChanged

        Call barang()
    End Sub

    Private Sub btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpan.Click
        IsiTabel()
    End Sub

    Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        LV.Items.Clear()
    End Sub

    Private Sub btndata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndata.Click
        LV.Items.Remove(LV.SelectedItems(0))
    End Sub

    Private Sub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
        Pembelian.Text = ""
        KdBarang.Text = ""
        NmBarang.Text = ""
        Merk.Text = ""
        Harga.Text = ""
        JlhBeli.Text = ""
        TotalHarga.Text = ""

    End Sub

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


    Private Sub jlhbeli_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles JlhBeli.TextChanged
        TotalHarga.Text = Val(JlhBeli.Text) * Val(Harga.Text)
    End Sub

    Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

    End Sub

    Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter

    End Sub
End Class
 HASIL  PROGRAM


Selasa, 17 Januari 2012

Tugas LISTVIEW smester III

LISTING PROGRAM

Public Class Form1
    Sub BuatTabel()
        With LV
            .Columns.Add("NPM", 80, HorizontalAlignment.Center)
            .Columns.Add("Nama", 120, HorizontalAlignment.Left)
            .Columns.Add("Jenjang", 100, HorizontalAlignment.Left)
            .Columns.Add("Jurusan", 100, HorizontalAlignment.Left)
            .Columns.Add("Tahun Masuk", 100, HorizontalAlignment.Left)
            .Columns.Add("Nilai Angka", 80, HorizontalAlignment.Left)
            .Columns.Add("Nilai Huruf", 80, HorizontalAlignment.Left)
            .GridLines = True
            .FullRowSelect = True
            .View = View.Details
        End With
    End Sub
    Sub IsiTabel()
        Dim Lst As New ListViewItem
        With Lst
            .Text = npm.Text(0)
            .SubItems.Add(nama.Text)
            .SubItems.Add(jenjang.Text)
            .SubItems.Add(jurusan.Text)
            .SubItems.Add(tahunmasuk.Text)
            .SubItems.Add(angka.Text)
            .SubItems.Add(huruf.Text)
            lv.Items.Add(Lst)
        End With
    End Sub


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

    Private Sub npm_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles npm.TextChanged
        Dim X, Y As String
        X = Microsoft.VisualBasic.Mid(npm.Text, 3, 1)
        Y = Microsoft.VisualBasic.Mid(npm.Text, 4, 1)
        If X = "0" Then
            If Y = "2" Then
                jenjang.Text = "D3"
                jurusan.Text = "Manajemen Informatika"
            End If
        ElseIf X = "1" Then
            jenjang.Text = "S1"
            If Y = "1" Then
                jurusan.Text = "Tek.Informatika"
            ElseIf Y = "2" Then
                jurusan.Text = "Sis.Informasi"
            End If

        End If
    End Sub


    Private Sub angka_keypress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles angka.KeyPress
        Dim tombol As Integer = Asc(e.KeyChar)
        If tombol = 13 Then
            CariNilai()
        End If

    End Sub

    Sub CariNilai()
        If ANGKA.Text >= 85 Then
            HURUF.Text = "A"
        ElseIf ANGKA.Text >= 75 Then
            HURUF.Text = "B"
        ElseIf ANGKA.Text >= 70 Then
            HURUF.Text = "C"
        ElseIf ANGKA.Text >= 60 Then
            HURUF.Text = "D"
        Else
            HURUF.Text = "E"
        End If

    End Sub


    Private Sub btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpan.Click
        IsiTabel()
    End Sub

    Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        lv.Items.Clear()
    End Sub

    Private Sub btndata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btndata.Click
        lv.Items.Remove(lv.SelectedItems(0))
    End Sub

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

    Private Sub btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbersih.Click
        npm.Text = ""
        nama.Text = ""
        jenjang.Text = ""
        jurusan.Text = ""
        tahunmasuk.Text = ""
        angka.Text = ""
        huruf.Text = ""

    End Sub
End Class


HASIL