FFII Ledger: Legacy Finance Database Structure

Schema of ledger_* tables in the FFII database

Tables, Columns and Primary Keys in the accounting data as compiled by our former treasurer Holger Blasum in 2003-2005 – needed for understanding the past and building the future of FFII finances.

1 Current Situation

  • Basically this system has produced readable analytic accounting reports of a type that fulfills the legal requirements and the expectations of the tax office; thus this data structure is worth using as a reference for creation of current and future reports
  • We need to understand this system of legacy data because the tax office is demanding more detailed info about the years 2003-5 in order to assess the public beneficiality of our expenditures of that time
  • Current documentation, in form of description strings for the postgresql database tables, is based on guesswork by the current treasurer phm (Hartmut Pilch) who is studying this data and drawing his conclusions.
  • Some tables mainly serve the purpose of transforming the data to a format used by a proprietary accounting software system called Lexware which is unlikely to be used in the future in FFII. In the future similar efforts may be needed for conversion back and forth to schemata used by something like GnuCash

2 To Do

  • Consult Holger about current documentation
  • Add tentative documentation about primary keys
  • Recreate this database in a more compact form, more closely adhering to the design principles of the ffii database, with more stringent references

3 Timeline

4 Schema Description

4.1 The ledger_* Tables

select tablename from pg_tables where tablename ~ 
'^ledger_*'
ledger
ledger_addr
ledger_balance
ledger_cc
ledger_event
ledger_giro
ledger_lexware_accountsystem
ledger_lexware_book
ledger_lexware_costcenter
ledger_vocabulary

4.2 ledger

comment on table ledger is 'transactions via all 
accounts of FFII; de: hauptbuch wo alles steht'
comment on column ledger.id is 'transaction 
identifier created by automatic incrementation'
comment on column ledger.amount is 'amount of 
money transacted in currency of the account (e.g. 
paypalus uses USD)'
comment on column ledger.local is 'ffii account 
which is used for the transaction'
comment on column ledger.uid is 'current uid of 
someone involved in this transaction, as defined 
in pnom.uid, if not there then (1) look it up in 
ledger_addr or (2) for bookings it between 
accounts it might be the ledger.local of another 
account'
comment on column ledger.cc is 'account ID = 
transaction category = cost center used for 
classifying transactions in the analytic 
accounting reports of 2003-5'
comment on column ledger.event is 'id of an event, 
as used in the analytic accounting of 2003-2005 
defined in ledger_event'
comment on column ledger.bookdate is 'date of 
booking'
comment on column ledger.settdate is 'date of 
settlement, i.e. arrival at other account (this 
was mostly used to keep the accounts consistent in 
the case of internal bookings eg from paypal to 
sskm etc where it takes some time until money 
arrives)'
comment on column ledger.voucher is 'file id of 
voucher used'
comment on column ledger.ispublic is 'level of 
publicness of a donation: 0 private, 1 public'
comment on column ledger.corrects is 'id of a 
transaction that this transaction corrects, 
similar to ledger.noise, but used only transiently 
in programs that will delete the corrected 
transaction and then void this field'
comment on column ledger.utid is 'tentative 
transaction identifier, used in some internal 
communications (eg by SSKM), not defined and not 
used in this db (this is basically old data 
generated by phm pre 2002 that blasum didnt want 
to throw away)'
comment on column ledger.rmk is 'typically 
original remark as found on bank transaction 
record, sometimes with additions or made up new 
(e.g. cash transactions)'
comment on column ledger.budget is 'a class which 
is closer to the purpose of the expenditure, e.g. 
a meal may be in cc = hotel and budget = conf; it 
seems this is an attribute of the event field, 
blasum thinks it has not really been used much if 
it has been used at all'
comment on column ledger.fix is 'temporary field, 
blasum dont think it has been used much'
comment on column ledger.contactperson is 
'temporary field of uid(s) of person(s) of blasum 
contacted for additional clarification in autumn 
2005'
comment on column ledger.contactstatus is 
'temporary field used in autumn 2005, level of 
contact to the uid, 0: none, 1: contacted, 2: dont 
know'
comment on column ledger.originalamount is 'amount 
where a total that has been paid in a transaction 
was booked into different accounts, say for a 
conference EUR 200 for hotel, EUR 300 for travel 
would have an originalamount of 500 in both fields'
comment on column ledger.country is 'country to 
which the money was sent or from where it came; 
1-letter abbreviations are UN Road Traffic 
Conventions license plate codes used by EU for 
postal addressing until 2004, iso codes (also used 
by EU since then) would have been preferable'
comment on column ledger.noise is 'an integer, 
remotely reminiscent of lexware_number, phm writes 
about 2/5 of our transactions have this (blasum 
thinks much less), used for spam or other bookings 
annulling each other'
comment on column ledger.ledger_giro is 'id of 
bank transaction, referring to ledger_giro.id'
comment on column ledger.lexware_numberrange is 
'an account to which the expenditure belongs, 
similar to local in ledger, Nummernkreis made up 
cschuster (only the combination of year, 
lexware_number and lexware_numberrange uniquely 
identifies uniquely a transaction in C Schuster s 
data)'
comment on column ledger.lexware_number is 'number 
made up cschuster (only the combination of year, 
lexware_number and lexware_numberrange uniquely 
identifies uniquely a transaction in C Schuster s 
data)'
comment on column ledger.printed is 'whether a 
received invoice was printed out and filed to 
folders or whether a printed donation receipt was 
sent; 1 is yes, no other values are used'
comment on column ledger.uidold is 'used 
temporarily for substitutions on uid'

