DuxReiNummariae 1.1.0-alpha.19
Simple and powerful budgeting application
Loading...
Searching...
No Matches
drn::accounting Namespace Reference

Namespaces

namespace  internal
namespace  literals

Classes

class  Account
 An entry location in the general ledger for similar kinds of transaction identified by a code. More...
class  AccountCode
 The representation of a unique identifier and its associated name for an account. The only identifying item is the number, the name is a convenience for the user to associate the number with a name. More...
struct  AccountError
 This represents an issue with an Account operation. More...
class  AccountNumber
 Represents a ledger book’s account through-out the entire accounting system, and is its unique identifier. It encapsulates the functionality for storing and managing this identifier. More...
class  AccountNumberGenerator
 A generalised generator for account code numbers. More...
struct  ByMajorUnit
 A flag for indicating operations should only happen in regards to the major currency unit. More...
class  GeneralLedger
 Represents a general ledger that manages and facilitates financial transactions, account ledgers, and general accounting operations. More...
struct  LedgerAccount
 This is responsible for recording the transactions relating to an entity's assets, liabilities, capital, revenue, and expenses of a given account. More...
class  SequentialAccountNumberGenerator
 An account code number generator that creates values sequentially. More...
class  Transaction
 Represents a financial transaction, typically involving the transfer of money between two accounts. More...
struct  TransactionError
 This represents an issue with a Transaction operation. More...
class  TransactionNumber
 Represents a unique identifier for a financial transaction. More...

Functions

DRN_ACCOUNTING_EXPORT pecunia::Money adjustAssetBalance (const AccountCode &asset, const pecunia::Money &balance, const Transaction &txn)
 Performs a theoretical adjustment of a supplied balance according to accounting rules.
DRN_ACCOUNTING_EXPORT pecunia::Money adjustLiabilityBalance (const AccountCode &liability, const pecunia::Money &balance, const Transaction &txn)
 Performs a theoretical adjustment of a supplied balance according to accounting rules.
DRN_ACCOUNTING_EXPORT bool areEqualish (const Transaction &lhs, const Transaction &rhs)
 Compares two transactions to determine if they are “equal-ish” by predefined criteria. The function checks multiple attributes of the transactions for equality. It is useful for identifying whether two transactions likely represent the same logical operation, but not necessarily the same entity, e.g. comparing two transactions created at different times.
DRN_ACCOUNTING_EXPORT std::set< pecunia::Currency > containedCurrencies (const GeneralLedger &gl) noexcept
 Collects all currencies used by the accounts in the general ledger.
DRN_ACCOUNTING_EXPORTconst ::QString & creditAbbreviation ()
 Retrieves the common abbreviation used for a credit entry in accounting.
DRN_ACCOUNTING_EXPORTconst ::QString & debitAbbreviation ()
 Retrieves the common abbreviation used for a debit entry in accounting.
DRN_ACCOUNTING_EXPORT std::optional< AccountCodefind (const AccountNumber &an, const std::set< AccountCode > &codes) noexcept
 Finds an AccountCode in a container of account codes based on a given account number.
DRN_ACCOUNTING_EXPORT bool isDifferenceWithinWindow (pecunia::Money diff, const foundation::Percentage &window, const pecunia::Money &goal, const ByMajorUnit &isByMajor=ByMajorUnit{false})
 Determines if a given difference is within +/- percentage of a goal amount.
DRN_ACCOUNTING_EXPORT bool isWithinWindow (const pecunia::Money &value, const foundation::Percentage &window, const pecunia::Money &goal, const ByMajorUnit &isByMajor=ByMajorUnit{false})
 Determines if a given amount of money is within +/- percentage of a goal amount.
