DuxReiNummariae 1.1.0-alpha.19
Simple and powerful budgeting application
Loading...
Searching...
No Matches
drn::surveying::CompletedSurvey Class Referencefinal

Represents a completed survey of a reconciled bank account, including distributions and associated data. It is primarily designed to allow tracking and managing a bank account’s reconciled state with respect to budgeting and distribution of account balance amount. More...

#include <CompletedSurvey.hpp>

Collaboration diagram for drn::surveying::CompletedSurvey:

Public Member Functions

 CompletedSurvey ()=default
 CompletedSurvey (banking::BankAccount ba, const pecunia::Currency &currency)
 Partial initialisation constructor for creating a new survey.
 CompletedSurvey (banking::ReconciledBankAccount reconciled, std::map< budgeting::BudgetItemIdentifier, pecunia::Money > distribution, pecunia::Money nonDistributed, std::optional<::QString > checksum)
 Full initialisation constructor. It is designed to ensure consistency and validity of the survey’s data.
 CompletedSurvey (CompletedSurvey &&other) noexcept=default
 CompletedSurvey (const CompletedSurvey &other) noexcept=default
 ~CompletedSurvey () noexcept=default
const std::optional<::QString > & checksum () const noexcept
 Retrieves the stored checksum value associated with the survey’s finalised state. This provides a mechanism to verify the integrity and consistency of the survey data after it has been reconciled.
void completed (const ::QDate &completedOn, const pecunia::Money &reconciledBalance, const std::map< budgeting::BudgetItemIdentifier, DistributedAmount > &distribution, const pecunia::Money &nonDistributed, const foundation::Percentage &balanceWindow)
 Finalises and records the completion of a survey of a reconciled bank account, including its reconciled balance, distribution, and related details.
const std::map< budgeting::BudgetItemIdentifier, pecunia::Money > & distribution () const noexcept
 Provides access to the distribution of allocated amounts from the reconciled balance in the completed survey, enabling consumers to review the allocation results.
const pecunia::Money & nonDistributed () const noexcept
 Retrieves the part of the total reconciled amount that has not been distributed.
bool operator!= (const CompletedSurvey &) const noexcept=default
std::strong_ordering operator<=> (const CompletedSurvey &other) const noexcept
 Compares this completed survey with another to determine their relative order. The comparison considers reconciliation state, non-distributed amounts, distribution data, and a checksum in that order.
CompletedSurveyoperator= (CompletedSurvey &&other) noexcept
 Moves the contents of another instance into this instance, effectively transferring ownership of all data.
CompletedSurveyoperator= (const CompletedSurvey &other) noexcept
 Assigns the contents of another instance to the current instance.
bool operator== (const CompletedSurvey &) const noexcept=default
const banking::ReconciledBankAccountreconciled () const noexcept
 Retrieves the reconciled bank account associated with the completed survey. This information is intended to facilitate the examination and tracking of the reconciled state within a budgeting or financial context.
void renamed (const accounting::AccountNumber &original, const accounting::AccountNumber &changed)
 Updates the reconciled bank account with a new account number.
void renamed (const banking::BankName &original, const banking::BankName &newName)
 Updates the surveyed bank account’s name.
void renamed (const budgeting::BudgetItemIdentifier &id, const budgeting::BudgetSource &newName)
 Renames a specific budget distribution item identified by its identifier.

Detailed Description

Represents a completed survey of a reconciled bank account, including distributions and associated data. It is primarily designed to allow tracking and managing a bank account’s reconciled state with respect to budgeting and distribution of account balance amount.

Constructor & Destructor Documentation

◆ CompletedSurvey() [1/5]

drn::surveying::CompletedSurvey::CompletedSurvey ( )
default
Here is the caller graph for this function:

◆ CompletedSurvey() [2/5]

drn::surveying::CompletedSurvey::CompletedSurvey ( banking::BankAccount ba,
const pecunia::Currency & currency )

Partial initialisation constructor for creating a new survey.

Parameters
baThe bank account that is reconciled.
currencyThe currency held within the bank account.

◆ CompletedSurvey() [3/5]

