...
This commit is contained in:
@@ -295,17 +295,29 @@ namespace Back.Services
|
|||||||
request.lastActivitiesSevices.Add(lastcus);
|
request.lastActivitiesSevices.Add(lastcus);
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
request.MostInvoicedProduct = await _invoiceitemRepo.Get(w => w.invoice.CompanyID == user.RolUsers.First().CompanyID
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var MostInvoicedProduct = await _invoiceitemRepo.Get(w => w.invoice.CompanyID == user.RolUsers.First().CompanyID
|
||||||
&& (w.invoice.invoiceType == InvoiceType.Sale || w.invoice.invoiceType == InvoiceType.BackFrmSale
|
&& (w.invoice.invoiceType == InvoiceType.Sale || w.invoice.invoiceType == InvoiceType.BackFrmSale
|
||||||
|| w.invoice.invoiceType == InvoiceType.Repair) && !w.invoice.BillReference.HasValue)
|
|| w.invoice.invoiceType == InvoiceType.Repair) && !w.invoice.BillReference.HasValue
|
||||||
.Include(inc=>inc.cODItem)
|
)
|
||||||
.GroupBy(g => g.CODID)
|
//.Include(inc => inc.cODItem)
|
||||||
.Select(s => new IdNameByCount<int>{
|
// .GroupBy(g => g.CODID)
|
||||||
ID= s.Key,
|
// .Select(s => new IdNameByCount<int>
|
||||||
Title=s.Select(s=>s.sstt).First(),
|
// {
|
||||||
count =Convert.ToInt32(s.Sum(s => s.am))
|
// ID = s.Key,
|
||||||
}).OrderByDescending(o => o.count)
|
// Title = s.Select(s => s.sstt).First(),
|
||||||
|
// count = Convert.ToInt32(s.Sum(s => s.am))
|
||||||
|
// }).OrderByDescending(o => o.count)
|
||||||
.ToListAsync();
|
.ToListAsync();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user