pub struct TrialBalance {Show 21 fields
pub trial_balance_id: String,
pub company_code: String,
pub company_name: Option<String>,
pub as_of_date: NaiveDate,
pub fiscal_year: i32,
pub fiscal_period: u32,
pub currency: String,
pub balance_type: TrialBalanceType,
pub lines: Vec<TrialBalanceLine>,
pub total_debits: Decimal,
pub total_credits: Decimal,
pub is_balanced: bool,
pub out_of_balance: Decimal,
pub is_equation_valid: bool,
pub equation_difference: Decimal,
pub category_summary: HashMap<AccountCategory, CategorySummary>,
pub created_at: NaiveDateTime,
pub created_by: String,
pub approved_by: Option<String>,
pub approved_at: Option<NaiveDateTime>,
pub status: TrialBalanceStatus,
}Expand description
A trial balance report for a company and period.
Fields§
§trial_balance_id: StringTrial balance identifier.
company_code: StringCompany code.
company_name: Option<String>Company name.
as_of_date: NaiveDateAs-of date.
fiscal_year: i32Fiscal year.
fiscal_period: u32Fiscal period.
currency: StringCurrency.
balance_type: TrialBalanceTypeTrial balance type.
lines: Vec<TrialBalanceLine>Individual account lines.
total_debits: DecimalTotal debits.
total_credits: DecimalTotal credits.
is_balanced: boolIs the trial balance balanced (debits = credits)?
out_of_balance: DecimalOut of balance amount.
is_equation_valid: boolIs the accounting equation valid (Assets = Liabilities + Equity)?
equation_difference: DecimalDifference in accounting equation (Assets - (Liabilities + Equity)).
category_summary: HashMap<AccountCategory, CategorySummary>Summary by account category.
created_at: NaiveDateTimeCreated timestamp.
created_by: StringCreated by.
approved_by: Option<String>Approved by (if applicable).
approved_at: Option<NaiveDateTime>Approval date.
status: TrialBalanceStatusStatus.
Implementations§
Source§impl TrialBalance
impl TrialBalance
Sourcepub fn new(
trial_balance_id: String,
company_code: String,
as_of_date: NaiveDate,
fiscal_year: i32,
fiscal_period: u32,
currency: String,
balance_type: TrialBalanceType,
) -> Self
pub fn new( trial_balance_id: String, company_code: String, as_of_date: NaiveDate, fiscal_year: i32, fiscal_period: u32, currency: String, balance_type: TrialBalanceType, ) -> Self
Create a new trial balance.
Sourcepub fn add_line(&mut self, line: TrialBalanceLine)
pub fn add_line(&mut self, line: TrialBalanceLine)
Add a line to the trial balance.
Sourcepub fn add_from_account_balance(&mut self, balance: &AccountBalance)
pub fn add_from_account_balance(&mut self, balance: &AccountBalance)
Add a line from an AccountBalance.
Sourcepub fn validate_accounting_equation(
&self,
) -> (bool, Decimal, Decimal, Decimal, Decimal)
pub fn validate_accounting_equation( &self, ) -> (bool, Decimal, Decimal, Decimal, Decimal)
Validate the accounting equation (Assets = Liabilities + Equity).
Returns true if the equation holds within tolerance, along with the calculated totals for each component.
Sourcepub fn get_lines_by_category(
&self,
category: AccountCategory,
) -> Vec<&TrialBalanceLine>
pub fn get_lines_by_category( &self, category: AccountCategory, ) -> Vec<&TrialBalanceLine>
Get lines for a specific category.
Sourcepub fn get_category_total(
&self,
category: AccountCategory,
) -> Option<&CategorySummary>
pub fn get_category_total( &self, category: AccountCategory, ) -> Option<&CategorySummary>
Get total for a category.
Sourcepub fn total_assets(&self) -> Decimal
pub fn total_assets(&self) -> Decimal
Get total assets.
Sourcepub fn total_liabilities(&self) -> Decimal
pub fn total_liabilities(&self) -> Decimal
Get total liabilities.
Sourcepub fn total_equity(&self) -> Decimal
pub fn total_equity(&self) -> Decimal
Get total equity.
Sourcepub fn total_revenue(&self) -> Decimal
pub fn total_revenue(&self) -> Decimal
Get total revenue.
Sourcepub fn total_expenses(&self) -> Decimal
pub fn total_expenses(&self) -> Decimal
Get total expenses.
Sourcepub fn net_income(&self) -> Decimal
pub fn net_income(&self) -> Decimal
Get net income.
Sourcepub fn sort_by_account(&mut self)
pub fn sort_by_account(&mut self)
Sort lines by account code.
Sourcepub fn sort_by_category(&mut self)
pub fn sort_by_category(&mut self)
Sort lines by category then account code.
Trait Implementations§
Source§impl Clone for TrialBalance
impl Clone for TrialBalance
Source§fn clone(&self) -> TrialBalance
fn clone(&self) -> TrialBalance
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 TrialBalance
impl Debug for TrialBalance
Source§impl<'de> Deserialize<'de> for TrialBalance
impl<'de> Deserialize<'de> for TrialBalance
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 TrialBalance
impl RefUnwindSafe for TrialBalance
impl Send for TrialBalance
impl Sync for TrialBalance
impl Unpin for TrialBalance
impl UnsafeUnpin for TrialBalance
impl UnwindSafe for TrialBalance
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>
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.