pub struct ChartOfAccounts {
pub coa_id: String,
pub name: String,
pub country: String,
pub industry: IndustrySector,
pub accounts: Vec<GLAccount>,
pub complexity: CoAComplexity,
pub account_format: String,
/* private fields */
}Expand description
Complete Chart of Accounts structure.
Contains all GL accounts for an entity along with metadata about the overall structure.
Fields§
§coa_id: StringUnique identifier for this CoA
name: StringName/description
country: StringCountry/region code
industry: IndustrySectorIndustry sector this CoA is designed for
accounts: Vec<GLAccount>All accounts in this CoA
complexity: CoAComplexityComplexity level
account_format: StringAccount number format (e.g., “######” for 6 digits)
Implementations§
Source§impl ChartOfAccounts
impl ChartOfAccounts
Sourcepub fn new(
coa_id: String,
name: String,
country: String,
industry: IndustrySector,
complexity: CoAComplexity,
) -> Self
pub fn new( coa_id: String, name: String, country: String, industry: IndustrySector, complexity: CoAComplexity, ) -> Self
Create a new empty Chart of Accounts.
Sourcepub fn add_account(&mut self, account: GLAccount)
pub fn add_account(&mut self, account: GLAccount)
Add an account to the CoA.
Sourcepub fn rebuild_index(&mut self)
pub fn rebuild_index(&mut self)
Rebuild the account index (call after deserialization).
Sourcepub fn get_account(&self, account_number: &str) -> Option<&GLAccount>
pub fn get_account(&self, account_number: &str) -> Option<&GLAccount>
Get an account by number.
Sourcepub fn get_postable_accounts(&self) -> Vec<&GLAccount>
pub fn get_postable_accounts(&self) -> Vec<&GLAccount>
Get all postable accounts.
Sourcepub fn get_accounts_by_type(&self, account_type: AccountType) -> Vec<&GLAccount>
pub fn get_accounts_by_type(&self, account_type: AccountType) -> Vec<&GLAccount>
Get all accounts of a specific type.
Sourcepub fn get_accounts_by_sub_type(
&self,
sub_type: AccountSubType,
) -> Vec<&GLAccount>
pub fn get_accounts_by_sub_type( &self, sub_type: AccountSubType, ) -> Vec<&GLAccount>
Get all accounts of a specific sub-type.
Sourcepub fn get_suspense_accounts(&self) -> Vec<&GLAccount>
pub fn get_suspense_accounts(&self) -> Vec<&GLAccount>
Get suspense/clearing accounts.
Sourcepub fn get_industry_weighted_accounts(
&self,
account_type: AccountType,
) -> Vec<(&GLAccount, f64)>
pub fn get_industry_weighted_accounts( &self, account_type: AccountType, ) -> Vec<(&GLAccount, f64)>
Get accounts weighted by industry relevance.
Sourcepub fn account_count(&self) -> usize
pub fn account_count(&self) -> usize
Get total account count.
Sourcepub fn postable_count(&self) -> usize
pub fn postable_count(&self) -> usize
Get count of postable accounts.
Trait Implementations§
Source§impl Clone for ChartOfAccounts
impl Clone for ChartOfAccounts
Source§fn clone(&self) -> ChartOfAccounts
fn clone(&self) -> ChartOfAccounts
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChartOfAccounts
impl Debug for ChartOfAccounts
Source§impl<'de> Deserialize<'de> for ChartOfAccounts
impl<'de> Deserialize<'de> for ChartOfAccounts
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for ChartOfAccounts
impl RefUnwindSafe for ChartOfAccounts
impl Send for ChartOfAccounts
impl Sync for ChartOfAccounts
impl Unpin for ChartOfAccounts
impl UnwindSafe for ChartOfAccounts
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