DRN_ACCOUNTING_EXPORT bool operator!= (const AccountCode &lhs, const AccountNumber &rhs)
DRN_ACCOUNTING_EXPORT bool operator!= (const AccountNumber &lhs, const AccountCode &rhs)
DRN_ACCOUNTING_EXPORT::QDebug operator<< (::QDebug o, const Account &a)
DRN_ACCOUNTING_EXPORT::QDebug operator<< (::QDebug o, const AccountCode &ac)
DRN_ACCOUNTING_EXPORT::QDebug operator<< (::QDebug out, const AccountNumber &data)
 Full object Qt stream insertion operator.
enum DRN_ACCOUNTING_EXPORT DRN_ACCOUNTING_EXPORT::QDebug operator<< (::QDebug out, const OpenStates &data)
 Full object Qt stream insertion operator.
DRN_ACCOUNTING_EXPORT::QDebug operator<< (::QDebug out, const Transaction &data)
 Full object Qt stream insertion operator.
DRN_ACCOUNTING_EXPORT::QDebug operator<< (::QDebug out, const TransactionNumber &data)
 Full object Qt stream insertion operator.
DRN_ACCOUNTING_EXPORT::QDebug operator<< (::QDebug out, const TransactionStatuses &data)
 Full object Qt stream insertion operator.
DRN_ACCOUNTING_EXPORT std::ostream & operator<< (std::ostream &o, const Account &a)
DRN_ACCOUNTING_EXPORT std::ostream & operator<< (std::ostream &o, const AccountCode &ac)
DRN_ACCOUNTING_EXPORT std::ostream & operator<< (std::ostream &o, const GeneralLedger &gl)
 Stream insertion operator for a human readable general ledger account.
DRN_ACCOUNTING_EXPORT std::ostream & operator<< (std::ostream &o, const LedgerAccount &la)
 Stream insertion operator for a human readable ledger account.
DRN_ACCOUNTING_EXPORT std::ostream & operator<< (std::ostream &out, const AccountNumber &data)
 Full object standard output stream insertion operator.
enum DRN_ACCOUNTING_EXPORT DRN_ACCOUNTING_EXPORT std::ostream & operator<< (std::ostream &out, const AccountTypes &at)
 A debug stream insertion operator.
DRN_ACCOUNTING_EXPORT std::ostream & operator<< (std::ostream &out, const Transaction &data)
 Full object standard out stream insertion operator.
DRN_ACCOUNTING_EXPORT std::ostream & operator<< (std::ostream &out, const TransactionNumber &data)
 Full object standard output stream insertion operator.
DRN_ACCOUNTING_EXPORT std::ostream & operator<< (std::ostream &out, const TransactionStatuses &data)
 Full object standard out stream insertion operator.
DRN_ACCOUNTING_EXPORT bool operator== (const AccountCode &lhs, const AccountNumber &rhs)
DRN_ACCOUNTING_EXPORT bool operator== (const AccountNumber &lhs, const AccountCode &rhs)
DRN_ACCOUNTING_EXPORT::QString presentationText (const AccountCode &ac)
 Converts an account code into a human-readable form.
DRN_ACCOUNTING_EXPORT::QString presentationText (const AccountNumber &an)
 Generates the presentation text for a given account number.
DRN_ACCOUNTING_EXPORT::QString presentationText (const AccountTypes &at)
 Converts a given account type into its localised presentation text for display in a GUI element.
DRN_ACCOUNTING_EXPORT::QString presentationText (const Transaction &t)
 Generates a formatted descriptive text for a transaction.
DRN_ACCOUNTING_EXPORT::QString presentationText (const TransactionNumber &tn)
 Generates the text representation of the given transaction number for presentation purposes.
DRN_ACCOUNTING_EXPORT::QString presentationText (const TransactionStatuses &ts)
 Provides a textual representation of the given transaction status to be displayed in the interface.
DRN_ACCOUNTING_EXPORT bool shouldDecreaseAsset (const Transaction &txn, const AccountNumber &account)
 Performs a check to see if a supplied asset account would decrease its balance in a given transaction.
