Please i need help what is the missing Code here...
THis is like a Simple POS
this is the CODE:
Dim total As Double
Dim item_price As Double
Private Sub cboFruits_Click()
Me.txtQuantity.SetFocus
End Sub
Private Sub cboFruits_DropDown()
Me.cmdAdd.Default = True
End Sub
Private Sub cmdAdd_Click()
item_price = 0
With Me.cboFruits
If .Text = "Apple" Then
item_price = 10.5
discount = 0.05
ElseIf .Text = "Banana" Then
item_price = 22
discount = 0.1
ElseIf .Text = "Grapes" Then
item_price = 120
discount = 0.07
ElseIf .Text = "Orange" Then
item_price = 8
discount = 0.12
ElseIf .Text = "Mango" Then
item_price = 15.5
discount = 0.15
ElseIf .Text = "Pineapple" Then
item_price = 10
discount = 0.08
End If
End With
With Me.MSFlexGrid1
.AddItem ""
.Row = .Rows - 2
.Col = 1
.Text = Me.cboFruits.Text
.Col = 2
.Text = Format(item_price, "Standard")
.Col = 3
.Text = Me.txtQuantity
.Col = 4
.Text = Format(discount, "Percent")
.Col = 5
discount_amount = (item_price * Val(Me.txtQuantity) * discount)
.Text = Format(discount_amount, "standard")
.Col = 6
______????????????????????????
total = Format(Round(total, 2), "#.00")
.Text = Format(Round((item_price * Val(Me.txtQuantity)) - discount_amount, 2), "#.00")
.Row = .Rows - 1
.Col = 5
.Text = "Total :"
.Col = 6
.Text = Format(Round(total, 2), "#.00")
End With
___________??????
_____________??????
______________??????
End Sub
Private Sub cmdChange_Click()
If total <= Val(Me.txtCash.Text) Then
Me.lblChange.Caption = Format((Val(Me.txtCash.Text) - total))
Else
Me.txtCash.Text = ""
Me.lblChange = ""
End If
End Sub
Private Sub cmdClose_Click()
End
End Sub
Private Sub cmdNew_Click()
Me.lblChange.Caption = ""
Me.lblTotalAmount.Caption = ""
Me.txtCash.Text = ""
total = 0
Me.MSFlexGrid1.Clear
With Me.MSFlexGrid1
.Row = 0
.Col = 1
.Text = "Fruit Name"
.Col = 2
.Text = "Price"
.Col = 3
.Text = "Quantity"
.Col = 4
.Text = "Discount"
.Col = 5
.Text = "Dis. Amt."
.Col = 6
.Text = "Subtotal"
.Rows = 2
End With
End Sub
Private Sub cmdRemove_Click()
With Me.MSFlexGrid1
If .RowSel = .Rows - 1 Or .Rows = 2 Then
Else
.RemoveItem .RowSel
Dim total_row As Integer
Dim total_price As Double
total_price = 0
total_row = Me.MSFlexGrid1.Rows - 2
a = 1
While a <= total_row
With Me.MSFlexGrid1
.Row = a
.Col = 1
If .Text = "Apple" Then
discount = 0.05
ElseIf .Text = "Banana" Then
discount = 0.1
ElseIf .Text = "Grapes" Then
discount = 0.07
ElseIf .Text = "Orange" Then
discount = 0.12
ElseIf .Text = "Mango" Then
discount = 0.15
ElseIf .Text = "Pineapple" Then
discount = 0.08
End If
.Col = 2
price = .Text
.Col = 3
qty = .Text
____________?????????
total_price = Round(total_price, 2)
a = a + 1
End With
Wend
With Me.MSFlexGrid1
.Col = 6
.Row = .Rows - 1
.Text = Format(total_price, "Standard")
End With
Me.lblTotalAmount.Caption = Format(total_price, "Standard")
End If
End With
total = total_price
End Sub
Private Sub Form_Load()
With Me.MSFlexGrid1
.Row = 0
.Col = 1
.Text = "Fruit Name"
.Col = 2
.Text = "Price"
.Col = 3
________________?????
.Col = 4
.Text = "Discount"
.Col = 5
.Text = "Dis. Amt."
.Col = 6
.Text = "Subtotal"
End With
End Sub
Private Sub txtCash_GotFocus()
Me.cmdChange.Default = True
End Sub
Private Sub txtQuantity_GotFocus()
Me.cmdAdd.Default = True
End Sub
very much appreciated your Replies...
THANK you in Advance.!