1C:Enterprise 8.3. Core Development Techniques Tutorial. Input on basis.

Input on basis

You can enter new documents in the 1C:Enterprise 8 system by using the "on basis" method. This method allows users to enter a document or a catalog item by filling its attributes with data taken from another infobase object (a document or an object of a different type, which is used as the "basis"). 

The "on basis" input feature utilizes the Input on Basis Wizard. This wizard is used to create a procedure with a reserved name, Filling(), in the document module. 

Let us see how to create an "on basis" input feature for the Receipt for Services Rendered document (with the Orders catalog as basis) using the Input on Basis Wizard.

You can use this wizard for catalogs, documents, charts of characteristic types, charts of accounts, charts of calculation types, exchange plans, business processes, and tasks.

Open the window for editing the Receipt for Services Rendered document and then, on the Input on Basis tab, select Catalog.Orders and run the Input on Basis Wizard.

 

 

In the upper part, you see a list of base objects and a list of attributes for the base object selected in the first list.

In the lower part, the list of attributes for the resulting object is displayed.

When you click the Fill Expressions button, the program creates completion formulas for the attributes of the base object. Automatic completion will not change the formulas that were created earlier. The document attributes will be matched with base object attributes according to the attribute names, IDs, and types. 

You can create formulas manually simply by typing them in the input box, but note that the Wizard will not check the correctness of the formulas. 

When you click OK, a procedure named Filling() will be created in the document module. If you call the Input on Basis Wizard repeatedly, the system will prompt you to agree to full replacement of the existing Filling() procedure with a new one.

Using applied objects for recording accounting data

Successful enterprise management implies monitoring a large number of various performance indicators using multiple reports and printed forms.

This is similar to driving a vehicle, where a driver has to watch the speed, fuel level, average fuel consumption, etc. with the help of a number of sensors, electronic devices, and a dashboard.

Accounting indicators can be divided into the following groups:

Real-time indicators that show real-time changes of the accounting objects and are subject to analysis in real time, i.e., the balance of goods or cash assets.

Management indicators that show how the accounting objects change without connection to real time (i.e., in the future or the past) but can be analyzed in real time, i.e., sale/purchase planning indicators. Changes in such indicators are registered when an enterprise event is recorded in the information system.

Scheduled indicators that show how the accounting objects change without connection to real time (i.e., in the future or the past) and, unlike management indicators, may be registered and calculated with a specified frequency, i.e., cost indicators.

1C:Enterprise 8 provides some features for implementing different types of indicators.

Real-time accounting features

First of all, let us discuss system features to be used for obtaining indicators. In the previous section, you have learned that the system supports the storage of various inventory characteristics in accordance with the schedule and terms specified. This is why many inexperienced 1C developers try to handle the tasks with the features they know, i.e., to store the inventory balance in the Warehouse view of information registers. This example demonstrates the need to use an accumulation register and explains why this cannot be fully and optimally handled with an information register. 

If you want to use an information register, you need the following:

A ReceiptOfGoods document with the Warehouse attribute and List tabular section. The List section contains the Product and Quantity attributes.

 

An information register to store information on the inventory balance in the Warehouse view.

 

(Use the ReceiptOfGoods document as the recorder.)

 

And the procedure for posting the document where the new balance is calculated: 

 

Therefore, you can see that when you use an information register, you will also have to use programming, and developing a new balance calculation algorithm (CalculateNewBalance) will take a great deal of effort and attention. Also, the system will have to spend some time to calculate the new balance when the records are formed in the information register.

To avoid unnecessary manipulations and programming, the platform developers have created a new type of register.  This is the accumulation register. It is optimized to handle balances and turnovers tasks. Let us create an accumulation register named InventoryBalance with the register type Balances

 

Select the document ReceiptOfGoods as the recorder.

 

Define the following record creation algorithm for the ReceiptOfGoods document.

 

In this scenario, the balance is fully calculated by the platform due to the type of the accumulation register (Balance). Automatically calculated balance data is stored in the Totals internal table. 

You can successfully register inventory receipts and write-offs at the warehouse only by configuring the system parameters, without any programming. 

Let us simplify the structure. Use the InventoryBalance accumulation register as a tabular section instead of the List tabular section and the Warehouse attribute in the ReceiptOfGoods document. First of all, delete the List tabular section and the Warehouse and Posting attributes from the module. Then disable posting of the ReceiptOfGoods document and leave only the InventoryBalance accumulation register selected.

 

Then we need to create a document form.

 

Add the InventoryBalance accumulation register to the document form to be displayed as a tabular section.

 

Fill in the Receipt of Goods in the 1C Enterprise mode:

 

In this case you fill in the accumulation register automatically by filling in the document. You have to customize your form so that the user only has to fill in the fields Inventory, Warehouse, and Quantity. The Period and RecordKind fields need to be filled in automatically and do not need to be displayed on the screen.

First, remove the fields that a user does not need, i.e., Period and RecordKind, from the ReceiptOfGoods document form.

 