DRN_ACCOUNTING_EXPORT bool shouldDecreaseLiability (const Transaction &txn, const AccountNumber &account)
 Performs a check to see if a supplied liability account would decrease its balance in a given transaction.
DRN_ACCOUNTING_EXPORT bool shouldIncreaseAsset (const Transaction &txn, const AccountNumber &account)
 Performs a check to see if a supplied asset account would increase its balance in a given transaction.
DRN_ACCOUNTING_EXPORT bool shouldIncreaseLiability (const Transaction &txn, const AccountNumber &account)
 Performs a check to see if a supplied liability account would increase its balance in a given transaction.
DRN_ACCOUNTING_EXPORT AccountCode toAccountCode (const ::QString &accountCode)
 Converts a string representation of the account code into the strong type.
DRN_ACCOUNTING_EXPORT AccountTypes toAccountTypes (const ::QString &weak)
 Converts a string representation of an account type into an enumeration value of AccountTypes.
DRN_ACCOUNTING_EXPORT AccountCode toFullAccountCode (const ::QString &accountCode, const std::optional<::QString > &parentNumber)
 Converts a string representation of the account code and parent into the strong type.
DRN_ACCOUNTING_EXPORT std::optional< TransactionNumbertoTransactionNumber (const ::QString &text) noexcept
 Converts a textual representation into an optional transaction number.
DRN_ACCOUNTING_EXPORT TransactionStatuses toTransactionStatuses (const ::QString &weak)
 Converts a weak string representation of a transaction status into its strong from.

Variables

enum DRN_ACCOUNTING_EXPORT AccountTypes
 This represents the various forms an account may have within the accounting system.
constexpr std::array allAccountTypes
 Contains a comprehensive collection of all account types available in the system.
enum DRN_ACCOUNTING_EXPORT Asset
 This represent the different types of economic resources owned or controlled by an entity.
enum DRN_ACCOUNTING_EXPORT Capital
 This represents the residual capital of an entity.
enum DRN_ACCOUNTING_EXPORT Cleared
 The transaction has been cleared through the account, but has not been reconciled.
enum DRN_ACCOUNTING_EXPORT Closed = 0b10
 Indicates that it is currently closed or inactive.
enum DRN_ACCOUNTING_EXPORT Expense
 This represents an entity's expenditures.
enum DRN_ACCOUNTING_EXPORT Liability
 This represents the different types of economic obligations of an entity.
enum DRN_ACCOUNTING_EXPORT OpenStates
 Represents the states in which an account or item can exist.
enum DRN_ACCOUNTING_EXPORT Reconciled
 The transaction has been reconciled with the account.
enum DRN_ACCOUNTING_EXPORT Revenue
 This represents an entity's earnings and/or income.
enum DRN_ACCOUNTING_EXPORT TransactionStatuses
 Enumerates the different statuses that a financial transaction can hold.

Function Documentation

◆ adjustAssetBalance()

DRN_ACCOUNTING_EXPORT pecunia::Money drn::accounting::adjustAssetBalance ( const AccountCode & asset,
const pecunia::Money & balance,
const Transaction & txn )

Performs a theoretical adjustment of a supplied balance according to accounting rules.

Exceptions
AccountErrorWhen neither the crediting nor debiting accounts is the requested asset account.
Parameters
assetThe code for the asset account to adjust.
balanceThe balance to start with in the adjustment.
txnThe transaction to apply to the balance.
Returns
The calculated balance after applying a transaction.

◆ adjustLiabilityBalance()

DRN_ACCOUNTING_EXPORT pecunia::Money drn::accounting::adjustLiabilityBalance ( const AccountCode & liability,
const pecunia::Money & balance,
const Transaction & txn )

Performs a theoretical adjustment of a supplied balance according to accounting rules.

Exceptions
AccountErrorWhen neither the crediting nor debiting accounts is the requested liability account.
Parameters
liabilityThe code for the liability account to adjust.
balanceThe balance to start with in the adjustment.
txnThe transaction to apply to the balance.
Returns
The calculated balance after applying a transaction.

