📜 ⬆️ ⬇️

Typical billing scheme

As a person, I was exhausted by various ASRs and I myself took part in the development of ASR regularly faced with the absence of some typical scheme that could be looked at to evaluate the ASR, as well as before creating my own ASR. There are a number of works on the network on this topic. For example, I once studied this diploma while writing a diploma. Methods of modeling and developing billing systems . A diploma is a diploma and it is a strange task to drag out schemes from it, since it does not respond to the realities.

As a result, now having quite a lot of experience with ASR, I decided to make my own scheme. But since I am still one person, then it should be shown to others and criticized. So I hope they will be interested in this topic and they will tell me what else to do and how. The scheme that I publish here has already been improved and corrected, and it is already possible to download it from github . Both as a file for Power Architect and as a ready-made DDL file for PostgreSQL. The only thing I did not have time to fill out reference books, but everything has its time. Now go to the scheme.

The first step is to look at the ER-diagram, as the most convenient means of representation of the scheme.

ER diagram

')
As you can see, although there are quite a lot of tables, in fact, the functionality is quite small.
And consists of the following features:


It is a necessary minimum for correct carrying out charges for services and accounting of funds.
But before proceeding to the description, it is worth mentioning the agreements used in the scheme:

And now the description slides .

Reference tables are:

Although these tables are quite enough for billing to work, but for convenience, tables of primary documents are added. The primary documents are those documents on the basis of which the entries are made to under the client's contract.

Now in the scheme there are the following primary documents:

Primary documents have both general fields and general rules for working with them. Let's start with the general fields:

As for the reporting period and the corrected and correctional document, I’ll stop by more detail.

Reporting period.
At the end of the month, you may have two open reporting periods due to the fact that, for example, the last days fall on a weekend, and the payments to the bank have not yet been posted. Plus, this is required in cases such as when the actual document date is January 2014, and the period used is June 2015, held in early July 2015. That is, in the period June 2015, in the creation date July 2, 2015, and in the document date January 2014. Because of this, the document actually has three dates.

Corrected and corrective documents.
In fact, if you have a document in your system that is in error, you cannot delete it. It can only be canceled. Those. create a corrective document which is strictly opposite to the incorrect document. For this purpose, these two fields are used. id_revoke - filled in the correction document, and id_revokedby in the corrected one. Otherwise, for example, a part of the document is not recommended, as well as deleting documents. Instead, hide such documents, if they are in the same period. If the documents are in different periods, then you don’t need to hide them. Also note that the wiring of such fields is not, they are not adjustable.

In addition to general fields, primary documents have their own specific fields:


Remaining fields I think are clear from a context and the selected names. This concludes the conversation about primary documents and go to the remaining reference tables.

The schema contains the following reference tables:

As well as two auxiliary tables:

And that is all. If you do not mind to answer the survey. The results will be taken into account when writing the next post in the series :) Well, ask your questions in the comments.

Source: https://habr.com/ru/post/259921/


All Articles