4.3 ledger_event

comment on table ledger_event is 'definition of 
ledger.event symbol: an event for which money was 
used, reference in analytic accounting reports of 
2003-5'
comment on column ledger_event.event is 'event 
symbol to be defined'
comment on column ledger_event.begindate is 'day 
on which the event itself (not preparation) began; 
unless an enddate is supplied the event took 1 day 
only'
comment on column ledger_event.enddate is 'day on 
which the event itself (not follow-up such as 
invoicing & accounting) ended; if not given then 
this was a 1-day event'
comment on column ledger_event.place is 'venue'
comment on column ledger_event.eventrem is 
'explantory name or explanation of the event'
comment on column ledger_event.type is 'class of 
event, to be defined by a primary key table'
comment on column ledger_event.uid is 'person 
responsible for event'
comment on column ledger_event.isfinancial is 
'whether the event appears on the FFII books, 1 if 
true; so far this has always been true'
comment on column ledger_event.lexware_cc is 'cost 
center (= event id) used in lexware, equivalent to 
ledger_event.cc but not to ledger.lexware_number 
nor ledger_cc.lexware_ct but it should be 
ledger_kostenstelle1 or ledger_kostenstelle2'

4.4 ledger_cc

comment on table ledger_cc is 'definition of cc 
i.e. class to which the expenditure belongs, 
rather by its nature than by its function; used in 
analytic accounting of 2003-5'
comment on column ledger_cc.cc is 'symbol denoting 
the class to be defined here'
comment on column ledger_cc.ccrem is 'explanation 
of what cc denotes'
comment on column ledger_cc.sign is 'effect on our 
accounts: 1: revenue, -1: expenditure'
comment on column ledger_cc.lexware_ct is 'lexware 
category, same as ledger.lexware_kostenstelle1 if 
blasum recalls correctly'

4.5 ledger_giro

comment on table ledger_giro is 'raw transaction 
data from the bank'
comment on column ledger_giro.id is 
'auto-incremented identifier'
comment on column ledger_giro.bookdate is 
'transaction date of the bank'
comment on column ledger_giro.originalamount is 
'amount transacted by the bank, same as 
ledger_giro.originalamoutn'
comment on column ledger_giro.utid is 'internal 
transaction id of the bank, inteneded to be the 
same as ledger_giro.utid'
comment on column ledger_giro.rmk is 'original 
remark from transaction of the bank'
comment on column ledger_giro.ledger_ref is 
'corresponding ledger.id, never entered, but 
apparently ledger_giro.id was entered in 
ledger.ledger_giro'

4.6 ledger_balance

comment on table ledger_balance is 'balance on 
various accounts at various dates'
comment on column ledger_balance.id is 'identifier 
created by auto-incrementation'
comment on column ledger_balance.local is 'the 
account, symbol used also in ledger.local but not 
defined'
comment on column ledger_balance.amount is 'the 
amount which was said to be on local at date'
comment on column ledger_balance.date is 'the date 
at which amount was found on local'

4.7 ledger_addr