◆ areEqualish()

DRN_ACCOUNTING_EXPORT bool drn::accounting::areEqualish ( const Transaction & lhs,
const Transaction & rhs )
nodiscard

Compares two transactions to determine if they are “equal-ish” by predefined criteria. The function checks multiple attributes of the transactions for equality. It is useful for identifying whether two transactions likely represent the same logical operation, but not necessarily the same entity, e.g. comparing two transactions created at different times.

Parameters
lhsThe first transaction to compare with.
rhsThe second transaction to compare against.
Returns
True if the transactions have identical key attributes (e.g., dates, numbers, debiting accounts, crediting accounts, and statuses). False otherwise.
Note
This method does not use a strict equality check but rather compares specific fields to allow for a reasonable match between the two transactions.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ containedCurrencies()

DRN_ACCOUNTING_EXPORT std::set< pecunia::Currency > drn::accounting::containedCurrencies ( const GeneralLedger & gl)
noexcept

Collects all currencies used by the accounts in the general ledger.

Parameters
glThe general ledger to collect from.
Returns
All the unique currency codes for the accounts are using.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ creditAbbreviation()

DRN_ACCOUNTING_EXPORTconst ::QString & drn::accounting::creditAbbreviation ( )
nodiscard

Retrieves the common abbreviation used for a credit entry in accounting.

This function provides a standardised shorthand for referring to credit transactions. It is useful for presenting financial information in a concise and consistent manner, such as in GUI elements or reports.

Returns
The abbreviation representing a credit entry.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ debitAbbreviation()

DRN_ACCOUNTING_EXPORTconst ::QString & drn::accounting::debitAbbreviation ( )
nodiscard

Retrieves the common abbreviation used for a debit entry in accounting.

This function provides a standardised shorthand for referring to debit transactions. It is useful for presenting financial information in a concise and consistent manner, such as in GUI elements or reports.

Returns
The abbreviation representing a debit entry.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ find()

DRN_ACCOUNTING_EXPORT std::optional< AccountCode > drn::accounting::find ( const AccountNumber & an,
const std::set< AccountCode > & codes )
noexcept

Finds an AccountCode in a container of account codes based on a given account number.

Parameters
anThe account number to search for.
codesThe container of account codes to search in.
Returns
If an account code with the given account number is found, it gives the account code. If not found, an empty optional will be returned.

◆ isDifferenceWithinWindow()

DRN_ACCOUNTING_EXPORT bool drn::accounting::isDifferenceWithinWindow ( pecunia::Money diff,
const foundation::Percentage & window,
const pecunia::Money & goal,
const ByMajorUnit & isByMajor = ByMajorUnit{false} )

Determines if a given difference is within +/- percentage of a goal amount.

Parameters
diffThe money difference to determine if it is within range.
windowThe percentage window +/- that the value must lie within.
goalThe amount that the supplied value must be within a percentage of.
isByMajorA flag, when true, changes the check to only consider the major unit, otherwise the major and minor units are used.
Returns
Gives true when the supplied value is +/- a percentage (inclusive) of the goal amount, false otherwise.

◆ isWithinWindow()

DRN_ACCOUNTING_EXPORT bool drn::accounting::isWithinWindow ( const pecunia::Money & value,
const foundation::Percentage & window,
const pecunia::Money & goal,
const ByMajorUnit & isByMajor = ByMajorUnit{false} )

Determines if a given amount of money is within +/- percentage of a goal amount.

Parameters
valueThe amount to determine if it is within range.
windowThe percentage window +/- that the value must lie within.
goalThe amount that the supplied value must be within a percentage of.
isByMajorA flag, when true, changes the check to only consider the major unit, otherwise the major and minor units are used.
Returns
Gives true when the supplied value is +/- a percentage (inclusive) of the goal amount, false otherwise.

