Terima kasih telah mengunjungi Blog saya...

Minggu, 08 Desember 2013

JAWAB QUIS ONLINE 8 DESEMBER 2013(PROGRAM PEMAKAIAN LISTRIK)


Public Class Form1
    Sub BUAT_TABLE()
        Lv.GridLines = True
        Lv.View = View.Details
        Lv.FullRowSelect = True
        Lv.Columns.Add("Kode pelanggan")
        Lv.Columns.Add("daerah")
        Lv.Columns.Add("tipe")
        Lv.Columns.Add("Biaya beban")
        Lv.Columns.Add("Harga Kwh")
        Lv.Columns.Add("Meter Bulan Ini")
        Lv.Columns.Add("Meter Bulan lalu")
        Lv.Columns.Add("Besar Pemakaian")
        Lv.Columns.Add("Total Tagihan")
        Lv.Columns.Add("pajak")
        Lv.Columns.Add("Pembayaran")


    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        kode.Items.Add("PAB-MED-100")
        kode.Items.Add("TOK-MAR-101")
        kode.Items.Add("SWA-TEM-102")
        kode.Items.Add("RUM-BIN-103")
        kode.Items.Add("PAB-PAK-104")
        Call BUAT_TABLE()
    End Sub

    Private Sub btnhapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnhapus.Click
        kode.Text = ""
        daerah.Text = ""
        Tipe.Text = ""
        Bbeban.Text = ""
        Kwh.Text = ""
        mini.Text = ""
        mlalu.Text = ""
        bpakai.Text = ""
        ttagihan.Text = ""
        pajak.Text = ""
        bayar.Text = ""
    End Sub

    Private Sub btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsimpan.Click
        Dim lst As New ListViewItem
        lst.Text = kode.Text
        lst.SubItems.Add(daerah.Text)
        lst.SubItems.Add(Tipe.Text)
        lst.SubItems.Add(Bbeban.Text)
        lst.SubItems.Add(Kwh.Text)
        lst.SubItems.Add(mini.Text)
        lst.SubItems.Add(mlalu.Text)
        lst.SubItems.Add(bpakai.Text)
        lst.SubItems.Add(ttagihan.Text)
        lst.SubItems.Add(pajak.Text)
        lst.SubItems.Add(bayar.Text)
        Lv.Items.Add(lst)


    End Sub

    Private Sub Btnhapussemua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapussemua.Click
        Lv.Items.Clear()
    End Sub

    Private Sub Btnhapusterpilih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapusterpilih.Click
        Lv.Items.Remove(Lv.SelectedItems(0))

    End Sub

    Private Sub no_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
        Dim x As String
        x = Microsoft.VisualBasic.Left(kode.Text, 3)
        Select Case x
            Case "TOK" : Tipe.Text = "TOKO"
                Kwh.Text = "500"
                Bbeban.Text = "150000"
            Case "RUM" : Tipe.Text = "RUMAH"
                Kwh.Text = "200"
                Bbeban.Text = "50000"
            Case "SWA" : Tipe.Text = "SWALAYAN"
                Kwh.Text = "1500"
                Bbeban.Text = "400000"
            Case "PAB" : Tipe.Text = "PABRIK"
                Kwh.Text = "10000"
                Bbeban.Text = "1000000"
        End Select
        x = Microsoft.VisualBasic.Mid(kode.Text, 5, 3)
        If x = "MED" Then
            daerah.Text = "MEDAN"
        ElseIf x = "BEL" Then
            daerah.Text = "BELAWAN"
        ElseIf x = "TEM" Then
            daerah.Text = "AKSARA"
        ElseIf x = "MAR" Then
            daerah.Text = "MARENDAL"
        ElseIf x = "BIN" Then
            daerah.Text = "BINJAI"
        Else
            daerah.Text = "LUBUK PAKAM"

        End If


    End Sub

    Private Sub bpakai_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles bpakai.KeyPress
        If Asc(e.KeyChar) = 13 Then
            ttagihan.Text = Val(Bbeban.Text) + Val(Kwh.Text) * bpakai.Text
            pajak.Text = 0.015 * ttagihan.Text
            bayar.Text = Val(pajak.Text) + Val(ttagihan.Text)

        End If
    End Sub

    Private Sub mlalu_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mlalu.TextChanged
        bpakai.Text = Val(mini.Text) - Val(mlalu.Text)
    End Sub
End Class

NAMA : TIAFANI HUTABARAT
NPM : 12110844
KELAS : TI-P 1217