Skip to main content

ChartOfAccounts

Struct ChartOfAccounts 

Source
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: String

Unique identifier for this CoA

§name: String

Name/description

§country: String

Country/region code

§industry: IndustrySector

Industry sector this CoA is designed for

§accounts: Vec<GLAccount>

All accounts in this CoA

§complexity: CoAComplexity

Complexity level

§account_format: String

Account number format (e.g., “######” for 6 digits)

Implementations§

Source§

impl ChartOfAccounts

Source

pub fn new( coa_id: String, name: String, country: String, industry: IndustrySector, complexity: CoAComplexity, ) -> Self

Create a new empty Chart of Accounts.

Source

pub fn add_account(&mut self, account: GLAccount)

Add an account to the CoA.

Source

pub fn rebuild_index(&mut self)

Rebuild the account index (call after deserialization).

Source

pub fn get_account(&self, account_number: &str) -> Option<&GLAccount>

Get an account by number.

Source

pub fn get_postable_accounts(&self) -> Vec<&GLAccount>

Get all postable accounts.

Source

pub fn get_accounts_by_type(&self, account_type: AccountType) -> Vec<&GLAccount>

Get all accounts of a specific type.

Source

pub fn get_accounts_by_sub_type( &self, sub_type: AccountSubType, ) -> Vec<&GLAccount>

Get all accounts of a specific sub-type.

Source

pub fn get_suspense_accounts(&self) -> Vec<&GLAccount>

Get suspense/clearing accounts.

Source

pub fn get_industry_weighted_accounts( &self, account_type: AccountType, ) -> Vec<(&GLAccount, f64)>

Get accounts weighted by industry relevance.

Source

pub fn account_count(&self) -> usize

Get total account count.

Source

pub fn postable_count(&self) -> usize

Get count of postable accounts.

Trait Implementations§

Source§

impl Clone for ChartOfAccounts

Source§

fn clone(&self) -> ChartOfAccounts

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ChartOfAccounts

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for ChartOfAccounts

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ChartOfAccounts

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,