diff --git a/client-gui2 b/client-gui2 index 91a46f6c..9839994e 160000 --- a/client-gui2 +++ b/client-gui2 @@ -1 +1 @@ -Subproject commit 91a46f6cf2627631b702308abaa5029783da60ef +Subproject commit 9839994ea55eb2b441b196eeb62cf15623de18ff diff --git a/common/proto/accounting.proto b/common/proto/accounting.proto index 9eaadcb4..e06370a4 100644 --- a/common/proto/accounting.proto +++ b/common/proto/accounting.proto @@ -63,6 +63,11 @@ service Accounting { returns (ListAccountingPeriodsResponse); rpc ListPeriodBalances(ListPeriodBalancesRequest) returns (ListPeriodBalancesResponse); + // Return a predvaha from one closed period's frozen account balances. + // Opening and closing signed balances are presented on their debit or credit + // side, while period turnover retains the journal's debit and credit columns. + rpc GetTrialBalance(GetTrialBalanceRequest) returns (GetTrialBalanceResponse); + // Materialize one row per directly transferable source account in a table // containing an ACCOUNTING_TRANSFER definition. Source fields are frozen // accounting facts; target fields start as an unchanged same-path copy and @@ -437,6 +442,43 @@ message ListPeriodBalancesResponse { repeated PeriodDenominationBalance denomination_balances = 2; } +message GetTrialBalanceRequest { + int64 period_id = 1; +} + +message TrialBalanceRow { + // Slash-delimited root-to-leaf account path. Rows include both posting + // accounts and consolidated ancestors from the frozen period snapshot. + string account = 1; + uint32 depth = 2; + bool is_summary = 3; + string currency = 4; + string opening_debit = 5; + string opening_credit = 6; + string period_debit = 7; + string period_credit = 8; + string closing_debit = 9; + string closing_credit = 10; +} + +message TrialBalanceTotals { + // Totals are calculated from root rows only, because descendant rows are + // already consolidated into their ancestors. + string opening_debit = 1; + string opening_credit = 2; + string period_debit = 3; + string period_credit = 4; + string closing_debit = 5; + string closing_credit = 6; +} + +message GetTrialBalanceResponse { + AccountingPeriod period = 1; + string currency = 2; + repeated TrialBalanceRow rows = 3; + TrialBalanceTotals totals = 4; +} + message GenerateAccountingTransferRequest { string profile_name = 1; string table_name = 2; diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 11470311..56b08f18 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/komp_ac.accounting.rs b/common/src/proto/komp_ac.accounting.rs index 27efa1f6..31e247b2 100644 --- a/common/src/proto/komp_ac.accounting.rs +++ b/common/src/proto/komp_ac.accounting.rs @@ -502,6 +502,68 @@ pub struct ListPeriodBalancesResponse { pub denomination_balances: ::prost::alloc::vec::Vec, } #[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] +pub struct GetTrialBalanceRequest { + #[prost(int64, tag = "1")] + pub period_id: i64, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct TrialBalanceRow { + /// Slash-delimited root-to-leaf account path. Rows include both posting + /// accounts and consolidated ancestors from the frozen period snapshot. + #[prost(string, tag = "1")] + pub account: ::prost::alloc::string::String, + #[prost(uint32, tag = "2")] + pub depth: u32, + #[prost(bool, tag = "3")] + pub is_summary: bool, + #[prost(string, tag = "4")] + pub currency: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub opening_debit: ::prost::alloc::string::String, + #[prost(string, tag = "6")] + pub opening_credit: ::prost::alloc::string::String, + #[prost(string, tag = "7")] + pub period_debit: ::prost::alloc::string::String, + #[prost(string, tag = "8")] + pub period_credit: ::prost::alloc::string::String, + #[prost(string, tag = "9")] + pub closing_debit: ::prost::alloc::string::String, + #[prost(string, tag = "10")] + pub closing_credit: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct TrialBalanceTotals { + /// Totals are calculated from root rows only, because descendant rows are + /// already consolidated into their ancestors. + #[prost(string, tag = "1")] + pub opening_debit: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub opening_credit: ::prost::alloc::string::String, + #[prost(string, tag = "3")] + pub period_debit: ::prost::alloc::string::String, + #[prost(string, tag = "4")] + pub period_credit: ::prost::alloc::string::String, + #[prost(string, tag = "5")] + pub closing_debit: ::prost::alloc::string::String, + #[prost(string, tag = "6")] + pub closing_credit: ::prost::alloc::string::String, +} +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, ::prost::Message)] +pub struct GetTrialBalanceResponse { + #[prost(message, optional, tag = "1")] + pub period: ::core::option::Option, + #[prost(string, tag = "2")] + pub currency: ::prost::alloc::string::String, + #[prost(message, repeated, tag = "3")] + pub rows: ::prost::alloc::vec::Vec, + #[prost(message, optional, tag = "4")] + pub totals: ::core::option::Option, +} +#[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GenerateAccountingTransferRequest { #[prost(string, tag = "1")] @@ -1375,6 +1437,35 @@ pub mod accounting_client { ); self.inner.unary(req, path, codec).await } + /// Return a predvaha from one closed period's frozen account balances. + /// Opening and closing signed balances are presented on their debit or credit + /// side, while period turnover retains the journal's debit and credit columns. + pub async fn get_trial_balance( + &mut self, + request: impl tonic::IntoRequest, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + > { + self.inner + .ready() + .await + .map_err(|e| { + tonic::Status::unknown( + format!("Service was not ready: {}", e.into()), + ) + })?; + let codec = tonic_prost::ProstCodec::default(); + let path = http::uri::PathAndQuery::from_static( + "/komp_ac.accounting.Accounting/GetTrialBalance", + ); + let mut req = request.into_request(); + req.extensions_mut() + .insert( + GrpcMethod::new("komp_ac.accounting.Accounting", "GetTrialBalance"), + ); + self.inner.unary(req, path, codec).await + } /// Materialize one row per directly transferable source account in a table /// containing an ACCOUNTING_TRANSFER definition. Source fields are frozen /// accounting facts; target fields start as an unchanged same-path copy and @@ -1631,6 +1722,16 @@ pub mod accounting_server { tonic::Response, tonic::Status, >; + /// Return a predvaha from one closed period's frozen account balances. + /// Opening and closing signed balances are presented on their debit or credit + /// side, while period turnover retains the journal's debit and credit columns. + async fn get_trial_balance( + &self, + request: tonic::Request, + ) -> std::result::Result< + tonic::Response, + tonic::Status, + >; /// Materialize one row per directly transferable source account in a table /// containing an ACCOUNTING_TRANSFER definition. Source fields are frozen /// accounting facts; target fields start as an unchanged same-path copy and @@ -2573,6 +2674,51 @@ pub mod accounting_server { }; Box::pin(fut) } + "/komp_ac.accounting.Accounting/GetTrialBalance" => { + #[allow(non_camel_case_types)] + struct GetTrialBalanceSvc(pub Arc); + impl< + T: Accounting, + > tonic::server::UnaryService + for GetTrialBalanceSvc { + type Response = super::GetTrialBalanceResponse; + type Future = BoxFuture< + tonic::Response, + tonic::Status, + >; + fn call( + &mut self, + request: tonic::Request, + ) -> Self::Future { + let inner = Arc::clone(&self.0); + let fut = async move { + ::get_trial_balance(&inner, request).await + }; + Box::pin(fut) + } + } + let accept_compression_encodings = self.accept_compression_encodings; + let send_compression_encodings = self.send_compression_encodings; + let max_decoding_message_size = self.max_decoding_message_size; + let max_encoding_message_size = self.max_encoding_message_size; + let inner = self.inner.clone(); + let fut = async move { + let method = GetTrialBalanceSvc(inner); + let codec = tonic_prost::ProstCodec::default(); + let mut grpc = tonic::server::Grpc::new(codec) + .apply_compression_config( + accept_compression_encodings, + send_compression_encodings, + ) + .apply_max_message_size_config( + max_decoding_message_size, + max_encoding_message_size, + ); + let res = grpc.unary(method, req).await; + Ok(res) + }; + Box::pin(fut) + } "/komp_ac.accounting.Accounting/GenerateAccountingTransfer" => { #[allow(non_camel_case_types)] struct GenerateAccountingTransferSvc(pub Arc); diff --git a/server b/server index 61f373ee..48d6b1cd 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 61f373ee5c75f35263e3e5773bb71310bd9371ad +Subproject commit 48d6b1cd089f21614c6525b7162b968eac08916d