//Reporte 3 FALTA TERMINAR public List <ReporteVendidoPorMes> ReporteVentasPorMesEnUnRangoDeFechas(DateTime fechadesde, DateTime fechahasta) { List <ReporteVendidoPorMes> ListaRetornar = new List <ReporteVendidoPorMes>(); decimal[] AcuxMes = new decimal[12]; for (int i = 0; i < AcuxMes.Length; i++) { AcuxMes[i] = 0; } foreach (var item in this.ListaVentas) { if (item.FechaVenta >= fechadesde && item.FechaVenta <= fechahasta) { for (int i = 0; i < AcuxMes.Length; i++) { AcuxMes[item.FechaVenta.Month] = AcuxMes[item.FechaVenta.Month] + (item.TotalVenta); } } } for (int i = 0; i < AcuxMes.Length; i++) { if (AcuxMes[i] != 0) { ReporteVendidoPorMes Agregar = new ReporteVendidoPorMes(); Agregar.Mes = RetornarMes(i.ToString()); Agregar.TotalVendido = ((AcuxMes[i]) / 12).ToString("N2"); ListaRetornar.Add(Agregar); } } return(ListaRetornar); }
//Reporte 3 public List <ReporteVendidoPorMes> ReporteVentasPorMesEnUnRangoDeFechas(DateTime fechadesde, DateTime fechahasta) { List <ReporteVendidoPorMes> ListaRetornar = new List <ReporteVendidoPorMes>(); ReporteVendidoPorMes Agregar = new ReporteVendidoPorMes(); Agregar.GananciaEstimada = 0.ToString(); Agregar.TotalCosto = 0.ToString(); Agregar.TotalVendido = 0.ToString(); decimal[] AcuxMes = new decimal[12]; for (int i = 0; i < AcuxMes.Length; i++) { AcuxMes[i] = 0; } foreach (var item in this.ListaVentas) { if (item.FechaVenta >= fechadesde && item.FechaVenta <= fechahasta) { for (int i = 0; i < AcuxMes.Length; i++) { AcuxMes[item.FechaVenta.Month] = AcuxMes[item.FechaVenta.Month] + (item.TotalVenta); } } } for (int i = 0; i < AcuxMes.Length; i++) { if (AcuxMes[i] != 0) { Agregar.Mes = RetornarMes(i.ToString()); Agregar.TotalVendido = ((AcuxMes[i]) / 12).ToString("N2"); } } decimal acudef = 0, ganancia = 0; if (this.ListasDevolucionDefectuosa != null) { foreach (var item in this.ListasDevolucionDefectuosa) { foreach (var item2 in this.ListaVentas) { if (item.CodigoVenta == item2.Codigo) { acudef = acudef + item2.TotalVenta; } } } } Agregar.TotalCosto = acudef.ToString("N2"); Agregar.GananciaEstimada = (decimal.Parse(Agregar.TotalVendido) - acudef).ToString("N2"); ListaRetornar.Add(Agregar); return(ListaRetornar); }