Welcome to Dream.In.Code
Become a VB Expert!

Join 137,228 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,901 people online right now. Registration is fast and FREE... Join Now!




Groupbox calculation

 
Reply to this topicStart new topic

Groupbox calculation, Groupbox calculation

VisualBasicBeginner
11 Mar, 2007 - 04:40 PM
Post #1

New D.I.C Head
*

Joined: 4 Mar, 2007
Posts: 33


My Contributions
Hello, I am trying to figure out a form for a car maintenance service. I am using 5 groupboxes. In the first groupbox called Oil and Lube, I have 2 checkboxes, one for oil which is $26.00 and another one for a Lube job for $18.00. In the second groupbox called Flushes, I have 2 checkboxes: one for Radiator Flush for $30.00 and another for Transmission Flush for $80.00. In the third groupbox, called Misc, I have 3 checkboxes, one for Inspection $15.00, another for Replace Muffler for $100.00, and one for Tire Rotation for $20.00. In the fourth groupbox called Other Services, I have 2 textboxes: part and labor. In the final groupbox called Total Fees, I have 4 labels: Services &Labor, Parts, Tax (on parts) and Total Fees. There is also a calculate total button to total up each of these. The car maintenance company performs nonroutine services and charges for parts and labor ($20 per hour) Also, tax is 6% and only charged for parts and not services.

The problems that I’m having include:

-Figuring out how to set up the code for the 2 textboxes. (I am confused as to what exactly is supposed to go inside of them.) (number of parts * 20??)
-Setting up the code for the 2 labels (Services&Labor and Parts) in the total fees groupbox.
-Making a function for TaxCharges, OtherCharges, and TotalCharges.

I have done as much as I could. If someone could guide me in the right direction, it would be much appreciated!! Thanks everyone!!

CODE

Public Class Form1

    Const DecTAX_RATE As Decimal = 0.06D

    Private Sub btnCalculateTotal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculateTotal.Click
        Dim decServiceLabor As Decimal
        Dim decParts As Decimal
        Dim decTax As Decimal
        Dim decTotal As Decimal

        decTotal = OilLubeCost() + FlushesCost() + MiscCost() + OtherServicesCost()
        decTax = txtPart.Text * DecTAX_RATE

        lblServiceTotal.Text = FormatCurrency(decServiceLabor)
        lblPartsTotal.Text = FormatCurrency(decParts)
        lblTaxTotal.Text = FormatCurrency(decTax)
        lblTotalFees.Text = FormatCurrency(decTotal)

    End Sub

    Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
        ClearOilLube()
        ClearFlushes()
        ClearMisc()
        ClearOther()
        ClearFees()
    End Sub


    Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
        Me.Close()
    End Sub

    Function OilLubeCost() As Decimal

        Dim decCostofOilLube As Decimal = 0

        If chkOil.Checked = True Then
            decCostofOilLube += 26D
        End If
        If chkLube.Checked = True Then
            decCostofOilLube += 18D
        End If

        Return decCostofOilLube
    End Function

    Function FlushesCost() As Decimal

        Dim decCostofFlush As Decimal = 0

        If chkRadiator.Checked = True Then
            decCostofFlush += 30D
        End If
        If chkTransmission.Checked = True Then
            decCostofFlush += 80D
        End If

        Return decCostofFlush
    End Function

    Function MiscCost() As Decimal

        Dim decCostofMisc As Decimal = 0

        If chkInspection.Checked = True Then
            decCostofMisc += 15D
        End If
        If chkMuffler.Checked = True Then
            decCostofMisc += 100D
        End If
        If chkTire.Checked = True Then
            decCostofMisc += 20D
        End If

        Return decCostofMisc
    End Function

    Function OtherServicesCost() As Decimal

        Dim decCostofOtherServices As Decimal = 0

    End Function

    Function CalcTax(ByVal decAmount As Decimal) As Decimal

        Return decAmount * DecTAX_RATE
    End Function

    Function TotalCharges()


    End Function

    Private Sub ClearOilLube()

        chkOil.Checked = False
    End Sub

    Sub ClearFlushes()

        chkRadiator.Checked = False
        chkTransmission.Checked = False
    End Sub

    Sub ClearMisc()

        chkInspection.Checked = False
        chkMuffler.Checked = False
        chkTire.Checked = False
    End Sub

    Sub ClearOther()

        txtPart.Clear()
        txtLabor.Clear()
    End Sub

    Sub ClearFees()

        lblServiceTotal.Text = ""
        lblPartsTotal.Text = ""
        lblTaxTotal.Text = ""
        lblTotalFees.Text = ""
    End Sub
End Class

User is offlineProfile CardPM
+Quote Post

VisualBasicBeginner
RE: Groupbox Calculation
13 Mar, 2007 - 01:33 PM
Post #2

New D.I.C Head
*

Joined: 4 Mar, 2007
Posts: 33


My Contributions
I figured it out thanks everyone!!!!!
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 02:58PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month