In this lesson you will study the Document configuration object. You will learn the purpose of this object, its structure, and its main properties.
Then you we will create several documents and learn how a developer can introduce custom algorithms that enhance document functionality.
Additionally, you will learn how to create a document form, familiarize yourself with some of the 1C:Enterprise script expressions, and learn what a type-specifying configuration object is.
The Document configuration object is intended for storing data related to completed financial operations or events that occurred within a company. Normally, every company uses such documents as goods receipts, hiring orders, sales invoices, or bills. The Document configuration object describes the structure and properties of these documents. The platform uses these objects to create database tables that store document data.
The document logic is different from the logic of other configuration objects. A document can be posted. Events recorded in posted documents affect the accounting records.
When a document is not yet posted, it does not affect the accounting records, at this stage the document is nothing more than a draft or a blank. Once a document is posted, the accounting operations described in the document take effect and the accounting records are changed accordingly.
Since a document changes accounting records, it is always tied to a specific point in time. This ensures reflecting the actual sequence of events in database records.
The next important observation, which follows from the previous two, is that the 1C:Enterprise system includes functionality for monitoring the accuracy of accounting records. If you change any of the previously posted documents and then repost them, 1C:Enterprise can monitor whether your changes would have an effect on subsequently posted documents and, if so, it can repost all of the affected documents.
Users can create documents such as sales and purchase invoices, bills, and so on.
In the database each document is an individual record in the main table that stores information about this document type (fig. 4.1).
Fig. 4.1. Standard attributes of a Goods receipt document in Designer mode, in 1C:Enterprise mode, and in the database
As a rule, each document contains data that describes the document in detail. For example, each Goods receipt can include vendor info, the warehouse where the goods are delivered, and so on.
This data set is the same for all documents of the same type, it is defined using the attributes of Document configuration objects (subordinate configuration objects). Developers create the majority of attributes manually but each Document configuration object also has a set of standard attributes, which are available by default. Two most important attributes are Date and Number. Since the Date data type contains dates and times with accuracy of one second, this attribute also generally serves as the document time stamp (fig. 4.2).
Fig. 4.2. Vendor attribute of a Goods receipt document in Designer mode, in 1C:Enterprise mode, and in the database
Documents can also store certain data sets that have identical structure but vary in quantity (different quantities for different documents). For example, each Goods receipt document can contain a list of received goods.
The Document configuration object uses tabular sections to store such data. In this case the database has additional tables for storing the tabular sections subordinate to a specific document (fig. 4.3).
Fig. 4.3. List of goods tabular section in a Goods receipt document in Designer mode, in 1C:Enterprise mode, and in the database