fix
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Models.Accounts;
|
||||
using MyOffice.Data.Models.Currencies;
|
||||
using MyOffice.Data.Repositories;
|
||||
|
||||
public class AccountRepository : AppRepository<Account>, IAccountRepository
|
||||
@@ -184,8 +185,8 @@ public class AccountRepository : AppRepository<Account>, IAccountRepository
|
||||
Id = x.Id,
|
||||
Name = x.Name,
|
||||
Type = x.Type,
|
||||
CurrencyName = x.Currency!.Name,
|
||||
CurrencyShortName = x.Currency!.ShortName,
|
||||
CurrencyName = x.Currency?.Name,
|
||||
CurrencyShortName = x.Currency?.ShortName,
|
||||
CurrencyRate = x.CurrentRate?.Rate,
|
||||
CurrencyQuantity = x.CurrentRate?.Quantity,
|
||||
TotalMinus = x.Minus,
|
||||
@@ -201,12 +202,19 @@ public class AccountRepository : AppRepository<Account>, IAccountRepository
|
||||
.Where(x => x.DateTime >= from && x.DateTime <= to)
|
||||
.Where(x => x.Item.Category!.UserId == userId)
|
||||
.Where(x => !x.Item.Category!.IsInternal)
|
||||
.GroupBy(x => new { x.Item.CategoryId, x.Item.Category!.Name })
|
||||
.GroupBy(x => new
|
||||
{
|
||||
ItemId = x.Item.CategoryId,
|
||||
ItemName = x.Item.Category!.Name,
|
||||
CurrencyId = x.Account.CurrencyGlobalId,
|
||||
CurrencyName = x.Account.CurrencyGlobal!.Name,
|
||||
})
|
||||
.Select(x => new MotionTotalSimple
|
||||
{
|
||||
Id = x.Key.CategoryId,
|
||||
Name = x.Key.Name,
|
||||
Amount = x.Sum(a => a.AmountPlus)
|
||||
CurrencyId = x.Key.CurrencyId,
|
||||
CurrencyName = x.Key.CurrencyName,
|
||||
Name = x.Key.ItemName,
|
||||
Amount = x.Sum(a => a.AmountPlus),
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
@@ -217,10 +225,18 @@ public class AccountRepository : AppRepository<Account>, IAccountRepository
|
||||
.Where(x => x.Item.CategoryId == categoryId)
|
||||
.Where(x => !x.Item.Category!.IsInternal)
|
||||
.Where(x => x.Item.Category!.UserId == userId)
|
||||
.GroupBy(x => new { Id = x.Item.ItemGlobalId, x.Item.ItemGlobal.Name })
|
||||
.GroupBy(x => new
|
||||
{
|
||||
ItemId = x.Item.ItemGlobalId,
|
||||
ItemName = x.Item.ItemGlobal!.Name,
|
||||
CurrencyId = x.Account.CurrencyGlobalId,
|
||||
CurrencyName = x.Account.CurrencyGlobal!.Name,
|
||||
})
|
||||
.Select(x => new MotionTotalSimple
|
||||
{
|
||||
Name = x.Key.Name,
|
||||
CurrencyId = x.Key.CurrencyId,
|
||||
CurrencyName = x.Key.CurrencyName,
|
||||
Name = x.Key.ItemName,
|
||||
Amount = x.Sum(a => a.AmountPlus),
|
||||
}).ToList();
|
||||
}
|
||||
@@ -232,12 +248,20 @@ public class AccountRepository : AppRepository<Account>, IAccountRepository
|
||||
.Where(x => x.DateTime >= from && x.DateTime <= to)
|
||||
.Where(x => x.Item.Category!.UserId == userId)
|
||||
.Where(x => !x.Item.Category!.IsInternal)
|
||||
.GroupBy(x => new { x.Item.CategoryId, x.Item.Category!.Name })
|
||||
.GroupBy(x => new
|
||||
{
|
||||
ItemId = x.Item.CategoryId,
|
||||
ItemName = x.Item.Category!.Name,
|
||||
CurrencyId = x.Account.CurrencyGlobalId,
|
||||
CurrencyName = x.Account.CurrencyGlobal!.Name,
|
||||
})
|
||||
.Select(x => new MotionTotalSimple
|
||||
{
|
||||
Id = x.Key.CategoryId,
|
||||
Name = x.Key.Name,
|
||||
Amount = x.Sum(a => a.AmountMinus)
|
||||
Id = x.Key.ItemId,
|
||||
Name = x.Key.ItemName,
|
||||
CurrencyId = x.Key.CurrencyId,
|
||||
CurrencyName = x.Key.CurrencyName,
|
||||
Amount = x.Sum(a => a.AmountPlus),
|
||||
}).ToList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user