Jumat, 05 Desember 2014

Program Sederhana Penjualan Mobil Secara Kredit Menggunakan VB.Net 2008

Sekarang saya akan memposting Program Sederhana Penjualan Mobil Secara Kredit Menggunakan VB.Net 2008. Okey langsung saja gan,
1. Tampilan Form Penjualan Mobil Secara Kredit


2. Listing Program

Public Class Form1

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

        Kode.Items.Add("MB1")
        Kode.Items.Add("MB2")
        Kode.Items.Add("MB3")
        Kode.Items.Add("MB4")

        For i = 2012 To 2014
            Tahun.Items.Add(i)
        Next

        Status.Items.Add("Baru")
        Status.Items.Add("Bekas")

        For x = 12 To 48
            LamaKredit.Items.Add(x)
        Next

        Call BuatTabel()
    End Sub

    Sub Bersih()
        Kode.Text = ""
        Mobil.Text = ""
        Tahun.Text = ""
        Status.Text = ""
        Harga.Text = ""
        Jumlah.Text = ""
        TotalHarga.Text = ""
        UangMuka.Text = ""
        KomisiSales.Text = ""
        TotalKredit.Text = ""
        LamaKredit.Text = ""
        Angsuran.Text = ""
        Kode.Focus()
    End Sub

    Sub BuatTabel()
        With LV
            .GridLines = True
            .View = View.Details
            .FullRowSelect = True
            .Columns.Add("Kode", 100)
            .Columns.Add("Nama Mobil", 130)
            .Columns.Add("Tahun", 100)
            .Columns.Add("Status", 100)
            .Columns.Add("Harga", 100)
            .Columns.Add("Jumlah", 100)
            .Columns.Add("Total Harga", 100)
            .Columns.Add("Uang Muka", 100)
            .Columns.Add("Komisi Sales", 100)
            .Columns.Add("Total Kredit", 100)
            .Columns.Add("Lama Kredit", 100)
            .Columns.Add("Angsuran / Bulan", 100)
        End With
    End Sub

    Sub isitabel()
        Dim lst As New ListViewItem
        With lst
            .Text = Kode.Text
            .SubItems.Add(Mobil.Text)
            .SubItems.Add(Tahun.Text)
            .SubItems.Add(Status.Text)
            .SubItems.Add(Harga.Text)
            .SubItems.Add(Jumlah.Text)
            .SubItems.Add(TotalHarga.Text)
            .SubItems.Add(UangMuka.Text)
            .SubItems.Add(KomisiSales.Text)
            .SubItems.Add(TotalKredit.Text)
            .SubItems.Add(LamaKredit.Text)
            .SubItems.Add(Angsuran.Text)
        End With
        LV.Items.Add(lst)
        Bersih()
    End Sub

    Private Sub Kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Kode.SelectedIndexChanged
        Select Case Kode.Text
            Case "MB1"
                Mobil.Text = "Avanza Veloz"
            Case "MB2"
                Mobil.Text = "Avanza G"
            Case "MB3"
                Mobil.Text = "Zenia"
            Case "MB4"
                Mobil.Text = "Yaris"
        End Select
    End Sub

    Private Sub Status_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Status.SelectedIndexChanged
        If Kode.Text = "MB1" And Tahun.Text = "2012" And Status.Text = "Baru" Then
            Harga.Text = 175000000
        ElseIf Kode.Text = "MB1" And Tahun.Text = "2012" And Status.Text = "Bekas" Then
            Harga.Text = 120000000
        ElseIf Kode.Text = "MB1" And Tahun.Text = "2013" And Status.Text = "Baru" Then
            Harga.Text = 195000000
        ElseIf Kode.Text = "MB1" And Tahun.Text = "2013" And Status.Text = "Bekas" Then
            Harga.Text = 130000000
        ElseIf Kode.Text = "MB1" And Tahun.Text = "2014" And Status.Text = "Baru" Then
            Harga.Text = 208000000
        ElseIf Kode.Text = "MB1" And Tahun.Text = "2014" And Status.Text = "Bekas" Then
            Harga.Text = 170000000

        ElseIf Kode.Text = "MB2" And Tahun.Text = "2012" And Status.Text = "Baru" Then
            Harga.Text = 180000000
        ElseIf Kode.Text = "MB2" And Tahun.Text = "2012" And Status.Text = "Bekas" Then
            Harga.Text = 125000000
        ElseIf Kode.Text = "MB2" And Tahun.Text = "2013" And Status.Text = "Baru" Then
            Harga.Text = 200000000
        ElseIf Kode.Text = "MB2" And Tahun.Text = "2013" And Status.Text = "Bekas" Then
            Harga.Text = 135000000
        ElseIf Kode.Text = "MB2" And Tahun.Text = "2014" And Status.Text = "Baru" Then
            Harga.Text = 220000000
        ElseIf Kode.Text = "MB2" And Tahun.Text = "2014" And Status.Text = "Bekas" Then
            Harga.Text = 180000000

        ElseIf Kode.Text = "MB3" And Tahun.Text = "2012" And Status.Text = "Baru" Then
            Harga.Text = 160000000
        ElseIf Kode.Text = "MB3" And Tahun.Text = "2012" And Status.Text = "Bekas" Then
            Harga.Text = 115000000
        ElseIf Kode.Text = "MB3" And Tahun.Text = "2013" And Status.Text = "Baru" Then
            Harga.Text = 180000000
        ElseIf Kode.Text = "MB3" And Tahun.Text = "2013" And Status.Text = "Bekas" Then
            Harga.Text = 125000000
        ElseIf Kode.Text = "MB3" And Tahun.Text = "2014" And Status.Text = "Baru" Then
            Harga.Text = 200000000
        ElseIf Kode.Text = "MB3" And Tahun.Text = "2014" And Status.Text = "Bekas" Then
            Harga.Text = 160000000

        ElseIf Kode.Text = "MB4" And Tahun.Text = "2012" And Status.Text = "Baru" Then
            Harga.Text = 200000000
        ElseIf Kode.Text = "MB4" And Tahun.Text = "2012" And Status.Text = "Bekas" Then
            Harga.Text = 150000000
        ElseIf Kode.Text = "MB4" And Tahun.Text = "2013" And Status.Text = "Baru" Then
            Harga.Text = 230000000
        ElseIf Kode.Text = "MB4" And Tahun.Text = "2013" And Status.Text = "Bekas" Then
            Harga.Text = 135000000
        ElseIf Kode.Text = "MB4" And Tahun.Text = "2014" And Status.Text = "Baru" Then
            Harga.Text = 245000000
        ElseIf Kode.Text = "MB4" And Tahun.Text = "2014" And Status.Text = "Bekas" Then
            Harga.Text = 180000000
        End If
    End Sub

    Private Sub Jumlah_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Jumlah.TextChanged
        If Harga.Text = "" Then
            Exit Sub
            Status.Focus()
        Else
            TotalHarga.Text = Jumlah.Text * Harga.Text
            UangMuka.Text = 0.3 * TotalHarga.Text
            KomisiSales.Text = 0.02 * Jumlah.Text * UangMuka.Text
            TotalKredit.Text = (TotalHarga.Text - UangMuka.Text)
        End If
    End Sub

    Private Sub BtnProses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnProses.Click
        Angsuran.Text = (((TotalKredit.Text) * (0.03 * LamaKredit.Text))) + Val(TotalKredit.Text) / LamaKredit.Text
    End Sub

    Private Sub BtnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSimpan.Click
        Call isitabel()
    End Sub

    Private Sub BtnBatal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnBatal.Click
        Bersih()
    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 BtnHapusPerKode_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnHapusPerKode.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
        Me.Close()
    End Sub
End Class


3. Hasil Program