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