Minggu, 29 November 2015

ListView Pembayaran Tagihan PDAM

















Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LV.Columns.Add("Kode", 70, HorizontalAlignment.Center)
        LV.Columns.Add("Nama", 70, HorizontalAlignment.Left)
        LV.Columns.Add("Tipe", 70, HorizontalAlignment.Left)
        LV.Columns.Add("Biaya", 70, HorizontalAlignment.Left)
        LV.Columns.Add("Jumah Pemakaian", 70, HorizontalAlignment.Left)
        LV.Columns.Add("Total Tagihan", 70, HorizontalAlignment.Left)
        LV.Columns.Add("Pajak", 70, HorizontalAlignment.Left)
        LV.Columns.Add("Pembayaran", 70, HorizontalAlignment.Left)
        LV.Columns.Add("Harga", 70, HorizontalAlignment.Left)
        LV.View = View.Details
        LV.GridLines = True
        LV.FullRowSelect = True

        Kode.Items.Add("001")
        Kode.Items.Add("002")
        Kode.Items.Add("003")
        Kode.Items.Add("004")

        Tipe.Items.Add("TOKO")
        Tipe.Items.Add("RUMAH")
        Tipe.Items.Add("PABRIK")
        Tipe.Items.Add("SWALAYAN")

        TotalT.Enabled = False
        Pajak.Enabled = False
        Pembayaran.Enabled = False
        Harga.Enabled = False    
    End Sub

    Private Sub btnbatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnbatal.Click
        Kode.Text = ""
        Tipe.Text = ""
        Nama.Text = ""
        Biaya.Text = ""
        JumlahP.Text = ""
        TotalT.Text = ""
        Pajak.Text = ""
        Pembayaran.Text = ""
        Harga.Text = ""
    End Sub

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

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

    Private Sub btnproses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnproses.Click
        TotalT.Text = Val(Biaya.Text) + Val(Harga.Text * JumlahP.Text)
        Pajak.Text = 0.01 * TotalT.Text
        Pembayaran.Text = Val(TotalT.Text) + Val(Pajak.Text)


        Dim lst As New ListViewItem
        lst.Text = Kode.Text
        lst.SubItems.Add(Nama.Text)
        lst.SubItems.Add(Tipe.Text)
        lst.SubItems.Add(Harga.Text)
        lst.SubItems.Add(Biaya.Text)
        lst.SubItems.Add(JumlahP.Text)
        lst.SubItems.Add(TotalT.Text)
        lst.SubItems.Add(Pajak.Text)
        lst.SubItems.Add(Pembayaran.Text)
        LV.Items.Add(lst)      
    End Sub

    Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kode.SelectedIndexChanged

        Select Case Kode.Text
            Case "001" : Nama.Text = "Suha"
            Case "002" : Nama.Text = "Alvi"
            Case "003" : Nama.Text = "Vita"
            Case "004" : Nama.Text = "Aldyan"
            Case Else : Nama.Text = ""
        End Select
    End Sub

    Private Sub Tipe_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Tipe.SelectedIndexChanged
        Select Case Tipe.Text
            Case "TOKO"
                Biaya.Text = 20000
                Harga.Text = 300
            Case "RUMAH"
                Biaya.Text = 25000
                Harga.Text = 100
            Case "SWALAYAN"
                Biaya.Text = 10000
                Harga.Text = 200
            Case "PABRIK"
                Biaya.Text = 300000
                Harga.Text = 500
        End Select
    End Sub
End Class


Demikianlah postingan saya Nama: Suha Alvita NPM:14110336
Selamat Belajar Pemrograman VB NET

1 komentar: