Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
buattable()
kdBrg.Items.Add("TS001")
kdBrg.Items.Add("TS002")
kdBrg.Items.Add("VG001")
kdBrg.Items.Add("VG002")
End Sub
Sub kde()
If Microsoft.VisualBasic.Left(kdBrg.Text, 2) = "TS" Then
Merek.Text = "Thosiba"
ElseIf Microsoft.VisualBasic.Left(kdBrg.Text, 2) = "VG" Then
Merek.Text = "V-Gen"
End If
If Microsoft.VisualBasic.Right(kdBrg.Text, 3) = "001" Then
NmBrg.Text = "Flashdick 4GB"
ElseIf Microsoft.VisualBasic.Right(kdBrg.Text, 3) = "002" Then
NmBrg.Text = "Flashdick 2GB"
End If
End Sub
Sub buattable()
LV.Columns.Add("No Pembelian", 100, HorizontalAlignment.Center)
LV.Columns.Add("Kode Barang", 80, HorizontalAlignment.Center)
LV.Columns.Add("Nama Barang", 80, HorizontalAlignment.Center)
LV.Columns.Add("Merek", 80, HorizontalAlignment.Center)
LV.Columns.Add("Harga", 80, HorizontalAlignment.Center)
LV.Columns.Add("Jumlah Beli", 80, HorizontalAlignment.Center)
LV.Columns.Add("Total Harga", 80, HorizontalAlignment.Center)
LV.View = View.Details
LV.FullRowSelect = True
LV.GridLines = True
End Sub
Sub isi()
Dim Lst As New ListViewItem
lst.Text = NoPemb.Text
lst.SubItems.Add(kdBrg.Text)
lst.SubItems.Add(NmBrg.Text)
lst.SubItems.Add(Merek.Text)
lst.SubItems.Add(Harga.Text)
lst.SubItems.Add(JlhBeli.Text)
lst.SubItems.Add(TtlHarga.Text)
LV.Items.Add(lst)
End Sub
Sub hrg()
If kdBrg.Text = "TS001" Then
Harga.Text = 105000
ElseIf kdBrg.Text = "TS002" Then
Harga.Text = 75000
ElseIf kdBrg.Text = "VG001" Then
Harga.Text = 90000
ElseIf kdBrg.Text = "VG002" Then
Harga.Text = 60000
End If
End Sub
Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kdBrg.SelectedIndexChanged
kde()
hrg()
End Sub
Private Sub Merek_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Merek.TextChanged
End Sub
Private Sub Harga_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Harga.TextChanged
hrg()
End Sub
Private Sub Jumlah_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles JlhBeli.KeyPress
If Asc(e.KeyChar) = 13 Then
TtlHarga.Text = JlhBeli.Text * Harga.Text
End If
End Sub
Private Sub BtnSimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSimpan.Click
isi()
NoPemb.Text = ""
kdBrg.Text = ""
NmBrg.Text = ""
Merek.Text = ""
Harga.Text = ""
JlhBeli.Text = ""
TtlHarga.Text = ""
NoPemb.Focus()
End Sub
Private Sub Hapus_semua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus_semua.Click
LV.Items.Clear()
End Sub
Private Sub Hapus_data_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Hapus_data.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
End
End Sub
End Class
Tampilan Menu Pembelian Flesdisk:
Tidak ada komentar:
Posting Komentar