PENJUALAN LAPTOP

 

Private Function baca(X As Integer) As String
Dim i As Long
Dim ratus(9) As String
Dim belas(9) As String
Dim puluh(9) As String
Dim satuan(9) As String
Dim sbaca As String

satuan(1) = “satu”
satuan(2) = “dua”
satuan(3) = “tiga”
satuan(4) = “empat”
satuan(5) = “lima”
satuan(6) = “enam”
satuan(7) = “tujuh”
satuan(8) = “delapan”
satuan(9) = “sembilan”

For i = 1 To 9
If i = 1 Then
puluh(i) = “sepuluh”
Else
puluh(i) = satuan(i) & ” puluh”
End If
Next

For i = 1 To 9
If i = 1 Then
belas(i) = “sebelas”
Else
belas(i) = satuan(i) & ” belas”
End If
Next

For i = 1 To 9
If i = 1 Then
ratus(i) = “seratus”
Else
ratus(i) = satuan(i) & ” ratus”
End If
Next

If X >= 100 Then
sbaca = ratus(Val(Mid(Str(X), 2, 1)))
X = Val(Mid(Str(X), 3, 2))
End If

If X >= 20 Or X = 10 Then
sbaca = sbaca & ” ” & puluh(Val(Mid(Str(X), 2, 1)))
X = Val(Mid(Str(X), 3, 1))
Else
If X > 10 Then
sbaca = sbaca & ” ” & belas(Val(Mid(Str(X), 3, 1)))
X = -1
End If
End If

If X >= 1 Then
sbaca = sbaca & ” ” & satuan(Val((Str(X))))
End If

baca = sbaca
End Function
Function terbilang(X As Currency) As String
Dim ribu, juta, milyar, trilyun, ratusan As Integer
Dim sterbilang As String
Dim ptext As Byte
sterbilang = “”

If Val(X) < 0 Then
Exit Function
End If

If Val(X) = 0 Then
sterbilang = “nol”
End If

If X >= 1000000000000# Then
ptext = Len(Str(X)) – 13
trilyun = Val(Mid(Str(X), 2, ptext))
sterbilang = sterbilang & ” ” & baca(Val(trilyun)) & ” trilyun”
X = Val(Mid(Str(X), ptext + 2, 12))
End If

If X >= 1000000000 Then
ptext = Len(Str(X)) – 10
milyar = Val(Mid(Str(X), 2, ptext))
sterbilang = sterbilang & ” ” & baca(Val(milyar)) & ” milyar”
X = Val(Mid(Str(X), ptext + 2, 9))
End If

If X >= 1000000 Then
ptext = Len(Str(X)) – 7
juta = Val(Mid(Str(X), 2, ptext))
sterbilang = sterbilang & ” ” & baca(Val(juta)) & ” juta”
X = Val(Mid(Str(X), ptext + 2, 6))
End If

If X >= 1000 Then
ptext = Len(Str(X)) – 4
ribu = Val(Mid(Str(X), 2, ptext))
If ribu = 1 Then
sterbilang = “seribu”
Else
sterbilang = sterbilang & ” ” & baca(Val(ribu)) & ” ribu”
End If
X = Val(Mid(Str(X), ptext + 2, 3))
End If

sterbilang = sterbilang & ” ” & baca(Val(X))
terbilang = Trim(sterbilang) & ” rupiah”
End Function

Private Sub Cbokode_Click()
Dim MT, HS As String
If Cbokode.Text = “Asus A43SA” Then
MT = “Asus A43SA-VX090D”
HS = “5500000”
ElseIf Cbokode.Text = “Asus A43SD” Then
MT = “Asus A43SD-VX052D”
HS = “4500000”
ElseIf Cbokode.Text = “Asus A43SJ” Then
MT = “Asus A43SJ-VX792D”
HS = “4300000”
ElseIf Cbokode.Text = “Asus A43TA” Then
MT = “Asus A43TA-VX034D”
HS = “4900000”
ElseIf Cbokode.Text = “Asus N43SL” Then
MT = “Asus N43SL-VX264D”
HS = “4300000”
ElseIf Cbokode.Text = “Apple MC965” Then
MT = “Apple MacBook Air MC965”
HS = “6600000”
ElseIf Cbokode.Text = “Apple MC966” Then
MT = “Apple MacBook Air MC966”
HS = “12800000”
ElseIf Cbokode.Text = “Apple MC969” Then
MT = “Apple MacBook Air MC969”
HS = “15800000”
ElseIf Cbokode.Text = “Apple MC700” Then
MT = “Apple MacBook Pro MC700”
HS = “11900000”
ElseIf Cbokode.Text = “Apple MC723” Then
MT = “Apple MacBook Pro MC723”
HS = “10800000”
ElseIf Cbokode.Text = “Apple MD311” Then
MT = “Apple MacBook Pro MD311”
HS = “19300000”
ElseIf Cbokode.Text = “Apple MD313” Then
MT = “Apple MacBook Pro MD313”
HS = “24200000”
ElseIf Cbokode.Text = “Apple MD314” Then
MT = “Apple MacBook Pro MD314”
HS = “11900000”
ElseIf Cbokode.Text = “Apple MD322” Then
MT = “Apple MacBook Pro MD322”
HS = “14700000”
ElseIf Cbokode.Text = “Apple MC965” Then
MT = “Apple MacBook Pro MC965”
HS = “21300000”
End If
Txtmerk.Text = MT
Txths.Text = HS
End Sub

Private Sub Cmdproses_Click()
Txthp.Text = Val(Txtjj.Text) * Val(Txths.Text)
If Txthp.Text > 140000000 Then
Txtdis.Text = Val(Txthp.Text) * 0.15
ElseIf Txthp.Text > 135000000 Then
Txtdis.Text = Val(Txthp.Text) * 0.1
ElseIf Txthp.Text > 130000000 Then
Txtdis.Text = Val(Txthp.Text) * 0.5
ElseIf Txthp.Text > 125000000 Then
Txtdis.Text = Val(Txthp.Text) * 0.02
End If
Txttb.Text = Val(Txthp.Text) – Val(Txtdis.Text)
End Sub

Private Sub Form_Load()
Cbokode.AddItem “Asus A43SA”
Cbokode.AddItem “Asus A43SD”
Cbokode.AddItem “Asus A43SJ”
Cbokode.AddItem “Asus A43TA”
Cbokode.AddItem “Asus N43SL”
Cbokode.AddItem “Apple MC965”
Cbokode.AddItem “Apple MC966”
Cbokode.AddItem “Apple MC969”
Cbokode.AddItem “Apple MC700”
Cbokode.AddItem “Apple MC723”
Cbokode.AddItem “Apple MD311”
Cbokode.AddItem “Apple MD313”
Cbokode.AddItem “Apple MD314”
Cbokode.AddItem “Apple MD322”
Cbokode.AddItem “Apple MC965”
End Sub

Private Sub TxtTb_Change()
Txtterbilang.Text = terbilang(Val(Txttb.Text))
End Sub
Private Sub Cmdkeluar_Click()
Unload Me
End Sub

Private Sub Cmdlagi_Click()
Cbokode.Text = “”
Txtmerk.Text = “”
Txths.Text = “”
Txtjj.Text = “”
Txthp.Text = “”
Txtdis.Text = “”
Txttb.Text = “”
Txtterbilang.Text = “”
Cbokode.SetFocus
End Sub

Iklan

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout /  Ubah )

Foto Google+

You are commenting using your Google+ account. Logout /  Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout /  Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout /  Ubah )

w

Connecting to %s