pub struct LedgerCoherenceReport {Show 15 fields
pub je_count: usize,
pub line_count: usize,
pub balanced_je_count: usize,
pub unbalanced_je_count: usize,
pub unbalanced_jes: Vec<UnbalancedJeRecord>,
pub all_jes_balanced: bool,
pub total_debits: String,
pub total_credits: String,
pub ledger_nets_to_zero: bool,
pub distinct_accounts: usize,
pub distinct_companies: usize,
pub period_span: Option<[String; 2]>,
pub top_account_activity: Vec<AccountActivity>,
pub tb_period_checks: Vec<TbPeriodCheck>,
pub all_tbs_balanced: bool,
}Expand description
Integrity self-validation report for a generated ledger.
Fields§
§je_count: usize§line_count: usize§balanced_je_count: usize§unbalanced_je_count: usize§unbalanced_jes: Vec<UnbalancedJeRecord>Unbalanced entries (capped to keep the report bounded).
all_jes_balanced: bool§total_debits: String§total_credits: String§ledger_nets_to_zero: boolTrue when total debits == total credits across the whole ledger.
distinct_accounts: usize§distinct_companies: usize§period_span: Option<[String; 2]>[min_posting_date, max_posting_date] (ISO) when any entries exist.
top_account_activity: Vec<AccountActivity>Top accounts by absolute net activity (capped).
tb_period_checks: Vec<TbPeriodCheck>Per-period trial-balance checks (empty until the runtime populates them).
all_tbs_balanced: boolTrue when every supplied period trial balance balances (vacuously true when no trial balances were supplied).
Implementations§
Source§impl LedgerCoherenceReport
impl LedgerCoherenceReport
Sourcepub const DEFAULT_LIST_CAP: usize = 200
pub const DEFAULT_LIST_CAP: usize = 200
Default cap on the number of unbalanced JEs / top accounts listed.
Sourcepub fn from_entries(entries: &[JournalEntry], list_cap: usize) -> Self
pub fn from_entries(entries: &[JournalEntry], list_cap: usize) -> Self
Compute the coherence report from journal entries alone. The trial-balance
section is left empty (the runtime augments it via Self::with_tb_checks).
Sourcepub fn with_tb_checks(
self,
tbs: impl IntoIterator<Item = (u16, u8, Decimal, Decimal)>,
) -> Self
pub fn with_tb_checks( self, tbs: impl IntoIterator<Item = (u16, u8, Decimal, Decimal)>, ) -> Self
Attach per-period trial-balance self-balance checks. tbs is an iterator
of (fiscal_year, fiscal_period, total_debit_balance, total_credit_balance).
Sourcepub fn is_coherent(&self) -> bool
pub fn is_coherent(&self) -> bool
True when the ledger is fully coherent: all JEs balance, the ledger nets to zero, and every supplied trial balance balances.
Trait Implementations§
Source§impl Clone for LedgerCoherenceReport
impl Clone for LedgerCoherenceReport
Source§fn clone(&self) -> LedgerCoherenceReport
fn clone(&self) -> LedgerCoherenceReport
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for LedgerCoherenceReport
impl Debug for LedgerCoherenceReport
Source§impl<'de> Deserialize<'de> for LedgerCoherenceReport
impl<'de> Deserialize<'de> for LedgerCoherenceReport
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for LedgerCoherenceReport
impl PartialEq for LedgerCoherenceReport
Source§fn eq(&self, other: &LedgerCoherenceReport) -> bool
fn eq(&self, other: &LedgerCoherenceReport) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for LedgerCoherenceReport
impl Serialize for LedgerCoherenceReport
impl StructuralPartialEq for LedgerCoherenceReport
Auto Trait Implementations§
impl Freeze for LedgerCoherenceReport
impl RefUnwindSafe for LedgerCoherenceReport
impl Send for LedgerCoherenceReport
impl Sync for LedgerCoherenceReport
impl Unpin for LedgerCoherenceReport
impl UnsafeUnpin for LedgerCoherenceReport
impl UnwindSafe for LedgerCoherenceReport
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.