Penghitungan data penjualan barang menggunakan visualbasic
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
RancangTabel()
K_barang.Items.Add("TS001")
K_barang.Items.Add("TS002")
K_barang.Items.Add("VG001")
K_barang.Items.Add("VG002")
N_pembelian.Focus()
End Sub
Sub RancangTabel()
Lv.Columns.Add("No Pembelian", 100, HorizontalAlignment.Center)
Lv.Columns.Add("Kode Barang", 80, HorizontalAlignment.Center)
Lv.Columns.Add("Nama Barang", 100, HorizontalAlignment.Center)
Lv.Columns.Add("Merk", 80, HorizontalAlignment.Center)
Lv.Columns.Add("Harga", 90, HorizontalAlignment.Center)
Lv.Columns.Add("Jumlah Beli", 50, HorizontalAlignment.Center)
Lv.Columns.Add("Total Harga", 80, HorizontalAlignment.Center)
Lv.View = View.Details
Lv.GridLines = True
Lv.FullRowSelect = True
End Sub
Sub hapus()
N_pembelian.text = ""
K_barang.text = ""
N_barang.text = ""
Merk.text = ""
Harga.text = ""
J_beli.text = ""
T_harga.text = ""
End Sub
Sub IsiTabel()
Dim Lst As New ListViewItem
Lst.Text = N_pembelian.Text
Lst.SubItems.Add(K_barang.Text)
Lst.SubItems.Add(N_barang.Text)
Lst.SubItems.Add(Merk.Text)
Lst.SubItems.Add(Harga.Text)
Lst.SubItems.Add(J_beli.Text)
Lst.SubItems.Add(T_harga.Text)
lv.Items.Add(Lst)
End Sub
Private Sub K_barang_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles K_barang.SelectedIndexChanged
Dim x As String
x = Microsoft.VisualBasic.Left(K_barang.Text, 2)
If x = "TS" Then
Merk.Text = "TOSHIBA"
ElseIf x = "VG" Then
Merk.Text = "V-GEN"
End If
Dim y As String
y = Microsoft.VisualBasic.Mid(K_barang.Text, 3)
If y = "001" Then
N_barang.Text = "FLASHDISK 4GB"
ElseIf y = "002" Then
N_barang.Text = "FLASHDISK 2GB"
End If
Dim z As String
z = Microsoft.VisualBasic.Left(K_barang.Text, 5)
If z = "TS001" Then
Harga.Text = "105000"
ElseIf z = "TS002" Then
Harga.Text = "75000"
ElseIf z = "VG001" Then
Harga.Text = "90000"
ElseIf z = "VG002" Then
Harga.Text = "60000"
End If
End Sub
Private Sub J_beli_Keypress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles J_beli.KeyPress
If e.KeyChar = Chr(13) Then
T_harga.Text = Val(Harga.Text) * J_beli.Text
End If
End Sub
Private Sub Btnsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnsimpan.Click
RancangTabel()
IsiTabel()
N_pembelian.Focus()
End Sub
Private Sub Btnhapussemua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapussemua.Click
Lv.Items.Clear()
End Sub
Private Sub Btnbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnbersih.Click
N_pembelian.Text = ""
K_barang.Text = ""
N_barang.Text = ""
Merk.Text = ""
Harga.Text = ""
J_beli.Text = ""
T_harga.Text = ""
End Sub
Private Sub Btnhapusdata_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Btnhapusdata.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
Bagikan
Penghitungan data penjualan barang menggunakan visualbasic
4/
5
Oleh
Vald Blog
Terimakasih telah memberi komentar di sonirivaldi.blogspot.com