New page /analytics shows the current mandator's expenses across all years, with drill-down all -> subclass -> account -> booking-text group, year range and month/quarter/year filters, KPI tiles, a stacked bar chart and a category list. Filters and drill-down position live in the URL. - MultiYearRepository reads any mandator/year (read-only, shared cache) - ExpenseAnalysis flattens all years and answers queries in memory: net amounts (refunds count negative), accounts keyed by number with the latest name, bookings counted in the year of their books, year-over-year comparison over the same months - Chart.js 4.5.1 vendored in wwwroot/lib/chartjs, wrapped by wwwroot/js/charts.js and StackedBarChart.razor Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
42 lines
2.1 KiB
C#
42 lines
2.1 KiB
C#
using Schaad.Accounting.Interfaces;
|
|
using Schaad.Accounting.Repositories;
|
|
using Schaad.Accounting.Services;
|
|
using Schaad.Finance.Api;
|
|
using Schaad.Finance.Services;
|
|
|
|
namespace Schaad.Accounting.UI
|
|
{
|
|
public static class Extensions
|
|
{
|
|
public static IServiceCollection AddAccounting(this IServiceCollection services)
|
|
{
|
|
// Singleton because MyHeader triggers a full page reload (forceLoad: true) after
|
|
// changing year/mandator; a Scoped instance would be recreated on the new circuit
|
|
// and lose the selection. TODO: persist selection to a cookie/query string so this
|
|
// can safely become Scoped.
|
|
services.AddSingleton<ISettingsService, SettingsService>();
|
|
|
|
services.AddScoped<RepositoryCache>();
|
|
services.AddScoped<IAccountRepository, AccountRepository>();
|
|
services.AddScoped<IBankTransactionRepository, BankTransactionRepository>();
|
|
services.AddScoped<IBookingRuleRepository, BookingRuleRepository>();
|
|
services.AddScoped<IBookingTextRepository, BookingTextRepository>();
|
|
services.AddScoped<ISplitPredefinitionRepository, SplitPredefinitionRepository>();
|
|
services.AddScoped<ISubclassRepository, SubclassRepository>();
|
|
services.AddScoped<ITransactionRepository, TransactionRepository>();
|
|
services.AddScoped<IMultiYearRepository, MultiYearRepository>();
|
|
|
|
services.AddScoped<IChartService, ChartService>();
|
|
services.AddScoped<IAnalyticsService, AnalyticsService>();
|
|
services.AddScoped<IViewService, ViewService>();
|
|
services.AddScoped<IFileService, FileService>();
|
|
services.AddScoped<IAccountStatementService, AccountStatementService>();
|
|
services.AddScoped<ICreditCardStatementService, CreditCardStatementService>();
|
|
services.AddSingleton<IFxService, DummyFxService>();
|
|
services.AddScoped<IFxConverter, FxConverter>();
|
|
services.AddSingleton<IPdfParsingService, PdfParsingService>();
|
|
|
|
return services;
|
|
}
|
|
}
|
|
}
|