drn::surveying::CompletedSurvey::CompletedSurvey ( banking::ReconciledBankAccount reconciled,
std::map< budgeting::BudgetItemIdentifier, pecunia::Money > distribution,
pecunia::Money nonDistributed,
std::optional<::QString > checksum )

Full initialisation constructor. It is designed to ensure consistency and validity of the survey’s data.

Exceptions
SurveyErrorWhen the currency of the non-distributed amount does not match the reconciled bank account’s currency.
SurveyErrorWhen a checksum is provided, but does not match the calculated value based on the values supplied.
SurveyErrorWhen a zero-amount is distributed in a budget item.
Parameters
reconciledThe reconciled bank account that reflects the current state of the account.
distributionA mapping of budget items to monetary allocations that distributes the account’s reconciled balance.
nonDistributedThe amount of funds that remain after allocation to budget items.
checksumA checksum to validate the integrity of the survey content. No validation occurs when null.
Here is the call graph for this function:

◆ CompletedSurvey() [4/5]

drn::surveying::CompletedSurvey::CompletedSurvey ( const CompletedSurvey & other)
defaultnoexcept
Here is the call graph for this function:

◆ CompletedSurvey() [5/5]

drn::surveying::CompletedSurvey::CompletedSurvey ( CompletedSurvey && other)
defaultnoexcept
Here is the call graph for this function:

◆ ~CompletedSurvey()

drn::surveying::CompletedSurvey::~CompletedSurvey ( )
defaultnoexcept

Member Function Documentation

◆ checksum()

const std::optional<::QString > & drn::surveying::CompletedSurvey::checksum ( ) const
nodiscardnoexcept

Retrieves the stored checksum value associated with the survey’s finalised state. This provides a mechanism to verify the integrity and consistency of the survey data after it has been reconciled.

Returns
The checksum value, representing the integrity validation data. If no checksum has been set, it returns an empty optional, and the validity cannot be guaranteed.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ completed()

void drn::surveying::CompletedSurvey::completed ( const ::QDate & completedOn,
const pecunia::Money & reconciledBalance,
const std::map< budgeting::BudgetItemIdentifier, DistributedAmount > & distribution,
const pecunia::Money & nonDistributed,
const foundation::Percentage & balanceWindow )

Finalises and records the completion of a survey of a reconciled bank account, including its reconciled balance, distribution, and related details.

Exceptions
SurveyErrorWhen the non-distributed balance currency is not the same as the reconciled account’s currency.
SurveyErrorWhen the combined total distribution balance and non-distributed balance is not within the specified percentage window of the reconciled balance.
SurveyErrorWhen a zero-amount is distributed in a budget item.
Parameters
completedOnThe date when the survey was finalised.
reconciledBalanceThe reconciled balance of the bank account associated with the survey.
distributionA map of budget item identifiers to distributed amounts, representing how the reconciled balance is distributed amongst budget items.
nonDistributedThe portion of the reconciled balance that has not been distributed to any budget item.
balanceWindowThe allowed percentage deviation within which the distribution balance must align with the reconciled balance.
Postcondition
Updates the reconciled bank account to mark it as reconciled at the specified date and balance.
Internal state reflecting distribution details and non-distributed balances is updated.
A checksum representing the reconciliation state is recalculated and stored.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ distribution()

const std::map< budgeting::BudgetItemIdentifier, pecunia::Money > & drn::surveying::CompletedSurvey::distribution ( ) const
nodiscardnoexcept

Provides access to the distribution of allocated amounts from the reconciled balance in the completed survey, enabling consumers to review the allocation results.

Returns
The mapping of budget items to their corresponding allocated amounts in the completed survey.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ nonDistributed()

const pecunia::Money & drn::surveying::CompletedSurvey::nonDistributed ( ) const
nodiscardnoexcept

Retrieves the part of the total reconciled amount that has not been distributed.

Returns
The amount that remains undistributed.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator!=()

bool drn::surveying::CompletedSurvey::operator!= ( const CompletedSurvey & ) const
nodiscarddefaultnoexcept
Here is the call graph for this function:

◆ operator<=>()

