TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
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
public
class
InformeVentasDTO
{
public
string
Producto {
get
;
set
; }
// Por este campo el Groupby
public
DateTime Fecha {
get
;
set
; }
public
string
Unidad {
get
;
set
; }
public
string
Cantidad {
get
;
set
; }
public
decimal
Valor {
get
;
set
; }
// Suma de las fechas
}
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 :
public
partial
class
tblMaestroVenta
{
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Usage"
,
"CA2214:DoNotCallOverridableMethodsInConstructors"
)]
public
tblMaestroVenta()
{
this
.tblDetalleVentas =
new
HashSet<tblDetalleVenta>();
}
public
int
Id {
get
;
set
; }
public
string
NumeroVenta {
get
;
set
; }
public
System.DateTime FechaVenta {
get
;
set
; }
public
Nullable<
int
> Cliente_Id {
get
;
set
; }
public
double
ValorVenta {
get
;
set
; }
public
int
Usuario_Id {
get
;
set
; }
public
virtual
tblCliente tblCliente {
get
;
set
; }
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Usage"
,
"CA2227:CollectionPropertiesShouldBeReadOnly"
)]
public
virtual
ICollection<tblDetalleVenta> tblDetalleVentas {
get
;
set
; }
public
virtual
tblUsuario tblUsuario {
get
;
set
; }
}
Detail:
public
partial
class
tblDetalleVenta
{
public
int
Id {
get
;
set
; }
public
int
tblMaestroVenta_Id {
get
;
set
; }
public
int
Producto_Id {
get
;
set
; }
public
int
UnidadMedida_Id {
get
;
set
; }
public
int
Categoria_Id {
get
;
set
; }
public
decimal
Precio {
get
;
set
; }
public
int
Cantidad {
get
;
set
; }
public
decimal
ValorFila {
get
;
set
; }
public
virtual
tblCategoria tblCategoria {
get
;
set
; }
public
virtual
tblMaestroVenta tblMaestroVenta {
get
;
set
; }
public
virtual
tblProducto tblProducto {
get
;
set
; }
public
virtual
tblUnidade tblUnidade {
get
;
set
; }
}
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
Reply
Answers (
0
)
Creating a variable inside a loop value
Login and Registration api in .net core.