'Project:     Shedd0402

'Date:        May 14, 2006

'Programmer:  Brad Shedd

'Description: This project will display the total sales for a beauty salon. This also calculates a new patron and displays a summary.

 

 

Option Strict On

Public Class beautySalonForm

    Inherits System.Windows.Forms.Form

 

#Region " Windows Form Designer generated code "

 

    Public Sub New()

        MyBase.New()

 

        'This call is required by the Windows Form Designer.

        InitializeComponent()

 

        'Add any initialization after the InitializeComponent() call

 

    End Sub

 

    'Form overrides dispose to clean up the component list.

    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)

        If disposing Then

            If Not (components Is Nothing) Then

                components.Dispose()

            End If

        End If

        MyBase.Dispose(disposing)

    End Sub

 

    'Required by the Windows Form Designer

    Private components As System.ComponentModel.IContainer

 

    'NOTE: The following procedure is required by the Windows Form Designer

    'It can be modified using the Windows Form Designer. 

    'Do not modify it using the code editor.

    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox

    Friend WithEvents GroupBox2 As System.Windows.Forms.GroupBox

    Friend WithEvents makeOverRadioButton As System.Windows.Forms.RadioButton

    Friend WithEvents hairStylingRadioButton As System.Windows.Forms.RadioButton

    Friend WithEvents manicureRadioButton As System.Windows.Forms.RadioButton

    Friend WithEvents permMakeUpRadioButton As System.Windows.Forms.RadioButton

    Friend WithEvents tenDiscountRadioButton As System.Windows.Forms.RadioButton

    Friend WithEvents twentyDiscountRadioButton As System.Windows.Forms.RadioButton

    Friend WithEvents noneRadioButton As System.Windows.Forms.RadioButton

    Friend WithEvents Label1 As System.Windows.Forms.Label

    Friend WithEvents Label2 As System.Windows.Forms.Label

    Friend WithEvents currentServiceLabel As System.Windows.Forms.Label

    Friend WithEvents totalServiceLabel As System.Windows.Forms.Label

    Friend WithEvents calculateButton As System.Windows.Forms.Button

    Friend WithEvents clearButton As System.Windows.Forms.Button

    Friend WithEvents exitButton As System.Windows.Forms.Button

    Friend WithEvents newPatronButton As System.Windows.Forms.Button

    Friend WithEvents summaryButton As System.Windows.Forms.Button

    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

        Me.GroupBox1 = New System.Windows.Forms.GroupBox

        Me.permMakeUpRadioButton = New System.Windows.Forms.RadioButton

        Me.manicureRadioButton = New System.Windows.Forms.RadioButton

        Me.hairStylingRadioButton = New System.Windows.Forms.RadioButton

        Me.makeOverRadioButton = New System.Windows.Forms.RadioButton

        Me.GroupBox2 = New System.Windows.Forms.GroupBox

        Me.noneRadioButton = New System.Windows.Forms.RadioButton

        Me.twentyDiscountRadioButton = New System.Windows.Forms.RadioButton

        Me.tenDiscountRadioButton = New System.Windows.Forms.RadioButton

        Me.Label1 = New System.Windows.Forms.Label

        Me.Label2 = New System.Windows.Forms.Label

        Me.currentServiceLabel = New System.Windows.Forms.Label

        Me.totalServiceLabel = New System.Windows.Forms.Label

        Me.calculateButton = New System.Windows.Forms.Button

        Me.clearButton = New System.Windows.Forms.Button

        Me.exitButton = New System.Windows.Forms.Button

        Me.newPatronButton = New System.Windows.Forms.Button

        Me.summaryButton = New System.Windows.Forms.Button

        Me.GroupBox1.SuspendLayout()

        Me.GroupBox2.SuspendLayout()

        Me.SuspendLayout()

        '

        'GroupBox1

        '

        Me.GroupBox1.Controls.Add(Me.permMakeUpRadioButton)

        Me.GroupBox1.Controls.Add(Me.manicureRadioButton)

        Me.GroupBox1.Controls.Add(Me.hairStylingRadioButton)

        Me.GroupBox1.Controls.Add(Me.makeOverRadioButton)

        Me.GroupBox1.Location = New System.Drawing.Point(16, 24)

        Me.GroupBox1.Name = "GroupBox1"

        Me.GroupBox1.Size = New System.Drawing.Size(208, 200)

        Me.GroupBox1.TabIndex = 0

        Me.GroupBox1.TabStop = False

        Me.GroupBox1.Text = "Services"

        '

        'permMakeUpRadioButton

        '

        Me.permMakeUpRadioButton.Location = New System.Drawing.Point(24, 152)

        Me.permMakeUpRadioButton.Name = "permMakeUpRadioButton"

        Me.permMakeUpRadioButton.Size = New System.Drawing.Size(144, 24)

        Me.permMakeUpRadioButton.TabIndex = 3

        Me.permMakeUpRadioButton.Text = "&Permanent Makeup"

        '

        'manicureRadioButton

        '

        Me.manicureRadioButton.Location = New System.Drawing.Point(24, 112)

        Me.manicureRadioButton.Name = "manicureRadioButton"

        Me.manicureRadioButton.Size = New System.Drawing.Size(96, 24)

        Me.manicureRadioButton.TabIndex = 2

        Me.manicureRadioButton.Text = "M&anicure"

        '

        'hairStylingRadioButton

        '

        Me.hairStylingRadioButton.Location = New System.Drawing.Point(24, 72)

        Me.hairStylingRadioButton.Name = "hairStylingRadioButton"

        Me.hairStylingRadioButton.TabIndex = 1

        Me.hairStylingRadioButton.Text = "&Hairstyling"

        '

        'makeOverRadioButton

        '

        Me.makeOverRadioButton.Location = New System.Drawing.Point(24, 32)

        Me.makeOverRadioButton.Name = "makeOverRadioButton"

        Me.makeOverRadioButton.TabIndex = 0

        Me.makeOverRadioButton.Text = "&Makeover"

        '

        'GroupBox2

        '

        Me.GroupBox2.Controls.Add(Me.noneRadioButton)

        Me.GroupBox2.Controls.Add(Me.twentyDiscountRadioButton)

        Me.GroupBox2.Controls.Add(Me.tenDiscountRadioButton)

        Me.GroupBox2.Location = New System.Drawing.Point(272, 32)

        Me.GroupBox2.Name = "GroupBox2"

        Me.GroupBox2.Size = New System.Drawing.Size(200, 152)

        Me.GroupBox2.TabIndex = 1

        Me.GroupBox2.TabStop = False

        Me.GroupBox2.Text = "Discounts"

        '

        'noneRadioButton

        '

        Me.noneRadioButton.Location = New System.Drawing.Point(32, 112)

        Me.noneRadioButton.Name = "noneRadioButton"

        Me.noneRadioButton.TabIndex = 2

        Me.noneRadioButton.Text = "&None"

        '

        'twentyDiscountRadioButton

        '

        Me.twentyDiscountRadioButton.Location = New System.Drawing.Point(32, 72)

        Me.twentyDiscountRadioButton.Name = "twentyDiscountRadioButton"

        Me.twentyDiscountRadioButton.TabIndex = 1

        Me.twentyDiscountRadioButton.Text = "&20% Discount"

        '

        'tenDiscountRadioButton

        '

        Me.tenDiscountRadioButton.Location = New System.Drawing.Point(32, 32)

        Me.tenDiscountRadioButton.Name = "tenDiscountRadioButton"

        Me.tenDiscountRadioButton.TabIndex = 0

        Me.tenDiscountRadioButton.Text = "&10% Discount"

        '

        'Label1

        '

        Me.Label1.Location = New System.Drawing.Point(24, 256)

        Me.Label1.Name = "Label1"

        Me.Label1.Size = New System.Drawing.Size(144, 23)

        Me.Label1.TabIndex = 2

        Me.Label1.Text = "Current Services"

        '

        'Label2

        '

        Me.Label2.Location = New System.Drawing.Point(24, 304)

        Me.Label2.Name = "Label2"

        Me.Label2.Size = New System.Drawing.Size(144, 23)

        Me.Label2.TabIndex = 3

        Me.Label2.Text = "Total Services"

        '

        'currentServiceLabel

        '

        Me.currentServiceLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D

        Me.currentServiceLabel.Location = New System.Drawing.Point(304, 248)

        Me.currentServiceLabel.Name = "currentServiceLabel"

        Me.currentServiceLabel.Size = New System.Drawing.Size(168, 23)

        Me.currentServiceLabel.TabIndex = 4

        Me.currentServiceLabel.TextAlign = System.Drawing.ContentAlignment.TopRight

        '

        'totalServiceLabel

        '

        Me.totalServiceLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D

        Me.totalServiceLabel.Location = New System.Drawing.Point(304, 296)

        Me.totalServiceLabel.Name = "totalServiceLabel"

        Me.totalServiceLabel.Size = New System.Drawing.Size(168, 23)

        Me.totalServiceLabel.TabIndex = 5

        Me.totalServiceLabel.TextAlign = System.Drawing.ContentAlignment.TopRight

        '

        'calculateButton

        '

        Me.calculateButton.Location = New System.Drawing.Point(16, 360)

        Me.calculateButton.Name = "calculateButton"

        Me.calculateButton.Size = New System.Drawing.Size(128, 40)

        Me.calculateButton.TabIndex = 6

        Me.calculateButton.Text = "&Calculate"

        '

        'clearButton

        '

        Me.clearButton.DialogResult = System.Windows.Forms.DialogResult.Cancel

        Me.clearButton.Location = New System.Drawing.Point(192, 360)

        Me.clearButton.Name = "clearButton"

        Me.clearButton.Size = New System.Drawing.Size(128, 40)

        Me.clearButton.TabIndex = 7

        Me.clearButton.Text = "C&lear"

        '

        'exitButton

        '

        Me.exitButton.Location = New System.Drawing.Point(368, 360)

        Me.exitButton.Name = "exitButton"

        Me.exitButton.Size = New System.Drawing.Size(128, 40)

        Me.exitButton.TabIndex = 8

        Me.exitButton.Text = "E&xit"

        '

        'newPatronButton

        '

        Me.newPatronButton.Location = New System.Drawing.Point(24, 440)

        Me.newPatronButton.Name = "newPatronButton"

        Me.newPatronButton.Size = New System.Drawing.Size(152, 40)

        Me.newPatronButton.TabIndex = 9

        Me.newPatronButton.Text = "New Patron"

        '

        'summaryButton

        '

        Me.summaryButton.Location = New System.Drawing.Point(240, 440)

        Me.summaryButton.Name = "summaryButton"

        Me.summaryButton.Size = New System.Drawing.Size(152, 40)

        Me.summaryButton.TabIndex = 10

        Me.summaryButton.Text = "Summary"

        '

        'beautySalonForm

        '

        Me.AcceptButton = Me.calculateButton

        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)

        Me.CancelButton = Me.clearButton

        Me.ClientSize = New System.Drawing.Size(568, 517)

        Me.Controls.Add(Me.summaryButton)

        Me.Controls.Add(Me.newPatronButton)

        Me.Controls.Add(Me.exitButton)

        Me.Controls.Add(Me.clearButton)

        Me.Controls.Add(Me.calculateButton)

        Me.Controls.Add(Me.totalServiceLabel)

        Me.Controls.Add(Me.currentServiceLabel)

        Me.Controls.Add(Me.Label2)

        Me.Controls.Add(Me.Label1)

        Me.Controls.Add(Me.GroupBox2)

        Me.Controls.Add(Me.GroupBox1)

        Me.Name = "beautySalonForm"

        Me.Text = "Total Sales for Beauty Salon"

        Me.GroupBox1.ResumeLayout(False)

        Me.GroupBox2.ResumeLayout(False)

        Me.ResumeLayout(False)

 

    End Sub

 

