1C:Enterprise 8. Practical Developer’s Guide. Lesson 12. Turnover Accumulation Registers.

Lesson 12. Turnover Accumulation Registers

Estimated duration of the lesson is 40 minutes.

CONTENT:

During this lesson we will become familiar with another type of accumulation registers - turnover accumulation register.

You will learn several important rules of selecting the dimensions and attributes for accumulation registers.

We will create a turnover accumulation register and will modify one of our documents to post records to this register as well.

Why We Need Another Register

Let us continue to discuss the functions of our ServicesRendered document.

So far we have created records in accumulation registers only for those document rows that contain materials. We have not yet accounted for the services listed in the document.

The point is that, when accounting for services, we must consider entirely different criteria than those we used to account for materials.

First of all, there is no sense talking about how many services there was and how many of them remain. All we need to know is the total quantity of services that were rendered within a given time period.

Additionally, we will want to track the following issues:

- The types of services rendered (to generate a rating of services);

- The client the services were rendered to (for instance, to offer them discounts based on the volume of services they paid for in the past); n The technician who performed the service (for payroll purposes).

Obviously, the accumulation registers we have so far are not suitable for the task at all.

Therefore, we will create one more data "repository" to be used in our program - the Sales turnover accumulation register.

What a Turnover Accumulation Register is

When we created the BalanceOfMaterials and CostOfMaterials registers, we deliberately skipped over discussion of the types of registers that are available in the 1C:Enterprise. Now it is time for a few words on the subject.

Accumulation registers can serve as balance or turnover registers.

The registers that we already have in our practice configuration, BalanceOfMaterials and CostOfMaterials are balance registers.

You may remember that when we created the Materials report in the query wizard we saw that three virtual tables were created for such registers: balance table, turnover table, and a combined balance and turnover table.

A turnover accumulation register is very similar to the balance register that we are familiar with, except that the idea of balance is meaningless here. A turnover register only accumulates turnovers and ignores balances entirely. Therefore, the only virtual table the system will create for this type of register is a turnover table. A turnover register is absolutely similar to a balance register in every other respect.

We should mention one distinctive feature in the design of accumulation registers, which is directly related to our ability to get balances. When creating a turnover accumulation register, there are no real issues in determining which data should serve as dimensions of the register; we can assign any data we want to be a dimension of the register.

The situation is entirely different for an accumulation register that supports accumulation of balances. For such a register you should select the dimensions based on the fact that there are two directions of register records: receipt and expense. Therefore, when you select dimensions you need to choose data for which both types of register records are totally possible.

For example, if materials are tracked in terms of products and warehouses, product and warehouse can obviously be dimensions since both receipt and expense of materials will always be made with a reference to a specific product and a specific warehouse. But if in this situation you may need to also account for materials in terms of suppliers, you will need to work based on the specific accounting procedures used within the company.

Probably a supplier will be specified for receipt of materials while for expenses a supplier will most certainly be missing. In the majority of situations this information is not needed at all.

Therefore, a supplier should be included as an attribute of the accumulation register instead of as a dimension.

However, in the situations where a supplier will certainly be indicated when materials are expended, it would make sense to add a supplier as one of the register's dimensions.

In other words, for every dimension of a balance accumulation register, resources should necessarily support changes in both directions: receipt and expense. There should be no dimensions where only receipt or only expense is possible.

Neglecting this principle of accumulation register design will lead to inefficient use of system resources and resultant reduction in performance and productivity.

This principle is less important for register attributes. Based on the register attributes resources may be both only received or only expended.

Adding a Turnover Accumulation Register

In the Designer Mode

Now that you know "almost everything" about accumulation registers, open the Designer and create a new Accumulation Register configuration object.

Enter Sales for its name and set the register type to Turnover.

Besides, enter Sales Register Records for Extended list presentation. This title will be displayed in the window of the register records list (fig. 12.1).

1C:Enterprise 8. Practical Developer's Guide. Lesson 12. Turnover Accumulation Registers

Fig. 12.1. Creating a turnover accumulation register

On the Subsystems tab check that this register will be displayed in the following subsystems: Accounting, Goods Management, and Rendering Services.

On the Data tab, we will create the register's dimensions:

- Product, type CatalogRef.Products; n Client, type CatalogRef.Customers;

- Technician, type CatalogRef.Employees.

The register will have three resources:

- Quantity, type Number, length 15, 3 decimal places;

- Revenue, type Number, length 15, 2 decimal places;

- Cost, type Number, length 15, 2 decimal places.

Once created, the Sales register will look as follows in the configuration tree (fig. 12.2):

1C:Enterprise 8. Practical Developer's Guide. Lesson 12. Turnover Accumulation Registers

Fig. 12.2. Sales turnover accumulation register

Now we will edit the command interface so that the link to view our turnover accumulation register is available in the subsystems Accounting, Rendering Services, and Goods Management.

Highlight the Subsystems branch in the configuration object tree, open its context menu and select All subsystems.

In the window that opens highlight Accounting in the Subsystems list on the left.

The right-hand Command Interface list will display all the commands of the selected subsystem.

In the Navigation Panel.Normal group enable visibility for the Sales command and drag it to the group Navigation Panel.See also.

In a similar manner highlight the subsystems RenderingServices and GoodsManagement and enable visibility for the Sales command in the navigation panel and drag it to See also group.

Posting the Services Rendered Document across Three Registers

