In 1C, registers are one of the key elements of the system. This term has its counterpart in the English language - ledger. It originally appeared in accounting practice, but over time, its logic began to be used in other areas.
Unlike 1C, where registers are one of the built-in types, there is no such concept in the
lsFusion platform
itself . But in it there is inheritance, polymorphism and aggregation, which, in particular, allows you to implement a similar register logic. In this article I will show how exactly by examples.
A register is a set of records, each of which reflects a state change for a certain set of subjects (or dimensions).
In 1C there are 4 types of registers:
- Accounting register
- Billing register
- Savings Register
- Information Register
The first two are highly specialized and are used only for accounting and payroll. Since lsFusion is a universal platform for developing business applications, I will not consider them, although it is quite simple to implement them. Let us dwell only on the last two types of registers.
Savings registers
Any entry in the register can be considered as an object of some abstract class. Suppose you want to implement a simple register that calculates the balance of a product in stock.
To do this, declare an abstract
SkuLedger class:
, ( ).
Sku () Stock () .
:
, :
, , , 1
. , .
:
, . , . ,
MATERIALIZED. , , 1.
, :
, , . , , . , , 1 , , 1 .
, , :
. , , .
, :
, . . , (MATERIALIZED), :
, , dateTime :
, .
,
. :
, .
ReceiptDetail SkuLedger:
, , :
, .
, :
, . () , . , :
, , .
, , ,
TransferSkuLedger,
SkuLedger:
AGGR , , ,
TransferSkuLedger, . .
:
, , .
, 1 , :
, . , .
, , . , . , .
, , .
. :
:
, , . , , :
, , 1, lsFusion . , .
, :
1 , ( ). , 1 . , , , , (), .
lsFusion , . , , .