◆ operator!=() [1/2]

DRN_ACCOUNTING_EXPORT bool drn::accounting::operator!= ( const AccountCode & lhs,
const AccountNumber & rhs )

◆ operator!=() [2/2]

DRN_ACCOUNTING_EXPORT bool drn::accounting::operator!= ( const AccountNumber & lhs,
const AccountCode & rhs )

◆ operator<<() [1/16]

DRN_ACCOUNTING_EXPORT::QDebug drn::accounting::operator<< ( ::QDebug o,
const Account & a )

◆ operator<<() [2/16]

DRN_ACCOUNTING_EXPORT::QDebug drn::accounting::operator<< ( ::QDebug o,
const AccountCode & ac )

◆ operator<<() [3/16]

DRN_ACCOUNTING_EXPORT::QDebug drn::accounting::operator<< ( ::QDebug out,
const AccountNumber & data )

Full object Qt stream insertion operator.

Parameters
outThe stream to place the data into.
dataThe data to place into the stream.
Returns
The modified stream after insertion.

◆ operator<<() [4/16]

enum DRN_ACCOUNTING_EXPORT DRN_ACCOUNTING_EXPORT::QDebug drn::accounting::operator<< ( ::QDebug out,
const OpenStates & data )

Full object Qt stream insertion operator.

Parameters
outThe stream to place the data into.
dataThe data to place into the stream.
Returns
The modified stream after insertion.

◆ operator<<() [5/16]

DRN_ACCOUNTING_EXPORT::QDebug drn::accounting::operator<< ( ::QDebug out,
const Transaction & data )

Full object Qt stream insertion operator.

Parameters
outThe stream to place the data into.
dataThe data to place into the stream.
Returns
The modified stream after insertion.

◆ operator<<() [6/16]

DRN_ACCOUNTING_EXPORT::QDebug drn::accounting::operator<< ( ::QDebug out,
const TransactionNumber & data )

Full object Qt stream insertion operator.

Parameters
outThe stream to place the data into.
dataThe data to place into the stream.
Returns
The modified stream after insertion.

◆ operator<<() [7/16]

DRN_ACCOUNTING_EXPORT::QDebug drn::accounting::operator<< ( ::QDebug out,
const TransactionStatuses & data )

Full object Qt stream insertion operator.

Parameters
outThe stream to place the data into.
dataThe data to place into the stream.
Returns
The modified stream after insertion.

◆ operator<<() [8/16]

DRN_ACCOUNTING_EXPORT std::ostream & drn::accounting::operator<< ( std::ostream & o,
const Account & a )

◆ operator<<() [9/16]

DRN_ACCOUNTING_EXPORT std::ostream & drn::accounting::operator<< ( std::ostream & o,
const AccountCode & ac )

◆ operator<<() [10/16]

DRN_ACCOUNTING_EXPORT std::ostream & drn::accounting::operator<< ( std::ostream & o,
const GeneralLedger & gl )

Stream insertion operator for a human readable general ledger account.

Parameters
oThe stream to insert the information into.
laThe ledgers to generate the information for.
Postcondition
The stream's filled with the information in the form: Member Name (Member Value).
Returns
The stream populated with the information.

◆ operator<<() [11/16]

DRN_ACCOUNTING_EXPORT std::ostream & drn::accounting::operator<< ( std::ostream & o,
const LedgerAccount & la )

Stream insertion operator for a human readable ledger account.

Parameters
oThe stream to insert the information into.
laThe account to generate the information for.
Postcondition
The stream's filled with the information in the form: Member Name (Member Value).
Returns
The stream populated with the information.

◆ operator<<() [12/16]

DRN_ACCOUNTING_EXPORT std::ostream & drn::accounting::operator<< ( std::ostream & out,
const AccountNumber & data )

Full object standard output stream insertion operator.

Parameters
outThe stream to place the data into.
dataThe data to place into the stream.
Returns
The modified stream after insertion.

