pub enum AccountType {
Asset,
Liability,
Expense,
Revenue,
OffBalance,
}Expand description
Account classification based on Belgian PCMN (Plan Comptable Minimum Normalisé)
This enum maps to Noalyss pcm_type field with the following equivalences:
Asset= ACT (Actif) - Classes 2, 3, 4, 5Liability= PAS (Passif) - Class 1Expense= CHA (Charges) - Class 6Revenue= PRO (Produits) - Class 7OffBalance= CON (Contrôle) - Class 9
Reference: Noalyss tmp_pcmn.pcm_type field
Variants§
Asset
Assets (Actif) - Classes 2, 3, 4, 5 in Belgian PCMN Examples: Buildings, Inventory, Receivables, Bank accounts
Liability
Liabilities (Passif) - Class 1 in Belgian PCMN Examples: Capital, Reserves, Provisions, Debts
Expense
Expenses (Charges) - Class 6 in Belgian PCMN Examples: Electricity, Maintenance, Insurance, Salaries
Revenue
Revenue (Produits) - Class 7 in Belgian PCMN Examples: Regular fees, Extraordinary fees, Interest income
OffBalance
Off-balance/Control accounts (Contrôle) - Class 9 in Belgian PCMN Examples: Memorandum accounts, Statistical accounts
Implementations§
Source§impl AccountType
impl AccountType
Sourcepub fn from_code(code: &str) -> Self
pub fn from_code(code: &str) -> Self
Automatically detect account type from Belgian PCMN code
Logic inspired by Noalyss find_pcm_type() function.
See: include/sql/mod1/schema.sql in Noalyss repository
§Arguments
code- Account code (e.g., “700”, “604001”)
§Returns
Detected AccountType based on first digit (Belgian PCMN class)
§Examples
use koprogo_api::domain::entities::account::AccountType;
assert_eq!(AccountType::from_code("700"), AccountType::Revenue);
assert_eq!(AccountType::from_code("604001"), AccountType::Expense);
assert_eq!(AccountType::from_code("100"), AccountType::Liability);
assert_eq!(AccountType::from_code("5500"), AccountType::Asset);Sourcepub fn is_balance_sheet(&self) -> bool
pub fn is_balance_sheet(&self) -> bool
Check if this account type appears on the balance sheet
Balance sheet accounts: Assets & Liabilities (Classes 1-5) Income statement accounts: Expenses & Revenue (Classes 6-7)
Sourcepub fn is_income_statement(&self) -> bool
pub fn is_income_statement(&self) -> bool
Check if this account type appears on the income statement
Income statement (Compte de résultat): Expenses & Revenue
Trait Implementations§
Source§impl Clone for AccountType
impl Clone for AccountType
Source§fn clone(&self) -> AccountType
fn clone(&self) -> AccountType
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AccountType
impl Debug for AccountType
Source§impl<'r> Decode<'r, Postgres> for AccountType
impl<'r> Decode<'r, Postgres> for AccountType
Source§impl<'de> Deserialize<'de> for AccountType
impl<'de> Deserialize<'de> for AccountType
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>,
Source§impl<'q, DB: Database> Encode<'q, DB> for AccountTypewhere
&'q str: Encode<'q, DB>,
impl<'q, DB: Database> Encode<'q, DB> for AccountTypewhere
&'q str: Encode<'q, DB>,
Source§fn encode_by_ref(
&self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, BoxDynError>
fn encode_by_ref( &self, buf: &mut <DB as Database>::ArgumentBuffer<'q>, ) -> Result<IsNull, BoxDynError>
fn size_hint(&self) -> usize
§fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
fn encode(
self,
buf: &mut <DB as Database>::ArgumentBuffer<'q>,
) -> Result<IsNull, Box<dyn Error + Sync + Send>>where
Self: Sized,
self into buf in the expected format for the database.fn produces(&self) -> Option<<DB as Database>::TypeInfo>
Source§impl PartialEq for AccountType
impl PartialEq for AccountType
Source§impl PgHasArrayType for AccountType
impl PgHasArrayType for AccountType
fn array_type_info() -> PgTypeInfo
fn array_compatible(ty: &PgTypeInfo) -> bool
Source§impl Serialize for AccountType
impl Serialize for AccountType
Source§impl Type<Postgres> for AccountType
impl Type<Postgres> for AccountType
impl Eq for AccountType
impl StructuralPartialEq for AccountType
Auto Trait Implementations§
impl Freeze for AccountType
impl RefUnwindSafe for AccountType
impl Send for AccountType
impl Sync for AccountType
impl Unpin for AccountType
impl UnwindSafe for AccountType
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
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Fake for T
impl<T> Fake for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more