private void btnReportCost_Click(object sender, EventArgs e) { DateTime finish = cmbFinalCostDate.Value; DateTime init = cmbInitialCostDate.Value; String fin = finish.Year + "-" + finish.Month + "-" + (finish.Day + 1); String inicio = init.Year + "-" + init.Month + "-" + (init.Day - 1); List <ReportPOJO> reports = ReportDAO.getAllReportCost(inicio, fin); dtgCostReports.Rows.Clear(); for (int i = 0; i < reports.Count; i++) { dtgCostReports.Rows.Add(reports[i].IdSale, reports[i].Date, reports[i].Total); } }
private void rbdYearCost_CheckedChanged(object sender, EventArgs e) { if (rbdYearCost.Checked) { cmbFinalCostDate.Visible = false; cmbInitialCostDate.Visible = false; label6.Visible = false; label7.Visible = false; btnReportCost.Visible = false; DateTime finish = DateTime.Now; int today = int.Parse(DateTime.Today.DayOfYear.ToString()); DateTime init = DateTime.Today.AddDays(-(today)); String fin = finish.Year + "-" + finish.Month + "-" + (finish.Day + 1); String inicio = init.Year + "-" + init.Month + "-" + init.Day; List <ReportPOJO> reports = ReportDAO.getAllReportCost(inicio, fin); dtgCostReports.Rows.Clear(); for (int i = 0; i < reports.Count; i++) { dtgCostReports.Rows.Add(reports[i].IdSale, reports[i].Date, reports[i].Total); } } }