Thursday, 5 December 2013

Program Jual Beli Visual Basic

 

Private Sub n_otomatis()
If Not txnf = "" Then
faktur = Mid(txnf.Text, 1, 3)
NoUrut = CLng(faktur)
NoUrut = NoUrut + 1
txnf.Text = "0" + Format(NoUrut, "00")
Else
NoUrut = 1
txnf = "0" + Format(NoUrut, "00")
End If
End Sub
Private Sub combo1_Click()
If combo1.Text = "Sabun Mandi" Then
txhs.Text = "Rp1500"
ElseIf combo1.Text = "Sabun Cuci" Then
txhs.Text = "Rp2000"
ElseIf combo1.Text = "Sampo" Then
txhs.Text = "Rp3500"
ElseIf combo1.Text = "Pepsodent" Then
txhs.Text = "Rp1000"
End If
txjb.SetFocus
End Sub
Private Sub Command1_Click()
n_otomatis
combo1.Text = ""
txhs.Text = ""
txjb.Text = ""
txd.Text = ""
txtb.Text = ""
txub.Text = ""
txk.Text = ""
End Sub
Private Sub Command2_Click()
End
End Sub

Private Sub Form_Load()
txhs.Enabled = False
txd.Enabled = False
txtb.Enabled = False
txk.Enabled = False
combo1.AddItem "Sabun Mandi"
combo1.AddItem "Sabun Cuci"
combo1.AddItem "Sampo"
combo1.AddItem "Pepsodent"
n_otomatis
End Sub
Private Sub txjb_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If txjb.Text <= 5 Then
txd.Text = "10%"
ElseIf txjb.Text <= 15 Then
txd.Text = "15%"
ElseIf txjb.Text <= 30 Then
txd.Text = "20%"
ElseIf txjb.Text >= 50 Then
txd.Text = "25%"
End If
discount = Left(txd.Text, 2)
discharga = CLng(discount)
satuan = Right(txhs.Text, 4)
hsharga = CLng(satuan)
txtb.Text = Val(hsharga) * Val(txjb.Text) * (Val(discharga) / 100)
txub.SetFocus
End If
End Sub
Private Sub txub_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
txk.Text = Val(txub.Text) - Val(txtb.Text)
End If
End Sub

No comments:

Post a Comment