Comp Codes
Comp Codes
Else MsgBox "No New Order to Clear", vbOKOnly + vbExclamation, "Customer Order" End If End Sub Private Sub cmdexit_Click() End End Sub
Private Sub cmdcalculate_Click() 'Dimension local variables, c alculate and display the current amounts, add to totals Dim Dim Dim Dim curPrice As Currency intQuantity As Integer curtax As Currency curitemamount As Currency curtaxrate As Currency = 0.08 curcappuccinoprice As Currency = 120 curespressoPrice As Currency = 125 curlatteprice As Currency = 115 curicedprice As Currency = 150
Private Sub cmdneworder_Click() 'Clear the current order and add to totals Call cmdclear_Click lblsubtotal.Caption = "" lbltax.Caption = "" lbltotaldue.Caption = "" 'Add to Totals If mcursubtotal <> 0 Then mcurGrandTotal = mcurGrandTotal + mcurtotal mcursubtotal = 0 mcurtotal = 0 mintCustomerCount = mintCustomerCount + 1 End If 'Clear appropriate display items and enable check box chktakeout.Enabled = True chktakeout.Value = 0 End Sub Private Sub cmdsummary_Click() 'Calculate the average and display the totals Dim Dim Dim Dim curaverage As Currency strMessageString As String strFormattedAvg As String strtotalsales As String
'Find the price If optcappuccino.Value = True Then curPrice = curcappuccinoprice ElseIf optespresso.Value = True Then curPrice = curespressoPrice ElseIf optlatte.Value = True Then curPrice = curlatteprice ElseIf opticedlatte.Value = True Or opticedcappuccino.Value = True Then curPrice = curicedprice End If 'Add the price times quantity to price so far If IsNumeric(txtquantity.Text) = True Then intQuantity = Val(txtquantity.Text) curitemamount = intQuantity * curPrice If chktakeout.Value = 0 Then mcursubtotal = curitemamount + mcursubtotal Else curtax = curtaxrate * curitemamount mcursubtotal = curitemamount + mcursubtotal End If mcurtotal = mcursubtotal + curtax lblitemamount.Caption = FormatCurrency(curitemamount) lblsubtotal.Caption = FormatCurrency(mcursubtotal) lbltax.Caption = FormatCurrency(curtax) lbltotaldue.Caption = FormatCurrency(mcurtotal) Else MsgBox "Quantity must be numeric", vbOKOnly + vbExclamation, "Numeric Test" txtquantity.SetFocus End If End Sub Private Sub cmdclear_Click() 'Clear appropriate controls If mcursubtotal <> 0 Then optcappuccino.Value = True optespresso.Value = False optlatte.Value = False opticedlatte.Value = False opticedcappuccino.Value = False txtquantity.Text = "" chktakeout.Enabled = False lblitemamount.Caption = "" txtquantity.SetFocus
If mintCustomerCount > 0 Then curaverage = mcurGrandTotal / mintCustomerCount If mcurtotal <> 0 Then Call cmdneworder_Click End If Else MsgBox "No data to summarize", vbOKOnly + vbExclamation, "Coffee Sales Summary" End If 'Format the numbers strFormattedAvg = FormatCurrency(curaverage) strtotalsales = FormatCurrency(mcurGrandTotal) 'Concatenate the message string strMessageString = "Number Orders: " & mintCustomerCount & vbCrLf & "Total Sales: " & strtotalsales & vbCrLf & "Average Sale: " & strFormattedAvg MsgBox strMessageString, vbOKOnly + vbInformation, "Coffee Sales Summary" End Sub
'Dimension module level variables Dim mcurGrandTotal, mcurprice, mcurtotal, mcursubtotal As Currency Dim mintCustomerCount As Integer Private Sub cmdCompute_Click() 'Dimension local varaibles, calculate and display the correct amount, add to totals Dim curPrice As Currency Dim curTotal, curdiscount As Currency Const Const Const Const Const Const cur10 As Currency = 0.1 cur20 As Currency = 0.2 curMakeoverPrice As Currency = 600 curHairstylingPrice As Currency = 500 curManicurePrice As Currency = 250 curPedicurePrice As Currency = 300 mintemployees = mintemployees + 1 If txtname.Text = "" Or txtnumber.Text = "" Then MsgBox "Missing Data.", vbOKOnly + vbInformation, "Data Missing" Else mintnumber = Val(txtnumber.Text) If mintnumber < 200 Then mintamount = mintnumber * 25 ElseIf mintnumber < 400 Then mintamount = mintnumber * 40 ElseIf mintnumber < 600 Then mintamount = mintnumber * 60 ElseIf mintnumber > 600 Then mintamount = mintnumber * 75 End If lblamountearned.Caption = FormatCurrency(mintamount) End If minttotalpieces = mintnumber + minttotalpieces minttotalpay = mintamount + minttotalpay mintaverage = minttotalpay / mintemployees End Sub Private Sub cmdclear_Click() txtname.Text = "" txtnumber.Text = "" lblamountearned.Caption = "" End Sub Private Sub cmdexit_Click() End End Sub Private Sub cmdsummary_Click() If txtname.Text = "" Or txtnumber.Text = "" Then MsgBox "Missing Data.", vbOKOnly + vbInformation, "Data Missing" Else 'Clear appropriate controls optmakeover.Value = False opthairstyling.Value = False optmanicure.Value = False optpedicure.Value = False lblprice.Caption = " " lbldiscount.Caption = " " End Sub Private Sub cmdexit_Click() End End Sub Private Sub cmdneworder_Click() Call cmdClear_Click End Sub lblpay.Caption = FormatCurrency(minttotalpay) lblpieces.Caption = minttotalpieces lblemployees.Caption = mintemployees lblaverage.Caption = FormatCurrency(mintaverage) End If End Sub Dim mintamount, mintnumber, mintemployees, minttotalpieces, minttotalpay, mintaverage As Integer Private Sub cmdcalculate_Click()
'Find the price If optmakeover.Value = True Then mcurprice = curMakeoverPrice ElseIf opthairstyling.Value = True Then mcurprice = curHairstylingPrice ElseIf optmanicure.Value = True Then mcurprice = curManicurePrice ElseIf optpedicure.Value = True Then mcurprice = curPedicurePrice End If If opt10.Value = True Then curdiscount = cur10 * mcurprice ElseIf opt20.Value = True Then curdiscount = cur20 * mcurprice End If 'Add the price times quantity to price so far mcurprice = mcurprice - curdiscount lblprice.Caption = curPrice lblprice.Caption = FormatCurrency(mcurprice) lbldiscount.Caption = FormatCurrency(curdiscount) mcurtotal = Val(lbltotal.Caption) mcurGrandTotal = mcurGrandTotal + mcurprice lbltotal.Caption = FormatCurrency(mcurGrandTotal) End Sub Private Sub cmdClear_Click()