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")
kode.Items.Add("MB5")
kode.Items.Add("MB6")
kode.Items.Add("MB7")
For i = 2012 To 2014
tahun.Items.Add(i)
Next
status.Items.Add("Baru")
status.Items.Add("Bekas")
For x = 12 To 48
lama_kredit.Items.Add(x)
Next
Call BuatTabel()
End Sub
Sub Bersih()
kode.Text = ""
mobil.Text = ""
tahun.Text = ""
status.Text = ""
harga.Text = ""
jumlah.Text = ""
total_harga.Text = ""
Uang_muka.Text = ""
komisi_sales.Text = ""
total_kredit.Text = ""
lama_kredit.Text = ""
angsuransi.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(total_harga.Text)
.SubItems.Add(Uang_muka.Text)
.SubItems.Add(komisi_sales.Text)
.SubItems.Add(total_kredit.Text)
.SubItems.Add(lama_kredit.Text)
.SubItems.Add(angsuransi.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 kode.Text
Case "MB1"
mobil.Text = "Avanza Veloz"
Case "MB2"
mobil.Text = "Avanza G"
Case "MB3"
mobil.Text = "Zenia"
Case "MB4"
mobil.Text = "Yaris"
Case "MB5"
mobil.Text = "toyota"
Case "MB6"
mobil.Text = "kijang"
Case "MB7"
mobil.Text = "honda"
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
total_harga.Text = jumlah.Text * harga.Text
Uang_muka.Text = 0.3 * total_harga.Text
komisi_sales.Text = 0.02 * jumlah.Text * Uang_muka.Text
total_kredit.Text = (total_harga.Text - Uang_muka.Text)
End If
End Sub
Private Sub Btn_proses_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_proses.Click
angsuransi.Text = (((total_kredit.Text) * (0.03 * lama_kredit.Text))) + Val(total_kredit.Text) / lama_kredit.Text
End Sub
Private Sub Btn_simpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btn_simpan.Click
Call isitabel()
End Sub
Private Sub batal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles batal.Click
Bersih()
End Sub
Private Sub hapus_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles hapus.Click
LV.Items.Clear()
End Sub
Private Sub Hapus_list_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus_list.Click
LV.Items.Remove(LV.SelectedItems(0))
End Sub
Private Sub Keluar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Keluar.Click
Me.Close()
End Sub
End Class
Tampilan Form
By :
Nama : Derokh Mawati Baene
Kelas : TI-M1310
NPM : 13110073
Semoga bermanfaat
Tidak ada komentar:
Posting Komentar