I have program:
Dim ItemCode(6) As String
Dim Description(6) As String
Dim price(6) As Currency
Dim Quantity As Integer
Dim SaleCost As Currency
Dim item As String
Dim position As Integer
Option Explicit
Private Sub Command1_Click()
item = Text3.Text
Quantity = Val(Text2.Text)
If Option2.Value = True Then
Call CodeSearch(item)
Else
Call DescriptionSearch(item)
End If
SaleCost = price(position) * Quantity
Text4.Text = ItemCode(position) & " - " & Description(position) & " - " & Quantity & " - " & price(position) & " - " & SaleCost
Text5.Text = SaleCost
Text6.Text = Discount(SaleCost)
End Sub
Private Function Discount(curr As Currency) As Currency
Dim temp As Currency
If curr < 15 Then
temp = 0
ElseIf (curr > 14.99) And (curr < 30) Then
temp = 0.05
ElseIf (curr > 29.99) Then
temp = 0.1
End If
Discount = curr - (curr * temp)
End Function
Private Sub CodeSearch(ByVal code As String)
Dim i As Integer
For i = 1 To 6
If ItemCode(i) = code Then
position = i
Exit For
End If
Next i
End Sub
Private Sub DescriptionSearch(ByVal Desc As String)
Dim i As Integer
For i = 1 To 6
If Description(i) = Desc Then
position = i
Exit For
End If
Next i
End Sub
Private Sub Form_Load()
ItemCode(1) = "A349"
ItemCode(2) = "B359"
ItemCode(3) = "C369"
ItemCode(4) = "D379"
ItemCode(5) = "E389"
ItemCode(6) = "F399"
Description(1) = "keyring"
Description(2) = "mug"
Description(3) = "scarf"
Description(4) = "pen"
Description(5) = "doll"
Description(6) = "pencil"
price(1) = 5.99
price(2) = 9.99
price(3) = 14.5
price(4) = 2.49
price(5) = 7.99
price(6) = 0.85
End Sub
know i have to do:
- first button have to only add items to order list and keep them there (textbox4)
- add another button to add discount (textbox6) and calculate total cost + 17,5% VAT (textbox5) . it have to calculate all items from textbox4
can someone help me with that?