pub struct AccountBalance {Show 16 fields
pub company_code: String,
pub account_code: String,
pub account_description: Option<String>,
pub account_type: AccountType,
pub currency: String,
pub opening_balance: Decimal,
pub period_debits: Decimal,
pub period_credits: Decimal,
pub closing_balance: Decimal,
pub fiscal_year: i32,
pub fiscal_period: u32,
pub group_currency_balance: Option<Decimal>,
pub exchange_rate: Option<Decimal>,
pub cost_center: Option<String>,
pub profit_center: Option<String>,
pub last_updated: NaiveDateTime,
}Expand description
Account balance for a single GL account.
Fields§
§company_code: StringCompany code.
account_code: StringAccount code.
account_description: Option<String>Account description.
account_type: AccountTypeAccount type (Asset, Liability, Equity, Revenue, Expense).
currency: StringCurrency.
opening_balance: DecimalOpening balance (beginning of period).
period_debits: DecimalPeriod debits.
period_credits: DecimalPeriod credits.
closing_balance: DecimalClosing balance (end of period).
fiscal_year: i32Fiscal year.
fiscal_period: u32Fiscal period.
group_currency_balance: Option<Decimal>Balance in group currency (for consolidation).
exchange_rate: Option<Decimal>Exchange rate used.
cost_center: Option<String>Cost center (if applicable).
profit_center: Option<String>Profit center (if applicable).
last_updated: NaiveDateTimeLast updated timestamp.
Implementations§
Source§impl AccountBalance
impl AccountBalance
Sourcepub fn new(
company_code: String,
account_code: String,
account_type: AccountType,
currency: String,
fiscal_year: i32,
fiscal_period: u32,
) -> Self
pub fn new( company_code: String, account_code: String, account_type: AccountType, currency: String, fiscal_year: i32, fiscal_period: u32, ) -> Self
Create a new account balance.
Sourcepub fn apply_debit(&mut self, amount: Decimal)
pub fn apply_debit(&mut self, amount: Decimal)
Apply a debit to this balance.
Sourcepub fn apply_credit(&mut self, amount: Decimal)
pub fn apply_credit(&mut self, amount: Decimal)
Apply a credit to this balance.
Sourcepub fn set_opening_balance(&mut self, balance: Decimal)
pub fn set_opening_balance(&mut self, balance: Decimal)
Set opening balance.
Sourcepub fn net_change(&self) -> Decimal
pub fn net_change(&self) -> Decimal
Get the net change for the period.
Sourcepub fn is_debit_normal(&self) -> bool
pub fn is_debit_normal(&self) -> bool
Check if this is a debit-normal account.
Sourcepub fn normal_balance(&self) -> Decimal
pub fn normal_balance(&self) -> Decimal
Get the normal balance (positive closing for correct sign).
Sourcepub fn roll_forward(&mut self)
pub fn roll_forward(&mut self)
Roll forward to next period.
Sourcepub fn is_balance_sheet(&self) -> bool
pub fn is_balance_sheet(&self) -> bool
Check if this is a balance sheet account.
Sourcepub fn is_income_statement(&self) -> bool
pub fn is_income_statement(&self) -> bool
Check if this is an income statement account.
Trait Implementations§
Source§impl Clone for AccountBalance
impl Clone for AccountBalance
Source§fn clone(&self) -> AccountBalance
fn clone(&self) -> AccountBalance
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more