I am doing a sales report for a clothing manufacturer that calculates its total sales for the week.Sales values are inputed seperatly for each clothing item, but the amount of sales for each of the five weekdays should be inputed all at once.The app should calculate the total amount of sales for each item in the week and also the total sales for the manufacturer for all the items in the week. The manufacturer is a small company so it produces at most 10 items in any week. This is what i have so far:
Public Class SalesReportForm
Dim itemCount As Integer = 0 'stores the number of items added
Dim itemNames(0 To 9) As String
'Declare two dimensional decimal array
Dim itemSales As Decimal(,) = New Decimal(9, 4) {}
' Display the sales report
Sub DisplaySales()
' clear the ListBox
outputListBox.Items.Clear()
' create a header for the ListBox
outputListBox.Items.Add("Name" & ControlChars.Tab & _
ControlChars.Tab & "Mon." & ControlChars.Tab & "Tue." & _
ControlChars.Tab & "Wed." & ControlChars.Tab & "Thu." & _
ControlChars.Tab & "Fri." & ControlChars.Tab & "Total")
Dim output As String
Dim counterItem As Integer
Dim counterDay As Integer
Dim weekTotal As Decimal = 0 ' weekly sales total
Dim salesTotal As Decimal = 0 ' total sales
End Sub ' DisplaySales
Private Sub submitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles submitButton.Click
Dim item As String
item = itemNames(itemCount) 'assign item name to itemnames array indexed with itemcount
' assign dailysales to two dimensional itemsales array
itemSales(itemCount, 0) = Convert.ToDecimal(mondayTextBox.Text)
itemSales(itemCount, 1) = Convert.ToDecimal(tuesdayTextBox.Text)
itemSales(itemCount, 2) = Convert.ToDecimal(wednesdayTextBox.Text)
itemSales(itemCount, 3) = Convert.ToDecimal(thursdayTextBox.Text)
itemSales(itemCount, 4) = Convert.ToDecimal(fridayTextBox.Text)
'increment variable itemCount to record another sales data being added
If itemSales = True Then
itemCount += 1
End If
My problem right now is the last line of code, I need to 'increment variable itemCount to record another sales data being added. I started with itemsales or items in my if statment but im not sure if this is right. Im a bit confused with this part. Should i continue with this statment or try another like a select case?