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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more