public List <FacturaTO> reporte(ReporteFacturacionTO reporteTO) { List <FacturaTO> listaFacturas = new List <FacturaTO>(); DateTime fechaInicio = DateTime.Parse(reporteTO.FechaInicio); DateTime fechaFin = DateTime.Parse(reporteTO.FechaFin); using (context = new EmpresaEntities()) { /*saca todas las facturas de un cliente*/ var query = from reporte in context.Facturas where (reporteTO.Cliente == reporte.Cliente) && (reporte.Fecha_Hora >= fechaInicio && reporte.Fecha_Hora <= fechaFin) select reporte; FacturaTO facturaTO; foreach (Factura fac in query) { facturaTO = new FacturaTO(); facturaTO.Cliente = fac.Cliente; facturaTO.Consecutivo = fac.Consecutivo; facturaTO.FechaHora = fac.Fecha_Hora; facturaTO.Total = fac.Total; listaFacturas.Add(facturaTO); } } return(listaFacturas); }
public List <FacturaBL> historico(String cedula, String fechaInicio, String fechaFin) { this.Cliente = cedula; this.FechaFin = fechaFin; this.FechaInicio = fechaInicio; ReporteFacturacionTO reporteTO = new ReporteFacturacionTO(); reporteTO.Cliente = this.Cliente; reporteTO.FechaFin = this.FechaFin; reporteTO.FechaInicio = this.FechaInicio; ReporteFacturas reporte = new ReporteFacturas(); List <FacturaTO> r = reporte.reporte(reporteTO); List <FacturaBL> facturas = new List <FacturaBL>(); FacturaBL f; for (int i = 0; i < r.Count; i++) { f = new FacturaBL(); f.Cliente = r[i].Cliente; f.Consecutivo = r[i].Consecutivo; f.FechaHora = r[i].FechaHora; f.Total = r[i].Total; facturas.Add(f); } return(facturas); }