AccountingNext/Schaad.Accounting.Services/AnalyticsService.cs
Claudio Schaad 64494e2de8 Analyse page: income, net and assets views; narrow-screen layout
- View switch Ausgaben | Einnahmen | Netto | Vermögen (URL: view=).
  ExpenseAnalysis becomes AccountingAnalysis:
  - Income: bookings from income accounts positive, to them negative
  - Net: income positive, expenses negative, ordered by size; bar chart with
    a net line, savings-rate tile, no treemap (areas can't be negative)
  - Assets: month-end balances of asset accounts in CHF (foreign balances
    converted once per currency, like the balance sheet); periods take their
    last balance, drill-down ends at the account
- Change colours follow the view: more expenses red, more income/assets green
- Old Vermögen chart page and its menu entry removed
- Narrow screens: side menu starts collapsed below 700px, slimmer header,
  wrapping button groups, two KPI tiles per row, pinned name column in the
  year table

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-22 18:38:46 +02:00

32 lines
1.2 KiB
C#

using System.Collections.Generic;
using System.Threading.Tasks;
using Schaad.Accounting.Datasets.Analytics;
using Schaad.Accounting.Interfaces;
namespace Schaad.Accounting.Services
{
public class AnalyticsService : IAnalyticsService
{
private readonly ISettingsService settingsService;
private readonly IMultiYearRepository multiYearRepository;
private readonly IFxConverter fxConverter;
public AnalyticsService(ISettingsService settingsService, IMultiYearRepository multiYearRepository, IFxConverter fxConverter)
{
this.settingsService = settingsService;
this.multiYearRepository = multiYearRepository;
this.fxConverter = fxConverter;
}
public async Task<AccountingAnalysis> GetAnalysisAsync()
{
var mandator = settingsService.GetMandator();
var years = new List<YearData>();
foreach (var year in multiYearRepository.GetYears(mandator))
{
years.Add(await multiYearRepository.GetYearDataAsync(mandator, year));
}
return new AccountingAnalysis(years, currency => fxConverter.ConvertToChf(1, currency));
}
}
}