fix
This commit is contained in:
@@ -223,6 +223,7 @@ public class AccountRepository : AppRepository<Account>, IAccountRepository
|
||||
{
|
||||
return _context.Motions
|
||||
.Where(x => x.DateTime >= from && x.DateTime <= to)
|
||||
.Where(x => x.Item.Category!.UserId == userId)
|
||||
.Where(x => x.Item.CategoryId == categoryId)
|
||||
.Where(x => !x.Item.Category!.IsInternal)
|
||||
.Where(x => x.Item.Category!.UserId == userId)
|
||||
@@ -235,9 +236,9 @@ public class AccountRepository : AppRepository<Account>, IAccountRepository
|
||||
})
|
||||
.Select(x => new MotionTotalSimple
|
||||
{
|
||||
Name = x.Key.Name,
|
||||
CurrencyId = x.Key.CurrencyId,
|
||||
CurrencyName = x.Key.CurrencyName,
|
||||
Name = x.Key.Name,
|
||||
Amount = x.Sum(a => a.AmountPlus),
|
||||
})
|
||||
.ToList();
|
||||
|
||||
@@ -50,8 +50,14 @@
|
||||
<table class="table align-items-center">
|
||||
<tbody>
|
||||
<tr *ngFor="let item of dashboardModel!.details">
|
||||
<td><i class="fa fa-circle col-cyan msr-2"></i> {{item.currency}}</td>
|
||||
<td [ngClass]="{ 'col-green': item.value != 0, 'col-red': item.value == 0}" style="text-align: right;">{{item.value | number: '1.2'}} ({{item.valueRaw}})</td>
|
||||
<td><i class="fa fa-circle col-cyan msr-2"></i> {{item.name}}</td>
|
||||
<td [ngClass]="{ 'col-green': item.value != 0, 'col-red': item.value == 0}" style="text-align: right;">{{item.valueRaw | number: '1.2'}}</td>
|
||||
<td [ngClass]="{ 'col-green': item.value != 0, 'col-red': item.value == 0}" style="text-align: right;">{{item.value | number: '1.2'}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-cyan">{{'TOTAL' | translate}}</td>
|
||||
<td class="col-cyan" style="text-align: right;"></td>
|
||||
<td class="col-cyan" style="text-align: right;">{{total | number: '1.2'}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -41,6 +41,7 @@ export class DashboardIncomeComponent implements OnInit {
|
||||
@ViewChild("chart") chart!: ChartComponent;
|
||||
public chartOptions!: Partial<ChartOptions>;
|
||||
dashboardModel?: DashboardInOutModel;
|
||||
total?: number;
|
||||
public dateFrom: Date = moment(new Date).add(-30, 'days').toDate();
|
||||
public dateTo: Date = moment(new Date).add(0, 'days').toDate();
|
||||
|
||||
@@ -91,6 +92,8 @@ export class DashboardIncomeComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
this.total = response.data.reduce((sum, current) => sum + current.value, 0);
|
||||
|
||||
if (update) {
|
||||
this.chart.updateSeries([{
|
||||
data: series
|
||||
|
||||
@@ -50,8 +50,14 @@
|
||||
<table class="table align-items-center">
|
||||
<tbody>
|
||||
<tr *ngFor="let item of dashboardModel!.details">
|
||||
<td><i class="fa fa-circle col-cyan msr-2"></i> {{item.currency}}</td>
|
||||
<td [ngClass]="{ 'col-green': item.value != 0, 'col-red': item.value == 0}" style="text-align: right;">{{item.value | number: '1.2'}} ({{item.valueRaw}})</td>
|
||||
<td><i class="fa fa-circle col-cyan msr-2"></i> {{item.name}}</td>
|
||||
<td [ngClass]="{ 'col-green': item.value != 0, 'col-red': item.value == 0}" style="text-align: right;">{{item.valueRaw | number: '1.2'}}</td>
|
||||
<td [ngClass]="{ 'col-green': item.value != 0, 'col-red': item.value == 0}" style="text-align: right;">{{item.value | number: '1.2'}}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="col-cyan">{{'TOTAL' | translate}}</td>
|
||||
<td class="col-cyan" style="text-align: right;"></td>
|
||||
<td class="col-cyan" style="text-align: right;">{{total | number: '1.2'}}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -42,6 +42,7 @@ export class DashboardOutcomeComponent implements OnInit {
|
||||
@ViewChild("chart") chart!: ChartComponent;
|
||||
public chartOptions!: Partial<ChartOptions>;
|
||||
dashboardModel?: DashboardInOutModel;
|
||||
total?: number;
|
||||
public dateFrom: Date = moment(new Date).add(-30, 'days').toDate();
|
||||
public dateTo: Date = moment(new Date).add(0, 'days').toDate();
|
||||
|
||||
@@ -97,6 +98,8 @@ export class DashboardOutcomeComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
this.total = response.data.reduce((sum, current) => sum + current.value, 0);
|
||||
|
||||
if (update) {
|
||||
this.chart.updateSeries([{
|
||||
data: series
|
||||
|
||||
@@ -53,8 +53,8 @@ public class DashboardService
|
||||
Id = x.Id,
|
||||
Name = x.Name,
|
||||
Balance = x.Balance,
|
||||
CurrencyName = x.CurrencyName,
|
||||
CurrencyShortName = x.CurrencyShortName,
|
||||
CurrencyName = x.CurrencyName!,
|
||||
CurrencyShortName = x.CurrencyShortName!,
|
||||
CurrencyRate = x.CurrencyRate,
|
||||
CurrencyQuantity = x.CurrencyQuantity,
|
||||
})
|
||||
@@ -76,7 +76,6 @@ public class DashboardService
|
||||
.ToList();
|
||||
|
||||
var currencies = data
|
||||
.Where(x => x.Amount != 0)
|
||||
.Select(x => x.CurrencyId)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
@@ -91,25 +90,45 @@ public class DashboardService
|
||||
{
|
||||
Id = x.Id.ToShort(),
|
||||
Name = x.Name,
|
||||
ValueRaw = x.Amount,
|
||||
Value = (x.Amount * rates.FirstOrDefault(r => r.Key == x.CurrencyId).Value),
|
||||
})
|
||||
.GroupBy(x => new { x.Id, x.Name })
|
||||
.GroupBy(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.Name,
|
||||
})
|
||||
.Select(x => new DashboardIncomeDataItem
|
||||
{
|
||||
Id = x.Key.Id,
|
||||
Name = x.Key.Name,
|
||||
Value = x.Sum(s => s.Value),
|
||||
ValueRaw = x.Sum(s => s.ValueRaw),
|
||||
})
|
||||
.OrderBy(x => x.Name)
|
||||
.ToList(),
|
||||
|
||||
Details = data.Select(x => new DashboardIncomeDataItem
|
||||
Details = data.Select(x => new
|
||||
{
|
||||
Id = x.Id.ToShort(),
|
||||
Currency = x.CurrencyId,
|
||||
Name = x.Name,
|
||||
Id = x.CurrencyId,
|
||||
Name = x.CurrencyName,
|
||||
ValueRaw = x.Amount,
|
||||
Value = (x.Amount * rates.FirstOrDefault(r => r.Key == x.CurrencyId).Value),
|
||||
}).ToList()
|
||||
})
|
||||
.GroupBy(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.Name,
|
||||
})
|
||||
.Select(x => new DashboardIncomeDataItem
|
||||
{
|
||||
Id = x.Key.Id,
|
||||
Name = x.Key.Name,
|
||||
Value = x.Sum(s => s.Value),
|
||||
ValueRaw = x.Sum(s => s.ValueRaw),
|
||||
})
|
||||
.OrderBy(x => x.Name)
|
||||
.ToList(),
|
||||
};
|
||||
}
|
||||
|
||||
@@ -124,7 +143,6 @@ public class DashboardService
|
||||
.ToList();
|
||||
|
||||
var currencies = data
|
||||
.Where(x => x.Amount != 0)
|
||||
.Select(x => x.CurrencyId)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
@@ -139,25 +157,45 @@ public class DashboardService
|
||||
{
|
||||
Id = x.Id.ToShort(),
|
||||
Name = x.Name,
|
||||
ValueRaw = x.Amount,
|
||||
Value = (x.Amount * rates.FirstOrDefault(r => r.Key == x.CurrencyId).Value),
|
||||
})
|
||||
.GroupBy(x => new { x.Id, x.Name })
|
||||
.GroupBy(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.Name,
|
||||
})
|
||||
.Select(x => new DashboardIncomeDataItem
|
||||
{
|
||||
Id = x.Key.Id,
|
||||
Name = x.Key.Name,
|
||||
Value = x.Sum(s => s.Value),
|
||||
ValueRaw = x.Sum(s => s.ValueRaw),
|
||||
})
|
||||
.OrderBy(x => x.Name)
|
||||
.ToList(),
|
||||
|
||||
Details = data.Select(x => new DashboardIncomeDataItem
|
||||
Details = data.Select(x => new
|
||||
{
|
||||
Id = x.Id.ToShort(),
|
||||
Currency = x.CurrencyId,
|
||||
Name = x.Name,
|
||||
Id = x.CurrencyId,
|
||||
Name = x.CurrencyName,
|
||||
ValueRaw = x.Amount,
|
||||
Value = (x.Amount * rates.FirstOrDefault(r => r.Key == x.CurrencyId).Value),
|
||||
}).ToList()
|
||||
})
|
||||
.GroupBy(x => new
|
||||
{
|
||||
x.Id,
|
||||
x.Name,
|
||||
})
|
||||
.Select(x => new DashboardIncomeDataItem
|
||||
{
|
||||
Id = x.Key.Id,
|
||||
Name = x.Key.Name,
|
||||
Value = x.Sum(s => s.Value),
|
||||
ValueRaw = x.Sum(s => s.ValueRaw),
|
||||
})
|
||||
.OrderBy(x => x.Name)
|
||||
.ToList(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user