private void namComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (ngayRadioButton.Checked) { doanhThuChart.Series[0].Name = "Doanh thu ngày"; doanhThuChart.Series[0].Points.Clear(); int month = int.Parse(thangComboBox.Text); int year = int.Parse(namComboBox.Text); int daysInMonth = DateTime.DaysInMonth(year, month); for (int day = 1; day <= daysInMonth; day++) { doanhThuChart.Series["Doanh thu ngày"].Points.AddXY(day, BillBUS.GetTotalByDay(day, month, year)); } } if (thangRadioButton.Checked) { doanhThuChart.Series[0].Name = "Doanh thu tháng"; doanhThuChart.Series[0].Points.Clear(); int year = int.Parse(namComboBox.Text); for (int month = 1; month <= 12; month++) { doanhThuChart.Series["Doanh thu tháng"].Points.AddXY(month, BillBUS.GetTotalByMonth(month, year)); } } }
private void thangRadioButton_CheckedChanged(object sender, EventArgs e) { if (thangRadioButton.Checked) { thangComboBox.Visible = false; thangLabel.Visible = false; namComboBox.Visible = true; namLabel.Visible = true; doanhThuChart.Series[0].Name = "Doanh thu tháng"; doanhThuChart.Series[0].Points.Clear(); int year = int.Parse(namComboBox.Text); for (int month = 1; month <= 12; month++) { doanhThuChart.Series["Doanh thu tháng"].Points.AddXY(month, BillBUS.GetTotalByMonth(month, year)); } } }