|
Can someone Please take a look at this and tell me what I need to do to get the calculations for Total on Sale and Total Regular Price? I have tried every different scenario I can think of and at one point they were reversed, so I thought that I could just reverse the items after the = sign, but Oh No that would have been too simple. : )
Private Sub btnTotalSales_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnTotalSales.Click 'Read each item in the lstTodaysSales list box, determine ' the amount in the second column, add the amount to the ' appropriate totals, and then display the totals. Dim intIndex, intListCount As Integer Dim sngTotalSales As Single = 0 Dim sngTotalOnSale As Single = 0 Dim sngTotalRegularPrice As Single = 0 Dim sngItemSales As Single Dim strResults As String, strItemSales As String intListCount = Convert.ToInt32(lstTodaysSales.Items.Count) Dim lviTodaysSales As ListViewItem For Each lviTodaysSales In lstTodaysSales.Items strItemSales = lviTodaysSales.SubItems(1).Text strItemSales = strItemSales.Replace("$", "0") sngItemSales = Convert.ToSingle(strItemSales) sngTotalSales = sngTotalSales + sngItemSales sngTotalOnSale = sngTotalSales - sngItemSales sngTotalRegularPrice = sngItemSales sngTotalOnSale = sngTotalSales - sngTotalRegularPrice sngTotalRegularPrice = sngTotalSales - sngTotalOnSale
Next strResults = "Total sales today: " & Format$(sngTotalSales, "Currency") & ControlChars.NewLine strResults &= "Total sales for items on sale: " & Format$(sngTotalOnSale, "Currency") & ControlChars.NewLine strResults &= "Total sales for items not on sale: " & Format$(sngTotalRegularPrice, "Currency") MessageBox.Show(strResults, "Daily Sales Totals") End Sub
This post has been edited by Persistant: 26 Apr, 2007 - 12:55 AM
Attached File(s)
Today_s_Sales_Check.zip ( 97.02k )
Number of downloads: 27
|