RobertoCarlos Melgar

RobertoCarlos Melgar

  • 1.6k
  • 159
  • 10.4k

Build query to display in RDLC report

Jun 23 2020 6:46 PM
Hello dear, good night. I annoy you for the following.
 
I want to create a report or report as best understood, which I need.
 
something like this: (Sample from excel)
 
 
 
With SQL I find it easier, but now I am using Entity Framework
for the purpose I have the following DTO class
  1. public class InformeVentasDTO  
  2. {  
  3. public string Producto { getset; } // Por este campo el Groupby  
  4. public DateTime Fecha { getset; }  
  5. public string Unidad { getset; }  
  6. public string Cantidad { getset; }  
  7. public decimal Valor { getset; } // Suma de las fechas  
  8. }  
All these attributes I have in both tables in the header I have the date.
 
in the detail I have the Product_Id and the other fields. that is why I need to join the two queries.
 
In other words, I need to join the detail master, in order to get my report, and the question would be, as one of the tables, with include, or with join is what I really don't know since I have seen that there is more than one way to do this. , Clear. I don't know how to use them, that's why I would like you to help me. I have these kinds of your models.
 
Master :
  1. public partial class tblMaestroVenta  
  2. {  
  3. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage""CA2214:DoNotCallOverridableMethodsInConstructors")]  
  4. public tblMaestroVenta()  
  5. {  
  6. this.tblDetalleVentas = new HashSet<tblDetalleVenta>();  
  7. }  
  8. public int Id { getset; }  
  9. public string NumeroVenta { getset; }  
  10. public System.DateTime FechaVenta { getset; }  
  11. public Nullable<int> Cliente_Id { getset; }  
  12. public double ValorVenta { getset; }  
  13. public int Usuario_Id { getset; }  
  14. public virtual tblCliente tblCliente { getset; }  
  15. [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage""CA2227:CollectionPropertiesShouldBeReadOnly")]  
  16. public virtual ICollection<tblDetalleVenta> tblDetalleVentas { getset; }  
  17. public virtual tblUsuario tblUsuario { getset; }  
  18. }  
Detail:
  1. public partial class tblDetalleVenta  
  2. {  
  3. public int Id { getset; }  
  4. public int tblMaestroVenta_Id { getset; }  
  5. public int Producto_Id { getset; }  
  6. public int UnidadMedida_Id { getset; }  
  7. public int Categoria_Id { getset; }  
  8. public decimal Precio { getset; }  
  9. public int Cantidad { getset; }  
  10. public decimal ValorFila { getset; }  
  11. public virtual tblCategoria tblCategoria { getset; }  
  12. public virtual tblMaestroVenta tblMaestroVenta { getset; }  
  13. public virtual tblProducto tblProducto { getset; }  
  14. public virtual tblUnidade tblUnidade { getset; }  
  15. }  
and at the top is a DTO, this in order not to show the Id but rather the corresponding Name.
 
hoping that please help me to do and why use one and not another or what is the most appropriate way to solve my problem, I say goodbye very cordially.
 
Thank you