◆ operator<<() [13/16]

enum DRN_ACCOUNTING_EXPORT DRN_ACCOUNTING_EXPORT std::ostream & drn::accounting::operator<< ( std::ostream & out,
const AccountTypes & at )

A debug stream insertion operator.

Parameters
outThe stream to place the information to.
atThe information to place into the stream.
Returns
The stream after the modification.

◆ operator<<() [14/16]

DRN_ACCOUNTING_EXPORT std::ostream & drn::accounting::operator<< ( std::ostream & out,
const Transaction & data )

Full object standard out stream insertion operator.

Parameters
outThe stream to place the data into.
dataThe data to place into the stream.
Returns
The modified stream after insertion.

◆ operator<<() [15/16]

DRN_ACCOUNTING_EXPORT std::ostream & drn::accounting::operator<< ( std::ostream & out,
const TransactionNumber & data )

Full object standard output stream insertion operator.

Parameters
outThe stream to place the data into.
dataThe data to place into the stream.
Returns
The modified stream after insertion.

◆ operator<<() [16/16]

DRN_ACCOUNTING_EXPORT std::ostream & drn::accounting::operator<< ( std::ostream & out,
const TransactionStatuses & data )

Full object standard out stream insertion operator.

Parameters
outThe stream to place the data into.
dataThe data to place into the stream.
Returns
The modified stream after insertion.

◆ operator==() [1/2]

DRN_ACCOUNTING_EXPORT bool drn::accounting::operator== ( const AccountCode & lhs,
const AccountNumber & rhs )

◆ operator==() [2/2]

DRN_ACCOUNTING_EXPORT bool drn::accounting::operator== ( const AccountNumber & lhs,
const AccountCode & rhs )

◆ presentationText() [1/6]

DRN_ACCOUNTING_EXPORT::QString drn::accounting::presentationText ( const AccountCode & ac)

Converts an account code into a human-readable form.

Parameters
acThe account code to convert.
Returns
The account code in the form: NumberSeparatorName.
Here is the caller graph for this function:

◆ presentationText() [2/6]

DRN_ACCOUNTING_EXPORT::QString drn::accounting::presentationText ( const AccountNumber & an)

Generates the presentation text for a given account number.

Parameters
anThe account number whose presentation text is to be generated.
Returns
A formatted account number as a human-readable string by applying specific formatting rules.
Here is the call graph for this function:

◆ presentationText() [3/6]

DRN_ACCOUNTING_EXPORT::QString drn::accounting::presentationText ( const AccountTypes & at)

Converts a given account type into its localised presentation text for display in a GUI element.

This function maps enumeration values of account types to their corresponding string representations. It is typically used when displaying account types in a user interface, such as dropdown menus or descriptions. This ensures consistency and user-friendly display names for account types across the system.

Exceptions
std::runtime_errorThrown if the provided account type cannot be mapped to a valid string.
Parameters
atThe account type to be converted into a presentation string.
Returns
The localised string representation of the provided account type. The return value will align with the predefined mappings of the system.

◆ presentationText() [4/6]

DRN_ACCOUNTING_EXPORT::QString drn::accounting::presentationText ( const Transaction & t)
nodiscard

Generates a formatted descriptive text for a transaction.

This function creates a user-readable presentation of a transaction, extracting and formatting details such as the transaction date, number, description, debit, credit, amount, and status. It is commonly used in displaying transaction details in a GUI item or exporting transaction summaries for user-facing purposes.

Parameters
tThe transaction object whose details are to be formatted for presentation.
Returns
A formatted text representation of the transaction.
Here is the call graph for this function:

◆ presentationText() [5/6]

DRN_ACCOUNTING_EXPORT::QString drn::accounting::presentationText ( const TransactionNumber & tn)

Generates the text representation of the given transaction number for presentation purposes.

