pub struct RunningBalanceTracker { /* private fields */ }Expand description
Tracks running balances for all accounts across companies.
Implementations§
Source§impl RunningBalanceTracker
impl RunningBalanceTracker
Sourcepub fn new(config: BalanceTrackerConfig) -> Self
pub fn new(config: BalanceTrackerConfig) -> Self
Creates a new balance tracker.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Creates a tracker with default configuration.
Sourcepub fn register_account_type(
&mut self,
account_code: &str,
account_type: AccountType,
)
pub fn register_account_type( &mut self, account_code: &str, account_type: AccountType, )
Registers an account type for balance tracking.
Sourcepub fn register_account_types(&mut self, types: &[(String, AccountType)])
pub fn register_account_types(&mut self, types: &[(String, AccountType)])
Registers multiple account types.
Sourcepub fn register_from_chart_prefixes(&mut self, prefixes: &[(&str, AccountType)])
pub fn register_from_chart_prefixes(&mut self, prefixes: &[(&str, AccountType)])
Registers account types from a chart of accounts prefix pattern.
Sourcepub fn initialize_from_snapshot(&mut self, snapshot: &BalanceSnapshot)
pub fn initialize_from_snapshot(&mut self, snapshot: &BalanceSnapshot)
Initializes balances from opening balance snapshot.
Sourcepub fn apply_entry(
&mut self,
entry: &JournalEntry,
) -> Result<(), ValidationError>
pub fn apply_entry( &mut self, entry: &JournalEntry, ) -> Result<(), ValidationError>
Applies a journal entry to the running balances.
Sourcepub fn apply_entries(
&mut self,
entries: &[JournalEntry],
) -> Vec<ValidationError>
pub fn apply_entries( &mut self, entries: &[JournalEntry], ) -> Vec<ValidationError>
Applies a batch of entries.
Sourcepub fn validate_balance_sheet(
&mut self,
company_code: &str,
date: NaiveDate,
entry_id: Option<&str>,
) -> Result<(), ValidationError>
pub fn validate_balance_sheet( &mut self, company_code: &str, date: NaiveDate, entry_id: Option<&str>, ) -> Result<(), ValidationError>
Validates the balance sheet equation for a company.
Sourcepub fn get_snapshot(
&self,
company_code: &str,
as_of_date: NaiveDate,
) -> Option<BalanceSnapshot>
pub fn get_snapshot( &self, company_code: &str, as_of_date: NaiveDate, ) -> Option<BalanceSnapshot>
Gets the current snapshot for a company.
Sourcepub fn get_all_snapshots(&self, as_of_date: NaiveDate) -> Vec<BalanceSnapshot>
pub fn get_all_snapshots(&self, as_of_date: NaiveDate) -> Vec<BalanceSnapshot>
Gets snapshots for all companies.
Sourcepub fn get_balance_changes(
&self,
company_code: &str,
from_date: NaiveDate,
to_date: NaiveDate,
) -> Vec<AccountPeriodActivity>
pub fn get_balance_changes( &self, company_code: &str, from_date: NaiveDate, to_date: NaiveDate, ) -> Vec<AccountPeriodActivity>
Gets balance changes for a period.
Sourcepub fn get_account_balance(
&self,
company_code: &str,
account_code: &str,
) -> Option<&AccountBalance>
pub fn get_account_balance( &self, company_code: &str, account_code: &str, ) -> Option<&AccountBalance>
Gets balance for a specific account.
Sourcepub fn get_validation_errors(&self) -> &[ValidationError]
pub fn get_validation_errors(&self) -> &[ValidationError]
Gets all validation errors.
Sourcepub fn clear_validation_errors(&mut self)
pub fn clear_validation_errors(&mut self)
Clears validation errors.
Sourcepub fn get_statistics(&self) -> &TrackerStatistics
pub fn get_statistics(&self) -> &TrackerStatistics
Gets tracker statistics.
Sourcepub fn roll_forward(&mut self, _new_period_start: NaiveDate)
pub fn roll_forward(&mut self, _new_period_start: NaiveDate)
Rolls forward balances to a new period.
Auto Trait Implementations§
impl Freeze for RunningBalanceTracker
impl RefUnwindSafe for RunningBalanceTracker
impl Send for RunningBalanceTracker
impl Sync for RunningBalanceTracker
impl Unpin for RunningBalanceTracker
impl UnwindSafe for RunningBalanceTracker
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
Mutably borrows from an owned value. Read more