Dim SubTotal As Long
Dim Total As Long
Private Sub ComboBrg_Click()
For i = 0 To ComboBrg.ListCount - 1
If ComboBrg.Text = ComboBrg.List(i) Then
HargaJualTxt.Text = ComboBrg.ItemData(i)
End If
Next
End Sub
Private Sub Form1_Load()
ComboBrg.Enabled = False
HargaJualTxt.Enabled = False
JmlText.Enabled = False
TambahJualCmd.Enabled = False
HapusCmd.Enabled = False
SemuaCmd.Enabled = False
TotalLbl.Caption = "Rp.0,00"
Total = 0
End Sub
Private Sub HapusCmd_Click()
For i = ListBrg.ListCount - 1 To 0 Step -1
If ListBrg.RemoveItem (i)
List.Harga.RemoveItem (i)
ListJml.RemoveItem (i)
ListSubTotal.RemoveItem (i)
End If
Next
If ListBrg.ListCount = 0 Then
HapusCmd.Enabled = False
SemuaCmd.Enabled = False
End If
HitungTotal
End Sub
Private Sub ListBrg_Click()
For i = 0 To ListBrg.ListCount - 1
If ListBrg.Selected(i) = True Then
ListHarga.Selected(i) = True
ListJml.Selected(i) = True
ListSubTotal.Selected(i) = True
Elself ListBrg.Selected(i) = True
ListHarga.Selected(i) = False
ListJml.Selected(i) = False
ListSubTotal.Selected(i) = False
End If
Next
End Sub
Private Sub SemuaCmd_Click()
For i = ListBrg.ListCount - 1 To 0 Step -1
ListBrg.RemoveItem (i)
ListHarga.RemoveItem (i)
ListJml.RemoveItem (i)
ListSubTotal.RemoveItem (i)
Next
HitungTotal
HapusCmd.Enabled = False
SemuaCmd.Enabled = False
End Sub
Private Sub TambahCmd_Click()
ComboBrg.AddItem NamaTxt.Text
ComboBrg.ItemData(ComboBrg.ListCount - 1) = Val(HargaTxt.Text)
NamaTxt.Text = ""
HargaTxt.Text = ""
ComboBrg.Enabled = True
JmlTxt.Enabled = True
TambahJualCmd.Enabled = True
End Sub
Private Sub TambahJualCmd_Click()
ListBrg.AddItem ComboBrg.Text
ListHarga.AddItem HargaJualTxt.Text
ListJml.AddItem JmlTxt.Text
SubTotal = Val(HargaJualTxt.Text) * Val(JmlTxt.Text)
ListTotal.AddItem SubTotal
HitungTotal
ComboBrg.Text = ""
HargaJualTxt.Text = ""
JmlTxt.Text = ""
HapusCmd.Enabled = True
SemuaCmd.Enabled = True
End Sub
Function HitungTotal()
Total = 0
For i = 0 To ListBrg.ListCount - 1
Total = Total + Val(ListTotal.List(i))
Next
TotalLbl.Caption = "Rp." & Format(Total, "##,##") & ",00"
End Function
Tidak ada komentar:
Posting Komentar