Parameters
tnThe transaction number to be converted into a presentation text format.
Returns
A textual representation of the provided transaction number.
Here is the call graph for this function:

◆ presentationText() [6/6]

DRN_ACCOUNTING_EXPORT::QString drn::accounting::presentationText ( const TransactionStatuses & ts)
nodiscard

Provides a textual representation of the given transaction status to be displayed in the interface.

Parameters
tsThe transaction status whose textual representation is to be obtained.
Returns
A descriptive string corresponding to the provided transaction status.
Here is the call graph for this function:

◆ shouldDecreaseAsset()

DRN_ACCOUNTING_EXPORT bool drn::accounting::shouldDecreaseAsset ( const Transaction & txn,
const AccountNumber & account )

Performs a check to see if a supplied asset account would decrease its balance in a given transaction.

Parameters
txnThe transaction to check if it decreases the asset account.
accountThe asset account to check for an decrease in the transaction.
Returns
Gives true when the transaction would decrease the asset's balance, false otherwise.

◆ shouldDecreaseLiability()

DRN_ACCOUNTING_EXPORT bool drn::accounting::shouldDecreaseLiability ( const Transaction & txn,
const AccountNumber & account )

Performs a check to see if a supplied liability account would decrease its balance in a given transaction.

Parameters
txnThe transaction to check if it decreases the liability account.
accountThe liability account to check for an decrease in the transaction.
Returns
Gives true when the transaction would decrease the liability's balance, false otherwise.

◆ shouldIncreaseAsset()

DRN_ACCOUNTING_EXPORT bool drn::accounting::shouldIncreaseAsset ( const Transaction & txn,
const AccountNumber & account )

Performs a check to see if a supplied asset account would increase its balance in a given transaction.

Parameters
txnThe transaction to check if it increases the asset account.
accountThe asset account to check for an increase in the transaction.
Returns
Gives true when the transaction would increase the asset's balance, false otherwise.

◆ shouldIncreaseLiability()

DRN_ACCOUNTING_EXPORT bool drn::accounting::shouldIncreaseLiability ( const Transaction & txn,
const AccountNumber & account )

Performs a check to see if a supplied liability account would increase its balance in a given transaction.

Parameters
txnThe transaction to check if it increases the liability account.
accountThe liability account to check for an increase in the transaction.
Returns
Gives true when the transaction would increase the liability's balance, false otherwise.

◆ toAccountCode()

DRN_ACCOUNTING_EXPORT AccountCode drn::accounting::toAccountCode ( const ::QString & accountCode)

Converts a string representation of the account code into the strong type.

Exceptions
ErrorWhen the supplied string form of the account code is not convertible.
AccountErrorWhen the supplied string is an invalid account code.
Parameters
accountCodeThe account code to convert.
Returns
The strong form of the account code.

◆ toAccountTypes()

DRN_ACCOUNTING_EXPORT AccountTypes drn::accounting::toAccountTypes ( const ::QString & weak)

Converts a string representation of an account type into an enumeration value of AccountTypes.

This function maps a given string that describes an account type into its corresponding enumeration value. It is useful in scenarios where account type information is read from external inputs like user input or files, ensuring that strings are validated and consistently converted into system-recognizable account types.

It guarantees that only predefined valid account types are produced, aligning with the AccountTypes enum. This function can be used in parsing input data, validating configurations, and managing account categorization programmatically.

Exceptions
std::logic_errorThrown if the input string does not represent a valid account type.
std::logic_errorThrown if the conversion is attempted on a type that is not an enumeration.
Parameters
weakA string value describing the account type to be converted.
Returns
The corresponding AccountTypes enumeration value for the provided input string.

◆ toFullAccountCode()

DRN_ACCOUNTING_EXPORT AccountCode drn::accounting::toFullAccountCode ( const ::QString & accountCode,
const std::optional<::QString > & parentNumber )

Converts a string representation of the account code and parent into the strong type.

