|
|
@ -506,6 +506,20 @@ namespace SiNan.Business |
|
|
|
Profit = g.Sum(g.Value.Profits), |
|
|
|
TotalCost = g.Sum(g.Value.TotalCost) |
|
|
|
}); |
|
|
|
|
|
|
|
var totalUV = datas.Sum(x => x.UV); |
|
|
|
var totalSales = datas.Sum(x => x.Sales); |
|
|
|
var totalProfit = datas.Sum(x => x.Profit); |
|
|
|
var totalCost = datas.Sum(x => x.TotalCost); |
|
|
|
|
|
|
|
foreach (var data in datas) |
|
|
|
{ |
|
|
|
data.UVPercent = totalUV == 0 ? 0 : Math.Round((data.UV / totalUV) ?? 0, 2); |
|
|
|
data.SalesPercent = totalSales == 0 ? 0 : Math.Round((data.Sales / totalSales) ?? 0, 2); |
|
|
|
data.ProfitPercent = totalProfit == 0 ? 0 : Math.Round((data.Profit / totalProfit) ?? 0, 2); |
|
|
|
data.TotalCostPercent = totalCost == 0 ? 0 : Math.Round((data.TotalCost / totalCost) ?? 0, 2); |
|
|
|
} |
|
|
|
|
|
|
|
return datas; |
|
|
|
} |
|
|
|
|
|
|
|