コード例 #1
0
        private void ModeCB_SelectedIndexChanged(object sender, EventArgs e)
        {
            ReportLV.Clear();
            initReportLV();
            if (ModeCB.Text == "Daily")
            {
                showDailyReport();
            }
            else if (ModeCB.Text == "Monthly")
            {
                showMonthlyReport();
            }
            else if (ModeCB.Text == "Yearly")
            {
                showYearlyReport();
            }
            else if (ModeCB.Text == "Quantity")
            {
                showQuantityReport();
            }

            int    totalsold   = 0;
            double totalincome = 0;

            for (int i = 0; i < report.Count; i++)
            {
                totalsold   = totalsold + report[i].quantity;
                totalincome = totalincome + report[i].price;
            }
            TotalSoldLB.Text   = "Total Item(s) Sold = " + totalsold.ToString();
            TotalIncomeLB.Text = "Total Income = RM" + totalincome.ToString("F");
        }
コード例 #2
0
        private void showQuantityReport()
        {
            ReportLV.Clear(); // Reset

            ReportLV.Columns.Add("Date", 150, HorizontalAlignment.Left);
            ReportLV.Columns.Add("Item(s) Sold", 200, HorizontalAlignment.Right);
            ReportLV.Columns.Add("Item Name", 200, HorizontalAlignment.Left);
            ReportLV.View = View.Details; // Manual sort

            for (int i = 0; i < report.Count; i++)
            {
                ListViewItem listViewItem = new ListViewItem(new string[] { report[i].date.ToString(), report[i].quantity.ToString(), report[i].itemName.ToString() });
                ReportLV.Items.AddRange(new ListViewItem[] { listViewItem });
            }
        }