Exceptions
ErrorWhen the supplied string form of the account code is not convertible.
AccountErrorWhen the supplied string is an invalid account code.
Parameters
accountCodeThe account code to convert.
parentNumber(Optional) The number for the parent account.
Returns
The strong form of the account code.

◆ toTransactionNumber()

DRN_ACCOUNTING_EXPORT std::optional< TransactionNumber > drn::accounting::toTransactionNumber ( const ::QString & text)
nodiscardnoexcept

Converts a textual representation into an optional transaction number.

Attempts to parse the given text input and derive a transaction number adhering to the expected format. It is intended for converting textual data (e.g., from external input or storage) into a usable TransactionNumber instance, ensuring validity and compatibility with the expected internal representation.

Parameters
textThe text input to be parsed for a transaction number. The text may contain any amount of suffix and prefix, but only the first number prefixed by the hash (#) symbol will be considered.
Returns
If the input text contains a valid transaction number in the correct format, contains the transaction number as generated by
See also
presentationText, the function returns an optional containing the corresponding TransactionNumber. If no valid transaction number is found, an empty optional is returned.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ toTransactionStatuses()

DRN_ACCOUNTING_EXPORT TransactionStatuses drn::accounting::toTransactionStatuses ( const ::QString & weak)
nodiscard

Converts a weak string representation of a transaction status into its strong from.

Exceptions
logic_errorWhen the weak representation is not valid for a transaction status.
Parameters
weakThe weak representation of a transaction status.
Returns
The strong form of the transaction status.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ AccountTypes

enum DRN_ACCOUNTING_EXPORT drn::accounting::AccountTypes
strong

This represents the various forms an account may have within the accounting system.

◆ allAccountTypes

std::array drn::accounting::allAccountTypes
inlineconstexpr
Initial value:
{
AccountTypes::Unknown,
AccountTypes::Asset,
AccountTypes::Capital,
AccountTypes::Expense,
AccountTypes::Liability,
AccountTypes::Revenue
}

Contains a comprehensive collection of all account types available in the system.

This variable acts as a reference for all possible account categories within the system. It is used to validate, retrieve, or display the set of account types in different contexts, such as user interfaces or back-end processing.

◆ Asset

enum DRN_ACCOUNTING_EXPORT drn::accounting::Asset

This represent the different types of economic resources owned or controlled by an entity.

◆ Capital

enum DRN_ACCOUNTING_EXPORT drn::accounting::Capital

This represents the residual capital of an entity.

◆ Cleared

enum DRN_ACCOUNTING_EXPORT drn::accounting::Cleared

The transaction has been cleared through the account, but has not been reconciled.

◆ Closed

enum DRN_ACCOUNTING_EXPORT drn::accounting::Closed = 0b10

Indicates that it is currently closed or inactive.

◆ Expense

enum DRN_ACCOUNTING_EXPORT drn::accounting::Expense

This represents an entity's expenditures.

◆ Liability

enum DRN_ACCOUNTING_EXPORT drn::accounting::Liability

This represents the different types of economic obligations of an entity.

◆ OpenStates

enum DRN_ACCOUNTING_EXPORT drn::accounting::OpenStates
strong

Represents the states in which an account or item can exist.

◆ Reconciled

enum DRN_ACCOUNTING_EXPORT drn::accounting::Reconciled

The transaction has been reconciled with the account.

◆ Revenue

enum DRN_ACCOUNTING_EXPORT drn::accounting::Revenue

This represents an entity's earnings and/or income.

◆ TransactionStatuses

enum DRN_ACCOUNTING_EXPORT drn::accounting::TransactionStatuses
strong

Enumerates the different statuses that a financial transaction can hold.

These statuses track the progress of a financial transaction from being unprocessed, through initial clearing, to final reconciliation. Each status reflects a specific stage in the transaction lifecycle.

This is designed to assist in managing and querying the state of a transaction within financial systems, providing clarity and control over its progression.