This commit is contained in:
Priec
2026-09-14 22:57:39 +02:00
parent 4a160d7d9a
commit 03b50e8f81
3 changed files with 1173 additions and 0 deletions

View File

@@ -585,3 +585,178 @@ message ListOpeningBalanceAccountsResponse {
repeated UnmappedSourceDenominationBalance repeated UnmappedSourceDenominationBalance
unmapped_source_denomination_balances = 3; unmapped_source_denomination_balances = 3;
} }
// Implemented by financial_reports_basic. Module approvals and user read
// permissions for both the journal and account catalogue are required.
service FinancialReports {
rpc PreviewFinancialReports(FinancialReportRequest) returns (FinancialReportBundle);
// Saves immutable source data and results; requires a closed, reconciled period.
rpc FinalizeFinancialReports(FinancialReportRequest) returns (SavedFinancialReport);
rpc GetFinancialReport(GetFinancialReportRequest) returns (SavedFinancialReport);
rpc ListFinancialReports(ListFinancialReportsRequest) returns (ListFinancialReportsResponse);
}
enum ReportStatementClass {
REPORT_STATEMENT_CLASS_UNSPECIFIED = 0;
REPORT_STATEMENT_CLASS_ASSETS = 1;
REPORT_STATEMENT_CLASS_EQUITY_AND_LIABILITIES = 2;
REPORT_STATEMENT_CLASS_EXPENSES = 3;
REPORT_STATEMENT_CLASS_REVENUE = 4;
}
enum ReportBalanceSide {
REPORT_BALANCE_SIDE_UNSPECIFIED = 0;
REPORT_BALANCE_SIDE_DEBIT = 1;
REPORT_BALANCE_SIDE_CREDIT = 2;
REPORT_BALANCE_SIDE_EITHER = 3;
}
enum FinancialReportBasis {
FINANCIAL_REPORT_BASIS_UNSPECIFIED = 0;
FINANCIAL_REPORT_BASIS_POSTED = 1;
FINANCIAL_REPORT_BASIS_BEFORE_TECHNICAL_CLOSING = 2;
}
message FinancialReportRequest {
string profile_name = 1;
int64 period_id = 2;
// Must be chosen explicitly. The server never guesses closing journals.
FinancialReportBasis basis = 3;
// Verified technical transfers removed from all three reports.
repeated TechnicalClosingJournal closing_journals = 4;
// Zero selects period_id alone; otherwise report consecutive periods through period_id.
int64 first_period_id = 5;
}
enum TechnicalClosingKind {
TECHNICAL_CLOSING_KIND_UNSPECIFIED = 0;
TECHNICAL_CLOSING_KIND_INCOME_TRANSFER = 1;
TECHNICAL_CLOSING_KIND_BALANCE_TRANSFER = 2;
}
message TechnicalClosingJournal {
int64 journal_id = 1;
TechnicalClosingKind kind = 2;
// Explicit account identity, never inferred from account numbers or descriptions.
string closing_account = 3;
}
message FinancialReportSourceRow {
repeated string account_segments = 1;
string denomination_currency = 2;
ReportStatementClass statement_class = 3;
ReportBalanceSide balance_side = 4;
// Aggregate amounts include descendants, in the profile bookkeeping currency.
string opening_balance = 5;
string period_debit = 6;
string period_credit = 7;
string closing_balance = 8;
// Direct movements of the explicitly selected closing journals only.
string excluded_debit = 9;
string excluded_credit = 10;
}
message FinancialReportSource {
AccountingPeriod period = 1;
string currency = 2;
string account_catalogue = 3;
int64 account_catalogue_id = 4;
FinancialReportBasis basis = 5;
repeated TechnicalClosingJournal closing_journals = 6;
repeated FinancialReportSourceRow rows = 7;
// Actual period generations; period above describes their combined range.
repeated AccountingPeriod periods = 8;
}
message FinancialStatementRow {
string account = 1;
ReportStatementClass statement_class = 2;
// Direct account amount, excluding descendants. Contra balances stay signed.
string amount = 3;
}
message BalanceSheet {
repeated FinancialStatementRow rows = 1;
string assets = 2;
string equity_and_liabilities = 3;
// Negative N/V balances on the selected report basis.
string untransferred_result = 4;
// Assets minus equity/liabilities minus untransferred result.
string difference = 5;
}
message ProfitAndLoss {
repeated FinancialStatementRow rows = 1;
string expenses = 2;
string revenue = 3;
string result = 4;
}
enum FinancialReportIssueKind {
FINANCIAL_REPORT_ISSUE_KIND_UNSPECIFIED = 0;
FINANCIAL_REPORT_ISSUE_KIND_UNEXPECTED_BALANCE_SIDE = 1;
FINANCIAL_REPORT_ISSUE_KIND_UNBALANCED_OPENING = 2;
FINANCIAL_REPORT_ISSUE_KIND_UNBALANCED_MOVEMENT = 3;
FINANCIAL_REPORT_ISSUE_KIND_UNBALANCED_CLOSING = 4;
FINANCIAL_REPORT_ISSUE_KIND_UNADJUSTED_OPEN_PERIOD = 5;
}
message FinancialReportIssue {
FinancialReportIssueKind kind = 1;
string account = 2;
string message = 3;
}
message FinancialReportBundle {
uint32 calculation_version = 1;
FinancialReportSource source = 2;
GetTrialBalanceResponse trial_balance = 3;
BalanceSheet balance_sheet = 4;
ProfitAndLoss profit_and_loss = 5;
repeated FinancialReportIssue issues = 6;
}
enum FinancialReportPeriodState {
FINANCIAL_REPORT_PERIOD_STATE_UNSPECIFIED = 0;
FINANCIAL_REPORT_PERIOD_STATE_SAME_CLOSED_PERIOD = 1;
FINANCIAL_REPORT_PERIOD_STATE_REOPENED_OR_CHANGED = 2;
FINANCIAL_REPORT_PERIOD_STATE_REMOVED = 3;
}
message SavedFinancialReport {
int64 id = 1;
string created_at = 2;
string created_by_user_id = 3;
FinancialReportBundle report = 4;
// Only describes the period generation. Saved classifications are immutable
// even when the current account catalogue is edited later.
FinancialReportPeriodState period_state = 5;
}
message GetFinancialReportRequest {
string profile_name = 1;
int64 report_id = 2;
}
message ListFinancialReportsRequest {
string profile_name = 1;
// Exclusive cursor; zero starts at the newest report.
int64 before_id = 2;
uint32 limit = 3;
}
message FinancialReportSummary {
int64 id = 1;
int64 period_id = 2;
string period_start = 3;
string period_end = 4;
string created_at = 5;
string created_by_user_id = 6;
uint32 calculation_version = 7;
}
message ListFinancialReportsResponse {
repeated FinancialReportSummary reports = 1;
// Pass as before_id for the next page; zero when no more rows remain.
int64 next_before_id = 2;
}

Binary file not shown.

File diff suppressed because it is too large Load Diff