-
Mar 19th, 2012, 12:58 PM
#1
Thread Starter
New Member
Need Help with VERY VERY BOARDS, 2010 Visual basic Bradley and Millsberge Chap 4
***Very, Very Boards does a big business in shirts, especially for groups and teams. They need a project that will calculate the price for individual orders, as well as a summary for all orders.
The store employee will enter the orders in an order form that has text boxes for customer name and order number. To specify the shirts, use a text box for the quantity, radio buttons to select the size (small, medium, large, extra large, and XXL), and check boxes to specify a monogram and/or a pocket. Display the shirt price for the current order and the order total in labels.
Include buttons to add a shirt to an order, clear the current item, complete the order, and display the summary of all orders. Do not allow the summary to display if the current order is not complete. Also, disable the text boxes for customer name and order number after an order is started; enable them again when the user clicks on the button to begin a new order. Confirm the operation before clearing the current order.
When the user adds shirts to an order, validate the quantity, which must be greater than zero. If the entry does not pass the validation, do not perform any calculation but display a message box and allow the user to correct the value. Determine the price of the shirts from the radio buttons and check boxes for the monogram and pockets. Multiply the quantity by the price to determine the extended price, and add to the order total and summary total
*************************************************
The assignment also requires a pop up message "Daily Summary" with total shirts sold, total sales, and average sale per customer.
So far I have this as my code but I am not sure what needs to change in order to display the correct total shirts- mine only displays the last accepted shirt order....
Public Class Form1
'Define Modular Level Variables
Const SMALL_CHG_DECIMAL As Decimal = 10
Const MEDIUM_CHG_DECIMAL As Decimal = 10
Const LARGE_CHG_DECIMAL As Decimal = 10
Const XLARGE_CHG_DECIMAL As Decimal = 11
Const XXLARGE_CHG_DECIMAL As Decimal = 12
Const MONOGRAM_CHG_DECIMAL As Decimal = 2
Const POCKET_CHG_DECIMAL As Decimal = 1
Dim TotalShirtsinteger As Integer
Dim TotalSalesDecimal As Decimal
Dim ExtPriceDecimal As Decimal
Dim OrderTotalDecimal As Decimal
Dim DailyTotalDecimal As Decimal
Dim OrderQTYInteger As Integer
Dim DailyQTYInteger As Integer
Dim QtyInteger As Integer
Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click
'Define Local Level Variables
Dim BasePriceDecimal As Decimal
Dim ValidDataBoolean As Boolean = True ' Boolean flag for data validation
'Reset ExtPriceDecimal
ExtPriceDecimal = 0
ErrorProvider1.Clear()
Try 'Try the qty
QtyInteger = Integer.Parse(QTYTextBox.Text)
If QtyInteger <= 0 Then
ValidDataBoolean = False
ErrorProvider1.SetError(QTYTextBox, "Please enter an amount greater then 0")
End If
Catch ex As Exception
ValidDataBoolean = False
End Try
If InvisibleRadioButton.Checked Then
ValidDataBoolean = False
End If
If ValidDataBoolean Then
If XXLGRadioButton.Checked Then
BasePriceDecimal = XXLARGE_CHG_DECIMAL
ElseIf XLGRadioButton.Checked Then
BasePriceDecimal = XLARGE_CHG_DECIMAL
ElseIf LGRadioButton.Checked Then
BasePriceDecimal = LARGE_CHG_DECIMAL
ElseIf MDRadioButton.Checked Then
BasePriceDecimal = MEDIUM_CHG_DECIMAL
ElseIf SMRadioButton.Checked Then
BasePriceDecimal = SMALL_CHG_DECIMAL
End If
If MonogramCheckBox.Checked Then
BasePriceDecimal += MONOGRAM_CHG_DECIMAL
End If
If PocketCheckBox.Checked Then
BasePriceDecimal += POCKET_CHG_DECIMAL
End If
'Calculate the QTY of shirts by the BPD
ExtPriceDecimal = QtyInteger * BasePriceDecimal
'Output to GUI
ExtPriceLabel.Text = ExtPriceDecimal.ToString("c")
'Event Change to buttons
AcceptItemButton.Enabled = True
CancelItemButton.Enabled = True
CalculateButton.Enabled = False
End If
End Sub
Private Sub AcceptItemButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcceptItemButton.Click
OrderTotalDecimal += ExtPriceDecimal
QTYTextBox.Text = ""
ExtPriceLabel.Text = ""
InvisibleRadioButton.Checked = True
MonogramCheckBox.Checked = False
PocketCheckBox.Checked = False
AcceptItemButton.Enabled = False
CancelItemButton.Enabled = False
AcceptOrderButton.Enabled = True
CancelOrderButton.Enabled = True
CalculateButton.Enabled = True
OrderTotalLabel.Text = OrderTotalDecimal.ToString("c")
End Sub
Private Sub CancelItemButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancelItemButton.Click
ExtPriceLabel.Text = ""
QTYTextBox.Text = ""
ExtPriceDecimal = 0
InvisibleRadioButton.Checked = True
MonogramCheckBox.Checked = False
PocketCheckBox.Checked = False
End Sub
Private Sub AcceptOrderButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcceptOrderButton.Click
QtyInteger += OrderQTYInteger
OrderTotalDecimal += DailyTotalDecimal
DailyQTYInteger += OrderTotalDecimal
CalculateButton.Enabled = True
AcceptItemButton.Enabled = False
CancelItemButton.Enabled = False
AcceptOrderButton.Enabled = False
CancelOrderButton.Enabled = False
DailySummaryButton.Enabled = True
End Sub
Private Sub CancelOrderButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancelOrderButton.Click
CustomerNameTextBox.Text = ""
AccountNumberTextBox.Text = ""
QTYTextBox.Text = ""
ExtPriceLabel.Text = ""
OrderTotalLabel.Text = ""
InvisibleRadioButton.Checked = True
MonogramCheckBox.Checked = False
PocketCheckBox.Checked = False
CalculateButton.Enabled = True
AcceptItemButton.Enabled = False
CancelItemButton.Enabled = False
AcceptOrderButton.Enabled = False
CancelOrderButton.Enabled = False
DailySummaryButton.Enabled = False
End Sub
Private Sub DailySummaryButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DailySummaryButton.Click
'Display Daily Summary
Dim CustCountInteger As Integer
Dim MessageString As String
Dim AvgChgPerCustDecimal As Decimal
AvgChgPerCustDecimal = DailyTotalDecimal / CustCountInteger
MessageString = "Total Shirts sold: " & QtyInteger.ToString("N0") & _
Environment.NewLine & _
"Total Sales: " & DailyTotalDecimal.ToString("c") & _
Environment.NewLine & _
"Average Charge / Customer: " & AvgChgPerCustDecimal.ToString("c")
MessageBox.Show(MessageString, "Daily Summary", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
Dim ExitDialogresult As DialogResult
ExitDialogresult = MessageBox.Show("Are you sure?", "Exit Validation", _
MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button2)
If ExitDialogresult = Windows.Forms.DialogResult.Yes Then
Me.Close()
End If
End Sub
End Class
-
Nov 25th, 2013, 08:19 AM
#2
New Member
Re: Need Help with VERY VERY BOARDS, 2010 Visual basic Bradley and Millsberge Chap 4
Originally Posted by kyles112256
***Very, Very Boards does a big business in shirts, especially for groups and teams. They need a project that will calculate the price for individual orders, as well as a summary for all orders.
The store employee will enter the orders in an order form that has text boxes for customer name and order number. To specify the shirts, use a text box for the quantity, radio buttons to select the size (small, medium, large, extra large, and XXL), and check boxes to specify a monogram and/or a pocket. Display the shirt price for the current order and the order total in labels.
Include buttons to add a shirt to an order, clear the current item, complete the order, and display the summary of all orders. Do not allow the summary to display if the current order is not complete. Also, disable the text boxes for customer name and order number after an order is started; enable them again when the user clicks on the button to begin a new order. Confirm the operation before clearing the current order.
When the user adds shirts to an order, validate the quantity, which must be greater than zero. If the entry does not pass the validation, do not perform any calculation but display a message box and allow the user to correct the value. Determine the price of the shirts from the radio buttons and check boxes for the monogram and pockets. Multiply the quantity by the price to determine the extended price, and add to the order total and summary total
*************************************************
The assignment also requires a pop up message "Daily Summary" with total shirts sold, total sales, and average sale per customer.
So far I have this as my code but I am not sure what needs to change in order to display the correct total shirts- mine only displays the last accepted shirt order....
Public Class Form1
'Define Modular Level Variables
Const SMALL_CHG_DECIMAL As Decimal = 10
Const MEDIUM_CHG_DECIMAL As Decimal = 10
Const LARGE_CHG_DECIMAL As Decimal = 10
Const XLARGE_CHG_DECIMAL As Decimal = 11
Const XXLARGE_CHG_DECIMAL As Decimal = 12
Const MONOGRAM_CHG_DECIMAL As Decimal = 2
Const POCKET_CHG_DECIMAL As Decimal = 1
Dim TotalShirtsinteger As Integer
Dim TotalSalesDecimal As Decimal
Dim ExtPriceDecimal As Decimal
Dim OrderTotalDecimal As Decimal
Dim DailyTotalDecimal As Decimal
Dim OrderQTYInteger As Integer
Dim DailyQTYInteger As Integer
Dim QtyInteger As Integer
Private Sub CalculateButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CalculateButton.Click
'Define Local Level Variables
Dim BasePriceDecimal As Decimal
Dim ValidDataBoolean As Boolean = True ' Boolean flag for data validation
'Reset ExtPriceDecimal
ExtPriceDecimal = 0
ErrorProvider1.Clear()
Try 'Try the qty
QtyInteger = Integer.Parse(QTYTextBox.Text)
If QtyInteger <= 0 Then
ValidDataBoolean = False
ErrorProvider1.SetError(QTYTextBox, "Please enter an amount greater then 0")
End If
Catch ex As Exception
ValidDataBoolean = False
End Try
If InvisibleRadioButton.Checked Then
ValidDataBoolean = False
End If
If ValidDataBoolean Then
If XXLGRadioButton.Checked Then
BasePriceDecimal = XXLARGE_CHG_DECIMAL
ElseIf XLGRadioButton.Checked Then
BasePriceDecimal = XLARGE_CHG_DECIMAL
ElseIf LGRadioButton.Checked Then
BasePriceDecimal = LARGE_CHG_DECIMAL
ElseIf MDRadioButton.Checked Then
BasePriceDecimal = MEDIUM_CHG_DECIMAL
ElseIf SMRadioButton.Checked Then
BasePriceDecimal = SMALL_CHG_DECIMAL
End If
If MonogramCheckBox.Checked Then
BasePriceDecimal += MONOGRAM_CHG_DECIMAL
End If
If PocketCheckBox.Checked Then
BasePriceDecimal += POCKET_CHG_DECIMAL
End If
'Calculate the QTY of shirts by the BPD
ExtPriceDecimal = QtyInteger * BasePriceDecimal
'Output to GUI
ExtPriceLabel.Text = ExtPriceDecimal.ToString("c")
'Event Change to buttons
AcceptItemButton.Enabled = True
CancelItemButton.Enabled = True
CalculateButton.Enabled = False
End If
End Sub
Private Sub AcceptItemButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcceptItemButton.Click
OrderTotalDecimal += ExtPriceDecimal
QTYTextBox.Text = ""
ExtPriceLabel.Text = ""
InvisibleRadioButton.Checked = True
MonogramCheckBox.Checked = False
PocketCheckBox.Checked = False
AcceptItemButton.Enabled = False
CancelItemButton.Enabled = False
AcceptOrderButton.Enabled = True
CancelOrderButton.Enabled = True
CalculateButton.Enabled = True
OrderTotalLabel.Text = OrderTotalDecimal.ToString("c")
End Sub
Private Sub CancelItemButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancelItemButton.Click
ExtPriceLabel.Text = ""
QTYTextBox.Text = ""
ExtPriceDecimal = 0
InvisibleRadioButton.Checked = True
MonogramCheckBox.Checked = False
PocketCheckBox.Checked = False
End Sub
Private Sub AcceptOrderButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AcceptOrderButton.Click
QtyInteger += OrderQTYInteger
OrderTotalDecimal += DailyTotalDecimal
DailyQTYInteger += OrderTotalDecimal
CalculateButton.Enabled = True
AcceptItemButton.Enabled = False
CancelItemButton.Enabled = False
AcceptOrderButton.Enabled = False
CancelOrderButton.Enabled = False
DailySummaryButton.Enabled = True
End Sub
Private Sub CancelOrderButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CancelOrderButton.Click
CustomerNameTextBox.Text = ""
AccountNumberTextBox.Text = ""
QTYTextBox.Text = ""
ExtPriceLabel.Text = ""
OrderTotalLabel.Text = ""
InvisibleRadioButton.Checked = True
MonogramCheckBox.Checked = False
PocketCheckBox.Checked = False
CalculateButton.Enabled = True
AcceptItemButton.Enabled = False
CancelItemButton.Enabled = False
AcceptOrderButton.Enabled = False
CancelOrderButton.Enabled = False
DailySummaryButton.Enabled = False
End Sub
Private Sub DailySummaryButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DailySummaryButton.Click
'Display Daily Summary
Dim CustCountInteger As Integer
Dim MessageString As String
Dim AvgChgPerCustDecimal As Decimal
AvgChgPerCustDecimal = DailyTotalDecimal / CustCountInteger
MessageString = "Total Shirts sold: " & QtyInteger.ToString("N0") & _
Environment.NewLine & _
"Total Sales: " & DailyTotalDecimal.ToString("c") & _
Environment.NewLine & _
"Average Charge / Customer: " & AvgChgPerCustDecimal.ToString("c")
MessageBox.Show(MessageString, "Daily Summary", MessageBoxButtons.OK, MessageBoxIcon.Information)
End Sub
Private Sub ExitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitButton.Click
Dim ExitDialogresult As DialogResult
ExitDialogresult = MessageBox.Show("Are you sure?", "Exit Validation", _
MessageBoxButtons.YesNo, _
MessageBoxIcon.Question, _
MessageBoxDefaultButton.Button2)
If ExitDialogresult = Windows.Forms.DialogResult.Yes Then
Me.Close()
End If
End Sub
End Class
/////////////////////////////// Would You Please show me the final outcome of this project? ////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Thank You! //////////////////////////////////////////////////////////////////////
-
Nov 25th, 2013, 09:43 AM
#3
Re: Need Help with VERY VERY BOARDS, 2010 Visual basic Bradley and Millsberge Chap 4
If you're trying to do the same assignment and are stuck, post a new thread showing what you've got so far, and what your current issue is.
-
Nov 26th, 2013, 06:39 AM
#4
New Member
Re: Need Help with VERY VERY BOARDS, 2010 Visual basic Bradley and Millsberge Chap 4
Originally Posted by matassew
/////////////////////////////// Would You Please show me the final outcome of this project? ////////////////////////////////////
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ Thank You! //////////////////////////////////////////////////////////////////////
Thank you for your reply. No, I dont have any assignment actually. I use infoPath to design forms, honestly speaking I never used VB. I was curious to see what the outcome and how the form is developed. It is just as a personal learning experience. Since you already put some of your codes makes me to be interested to see what the final product looks like.
Thank you,
-
Nov 26th, 2013, 07:04 AM
#5
Re: Need Help with VERY VERY BOARDS, 2010 Visual basic Bradley and Millsberge Chap 4
Originally Posted by matassew
Thank you for your reply. No, I dont have any assignment actually. I use infoPath to design forms, honestly speaking I never used VB. I was curious to see what the outcome and how the form is developed. It is just as a personal learning experience. Since you already put some of your codes makes me to be interested to see what the final product looks like.
Thank you,
The first post was over a year and a half ago and the poster has not posted again since. There's probably not much chance of their returning to answer your question.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|