DjAccount v0.2 Design

From ArgeoWiki

Jump to: navigation, search

Projects > DjAccount > v0.2 (All DjAccount pages)

Contents

Detailed Design

Local Currency Handling

(see DjAccount_v0.2_Requirements#Local_Currency_Handling for requirements)

Entry Booking

  • new Entry e with default currency by default
  • when local currency change from default currency
    • by default set the ExchangeRate available for e.valueDate (see below)
    • reset all amounts to 0 (user has to explicitly book local amount)
  • when ExchangeRate is active
    • def. curr. amount is frozen, only local amount can be booked
  • when ExchangeRate is not active
    • both amounts can be booked
  • when currency change (not to def. curr.)
    • if ER active: chose a new ER according to rule below
    • if ER not active, keep both amounts
  • when currency change to def. curr
    • keep def. curr. amount
    • clear local amount

Rule for choosing an ExchangeRate er based on Entry valueDate and currency:

  from ExchangeRate er 
  where er.valueDate = 
   (select max(er1.valueDate) from ExchangeRate er1 
     where er1.valueDate <= :valueDate and er1.currency = er.currency)
   and er.currency = :currency

ExchangeRate Management

The field rate of an ExchangeRate cannot be equals to 0.

New ExchangeRate with date :date, rejected if

  from ExchangeRate er where er.valueDate >= :date 

is not empty or if

  from Entry e where (e.valueDate >= :date and e.exchangeRate.valueDate < :date)

is not empty.

Modification of ExchangeRate er, rejected if

  from Entry e where e.exchangeRate = :er

is not empty

Reports/queries

Types of reports:

  • one single pure HQL done in the generic query view
  • pre-programmed multiple query
    • a default UI is provided but can have a specific one
    • can take key/value arguments, which are applied as named parameters

Data model

Account

An account is a legal location where entries have to be registered.

Field Type Description Default Value Comment
idLongthe id
labelStringthe account number either [numeric] or [numeric]-[numeric]
titleStringthe title
descriptionStringthe description
commentStringa comment
parent #Account the parent Account can be null

Project

A project is a collection of movements used for analytical accounting (vs. legal accounting).

Field Type Description Comment
idLongthe id
nameStringthe name
descriptionStringthe description
parent#Projectthe parentProjectcan be null

Movement

A movement is a collection of entries. The amount of credit entries has to be equal with the amount of the debit entries.

Field Type Description Comment
idLongthe id
project#Projectthe related Project
titleStringthe title
entriesSet<#Entry>the related entries
documentsSet<#Document>the related documents

Entry

An entry is a cashflow to an account. It is either debit or credit.

Field Type Description Comment
idLongthe id
valueDateDatethe value date
account#Accountthe related account
creditDoublecredit value, 0 if not of credit type
debitDoubledebit value, 0 if not of debit type
typeStringthe type of entry
localCurrency#Currencythe localCurrency
localCreditDoublecredit value in local currency, 0 if not of credit type
localDebitDoubledebit value in local currency, 0 if not of debit type
exchangeRate#ExchangeRateoptional rate to use to convert from local to default currencycan be null
commentStringa comment

Document

A document is a proof of the accuracy of entries in a movement.

Field Type Description Comment
idLongthe id
labelStringthe label
commentStringa comment

Exchange Rates

Exchange rate relative to the main accounting currency. This is used to compute a value in the main currency when the exact cost is not known, or to revaluate stocks of currencies.

Field Type Description Comment
idLongthe id
currency#Currencythe currency
rateFloatthe exchange rate
valueDateDatethe value date

Currency

A currency

Field Type Description Comment
idLongthe id
labelStringlabele.g. EUR, USD
nameStringnamee.g. Euro, Dollar
symbolStringrelated symbole.g. €, $
Personal tools