Bladeren bron

更新订单统计

master
fyf 2 jaren geleden
bovenliggende
commit
d737b4b796
1 gewijzigde bestanden met toevoegingen van 11 en 12 verwijderingen
  1. +11
    -12
      DataVApi.Order/OrderProvider.cs

+ 11
- 12
DataVApi.Order/OrderProvider.cs Bestand weergeven

@@ -194,21 +194,20 @@ WHERE

var sql = sb.ToString();
var data = db.SqlQueryable<OrderNumberDto>(sql).ToList();
int Year = data.Where(t => t.CreatedAt.Year == DateTime.Now.Year).Count();
int Month = data.Where(t => t.CreatedAt.Month == DateTime.Now.Month).Count();
int Day = data.Where(t => t.CreatedAt.Day == DateTime.Now.Day).Count();
int L_Year = data.Where(t => t.CreatedAt.Year == DateTime.Now.AddYears(-1).Year).Count();
int L_Month = data.Where(t => t.CreatedAt.Month == DateTime.Now.AddMonths(-1).Month).Count();
int L_Day = data.Where(t => t.CreatedAt.Day == DateTime.Now.AddDays(-1).Day).Count();

return new
{
Year = data.Where(t => t.CreatedAt.Year == DateTime.Now.Year).Count(),
L_Year = data.Where(t => t.CreatedAt.Year == DateTime.Now.AddYears(-1).Year).Count(),
B_Year = (data.Where(t => t.CreatedAt.Year == DateTime.Now.Year).Count() - data.Where(t => t.CreatedAt.Year == DateTime.Now.AddYears(-1).Year).Count())*100/(data.Where(t => t.CreatedAt.Year == DateTime.Now.Year).Count() + data.Where(t => t.CreatedAt.Year == DateTime.Now.AddYears(-1).Year).Count()),

Month = data.Where(t => t.CreatedAt.Month == DateTime.Now.Month).Count(),
L_Month = data.Where(t => t.CreatedAt.Month == DateTime.Now.AddMonths(-1).Month).Count(),
B_Month = (data.Where(t => t.CreatedAt.Month == DateTime.Now.Month).Count() - data.Where(t => t.CreatedAt.Month == DateTime.Now.AddMonths(-1).Month).Count()) * 100 / (data.Where(t => t.CreatedAt.Month == DateTime.Now.Month).Count() + data.Where(t => t.CreatedAt.Month == DateTime.Now.AddMonths(-1).Month).Count()),

Day = data.Where(t => t.CreatedAt.Day == DateTime.Now.Day).Count(),
L_Day = data.Where(t => t.CreatedAt.Day == DateTime.Now.AddDays(-1).Day).Count(),
B_Day = (data.Where(t => t.CreatedAt.Day == DateTime.Now.Day).Count() - data.Where(t => t.CreatedAt.Day == DateTime.Now.AddDays(-1).Day).Count()) * 100 / (data.Where(t => t.CreatedAt.Day == DateTime.Now.Day).Count() + data.Where(t => t.CreatedAt.Day == DateTime.Now.AddDays(-1).Day).Count())

Year = Year, Month = Month, Day = Day,
L_Year = L_Year, L_Month = L_Month, L_Day = L_Day,
B_Year = ((Year + L_Year) == 0) ? 0 : (((Year - L_Year) * 100) / (Year + L_Year)),
B_Month = ((Month + L_Month) == 0) ? 0 : (((Month - L_Month) * 100) / (Month + L_Month)),
B_Day = ((Day + L_Day) == 0) ? 0 : (((Day - L_Day) * 100) / (Day + L_Day))
};
}
}


Laden…
Annuleren
Opslaan