ecb conversions with corrections2
This commit is contained in:
@@ -56,13 +56,6 @@ pub struct PostJournalRequest {
|
||||
/// the latest closed or approved accounting boundary for the profile.
|
||||
#[prost(string, tag = "7")]
|
||||
pub accounting_date: ::prost::alloc::string::String,
|
||||
/// Convert this posting with the profile's own rate for the publication date
|
||||
/// instead of the ECB reference rate. False, the default, always uses ECB, even
|
||||
/// where a custom rate for that date exists. True requires one to have been
|
||||
/// entered: a missing rate is refused rather than silently converted at the
|
||||
/// official rate. Ignored when nothing needs converting.
|
||||
#[prost(bool, tag = "8")]
|
||||
pub use_custom_rate: bool,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct JournalLineInput {
|
||||
@@ -75,6 +68,12 @@ pub struct JournalLineInput {
|
||||
pub amount: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "4")]
|
||||
pub description: ::prost::alloc::string::String,
|
||||
/// Empty uses previous publication and ECB. Set this per line when the
|
||||
/// accountant needs a different rule, a saved custom rate, or a one-off rate.
|
||||
#[prost(message, optional, tag = "5")]
|
||||
pub exchange_rate_selection: ::core::option::Option<
|
||||
super::ecb::ExchangeRateSelection,
|
||||
>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct CloseJournalRequest {
|
||||
@@ -96,8 +95,8 @@ pub struct GetJournalRequest {
|
||||
pub profile_name: ::prost::alloc::string::String,
|
||||
#[prost(int64, tag = "2")]
|
||||
pub journal_id: i64,
|
||||
/// False by default. True is reserved for a future Casbin permission granted
|
||||
/// only to superadmin and is rejected until that permission is implemented.
|
||||
/// False returns the live journal. True also returns superseded/deleted lines
|
||||
/// so an authorized journal reader can inspect the correction trail.
|
||||
#[prost(bool, tag = "3")]
|
||||
pub include_deleted: bool,
|
||||
}
|
||||
@@ -229,6 +228,31 @@ pub struct SoftDeleteJournalLineRequest {
|
||||
#[prost(int64, tag = "3")]
|
||||
pub journal_line_id: i64,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct CorrectJournalRequest {
|
||||
#[prost(string, tag = "1")]
|
||||
pub profile_name: ::prost::alloc::string::String,
|
||||
#[prost(int64, tag = "2")]
|
||||
pub journal_id: i64,
|
||||
/// One or more line replacements committed as a single correction. Batching
|
||||
/// lets both sides of a closed balanced journal be corrected together.
|
||||
#[prost(message, repeated, tag = "3")]
|
||||
pub corrections: ::prost::alloc::vec::Vec<JournalLineCorrection>,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct JournalLineCorrection {
|
||||
#[prost(int64, tag = "1")]
|
||||
pub journal_line_id: i64,
|
||||
/// Full replacement line. Its amount is expressed in currency.
|
||||
#[prost(message, optional, tag = "2")]
|
||||
pub replacement: ::core::option::Option<JournalLineInput>,
|
||||
#[prost(string, tag = "3")]
|
||||
pub currency: ::prost::alloc::string::String,
|
||||
/// Required independently of any exceptional exchange-rate reason and stored
|
||||
/// permanently beside this original/replacement pair.
|
||||
#[prost(string, tag = "4")]
|
||||
pub correction_reason: ::prost::alloc::string::String,
|
||||
}
|
||||
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
|
||||
pub struct JournalLine {
|
||||
#[prost(int64, tag = "1")]
|
||||
@@ -256,6 +280,21 @@ pub struct JournalLine {
|
||||
pub source_record_id: i64,
|
||||
#[prost(int64, tag = "12")]
|
||||
pub source_row_revision: i64,
|
||||
/// Populated on a replacement created by CorrectJournal.
|
||||
#[prost(int64, tag = "13")]
|
||||
pub supersedes_line_id: i64,
|
||||
#[prost(string, tag = "14")]
|
||||
pub correction_reason: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "15")]
|
||||
pub corrected_by_user_id: ::prost::alloc::string::String,
|
||||
/// Original foreign-currency input and immutable conversion evidence. Empty/
|
||||
/// zero when the line did not require conversion.
|
||||
#[prost(string, tag = "16")]
|
||||
pub original_amount: ::prost::alloc::string::String,
|
||||
#[prost(string, tag = "17")]
|
||||
pub original_currency: ::prost::alloc::string::String,
|
||||
#[prost(int64, tag = "18")]
|
||||
pub conversion_evidence_id: i64,
|
||||
}
|
||||
#[derive(Clone, PartialEq, ::prost::Message)]
|
||||
pub struct Journal {
|
||||
@@ -1027,6 +1066,31 @@ pub mod accounting_client {
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Atomically supersede active lines and append corrected replacements. The
|
||||
/// originals and their conversion evidence remain immutable audit history.
|
||||
pub async fn correct_journal(
|
||||
&mut self,
|
||||
request: impl tonic::IntoRequest<super::CorrectJournalRequest>,
|
||||
) -> std::result::Result<tonic::Response<super::Journal>, 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/CorrectJournal",
|
||||
);
|
||||
let mut req = request.into_request();
|
||||
req.extensions_mut()
|
||||
.insert(
|
||||
GrpcMethod::new("komp_ac.accounting.Accounting", "CorrectJournal"),
|
||||
);
|
||||
self.inner.unary(req, path, codec).await
|
||||
}
|
||||
/// Create an open accounting period for a profile. Periods may be any length
|
||||
/// (month, half-year, year). Overlapping ranges for the same profile are rejected.
|
||||
pub async fn configure_accounting_period(
|
||||
@@ -1456,6 +1520,12 @@ pub mod accounting_server {
|
||||
&self,
|
||||
request: tonic::Request<super::SoftDeleteJournalLineRequest>,
|
||||
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>;
|
||||
/// Atomically supersede active lines and append corrected replacements. The
|
||||
/// originals and their conversion evidence remain immutable audit history.
|
||||
async fn correct_journal(
|
||||
&self,
|
||||
request: tonic::Request<super::CorrectJournalRequest>,
|
||||
) -> std::result::Result<tonic::Response<super::Journal>, tonic::Status>;
|
||||
/// Create an open accounting period for a profile. Periods may be any length
|
||||
/// (month, half-year, year). Overlapping ranges for the same profile are rejected.
|
||||
async fn configure_accounting_period(
|
||||
@@ -2037,6 +2107,51 @@ pub mod accounting_server {
|
||||
};
|
||||
Box::pin(fut)
|
||||
}
|
||||
"/komp_ac.accounting.Accounting/CorrectJournal" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct CorrectJournalSvc<T: Accounting>(pub Arc<T>);
|
||||
impl<
|
||||
T: Accounting,
|
||||
> tonic::server::UnaryService<super::CorrectJournalRequest>
|
||||
for CorrectJournalSvc<T> {
|
||||
type Response = super::Journal;
|
||||
type Future = BoxFuture<
|
||||
tonic::Response<Self::Response>,
|
||||
tonic::Status,
|
||||
>;
|
||||
fn call(
|
||||
&mut self,
|
||||
request: tonic::Request<super::CorrectJournalRequest>,
|
||||
) -> Self::Future {
|
||||
let inner = Arc::clone(&self.0);
|
||||
let fut = async move {
|
||||
<T as Accounting>::correct_journal(&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 = CorrectJournalSvc(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/ConfigureAccountingPeriod" => {
|
||||
#[allow(non_camel_case_types)]
|
||||
struct ConfigureAccountingPeriodSvc<T: Accounting>(pub Arc<T>);
|
||||
|
||||
Reference in New Issue
Block a user