comment on table ledger_addr is 'phm guess: 
addresses of some people with whom blasum dealt, 
based on uid as used in table ledger but not 
referenced by that table'
comment on column ledger_addr.uid is 'user id'
comment on column ledger_addr.finpnom is 'personal 
name'
comment on column ledger_addr.finstr is 'street'
comment on column ledger_addr.finplz is 'post code'
comment on column ledger_addr.finurb is 'city'
comment on column ledger_addr.finland is 'country'
comment on column ledger_addr.fincorp is 'whether 
this is a corporation; 1: yes, 0: no'
comment on column ledger_addr.finemail is 'e-mail'
comment on column ledger_addr.finurl is 'url of 
homepage'

4.8 ledger_lexware_accountsystem

comment on table ledger_lexware_accountsystem is 
'definitions of accounts (classes of transactions, 
based on immediate purpose) as defined in Lexware 
(based on Lexware data export in Nov 2005, 
essentially a backup of cschuster data)'
comment on column 
ledger_lexware_accountsystem.kontonummer is 
'numeric class symbol, should be primary key to 
which ledger.lexware_number & ledger_cc.lexware_ct 
refer'
comment on column 
ledger_lexware_accountsystem.kontenbezeichnung is 
'explanatory name or explanation of kontonummer in 
german'
comment on column 
ledger_lexware_accountsystem.accountdescription is 
'explanatory name or explanation of kontonummer in 
english'

4.9 ledger_lexware_costcenter

comment on table ledger_lexware_costcenter is 
'secondary data resulting from conversion of 
ledger_event itno a numeric form usable by 
ledger_lexware_book (based on Lexware data export 
in Nov 2005, essentially a backup of cschuster 
data)'
comment on column ledger_lexware_costcenter.cc is 
'identification of cost centers, equivalent to 
events defined in ledger_event, by integer keys, 
which are defined here, for use by lexware system'
comment on column ledger_lexware_costcenter.ccref 
is 'phm guess: explanation of cc?'

4.10 ledger_lexware_book

comment on table ledger_lexware_book is 'secondary 
data resulting from conversion of source, i.e. 
tables ledger & co, into a format that is closer 
to what the lexware system uses (backup of 
cschuster data Nov 2005)'
comment on column ledger_lexware_book.belegdatum 
is 'voucher booking data in ledger'
comment on column 
ledger_lexware_book.buchungsdatum is 'booking data 
in ledger, i think most times equal to belegdatum 
if used at all'
comment on column 
ledger_lexware_book.belegnummernkreis is 
'designates account (giro/credit 
card/cash/paypalus/etc)'
comment on column ledger_lexware_book.belegnummer 
is 'number to used in conjunction with 
belegnummernkreis'
comment on column ledger_lexware_book.buchungstext 
is 'remark'
comment on column 
ledger_lexware_book.buchungsbetrag is 'amount'
comment on column ledger_lexware_book.sollkonto is 
'debit account'
comment on column ledger_lexware_book.habenkonto 
is 'credit account'
comment on column 
ledger_lexware_book.steuerschluessel is 'blasum 
has no idea and thinks it was not used'
comment on column 
ledger_lexware_book.kostenstelle1 is 'blasum 
thinks this was used for cc like in ledger'
comment on column 
ledger_lexware_book.kostenstelle2 is 'blasum 
thinks this was used for event like in ledger'
comment on column 
ledger_lexware_book.buchungsbetragdm is 'amount in 
DEM, lexware artefact for EUR conversion support, 
not used blasum thinks'
comment on column 
ledger_lexware_book.buchungsbetrageur is 'amount 
in EUR'
comment on column ledger_lexware_book.waehrung is 
'currency'
comment on column ledger_lexware_book.year is 
'year (lexware does it year-by-year only)'

4.11 ledger_vocabulary

comment on table ledger_vocabulary is 'bilingual 
accounting vocabulary'
comment on column ledger_vocabulary.de is 'german 
term'
comment on column ledger_vocabulary.en is 'english 
term'

5 Resources

6 History

  • dat: 2008-01-30; prs: phm: PILCH Hartmut creates this directory
[ I2P | Database | Design | Ledger ]
Valid XHTML 1.0! Valid CSS! deplate
http://a2e.de/i2p/ffiidb/ledger
© 2008-01-30 Hartmut PILCH