Sub buattable()
lv.Columns.Add("Kode Pelanggan", 100, HorizontalAlignment.Center)
lv.Columns.Add("Nama", 60, HorizontalAlignment.Center)
lv.Columns.Add("Tipe", 80, HorizontalAlignment.Center)
lv.Columns.Add("HargaM3", 80, HorizontalAlignment.Center)
lv.Columns.Add("Jumlah Pemakaian", 120, HorizontalAlignment.Center)
lv.Columns.Add("Total Tagihan", 100, HorizontalAlignment.Center)
lv.Columns.Add("Pembayaran", 80, HorizontalAlignment.Center)
lv.Columns.Add("Daerah", 80, HorizontalAlignment.Center)
lv.Columns.Add("Biaya Beban", 90, HorizontalAlignment.Center)
lv.Columns.Add("Pajak", 70, HorizontalAlignment.Center)
lv.View = View.Details
lv.GridLines = True
lv.FullRowSelect = True
End Sub
Sub isitable()
Dim lst As New ListViewItem
lst.Text = kp.Text
lst.SubItems.Add(nama.Text)
lst.SubItems.Add(tipe.Text)
lst.SubItems.Add(hargam3.Text)
lst.SubItems.Add(jp.Text)
lst.SubItems.Add(T_tagihan.Text)
lst.SubItems.Add(pembayaran.Text)
lst.SubItems.Add(daerah.Text)
lst.SubItems.Add(B_beban.Text)
lst.SubItems.Add(pajak.Text)
lv.Items.Add(lst)
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
buattable()
kp.Items.Add("TOK-MED-100")
kp.Items.Add("PAB-BEL-101")
kp.Items.Add("SWA-BEL-102")
kp.Items.Add("PAB-MED-103")
kp.Items.Add("RUM-MED-104")
End Sub
Private Sub jp_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles jp.KeyPress
If Asc(e.KeyChar) = 13 Then
T_tagihan.Text = Val(B_beban.Text) + (hargam3.Text * jp.Text)
pajak.Text = 0.01 * T_tagihan.Text
pembayaran.Text = Val(T_tagihan.Text) + Val(pajak.Text)
End If
End Sub
Private Sub kp_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles kp.SelectedIndexChanged
Dim x As String
x = Microsoft.VisualBasic.Right(kp.Text, 3)
Select Case x
Case "100" : nama.Text = "Desi"
Case "101" : nama.Text = "Yulia"
Case "102" : nama.Text = "Heri"
Case "103" : nama.Text = "Dedi"
Case "104" : nama.Text = "Rini"
End Select
x = Microsoft.VisualBasic.Left(kp.Text, 3)
Select Case x
Case "TOK"
hargam3.Text = 250
B_beban.Text = 15000
tipe.Text = "Toko"
Case "RUM"
hargam3.Text = 150
B_beban.Text = 10000
tipe.Text = "Rumah"
Case "PAB"
hargam3.Text = 25000
B_beban.Text = 250000
tipe.Text = "Pabrik"
Case "SWA"
hargam3.Text = 20000
B_beban.Text = 60000
tipe.Text = "Swalayan"
End Select
x = Microsoft.VisualBasic.Mid(kp.Text, 5, 3)
Select Case x
Case "MED" : daerah.Text = "Medan"
Case "BEL" : daerah.Text = "Belawan"
Case Else : daerah.Text = "-"
End Select
End Sub
Private Sub ButtonKELUAR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonKELUAR.Click
Dim tanya As String
tanya = MsgBox("Apakah Anda Yakin Ingin Keluar", MsgBoxStyle.Question + MsgBoxStyle.YesNo)
If tanya = vbYes Then
Me.Close()
Else
Exit Sub
End If
End Sub
Private Sub Buttonbersih_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonbersih.Click
kp.Text = ""
nama.Text = ""
tipe.Text = ""
daerah.Text = ""
hargam3.Text = ""
B_beban.Text = ""
jp.Text = ""
T_tagihan.Text = ""
pajak.Text = ""
pembayaran.Text = ""
End Sub
Private Sub Buttonsimpan_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonsimpan.Click
isitable()
End Sub
Private Sub Buttonhapus_semua_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonhapus_semua.Click
lv.Clear()
kp.Text = ""
nama.Text = ""
tipe.Text = ""
daerah.Text = ""
hargam3.Text = ""
B_beban.Text = ""
jp.Text = ""
T_tagihan.Text = ""
pajak.Text = ""
pembayaran.Text = ""
End Sub
Private Sub Buttonhapus1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Buttonhapus1.Click
lv.Items.Remove(lv.Items(0))
End Sub
End Class
0 komentar:
Posting Komentar