Then set the autofill rules for the removed fields in the InventoryBalance accumulation register. 

Add the following algorithm to the record set module (the Date is taken from the document date, and RecordKind is defined by the document type).

Procedure BeforeWrite(Cancel, Replacing)

       Document = ThisObject.Filter.Recorder.Value;

       DocumentDate = Document.Date;

        If Document.Metadata() = Metadata.Documents.ReceiptOfGoods Then

              RecordType = AccumulationRecordType.Receipt

       Else

              RecordType = AccumulationRecordType.Expense

       EndIf;

       For Each Record In ThisObject Do

              Record.Period = DocumentDate;

              Record.RecordType = RecordType;

       EndDo;

EndProcedure

Check the document in 1C:Enterprise mode:

 

You can view records in the accumulation register through main menu – All functions.

We will discuss calculating the current balance and the balance for a specific date later.

The accumulation register defines how changes in the accounting object state are registered, while the report defines how an indicator value for a specific date is presented.

You can use two types of accumulation registers: balance registers and turnover registers.

For balance registers, 1C:Enterprise script methods allow you to get the accumulation register balance for a specific point in time. You can filter data by dimension values, or obtain balances by other dimensions.

 

Turnover registers are used to store information for which the balance concept makes no sense, e.g., sales volumes for different customers.

 

Information on any register changes caused by the recorder is called a register record:

 

The totals calculation feature uses register records to make direct changes in accumulation registers. Therefore, register records contain only increments (positive or negative) of register resource values, but not the bottom-line values. Register records influence the register totals.

The totals value is summarized register data obtained by summing up the values provided by register records. 

The totals in the accumulation register are stored with a monthly periodicity plus current totals as of the last record in the register. 

Unlike register records, there is no way to directly view the totals of the accumulation register by using 1C:Enterprise 8 tools.

Physically, the accumulation register can be considered as two tables: a records table and a totals table.

The totals may be called in the following ways.

• by using a script:

AccumulationRegisters.AccumulationRegister_Balances.Balance()

by using query language in the reports:

SELECT

    Balance.Item,

    Balance.QuantityBalance

FROM

    AccumulationRegister.AccumulationRegister_Balances.Balance AS Balance

If you want to obtain the totals for the moment that differs from the beginning of the month, the system will analyze the records from the nearest calculated month. To manage the calculated totals in 1C:Enterprise mode, you can use the Totals Management dialog called from the main menu by clicking All functionsStandardTotals Management

 

You can use an alternative method for storing the totals in the turnover registers. This is called aggregates. Aggregates help you to obtain the results for quick generation of reports of similar type. The more data you have in your infobase, the more effectively the aggregates will be used.

Use the "get optimal aggregates" feature at run time to define the optimal aggregate structure. 

 

Documents have a RegisterRecords property (FixedCollection type) that provides access to a collection of document record sets. Collection properties contain empty document record sets enabled for this document in the configuration. This is why, when documents are posted, the records are first added to the set, and then the set is written to the database.

Accumulation register records are created mainly when documents are posted. To enable a document to create records in a register, specify the following parameters on the Register records tab.

Posting – specifies whether document posting during writing is enabled.

Real-time posting – specifies whether real-time posting is enabled. If real-time posting is enabled, the system allows interactive selection of a posting method when the document is posted for the current date. When a noncurrent date is selected, documents with real-time posting enabled are posted in regular mode because in this case an occurred event that does not require real-time verification is being recorded (for example, checking the balance in a product invoice). Disable real-time posting to enable document posting for a future date.

Register records deletion – enables automatic deletion of all records written by the document during previous posting at the time of reposting or unposting.

You also need to select the accumulation registers where the document will create records.

 

Register Records Wizard

The Register Records Wizard is used for documents only; it helps to create a script procedure for handling document posting. The Wizard may, for example, be called from the document editing window.

 

Several lines will be displayed in the Registers box if the Wizard is used to edit several records simultaneously.

 

If a document has tabular sections, and their data affects the status of registers, include the tabular section in the Tabular Section list. If an attribute type matches the resource type, it is marked with a special icon in the list of attributes. If you click the Fill Expressions button, attribute formulas are filled for each register on the basis of the document attribute data. These formulas can be edited manually.

 

Task 19

1. Create an accumulation register named Settlements with dimensions Customer (type CatalogRef.Customers) and Settlement Document (type

DocumentRef.ReceiptForServicesRendered), and the TotalSum resource. Enable creation of records in the Settlements register for the ReceiptForServicesRendered document.

2. Create a document named Payment from Customer with the following attributes: Contractor, ReceiptForServicesRendered, and TotalSum, and enable creation of records in the Settlements accumulation register for this document. 

3. Create an external data processor named Receipt of Materials, which will create register records for the Receipt of Materials document in the MaterialsBalance register. Use the

AccumulationRegisterRecordSet object to create the records.

Leave a Reply

Your email address will not be published. Required fields are marked *

1C:Enterprise Developer's Community