- Kode barang menentukan nama barang dan merk
- 2 digit karakter dari sebelah kiri menentukan merk barang.
- 3 digit karakter dari sebelah kanan adalah menentukan nama barang.
- Total harga muncul ketika terjadi penekanan Enter di jumlah beli.
- Total Harga = Harga * Jumlah Beli
Contoh : Kode Barang = TS001, Merk = Toshiba, Nama Barang = Flashdisk 4GB.
Kode Barang = TS002, Merk = Toshiba, Nama Barang = Flashdisk 2GB.
Kode Barang = VG001, Merk = V-Gen, Nama Barang = Flashdisk 4GB.
Kode Barang = VG002, Merk = V-Gen, Nama Barang = Flashdisk 2GB.
Ketentuan Harga :
Kode Barang
|
001
|
002
|
TS
|
105000
|
75000
|
VG
|
90000
|
60000
|
Public Class Form1
Sub
rancangtabel()
With lv
.Columns.Add("No Pembelian", 80,
HorizontalAlignment.Center)
.Columns.Add("Kode Barang", 80,
HorizontalAlignment.Center)
.Columns.Add("Nama Barang", 80,
HorizontalAlignment.Center)
.Columns.Add("Merk", 80, HorizontalAlignment.Center)
.Columns.Add("Harga", 100,
HorizontalAlignment.Center)
.Columns.Add("Jumlah Beli", 100, HorizontalAlignment.Center)
.Columns.Add("Total harga", 80,
HorizontalAlignment.Center)
.GridLines = True
.FullRowSelect = True
.View = View.Details
End With
End Sub
Sub
isitabel()
Dim x As New ListViewItem
x.Text = nopembelian.Text
x.SubItems.Add(kode.Text)
x.SubItems.Add(nama.Text)
x.SubItems.Add(merk.Text)
x.SubItems.Add(harga.Text)
x.SubItems.Add(jumlah.Text)
x.SubItems.Add(total.Text)
lv.Items.Add(x)
End Sub
Private Sub Form1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
kode.Items.Add("AC001")
kode.Items.Add("AX002")
kode.Items.Add("CO003")
kode.Items.Add("AS004")
Call
rancangtabel()
End Sub
Private Sub kode_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles
kode.SelectedIndexChanged
Dim x As String
x =
Microsoft.VisualBasic.Left(kode.Text, 2)
If x = "AC" Then
merk.Text = "Acer"
ElseIf
x = "AX" Then
merk.Text = "Axio"
ElseIf
x = "CO" Then
merk.Text = "Compack"
Else
merk.Text = "Asus"
End If
x =
Microsoft.VisualBasic.Right(kode.Text, 3)
If x = "001" Then
nama.Text = "Laptop Acer Dual Cor"
harga.Text = "3500000"
ElseIf
x = "002" Then
nama.Text = "Laptop Axio Cor 3"
harga.Text = "4000000"
ElseIf
x = "003" Then
nama.Text = "Laptop Compack AMD"
harga.Text = "3000000"
Else
nama.Text = "Laptop Asus Pentium I"
harga.Text = "2500000"
End If
End Sub
Private Sub jumlah_KeyPress(ByVal
sender As Object,
ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles
jumlah.KeyPress
If
e.KeyChar = Chr(13) Then
total.Text = Val(harga.Text *
jumlah.Text)
End If
End Sub
Private Sub Button1_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Call
isitabel()
End Sub
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
nopembelian.Text = ""
kode.Text = ""
nama.Text = ""
harga.Text = ""
merk.Text = ""
jumlah.Text = ""
total.Text = ""
End Sub
Private Sub Button3_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
nopembelian.Text = ""
kode.Text = ""
nama.Text = ""
harga.Text = ""
merk.Text = ""
jumlah.Text = ""
total.Text = ""
lv.Clear()
End Sub
Private Sub Button4_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button4.Click
If
lv.SelectedItems.Count <> 0 Then
lv.SelectedItems(0).Remove()
Else
MsgBox("BLOCK
DULU BROW,BARU HAPUS LIST..OK")
End If
End Sub
Private Sub Button5_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles Button5.Click
Me.Close()
End Sub
End Class
Tidak ada komentar:
Posting Komentar