DjAccount v0.2 Design
From ArgeoWiki
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 |
|---|---|---|---|---|
| id | Long | the id | ||
| label | String | the account number | either [numeric] or [numeric]-[numeric] | |
| title | String | the title | ||
| description | String | the description | ||
| comment | String | a 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 |
|---|---|---|---|
| id | Long | the id | |
| name | String | the name | |
| description | String | the description | |
| parent | #Project | the parentProject | can 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 |
|---|---|---|---|
| id | Long | the id | |
| project | #Project | the related Project | |
| title | String | the title | |
| entries | Set<#Entry> | the related entries | |
| documents | Set<#Document> | the related documents |
Entry
An entry is a cashflow to an account. It is either debit or credit.
| Field | Type | Description | Comment |
|---|---|---|---|
| id | Long | the id | |
| valueDate | Date | the value date | |
| account | #Account | the related account | |
| credit | Double | credit value, 0 if not of credit type | |
| debit | Double | debit value, 0 if not of debit type | |
| type | String | the type of entry | |
| localCurrency | #Currency | the localCurrency | |
| localCredit | Double | credit value in local currency, 0 if not of credit type | |
| localDebit | Double | debit value in local currency, 0 if not of debit type | |
| exchangeRate | #ExchangeRate | optional rate to use to convert from local to default currency | can be null |
| comment | String | a comment |
Document
A document is a proof of the accuracy of entries in a movement.
| Field | Type | Description | Comment |
|---|---|---|---|
| id | Long | the id | |
| label | String | the label | |
| comment | String | a 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 |
|---|---|---|---|
| id | Long | the id | |
| currency | #Currency | the currency | |
| rate | Float | the exchange rate | |
| valueDate | Date | the value date |
Currency
A currency
| Field | Type | Description | Comment |
|---|---|---|---|
| id | Long | the id | |
| label | String | label | e.g. EUR, USD |
| name | String | name | e.g. Euro, Dollar |
| symbol | String | related symbol | e.g. €, $ |