In this section we will first modify the posting procedure for the ServicesRendered document and then will repost all these documents in the 1C:Enterprise mode for the newly modified posting procedure to be executed for the Services Rendered documents.

In the Designer Mode

Open the ServicesRendered document in the configuration object editor. On the Register Records tab indicate that the document will post records for the Sales register as well.

Go to the Other tab and open the document module. To do so, click Object Module.

Open the procedure for the Posting event handler.

In the end of the loop after the EndIf and before the EndDo, we will add some lines of code to generate records in the Sales register from the ServicesRendered document (listing 12.1).

Listing 12.1. Register records of the ServicesRendered document (fragment)

// Sales register
Record = RegisterRecords.Sales.Add();
Record.Period = Date;
Record.Product = CurRowProductList.Product;
Record.Client = Client;
Record.Technician = Technician;
Record.Quantity = CurRowProductList.Quantity;
Record.Revenue = CurRowProductList.Total; 
Record.Cost = CurRowProductList.Cost*CurRowProductList.Quantity;

Before the loop itself we will select True for the Write property of the record set for this register.

This results in the following appearance of the Posting procedure (listing 12.2):

Listing 12.2. Register records of ServicesRendered document

Procedure Posting(Cancel, Mode)

	RegisterRecords.BalanceOfMaterials.Write = True;
	RegisterRecords.CostOfMaterials.Write = True;
	RegisterRecords.Sales.Write = True;

	For Each CurRowProductList In ProductList Do	
		If CurRowProductList.Product.ProductType = Enums.ProductTypes.Material Then
			// register BalanceOfMaterials Expense
			Record = RegisterRecords.BalanceOfMaterials.Add();
			Record.RecordType = AccumulationRecordType.Expense;
			Record.Period = Date;
			Record.Material = CurRowProductList.Product;
			Record.Warehouse = Warehouse;
			Record.Quantity = CurRowProductList.Quantity;

			// register CostOfMaterials Expense
			Record = RegisterRecords.CostOfMaterials.Add();
			Record.RecordType = AccumulationRecordType.Expense;
			Record.Period = Date;
			Record.Material = CurRowProductList.Product;
			Record.Cost = CurRowProductList.Quantity * CurRowProductList.Cost;
		EndIf;

		// Sales register
		Record = RegisterRecords.Sales.Add();
		Record.Period = Date;
		Record.Product = CurRowProductList.Product;
		Record.Client = Client;
		Record.Technician = Technician;
		Record.Quantity = CurRowProductList.Quantity;
		Record.Revenue = CurRowProductList.Total; 
		Record.Cost = CurRowProductList.Cost*CurRowProductList.Quantity;
	EndDo;
EndProcedure

You already know all the added expressions well.

Just note that the turnover register does not have a RecordType property, since reflecting the type of record (receipt or expense) only makes sense when accounting for balances. But for a turnover register, we are only interested in the value that we will need to write to the register's resource.

Also note that we have arranged the commands that create records in the Sales register in the end of the loop of searching in the document tabular section after the condition that the loop should be applied to materials only. This is important because in this register records are created both for materials and services.

Finally, we will edit the command interface of the document form so that the navigation panel made it possible to go to the list of Sales register records related to the document.

To do so, open the form of the ServicesRendered document.

In the upper left window navigate to the Command Interface tab.

In the Navigation Panel section expand Go To group and locate the command that opens the accumulation register named Sales.

Check the property Visibility for this command.

In the 1C:Enterprise Mode

In the 1C:Enterprise mode we need to repost all the documents of Rendering Services and make sure that they create correct records in the Sales register.

Launch 1C:Enterprise in the debugging mode and open all the Services Rendered documents one by one.

Click Post and go to the list of records these documents create for the Sales register. They should look as follows (fig. 12.3a, 12.3b, 12.4a, 12.4b, 12.5a, 12.5b).

1C:Enterprise 8. Practical Developer's Guide. Lesson 12. Turnover Accumulation Registers

Fig. 12.3a. Records of the Services Rendered No. 1 document in the Sales register

1C:Enterprise 8. Practical Developer's Guide. Lesson 12. Turnover Accumulation Registers

Fig. 12.3b. Records of the Services Rendered No. 1 document in the Sales register

1C:Enterprise 8. Practical Developer's Guide. Lesson 12. Turnover Accumulation Registers

Fig. 12.4a. Records of the Services Rendered No. 2 document in the Sales register

1C:Enterprise 8. Practical Developer's Guide. Lesson 12. Turnover Accumulation Registers

Fig. 12.4b. Records of the Services Rendered No. 2 document in the Sales register

1C:Enterprise 8. Practical Developer's Guide. Lesson 12. Turnover Accumulation Registers

Fig. 12.5a. Records of the Services Rendered No. 3 document in the Sales register

1C:Enterprise 8. Practical Developer's Guide. Lesson 12. Turnover Accumulation Registers

Fig. 12.5b. Records of the Services Rendered No. 3 document in the Sales register

Now we have virtually all the information we need to analyze operations of Jack of All Trades.

During the next lesson we will create some reports that will provide us with summary information on the company's operations.

Quiz

  • What is a turnover accumulation register?
  • What is the difference between balance accumulation registers and turnover accumulation registers?
  • How does one select attributes and dimensions when creating accumulation registers?
  • How does one create a turnover accumulation register?

Leave a Reply

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

1C:Enterprise Developer's Community