View Single Post
Old Mar 12, 2003 | 07:00 PM
  #18  
hondav6's Avatar
hondav6
Senior Member
 
Joined: Jul 2002
Posts: 1,119
Likes: 0
From: La Plata, Maryland
Default

Option Explicit
Dim bagel_total, toppings, subTotal, total_tax, total_bill As Double
Const tax = 0.06
Const x = 25


Private Sub cmdCalc_Click()

'Bagel and Coffee Selection
If (optWhite = True) Then
If (optNone = True) Then
bagel_total = 1.25
End If
End If
If (optWhite = True) Then
If (optRegular = True) Then
bagel_total = 2.5
End If
End If
If (optWhite = True) Then
If (optCapp = True) Then
bagel_total = 3.25
End If
End If
If (optWhite = True) Then
If (optCafe = True) Then
bagel_total = 3
End If
End If

If (optWheat = True) Then
If (optNone = True) Then
bagel_total = 1.5
End If
End If
If (optWheat = True) Then
If (optRegular = True) Then
bagel_total = 2.75
End If
End If
If (optWheat = True) Then
If (optCapp = True) Then
bagel_total = 3.5
End If
End If
If (optWheat = True) Then
If (optCafe = True) Then
bagel_total = 3.75
End If
End If

'Toppings
If (chkCheese = vbChecked) Then
toppings = toppings + 0.5
End If
If (chkButter = vbChecked) Then
toppings = toppings + 0.25
End If
If (chkBlue = vbChecked) Then
toppings = toppings + 0.75
End If
If (chkRasp = vbChecked) Then
toppings = toppings + 0.75
End If
If (chkPeach = vbChecked) Then
toppings = toppings + 0.75
End If

subTotal = bagel_total + toppings
total_tax = subTotal * tax
total_bill = subTotal + total_tax

lblSubtotal.Caption = FormatCurrency(subTotal)
lblTax.Caption = FormatCurrency(total_tax)
lblTotal.Caption = FormatCurrency(total_bill)

picResult.Cls
picResult.FontBold = True
picResult.Print "Customer Reciept"
picResult.FontBold = False
picResult.Print
picResult.Print "Subtotal: "; Tab(x); FormatCurrency(subTotal)
picResult.Print "Tax: "; Tab(x); FormatCurrency(total_tax)
picResult.Print "Total: "; Tab(x); FormatCurrency(total_bill)

End Sub

Private Sub cmdExit_Click()
End
End Sub

Private Sub cmdPayment_Click()
Dim payment, cashDue As Single
payment = Val(InputBox("Enter the Pament", "Payment", FormatNumber(total_bill, 2)))

If (payment < total_bill) Then
MsgBox "Incorrect Amount!", vbOKOnly + vbCritical, "Error!"
Else
cashDue = payment - total_bill
picResult.Print "Payment"; Tab(x); FormatCurrency(payment)
picResult.Print "Change Due"; Tab(x); FormatCurrency(cashDue)
End If
End Sub
Reply