Selasa, 19 November 2013

progam penjualan dengan menggunakan fungsi if

mesran.net


A. Tampilan program penjualan

B. Listing code program

Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim i As Integer
        For i = 1 To 10
            kode.Items.Add("BT-A0" & i)
        Next
        Call BuatTable()
    End Sub
    Sub BuatTable()
        LV.Columns.Add("Kode", 50, HorizontalAlignment.Center)
        LV.Columns.Add("Nama", 100, HorizontalAlignment.Left)
        LV.Columns.Add("Harga", 80, HorizontalAlignment.Right)
        LV.Columns.Add("Jumlah", 50, HorizontalAlignment.Center)
        LV.Columns.Add("Jumlah Harga", 80, HorizontalAlignment.Left)
        LV.Columns.Add("Diskon", 80, HorizontalAlignment.Right)
        LV.Columns.Add("Total Bayar", 80, HorizontalAlignment.Right)
        LV.GridLines = True
        LV.View = View.Details
        LV.FullRowSelect = True
    End Sub
    Sub isiTabel()
        Dim lst As New ListViewItem
        lst.Text = Kode.Text
        lst.SubItems.Add(nabar.Text)
        lst.SubItems.Add(harga.Text)
        lst.SubItems.Add(jlh.Text)
        lst.SubItems.Add(jlhharga.Text)
        lst.SubItems.Add(diskon.Text)
        lst.SubItems.Add(total.Text)
        LV.Items.Add(lst)
    End Sub
    Sub bersih()
        kode.Text = ""
        nabar.Text = ""
        harga.Text = ""
        jlh.Text = ""
        jlhharga.Text = ""
        diskon.Text = ""
        total.Text = ""
    End Sub

    Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kode.SelectedIndexChanged
        If kode.Text = "BT-A01" Then
            nabar.Text = "TV"
            harga.Text = 1500000
        ElseIf kode.Text = "BT-A02" Then
            nabar.Text = "Kulkas"
            harga.Text = 2000000
        ElseIf kode.Text = "BT-A03" Then
            nabar.Text = "Kipas"
            harga.Text = 350000
        ElseIf kode.Text = "BT-A04" Then
            nabar.Text = "Louspeaker"
            harga.Text = 700000
        ElseIf kode.Text = "BT-A05" Then
            nabar.Text = "Digital"
            harga.Text = 700000
        ElseIf kode.Text = "BT-A06" Then
            nabar.Text = "DVD"
            harga.Text = 350000
        ElseIf kode.Text = "BT-A07" Then
            nabar.Text = "Strika"
            harga.Text = 250000
        ElseIf kode.Text = "BT-A08" Then
            nabar.Text = "Teeb"
            harga.Text = 350000
        ElseIf kode.Text = "BT-A09" Then
            nabar.Text = "ACC"
            harga.Text = 3500000
        Else
            nabar.Text = "Printer"
            harga.Text = 700000
        End If
    End Sub

    Private Sub hitung_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hitung.Click
        jlhharga.Text = harga.Text * jlh.Text
        diskon.Text = 2 / 100 * jlhharga.Text
        total.Text = jlhharga.Text - diskon.Text
    End Sub

    Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
        Call bersih()
    End Sub

    Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
        Close()
    End Sub

    Private Sub smpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles smpan.Click
        Call isiTabel()
    End Sub

    Private Sub hps_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

    End Sub
End Class

C. Tampilan hasil program


Tidak ada komentar:

Posting Komentar