#End Region

    'Declare the constants

    Const MAKEOVER_PRICE_Decimal As Decimal = 125D

    Const MANICURE_PRICE_Decimal As Decimal = 35D

    Const HAIRSTYLING_PRICE_Decimal As Decimal = 60D

    Const PERMANENT_MAKEUP_PRICE_Decimal As Decimal = 200D

    Const DISCOUNT20_Decimal As Decimal = 0.2D

    Const DISCOUNT10_Decimal As Decimal = 0.1D

 

    ' Declare variables

    Dim priceDecimal, discountDecimal, totalPriceDecimal, grandTotalDecimal, subTotalDecimal As Decimal

    Dim customerCountInteger As Integer

 

    Private Sub calculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles calculateButton.Click

        ' Calculate abd display current and total services.

 

        ' Calculate Price

        If makeOverRadioButton.Checked Then

            priceDecimal = MAKEOVER_PRICE_Decimal

        ElseIf manicureRadioButton.Checked Then

            priceDecimal = MANICURE_PRICE_Decimal

        ElseIf hairStylingRadioButton.Checked Then

            priceDecimal = HAIRSTYLING_PRICE_Decimal

        ElseIf permMakeUpRadioButton.Checked Then

            priceDecimal = PERMANENT_MAKEUP_PRICE_Decimal

        End If

 

        'Caculate extended price and add to order total

        subTotalDecimal += priceDecimal

        totalPriceDecimal = subTotalDecimal + priceDecimal

 

        'Calculate discount

        If twentyDiscountRadioButton.Checked Then

            totalPriceDecimal = priceDecimal - priceDecimal * DISCOUNT20_Decimal

        ElseIf tenDiscountRadioButton.Checked Then

            totalPriceDecimal = priceDecimal - priceDecimal * DISCOUNT10_Decimal

        Else : totalPriceDecimal = priceDecimal

        End If

 

        ' Format answers to labels

        currentServiceLabel.Text = priceDecimal.ToString("C")

        totalServiceLabel.Text = totalPriceDecimal.ToString("C")

 

    End Sub

 

    Private Sub clearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearButton.Click

        ' Clears the labels

        currentServiceLabel.Text = ""

        totalServiceLabel.Text = ""

 

    End Sub

 

    Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click

        ' Exits the project

 

        Me.Close()

    End Sub

 

    Private Sub newPatronButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles newPatronButton.Click

        ' Clear current order and add to totals.

        Dim returnDialogResults As DialogResult

        Dim messageString As String

 

        'Confirm and clear current order

        messageString = "Clear current order figures?"

        returnDialogResults = MessageBox.Show(messageString, "Clear Order", _

        MessageBoxButtons.YesNo, MessageBoxIcon.Question, _

        MessageBoxDefaultButton.Button2)

 

 

        If returnDialogResults = DialogResult.Yes Then 'User said yes.

            'Clear screen field.

            clearButton_Click(sender, e)

            currentServiceLabel.Text = ""

            totalServiceLabel.Text = ""

 

            'Add to totals.

            'Adds only if not new order/customer.

            If subTotalDecimal <> 0 Then

                grandTotalDecimal += totalPriceDecimal

                customerCountInteger += 1

 

                'Reset totals for next patron

                'subTotalDecimal = 0

                'totalPriceDecimal = 0

 

            End If

 

            clearButton.Enabled = True

        End If

    End Sub

 

    Private Sub summaryButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles summaryButton.Click

        'Calculate average and display the totals.

        Dim averageDecimal As Decimal

        Dim messageString As String

 

        If totalPriceDecimal <> 0 Then

            'Make sure last order is counted

            newPatronButton_Click(sender, e)

        End If

 

        If customerCountInteger > 0 Then

            'Calculate the average.

            grandTotalDecimal = totalPriceDecimal

            averageDecimal = grandTotalDecimal / customerCountInteger

 

            'Concatenate the string number string.

            messageString = "Number Of Orders:" _

                            & customerCountInteger.ToString() _

                            & ControlChars.NewLine & ControlChars.NewLine _

                            & "Total Sales: " & grandTotalDecimal.ToString("C") _

                            & ControlChars.NewLine & ControlChars.NewLine _

                            & "Average Sale: " & averageDecimal.ToString("C")

            MessageBox.Show(messageString, "Sales Summary", _

            MessageBoxButtons.OK, MessageBoxIcon.Information)

        Else

            messageString = "No Sales data to summerize."

            MessageBox.Show(messageString, "Sales Summary", _

            MessageBoxButtons.OK, MessageBoxIcon.Information)

 

 

 

        End If

    End Sub

End Class

 

 

Homepage