1
In this lambda, is giving error in select in t1 and t2. If placed Key says it does not recognize Totalliquido and the fields in t2. If removed Groupby works.
public List<LiberacaoItensDTO> GetLibItems(double id)
{
var lista = contexto.Liberacoes
.Join
(
contexto.ItensLibs,
t1 => t1.IdOrcamento,
t2 => t2.IdOrcamento,
(t1, t2) => new { t1, t2 }
)
.Where(a => a.t1.IdOrcamento == a.t2.IdOrcamento && a.t1.IdOrcamento == id)
.GroupBy(gb => new { gb.t1.IdOrcamento })
.Select(item => new LiberacaoItensDTO
{
TotalVenda = item.t1.TotalLiquido,
TotalLucro = item.t2.Total - (item.t2.Qtde*item.t2.Custo)
}).ToList();
//double totallucro = lista.Sum(t => t.TotalLucro);
// lista.ForEach(t => t.TotalLucro = totallucro);
return lista;
}
Hello Bruno, the idea and have a summation on the chart. What happens is that the table of items it prints in the graph the margin, as many times as it is the Qtde of items and need to show only one slice in the graph. So I created another DTO to load the profit from the table of items and I don’t even know if it will happen.
– pnet