Writing /giga/dw/dng/dokuwiki/data/meta/dev/010how/040cbs/0010cbs.meta failed
dev:010how:040cbs:0010cbs

CBS - Contract Balance System

The system used in the CBS allows to store amounts together with the data relevant to the changes. Thereby it is possible to retrieve amounts or balances for any date in the past.

The CBS system is setup as a generic system to store amounts for many different types of objects. It supplies functions for invisible internal usage within the using application. Thus on the application surface typically the balance as per today is retreived and shown. For reporting purposes the balances per any valid date might be used.

Instead of storing amounts as part of normal database entries, with the usage of CBS the amounts are booked to the CBS system and balances might be retreived per any valid date.

The balances are stored and maintained with a date range definition per balance entry. These date ranges are automatically maintained when entering new bookings. Typically the last valid balance entry gets a begin date as of today and an high value (reflecting the last possible date) as end date. Thus the last entry has an infinite validity.

The handling of date ranges are supplied by the core module RNGMOD.

The database structure is setup in a manner that the access to the database directly accesses exactly the one valid entry per requested date. No accumulation or browsing through multiple entries are necessary to determine the balance of a certain column, date and object.

Features

There are different features available.

  • Storage of a new CBS booking
  • Retreiving the balance of a CBS column per object and date
  • Maintenance of the countervalue in system currency
  • Maintain a state of booking to differentiate between stored and commited (= irreversible) bookings
  • Possibility to get the access SQL needed to retreive a certain CBS balance
  • Maintain a booking and a value date per booking
  • Automatic adjustment of future balances to support backdated value dates
  • Supply an external id to be able to support multiple independent balances with the same object type
  • Function to roll back all CBS bookings / balances of a certain transaction
  • Function to delete all CBS bookings / balances of a certain object
  • Call functions to retreive the CBS configuration of a certain object type

The typical sequence of functions is

  1. Retrieve the CBS balance of needed columns when loading a contract
  2. calculate the necessary booking amount
  3. in case the delta amount is not zero store a cbs entry with the delta amount
  4. after release mark the transaction as final (to commit the CBS amount)

Glossary of Terms

For a better understanding, some terms that are important in the CBS context and are used in several functions are described below.

Mnemo Description Content Examples
CBO (Object) Object (OBJTYP) The configuration (the way how to process the balances) is defined per object type, as various contracts are to be stored in various amounts and balances. The concrete balances will then be stored (per instance) below one of those object types. LED
BED
PTE
CBT (Type) Booking Type Amounts are stored in CBS via bookings. In order to differentiate between the various bookings, booking types are used. Per pair of object type and booking type the way to map the booking into the defined columns is configured. Thus different booking types might be connected to one or more columns. Per pair it has to be defined whether the booking has to be added or subtracted into the column. MAXAMT
UTLAMT
AKZIN
LIAIN
LIAOUT
CBC (Column) Column In order to differentiate between the various balances, the balances are named as columns of an imaginary booking log. The individual booking types are assigned to one or more columns (whether with a positive or negative value). Thereby, a booking can be added in one column and subtracted in another one. MAXSUM
OPN
AKZSUM
LIASUM
CBE (Entry) Booking Each amount change in the CBS is done by a booking which is also saved as a single record in the database. Within the booking, the object (OBJTYP + OBJINR), the booking type (CBT), as well as currency (CUR), amount (AMT), value date (DAT) and other booking-specific data are defined.
CBB (Balance) Balance The balance amounts that are changing over the time are stored for every balance of an object in single balance records. Besides the object (OBJTYP + OBJINR) these records also contain the currency (CUR) and the balance (AMT), as well as the validity period for this balance (including BEGDAT (incl. begin date), exclusive ENDDAT (excl. end date)).
EXTID Subtype It is possible to process several balances per object type at the same time via the field EXTID. In an accounting department this would be described, for example, as subaccounts. Depending on the specified EXTID, the balances will automatically be kept separately per EXTID. AMT1
AMT2

Transactions

Transaction Description
REOCBS The transaction is used to
* recreate the balances based on the existing bookings after database corruption or after changes of the configuration.
* update the configuration stored in cbsconf.ini in case of changed configuration
DBICBO Display of defined CBS objects
DBICBT Display of defined CBS booking types
DBICBC Display of defined CBS columns
DBICBI Display of defined CBS associations
DBICBA Display of defined CBS functions

Modules

Module Description
CBSMOD Full module to supply the functions needed to maintain and retreive CBS balances
CBSGET Small module to supply the functions needed to retreive CBS balances
This module is included into CBSMOD
XRTMOD core module to handle and support currency exchange rate calculations
This module is included into CBSGET (and thus in CBSMOD)
RNGMOD core module to handle and support date range storage and access of database table
This module has to be included in case CBSGET or CBSMOD are used in a transaction
CBE Module to hold all fields of a CBS booking entry
A localy needed instance is included into CBSGET
CBB Module to hold all fields of a CBS balance entry
A localy needed instance is included into CBSGET

Details about the Implementation can be found here.

dev/010how/040cbs/0010cbs.txt · Last modified: 2024/04/05 10:10 (external edit)