private void btnReportSales_Click(object sender, EventArgs e) { DateTime finish = cmbFinalSalesDare.Value; DateTime init = cmbInitialSalesDate.Value; String fin = finish.Year + "-" + finish.Month + "-" + (finish.Day + 1); String inicio = init.Year + "-" + init.Month + "-" + (init.Day - 1); List <ReportPOJO> reports = ReportDAO.getAllReportSales(inicio, fin); dtgSalesReport.Rows.Clear(); for (int i = 0; i < reports.Count; i++) { dtgSalesReport.Rows.Add(reports[i].IdSale, reports[i].Date, reports[i].Total); } }
private void rdbYearSales_CheckedChanged(object sender, EventArgs e) { if (rdbYearSales.Checked) { cmbFinalSalesDare.Visible = false; cmbInitialSalesDate.Visible = false; label1.Visible = false; label2.Visible = false; btnReportSales.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.getAllReportSales(inicio, fin); dtgSalesReport.Rows.Clear(); for (int i = 0; i < reports.Count; i++) { dtgSalesReport.Rows.Add(reports[i].IdSale, reports[i].Date, reports[i].Total); } } }