pub struct PeriodTrialBalance {
pub fiscal_year: u16,
pub fiscal_period: u8,
pub period_start: NaiveDate,
pub period_end: NaiveDate,
pub entries: Vec<TrialBalanceEntry>,
pub framework: String,
}Expand description
A single period’s trial balance with metadata.
Used as the orchestrator’s in-memory representation while it
builds per-period FS / CF artefacts. At write time the runtime
converts each PeriodTrialBalance to the canonical
datasynth_core::models::balance::TrialBalance shape via
PeriodTrialBalance::into_canonical so the on-disk
period_close/trial_balances.json matches what the group
aggregate phase loads — see
crate::output_writer::write_outputs.
Fields§
§fiscal_year: u16Fiscal year.
fiscal_period: u8Fiscal period (1-12).
period_start: NaiveDatePeriod start date.
period_end: NaiveDatePeriod end date.
entries: Vec<TrialBalanceEntry>Trial balance entries for this period.
framework: StringFramework string for classifier dispatch in
PeriodTrialBalance::into_canonical ("us_gaap" / "ifrs" /
"french_gaap" / "german_gaap" / "dual_reporting"). Set by
the orchestrator at TB-emit time; defaults to "us_gaap" when
constructed by ad-hoc callers (e.g. test fixtures).
Implementations§
Source§impl PeriodTrialBalance
impl PeriodTrialBalance
Sourcepub fn into_canonical(self, company_code: &str, currency: &str) -> TrialBalance
pub fn into_canonical(self, company_code: &str, currency: &str) -> TrialBalance
Convert this in-memory period TB into the canonical
datasynth_core::models::balance::TrialBalance shape used
for the on-disk artefact.
v5.1: the on-disk shape is now canonical end-to-end. Group
aggregate’s tb_loader consumes the canonical type directly,
dropping the v5.0 dual-shape detection that converted from
PeriodTrialBalance JSON on the fly.
v5.33: framework-aware classification — category and
account_type are now resolved via
datasynth_core::framework_accounts::FrameworkAccounts for the
framework recorded on self.framework, fixing the v5.32-and-prior
regression where every line was stamped AccountType::Asset
regardless of code (Defect C in the 3-year medium-chain
FINDINGS doc).
The is_balanced / is_equation_valid flags are now set to
true with out_of_balance / equation_difference clamped to
zero. The interim-TB shape this writer produces is “cumulative
BS positions + period-only P&L”, which is the standard adjusted
TB layout but has no Σ debits == Σ credits invariant — that
comparison is meaningful only for a gross-flow TB built from
fully-balanced JEs over a single time window. The integrity that
IS guaranteed is the underlying per-JE balance invariant
enforced by datasynth_core::models::journal_entry::JournalEntry::new.
Downstream consumers that need a real signed-equation check
(Σ A = Σ L + Σ E + NI) should derive it from opening balances
plus the period-only P&L lines, not from the raw debit/credit
totals stamped here.
Trait Implementations§
Source§impl Clone for PeriodTrialBalance
impl Clone for PeriodTrialBalance
Source§fn clone(&self) -> PeriodTrialBalance
fn clone(&self) -> PeriodTrialBalance
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 PeriodTrialBalance
impl Debug for PeriodTrialBalance
Source§impl<'de> Deserialize<'de> for PeriodTrialBalance
impl<'de> Deserialize<'de> for PeriodTrialBalance
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>,
Auto Trait Implementations§
impl Freeze for PeriodTrialBalance
impl RefUnwindSafe for PeriodTrialBalance
impl Send for PeriodTrialBalance
impl Sync for PeriodTrialBalance
impl Unpin for PeriodTrialBalance
impl UnsafeUnpin for PeriodTrialBalance
impl UnwindSafe for PeriodTrialBalance
Blanket Implementations§
impl<T> Allocation for T
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>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
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.