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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AccountBalance
impl Debug for AccountBalance
Source§impl<'de> Deserialize<'de> for AccountBalance
impl<'de> Deserialize<'de> for AccountBalance
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 AccountBalance
impl RefUnwindSafe for AccountBalance
impl Send for AccountBalance
impl Sync for AccountBalance
impl Unpin for AccountBalance
impl UnsafeUnpin for AccountBalance
impl UnwindSafe for AccountBalance
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,
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.