std::strong_ordering drn::surveying::CompletedSurvey::operator<=> ( const CompletedSurvey & other) const
nodiscardnoexcept

Compares this completed survey with another to determine their relative order. The comparison considers reconciliation state, non-distributed amounts, distribution data, and a checksum in that order.

Precondition
Both surveys must be valid and fully initialised before invoking this function.
Parameters
otherThe other completed survey to compare against.
Returns
The result of the comparison expressed in a strong ordering manner. It is strong_ordering::less if this survey is less, strong_ordering::greater if greater, and strong_ordering::equal if both are considered equivalent.
Here is the call graph for this function:

◆ operator=() [1/2]

CompletedSurvey & drn::surveying::CompletedSurvey::operator= ( CompletedSurvey && other)
noexcept

Moves the contents of another instance into this instance, effectively transferring ownership of all data.

This ensures efficient transfer of resources without the need for duplicating data, and it is used to handle ownership transfer scenarios where copying data would negatively impact performance or where the original instance’s data is no longer needed.

Parameters
otherThe instance whose data will be transferred to this instance.
Postcondition
The “other” instance will be in an undefined state where all moved-from members in it are no longer safe to use until they are reassigned.
This instance will own the data previously contained in “other”.
Returns
This instance, now containing the moved data.
Here is the call graph for this function:

◆ operator=() [2/2]

CompletedSurvey & drn::surveying::CompletedSurvey::operator= ( const CompletedSurvey & other)
noexcept

Assigns the contents of another instance to the current instance.

Parameters
otherAn instance whose data will be duplicated into the current instance.
Postcondition
The current survey’s data will be updated to match the provided instance.
Returns
The current modified instance.
Here is the call graph for this function:

◆ operator==()

bool drn::surveying::CompletedSurvey::operator== ( const CompletedSurvey & ) const
nodiscarddefaultnoexcept
Here is the call graph for this function:

◆ reconciled()

const banking::ReconciledBankAccount & drn::surveying::CompletedSurvey::reconciled ( ) const
nodiscardnoexcept

Retrieves the reconciled bank account associated with the completed survey. This information is intended to facilitate the examination and tracking of the reconciled state within a budgeting or financial context.

Returns
The reconciled bank account associated with the completed survey.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renamed() [1/3]

void drn::surveying::CompletedSurvey::renamed ( const accounting::AccountNumber & original,
const accounting::AccountNumber & changed )

Updates the reconciled bank account with a new account number.

Exceptions
SurveyErrorIf the provided original account number does not match the account number of the reconciled bank account.
Parameters
originalThe account number of the bank account being renamed.
changedThe new account number to replace the original number for the reconciled bank account.
Postcondition
Updates the internal record of the reconciled bank account to reflect the new account number.
Recalculates the checksum to ensure internal consistency with the updated account number.
Here is the call graph for this function:

◆ renamed() [2/3]

void drn::surveying::CompletedSurvey::renamed ( const banking::BankName & original,
const banking::BankName & newName )

Updates the surveyed bank account’s name.

Exceptions
SurveyErrorWhen the original bank name does not match the currently surveyed bank account.
Parameters
originalThe current name of the surveyed bank account.
newNameThe new name to assign to the surveyed bank account.
Postcondition
Updates the internal state of the surveyed bank account to use the new bank name whilst retaining account type, balance, and reconciliation details.
Re-calculates the checksum of the surveyed account to maintain an up-to-date internal checksum following the name update.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ renamed() [3/3]

void drn::surveying::CompletedSurvey::renamed ( const budgeting::BudgetItemIdentifier & id,
const budgeting::BudgetSource & newName )

Renames a specific budget distribution item identified by its identifier.

Exceptions
BudgetItemErrorThrown when the specified identifier does not correspond to any existing budget item in the distribution.
Parameters
idThe identifier of the budget item to be renamed.
newNameThe new name to be assigned to the identified budget item.
Postcondition
A new budget item is added with the specified new name, preserving the corresponding distribution value.
The original budget item is removed from the distribution.
The checksum representing the integrity of the distribution is recalculated to reflect the changes.
Here is the call graph for this function: