251
Core Development Techniques Tutorial Part 1 Powered by 1C:Enterprise 8.2 – Business Applications Platform

Document1c

Embed Size (px)

Citation preview

Page 1: Document1c

Core Development Techniques Tutorial

Part 1

Powered by 1C:Enterprise 8.2 – Business Applications Platform

Page 2: Document1c

Core Development Techniques

2

THE ENTIRE COPYRIGHT TO THIS TUTORIAL BELONGS TO 1С COMPANY

By accepting this tutorial, you agree not to allow anyone to copy these materials without the written permission of 1С Company.

© 2012 1С LLC

1С Company

123056, PO box 64, Russia, Moscow

E-mail: [email protected]

Web site: 1c-dn.com

Created by: S.R. Arutyunov, 1C:Training Center No.1

Page 3: Document1c

Tutorial

3

Contents

Introduction .................................................................................................. 4

About this course ........................................................................................ 4

General information .................................................................................. 4

Requirements for participation ................................................................... 5

Basic principles ............................................................................................. 6

Overview ................................................................................................... 7

Purpose and basic concepts of 1C:Enterprise 8 ............................................. 9

Platform, configuration, and applied solution concepts .................................. 10

Installation options and operation modes ...................................................... 16

Installation ............................................................................................. 16

Usage scenarios ...................................................................................... 22

Operation modes ..................................................................................... 23

Development tools ..................................................................................... 27

Development of an applied solution ........................................................... 28

Starting and customizing Designer ............................................................. 35

Major developer tools ............................................................................... 44

Runtime tools ............................................................................................ 66

Window interface ..................................................................................... 67

Task-oriented interface ............................................................................ 68

System commands .................................................................................. 70

Additional features ................................................................................... 73

Managed forms ....................................................................................... 75

Developing data storage structure .................................................................. 84

Defining configuration types ........................................................................ 85

Configuration objects and their classification concepts .................................. 107

Tutorial: designing configuration structure .................................................. 123

Using common applied objects ................................................................ 124

Information registers ............................................................................. 155

Charts of characteristic types .................................................................. 172

Documents ........................................................................................... 189

Document journals ................................................................................ 203

Document sequences ............................................................................. 206

Input on basis ....................................................................................... 209

Using applied objects for recording accounting data ................................... 211

Tools for scheduled reporting and accounting ............................................ 223

Page 4: Document1c

Core Development Techniques

4

Introduction

Experience shows that training course readers can be broken down into the following general groups:

Heads of departments

1C:Enterprise end users

Information system and network administrators

Application developers

Decision makers require timely answers to critical questions, such as:

Will 1C:Enterprise 8 completely support automation of our company?

Is it sufficiently powerful to store and process the required data

volume?

Is it feasible to migrate to 1C:Enterprise 8 from version 7.7 or third-party solutions?

Which employees would benefit from which training courses?

Users have their own sets of questions to answer:

What is this system capable of?

How to encourage users to formulate their functional requests for the

developers, taking into account all platform capabilities, not just the features currently available in the application?

How can one optimize user experience with applied solutions based

on the general capabilities of the platform?

And for administrators and developers:

Accumulated information should be sorted and organized, i.e. a variety of objects, procedures, functions, and tools should be presented in a comprehensive view.

About this course

This course is designed for partners and users who want to learn how to develop applied solutions for the 1C:Enterprise 8 platform and look into the

capabilities that the 1C:Enterprise 8.2 technological platform offers.

General information

This course provides a complete description of the purpose and functionality of the 1C:Enterprise 8 system based on the 1C:Enterprise 8.2 platform.

To ensure that learning is as effective as possible, the theoretical knowledge is reinforced through practical exercises. The participants will thus be able

to acquire software development skills in the area of managed application engineering.

Page 5: Document1c

Tutorial

5

Requirements for participation

Object-oriented language programming experience is desirable.

Page 6: Document1c

Core Development Techniques

6

Basic principles

This section provides answers to the following questions:

What is 1C:Enterprise 8 and what tasks does it solve?

What is a technological platform?

What is an applied solution and what kinds of applied solutions exist?

What infobase interfaces are available?

How does the file mode function?

What is a client-server mode?

Who can develop applied solutions and how is this done?

What is the licensing policy used?

What actions can be performed on standard mass-market solutions?

Who can change the functionality of an applied solution?

Page 7: Document1c

Tutorial

7

Overview

A number of questions may arise in the course of development and

operation of business automation software. These should be answered by programmers or users at different stages of design, development, and operation.

Data processing is the primary and most crucial issue when dealing with

economic tasks.

This is due to the fact that while most software system development areas

have reached a "close-to-perfect" level (text processors, for instance), economic software still lags behind.

This course explores the issues related to the design and development of

such software products based on the 1C:Enterprise 8 platform. For the purposes of this training, programs that automate enterprise business are

called "business applications".

The primary issues to be addressed during the development of a business application are:

How to store data?

How to retrieve data upon request?

Page 8: Document1c

Core Development Techniques

8

This leads to a number of technical questions, such as:

Implementation tool choice:

What language should be used to create the business application?

What data storage format should be chosen?

Technical details:

What data storage structure is to be implemented?

How to implement multi-user support?

Interface-related questions:

What should the user interface look like?

What principles will define user activities?

How to implement online manuals for the application?

There are two approaches to answer these questions.

1. Create an application from scratch.

2. Customize an off-the-shelf solution.

Each of these options has its advantages and disadvantages.

Programmers tend to select multiple implementation tools when developing applications from scratch. In this scenario, too much time is spent on coding

and user interface development. The resulting application is dependent on the data storage system for which it was developed, which naturally limits the number of potential users and narrows the area of its use.

If an off-the-shelf solution is chosen, the modification and customization options are greatly limited and closely connected with the developer of the

Page 9: Document1c

Tutorial

9

selected solution. This limits the ability to customize the system quickly to satisfy the enterprise’s current needs.

There are a great number of various programming systems for developing custom applications, such as Visual Studio, Fox Pro, Access, and so on, and

a number of off-the-shelf applications, such as SAP R/3, Microsoft Dynamics, and so on.

This course does not include a comparative analysis of the 1C:Enterprise 8

system with other business application development systems. Let us simply review the key capabilities of 1C:Enterprise:

by system architecture;

by development methodology;

by operation.

Purpose and basic concepts of 1C:Enterprise 8

1C Company offers 1C:Enterprise 8 to automate corporate business in any of the ways described here. You can deploy an off-the-shelf business

application, as well as develop a new application from scratch.

1C:Enterprise 8 offers incredible opportunities to:

handle planning and operation management tasks;

perform accounting, management accounting, and payroll operations;

implement comprehensive automation of administrative and

economic activities in production enterprises, sales and financial organizations, budget institutions, and service providers.

A variety of mechanisms currently implemented in 1C:Enterprise 8 allows

comprehensive automation of the whole business process management cycle, from storing accounting parameters, accounting objects, and

documents, to decision-making process automation.

Page 10: Document1c

Core Development Techniques

10

Platform, configuration, and applied solution

concepts

Business applications on 1C:Enterprise platform are highly flexible. This allows rapid extension of their functionality in order to cope with the

evolving business tasks that need to be automated, and meet the unpredictable needs and demands of a dynamic business.

The specifics of application functionality and usage depend on:

parametric configuration of the complete schema;

development of additional software modules for the accounting of

new corporate business segments.

The platform used by 1C:Enterprise for business application development,

operation, and customization, can be described as follows.

From a technical point of view, this is a set of programs used for development, administration, and operation of business applications:

1C:Enterprise has multiple usage scenarios, each with its own executable file1:

You can select the platform components that you want to install. You can add or remove platform components later, both on end-user and server

computers. The following figure shows the component selection page of the Installation Wizard.

1 The scenarios are described in detail in section "Usage scenarios" on page 22.

Page 11: Document1c

Tutorial

11

From a functional point of view, this platform is a set of ready-to-use mechanisms to facilitate development, efficient user operation, and convenient administration:

Internationalization Support allows the use of different languages both during the development of an applied solution and during user operation (for example, an accountant works in Russian, while a sales

manager works in English, and so on).

Web Services allow web interaction with your business application

for end users (from any application with web support), as well as for collaborative development.

Web Extension allows the integration of data access mechanisms into existing web sites and web applications.

Integration Support allows integration with practically any type of

external software and equipment through common open standards and data transfer protocols.

Development Tools are instruments available to the developer and are provided in the Designer mode of the technological platform.

Page 12: Document1c

Core Development Techniques

12

Data Exchange allows the development of geographically distributed information systems based on 1C:Enterprise 8 infobases and third-

party information systems.

Interface Mechanisms are intended to support interaction between the user and a business application. They implement modern interface design and enhance user experience in the long run.

Page 13: Document1c

Tutorial

13

Full-Text Search helps search for data through the use of search operators (AND, OR, NOT, NEAR, and so on).

General Purpose Mechanisms allow template-level application development to significantly accelerate the process of development

and modification of business applications.

This approach allows developers to think in user categories and abstract from technical tasks that arise when standard programming

tools are used.

Access Rights System restricts user access to data that is required to perform certain functions in an applied solution.

Economical and Analytical Reporting tools are used to create customizable reports and print forms.

Page 14: Document1c

Core Development Techniques

14

User Productivity Tools ensure easy adoption for beginners and high operation speed for advanced users.

What role does the technological platform play in

the business application under development?

The 1C:Enterprise 8 technological platform is a business application technical foundation because it:

ensures stable and sustainable data storage;

ensures multiuser data access;

keeps a log of user actions;

helps resolve other technical issues not related to application-specific

areas of a particular business solution.

So now, where are the following defined?

object-oriented data storage structure;

user interfaces and forms;

rules for data processing and analysis;

and other settings related to the application business logic.

All these settings are stored in the description of the application business logic. Each application has its own business logic description. From the

programmers’ point of view, such descriptions differ from software source codes since they contain not only algorithms, but some other data as well:

1C developers call these descriptions "configurations". To store descriptions in files separately from the business application, 1C:Enterprise 8 developers have created two file formats:

one containing full business logic description:

the other one containing the description of business logic changes in comparison with the previous description:

Page 15: Document1c

Tutorial

15

Therefore, there are two components of any business application:

the technical part of the business application (technological

platform);

the business logic description (configuration).

Combining these "ingredients" provides a ready-to-use business application supporting technical and user settings.

Developers call such a business application an applied solution.

An applied solution is a program that is ready for use by the end user but can be enhanced (developed) in accordance with the user’s unique tasks

with almost no limitations, which is an essential requirement for management accounting. In this scenario, the end user does not have to purchase any additional programming systems such as Visual Studio, Fox

Pro, Access, and so on.

Being a commercial product, 1C:Enterprise 8 is supplied as an off-the-shelf

solution to automate a certain type of activity, i.e. it includes both the standard technological platform and a specific configuration template with unlimited capabilities for modification and custom configuration, as well as

for the number of applied solutions developed under the licensing policy.

There are a great number of configurations (descriptions) that define the

business logic of enterprises from different types and areas of business, i.e. templates for specific accounting practices or types of enterprises, also known as configuration templates. Such templates are supplied in

distribution kits.

Page 16: Document1c

Core Development Techniques

16

Installation options and operation modes

As we already know, any business application consists of two components:

technological platform;

configuration.

These components, which are required for business application

development, are delivered in distribution kits. Naturally, you need to install them to be able to develop a business application.

This section provides answers to the following questions:

How to use the technological platform distribution kit?

How to use a configuration distribution kit?

Installation

Before you install the 1C:Enterprise platform, ensure that your computer meets the software requirements listed at http://1c-dn.com/library/system_requirements/system_requirements/.

Page 17: Document1c

Tutorial

17

To facilitate the installation process, the distribution disc includes the AutoRun program.

You have the option to start the installation without using the AutoRun

program. You only need to use this option if you downloaded the distribution kit from the support web site.

Run the file setup.exe.

Page 18: Document1c

Core Development Techniques

18

Then select 1C:Enterprise 8 components that you want to install and specify the installation directory.

Alternatively, you can install the recommended component set and use the

default installation folder.

At the end of the installation you are offered to install a HASP device driver

(the driver installation files are always copied to the platform installation directory).

Page 19: Document1c

Tutorial

19

This driver allows you to use a local technological platform protection key (purple, marked ORGL8) for working with your applied solution.

If you want to use a network key to protect multiple computers running your applied solution, you only need to install the HASP device driver on the

computer where the protection key is physically installed.

Network keys have red color, and their labels may vary. The list of valid labels is available in the platform documentation.

As a rule, network keys are used at the enterprise level. You can use multiple network keys simultaneously, but in this scenario certain rules

apply.

To use network protection keys, in addition to installing the HASP device

driver, you need to install dedicated software on the computers where network keys are installed. This software (as well as the HASP device driver) is included in the HASP License Manager delivery kit as a separate

installation file, rather than a technological platform component.

Individual installation of the technological platform on each computer across

the whole enterprise is not feasible. There are ways to automate platform installation and upgrade, which significantly simplifies this task.

Note that installation is required for correct operation of this technological platform. If you copy an installed platform to a different computer, the copied platform will have the following limitations:

The platform cannot be updated.

You will not be able to add or remove components.

You will not be able to work in the client/server mode.

Some options of common infobase lists, 1C shortcuts, and some other features will be disabled.

Page 20: Document1c

Core Development Techniques

20

Installed platform versions are shown in Add or Remove Programs.

Correct installation of the platform allows prompt changes in the list of

platform components by adding or removing them.

After client applications of the technological platform have been installed, commands for starting applications are added to the Start menu.

A shortcut is placed on the desktop.

When you start a client application of the technological platform, a window

prompting you to select an infobase and the platform mode is displayed. The following modes are available:

Standard 1C:Enterprise mode (thick client).

Light 1C:Enterprise mode (thin client), which does not include

Designer.

Page 21: Document1c

Tutorial

21

Configurations also have distribution kits.

A configuration can be described as a type of applied solution you design.

You can create an unlimited number of applications based on a specific configuration. Templates2, i.e. configurations installed as external files in

certain directories, help handle this task.

You can install configurations independently from the technological platform. 1C:Enterprise distribution packages might include standard

configurations, which are shown in the AutoRun window.

You can also install a configuration by running the configuration installation

file:

The wizard page specifies the name of the installed configuration (this is not

something you can find out from the configuration file name).

2 The use of templates is described later in this course.

Page 22: Document1c

Core Development Techniques

22

Then the setup program prompts you to specify the directory for storing configuration templates.

If the specified directory does not exist, the setup program creates it and then records the configuration template file and the configuration

description (manifest) file to this directory.

The creation of an applied solution is described later in this document.

Usage scenarios

The technological platform contains many tools for developers,

administrators, and users. To optimize task-based operation and release some load from your PC, 1C:Enterprise 8 developers created several startup

options.

First, they defined the major business application usage scenarios:

configuration and administration;

usage.

Developers and administrators often work with tools that users do not need:

configuration editing tools;

Page 23: Document1c

Tutorial

23

administration and testing tools;

applied solution debug tools.

These are operated through the "thick client"3. It is a 1С:Enterprise 8 client application4, which allows you to use all 1С:Enterprise 8.2 functionality,

including development, administration, and application code execution. However, it does not support web interaction with infobases, requires pre-installation on a user’s computer, and has a large-sized distribution kit.

End users, however, are another matter. They generally only need to input data and receive data processing output. The "thin client"5 and the "web

client" were therefore created for them.

The following table shows the comparison of the client applications:

THICK CLIENT THIN CLIENT WEB CLIENT

Applied solution development Yes No No

LAN-based infobase access Yes Yes Yes

Internet-based infobase access No Yes Yes

Installation is required Yes, large

distribution kit

Yes, small

distribution kit

No

Operation modes

The technological platform is highly scalable; it allows running applied solutions to support operation for a single user, as well as for an unlimited

number of users.

To select the optimal operation mode, as well as data storage and distribution methods, consider the number of concurrent users of the

applied solution:

A single user

3 The "thick" client got its name because it provides enriched platform functionality

independent of the server.

4 The thick client executable file is 1cv8.exe (operating systems of Windows family only).

5 The "thin" client supports limited functionality of 1C:Enterprise script. The thin client

executable file is 1cv8c.exe (operating systems of Windows family only).

Page 24: Document1c

Core Development Techniques

24

A group of users

Groups of users with a distributed data storage structure (we’ll review

it later, after we create an applied solution)

File Mode

If an application is operated by a single user, there is no need to complicate the internal mechanisms. User experience related to the installation and

operation of the application should be as simple as possible. This operating mode should offer significant cost reduction.

Which user categories can use this mode?

Developers, for creating and modifying applied solutions both

individually and in a group (group development will be reviewed later).

Administrators, for performing scheduled applied solution

maintenance tasks and setting user access parameters.

Users (the main target audience of this applied solution), for working

individually with their regular database or test database.

To support the capabilities listed above, platform developers created the file mode. It provides the following advantages:

User-friendliness:

• simple installation;

• no need to use additional software;

• no need to use a server.

Page 25: Document1c

Tutorial

25

Standard platform functionality is sufficient for all data storage tasks:

• for security purposes, the platform uses a proprietary file

format;

• to ease maintenance, all data is stored in a single infobase

file (this includes user authorization data).

Users can start client applications in the light mode (with less strict system requirements).

After minimal customization, users have the option to access the system using a web browser, both on Windows and Linux operating systems. This

makes the requirements to user workstations even less strict.

Let us summarize the usage scenarios and operation modes in a diagram.

As was mentioned above, the file database comprises a single file. The file name is 1Cv8.CD. It stores all infobase data (which includes configuration,

database, and administrative data) in the file mode.

The file database is managed by a proprietary file DBMS and is part of the

platform. The following permissions are required to work with the database: read/write access for all infobase files and for the directory where they

reside. This directory can be maintained on any network resource (running Microsoft Windows, Linux, or any other operating system) provided that it is accessed from a computer running Microsoft Windows.

For the purposes of this course, we will use the file mode since this is the only work mode supported in the 1C:Enterprise 8.2 training version.

Client/Server Mode

During business application's life, the demand for additional user capacity may arise, potentially leading to technical issues in the following areas:

data storage;

load distribution;

multiuser data access;

Page 26: Document1c

Core Development Techniques

26

limiting direct access to database files;

and many others.

As was noted above, the technological platform is designed to handle technical tasks related to system operation, so you only need to update

your applied solution to a new client/server level to enable new capabilities.

The client/server mode is designed for workgroups or enterprise-wide operation. It is implemented on the basis of three-tiered client-server

architecture.

Cluster-based ideology allows deploying 1C:Enterprise server software on any number of computers, thus offering unlimited scalability.

Use of a 1C:Enterprise 8 server cluster allows transferring most resource-consuming data processing tasks to the server side. In this scenario the

end-user software only retrieves the query results, regardless of the query complexity, while the server handles intermediate processing tasks. Upgrading the server cluster for additional processing power is easier and

more feasible than replacing the whole park of client computers.

Database server operation is supported with a DBMS. A DBMS is a program

(or a set of programs) that organizes and maintains a database.

1C:Enterprise 8.2 server clusters support four types of third-party DBMS:

Microsoft SQL Server;

Page 27: Document1c

Tutorial

27

Postgre SQL;

IBM DB2;

Oracle Database.

A 1C:Enterprise 8 server cluster and a database server can be physically

stored on the same computer or on different computers. This provides capabilities for flexible load distribution between servers.

The client/server mode provides end users with multiple options for

connecting to applied solutions:

Development tools

Development and operation of an applied solution are separate processes.

Combining them may cause many issues for users, administrators, and developers (this is similar to changing tyres on a moving vehicle: the driver, the mechanic, and the passengers will probably all be unhappy with that).

To simplify the modification of applied solutions, 1C:Enterprise features a set of tools supporting "hot mode" development and maintenance. This

process may be compared to servicing race cars during a race. Changes are implemented swiftly and accurately in order not to impede or delay user

operation.

We will review this process at the methodological level and reinforce the knowledge through exercises. To begin with, let us review the general

Page 28: Document1c

Core Development Techniques

28

procedure used to develop, support, and operate applied solutions in 1C:Enterprise 8:

We will use this procedure to practice developing, updating, and operating

an applied solution during the whole course. We will start with the creation and installation (deployment) of an applied solution.

Development of an applied solution

First of all, we need to define what kind of a client application we will be

creating. Since we are the developers, we will use the thick client as a client application for development.

We will use the thin client to interact with the database, except for cases when applied solution updates are required.

As we know, an applied solution requires a configuration. But what if we

design our business application "from scratch"?

In this case the technological platform creates an empty configuration – a

structure to be filled with initial settings later. We will also need an infobase

Page 29: Document1c

Tutorial

29

for storing both data and configuration (which is the basis for our applied solution).

We will use separate infobases for development and operation. Let us place them into different folders in the 1C:Enterprise 8 startup window:

However, the option to create a folder is absent.

This is correct because the availability of this option depends on the infobase list display method. We need to display the infobase list as a tree:

A hierarchical view icon appears in the upper left corner of the infobase list:

Let us create a folder6 called "Core development techniques", and two

folders inside this group: "Development" and "Operation".

6 Use the Add button.

Page 30: Document1c

Core Development Techniques

30

During this course, an end-to-end applied solution will be developed according to the diagram shown below.

The development consists of the following steps:

1. Design of the applied solution

2. Design of the applied solution delivery kit

3. Installation of applied solution templates

4. Development of the applied solution

5. Enabling group development

6. Development of an update for the applied solution

7. Updating the applied solution

Page 31: Document1c

Tutorial

31

Task 1. Creating an infobase for application development

In the "Development" folder, create a file-mode infobase. Name it "Main development base" and place it here:

"C:\1C\Infobases\development\main".

Solution

1. Select the Development folder, click Add, click Create a new

infobase, and then click Next.

2. Click Create an infobase without configuration to develop a new configuration or restore a previously dumped infobase7, and then click Next.

7 If the client license is not available on your computer, the option to create an infobase

without a configuration is absent. You only have the option to create an infobase from a

template.

Page 32: Document1c

Core Development Techniques

32

3. Specify the infobase name and location, and then click Next.

4. Specify the infobase directory and language, and then click Next.

5. Select the startup mode (thick client) and the platform version (8.2),

and then click Ready.

Page 33: Document1c

Tutorial

33

6. Verify the resulting infobase name and location.

Task 2. Registering an infobase for application

execution (without creating it)

In the "Operation" folder, create a file-mode infobase. Name it "Central infobase" and place it here:

"C:\1C\Infobases\use\central".

Solution

1. Select the "Operation" folder and click Add.

2. Click Add an existing infobase to the list and then click Next.

Page 34: Document1c

Core Development Techniques

34

3. Specify the infobase name and location, and then click Next.

4. Specify the infobase directory and then click Next.

5. Select the startup mode (thick client) and the platform version (8.2), and then click Ready.

Page 35: Document1c

Tutorial

35

6. Verify the resulting infobase name and location.

Starting and customizing Designer

The "thick client" is the main developer tool. It allows you to use the following modes:

"Designer", which is used for modifying and debugging the applied solution.

"1C:Enterprise", which is used for data input and functional testing.

To customize Designer for your needs, on the Tools menu, click Options.

Pay attention to setting the application startup mode on the General tab (introduced in platform version 8.2):

It defines not only Designer appearance (for instance, the content of tabs in Designer settings),

Page 36: Document1c

Core Development Techniques

36

but also the availability of certain properties and structural elements of the configuration.

Page 37: Document1c

Tutorial

37

Designer includes an embedded text editor. It is one of the development tools, which is used for editing text documents and software modules of the

configuration. It provides the basic text and software module editing functionality. 1С:Enterprise 8 Designer uses this editor in two modes:

editing text documents;

editing module script (as part of the form editor).

The Texts and Modules tabs allow you to specify text editor settings for

these two modes.

The figure shows which settings are related to text and script editing:

1 – text editing only;

2 – both text and script editing;

3 – script editing only.

The example below shows both editor modes:

Script editing (for a common module)

Text editing (for a readme file)

Page 38: Document1c

Core Development Techniques

38

Text is displayed in different fonts in these two windows. Spaces and tabs

are marked by special characters in both windows. Color highlighting is only enabled in the module editing window.

Distinct visual styles make text editing more comfortable.

Both text editor modes are described in more detail and with practical examples later in this course.

The 1C:Enterprise startup tab provides settings for starting applications from Designer.

Page 39: Document1c

Tutorial

39

The Help tab allows you to customize the display and contents of the reference materials.

Page 40: Document1c

Core Development Techniques

40

The menu bar and the toolbars are designed for enriched usability.

If a feature is not currently accessible, the corresponding menus are hidden, while toolbar commands and items belonging to these menus are unavailable. For example, the Text menu is only displayed while you are

editing a text or script:

The Text menu is only available while the cursor is in the text editor window. Otherwise the Text menu contains unavailable commands.

Page 41: Document1c

Tutorial

41

Designer provides options for customizing the menu bar and the toolbars, as well as for creating custom toolbars:

To customize the menu bar and toolbars, on the Tools menu, click Customize.

To remove menus or toolbar items, drag them to the Designer work area

while the Main menu setup window is on the screen. For example, you can remove the File menu, as shown on the following figure.

Page 42: Document1c

Core Development Techniques

42

To restore the default view of the menu bar or a specific toolbar, in the Main menu setup window, select Main Menu or the toolbar name, and

then click Reset.

To show or hide toolbars, on the Toolbars tab, select or clear the check boxes next to their names.

To add commands to a toolbar, drag them from the Commands tab to the toolbar.

To create a custom toolbar, on the Toolbars tab, click Create, enter the toolbar name, and then click OK. Then drag commands from the Commands tab to the new toolbar.

Page 43: Document1c

Tutorial

43

You have the option to show or hide toolbars using the shortcut menu in the Designer window:

For detailed information on interface customization options, see the embedded Help files:

Page 44: Document1c

Core Development Techniques

44

Major developer tools

This section provides an overview of the major Designer tools. Their practical application will be explained with examples later during this

course.

Let us start with some common Designer tools:

working with files;

service tools;

Page 45: Document1c

Tutorial

45

pane customization;

global help.

You can customize your applied solution using the following main menu sections: Configuration, Debug, and Administration.

Page 46: Document1c

Core Development Techniques

46

The Configuration section allows you to work with the current configuration of the applied solution:

This includes the following functionalities:

creating infobase structure;

applied solution update;

collaborative development;

applied solution delivery;

verification of current configuration;

and other configuration-related activities.

Designer includes multiple wizards and editors for creating and modifying applied solutions. These will be reviewed in the exercises later in the

course.

The Debug menu provides access to the tools that simplify development

and debugging of 1C:Enterprise 8 software modules.

Page 47: Document1c

Tutorial

47

The debugger provides the following functionality:

search and correction of algorithm errors;

algorithm optimization for higher execution speed and reduced

number of calls, and determining optimal place of execution;

Page 48: Document1c

Core Development Techniques

48

extra algorithm-building functionality not covered by embedded text editors - for example, looking up values of parameters passed to a

procedure or function.

For more information on the use of the debugger, see the corresponding

sections of this course.

The Administration section provides access to the tools for administering

the applied solution and the infobase (for both file and client/server modes).

Specific administration tools of the file and client/server work modes are

presented as separate applications and are not included in Designer interface. For more information on these tools, see "Chapter 7. Service and

Maintenance" in part 2 of this tutorial.

Interface Language of the Platform

The multi-language interface of the platform allows creation of applied solutions for users who do not speak English. In addition to that, developers

can switch the platform to their native interface language during application development.

Page 49: Document1c

Tutorial

49

Once a platform interface language is selected, the following elements are displayed in this language:

system menus;

system dialogs;

system messages;

online help.

To be able to use an interface language, you have to install it from the

platform distribution kit.

You have the option to select one of the available interface languages (for example, Russian) as a default one, which allows you to conduct

development is this language:

You also have the option to select the interface language at the startup of the client application.

Page 50: Document1c

Core Development Techniques

50

The language selected at the startup of 1C:Enterprise 8 does not limit the use of the infobase in any way. Multiple users having different interface

languages can work with a single infobase simultaneously. You have the option to run multiple instances of 1C:Enterprise with different interface

languages on a single computer.

The standard platform distribution kit includes the following interface languages:

Bulgarian;

English;

Georgian;

German;

Kazakh;

Latvian;

Lithuanian;

Polish;

Romanian;

Russian;

Ukrainian;

Vietnamese.

The localization of the Russian interface into other languages has been performed by 1C company in cooperation with a number of Russian and

foreign companies.

UNICODE Support

The multi-language support in 1C:Enterprise is facilitated by storing all configuration and database texts in the UNICODE format. This format

supports concurrent use of characters belonging to different languages in any text data. Therefore, the user can enter data in different languages (for example, if a product description or contract text should be stored in the

manufacturer’s language). In this scenario, the texts are displayed properly, and both the search and sorting functions are supported.

Localization of Applied Solutions

In addition to selecting the interface language for standard platform

commands, you have the option to specify different languages for forms and other interface objects that you create.

You can add multiple objects of Language type to your configuration.

Page 51: Document1c

Tutorial

51

Since all configuration and database texts are stored in the UNICODE format, each text string can have multiple display options, one for each of the available interface languages.

If you are creating a multilanguage application, you have the option to

switch between the languages using a couple of clicks. This option is handy for form development because it allows quick switching between the form

layouts in different languages, for example, English and then Spanish.

Page 52: Document1c

Core Development Techniques

52

You can assign a default language for each user that has access to the infobase. The interface texts are displayed to each user in their default

language.

Since the interface of an applied solution might be very large and complex, the platform provides a tool for editing interface texts.

The tool for editing interface texts is essential for localization of applied

solutions. The most complex part of localization is finding the places where the text is to be entered in the required language. The interface text editing

tool automates the finding and grouping of all occurrences of a specific string in the configuration and allows one-touch replacement or addition of this string in another language.

This tool is a part of Designer. To access it, on the Edit menu, click Edit interface texts.

The tool allows you to aggregate all interface texts so that you can quickly and easily specify their localizations into languages supported by your

configuration.

Page 53: Document1c

Tutorial

53

You have the option to specify the applied solution part whose texts you want to aggregate:

You can choose to search for texts in the entire applied solution, external files, open documents, or specific elements of the applied solution, such as

a data processor form:

Search results are presented as a list containing the locations of text strings

and their localizations to different languages.

For the purposes of convenience, you can collapse the list to hide the

strings that are identical in all languages, or to hide the strings that are identical in a specific language.

Page 54: Document1c

Core Development Techniques

54

You can navigate to the element of the applied solution that contains the

selected string with a mouse click, as well as edit string values directly in this list:

Localization to multiple languages is performed by specifying each string value in each of the languages.

Support of Regional Date and Number Format

Regional date and number display formats and text sorting rules are

supported for all major European languages. You can configure your applied solution to use the regional standards of the countries that speak the given

language. The infobase administrator can choose between the default operating system settings and their own custom settings.

Two Script Variants

The script is actively used in the development of an applied solution. You

can use it to describe custom algorithms of your applied solution. All script operators have English and Russian versions, and you are allowed to mix

English and Russian operators in a single script fragment. You do not need

Page 55: Document1c

Tutorial

55

to change any Designer settings for this; the Designer is capable of processing operators written in both languages. The Russian documentation

and the Russian Syntax Assistant contain English syntax and synonyms for all script operators.

Internationalization Support in the Script

The script contains a number of functions that support internationalization:

NStr() — extracts the string in the required language or in the default language of the current user from a set of strings in different

configuration languages. For example, executing the following code:

Message = New UserMessage;

Message.Text = (NStr("ru = ""Добрый вечер!""; en = ""Good evening!""",

"en"));

Message.Message();

results in displaying the following message:

To simplify the creation and editing of the string that goes to the first parameter of this function, the platform offers a multi-language string

designer, which can be called using the shortcut menu in any module:

Page 56: Document1c

Core Development Techniques

56

PeriodPresentation() — generates a presentation of a time period

in one of the languages supported by the platform. The period is specified by its start and end dates. For example, executing the

following code:

CurrentDate = CurrentDate();

BeginOfPeriod = BegOfMonth(CurrentDate);

EndOfPeriod = EndOfMonth(CurrentDate);

Message = New UserMessage;

Message.Text = (PeriodPresentation(BeginOfPeriod, EndOfPeriod,

"L=en_US") + Chars.LF +

PeriodPresentation(BeginOfPeriod, EndOfPeriod, "L=uk_UA"));

Message.Message();

results in the following period presentation in English and Ukrainian:

Page 57: Document1c

Tutorial

57

Generation of period presentations is supported for the following languages:

• Belorussian;

• Bulgarian;

• English;

• Estonian;

• Finnish;

• Georgian;

• German;

• Kazakh;

• Latvian;

• Lithuanian;

• Romanian;

• Russian;

• Ukrainian;

• Vietnamese.

NumberInWords() — generates a presentation of a number as text according to the specified template in one of the languages supported by the platform. For example, executing the following code:

CurrentDate = CurrentDate();

BeginOfPeriod = BegOfMonth(CurrentDate);

EndOfPeriod = EndOfMonth(CurrentDate);

Message = New UserMessage;

Message.Text = (NumberInWords(1457.25, "L=en_US", "dollar,

|dollars

|cent,

|cents,

|2") + Chars.LF + NumberInWords(1457.25, "L=uk_UA", "гривня,

|гривнi,

|гривень,

|ж,

|копiйка,

|копiйки,

|копiйок,

Page 58: Document1c

Core Development Techniques

58

|ж,

|2"));

Message.Message();

results in the following number presentation in English and Ukrainian:

Generation of number presentations is supported in the same languages as generation of period presentations.

Format() — creates a value presentation that is convenient for the reader. This presentation can use formatting standards of the

selected language or country. For instance, presentations of Boolean, number, and date values:

CurrentDate = CurrentDate();

BeginOfPeriod = BegOfMonth(CurrentDate);

EndOfPeriod = EndOfMonth(CurrentDate);

Message = New UserMessage;

Message.Text = (Format(True, "L=en_US")) +

Chars.LF +

Format(True, "L=uk_UA");

Message.Message();

Message.Text = (Format(1475.25, "L=en_US")) +

Chars.LF +

Format(1475.25, "L=uk_UA");

Message.Message();

Message.Text = (Format(20010820105635, "L=en_US")) +

Chars.LF +

Format(20010820105635, "L=uk_UA");

Message.Message();

will look like this in English and Ukrainian:

Page 59: Document1c

Tutorial

59

The Format() function allows you to generate value presentations

based over 80 regional settings.

Setup Interface Languages

The installation program displays all of its messages in the language that matches the operation system regional settings. For example, if Latvian

regional settings are used, it displays all of the messages in Latvian, and if English settings are used, it displays all of the messages in English.

The following interface languages are available in the installation program:

Bulgarian,

English,

German,

Latvian,

Page 60: Document1c

Core Development Techniques

60

Lithuanian,

Polish,

Romanian,

Russian,

Ukrainian.

The installation program allows you to install multiple platform versions on an end-user computer or on any other computer that runs a part of the

platform (such as computers running server clusters or web servers).

On startup, the installation program automatically selects the interface

language that matches the regional settings of the computer. You have the option to specify desired interface language of the installation program in its

command line parameters.

Languages of Accompanying Files

The accompanying files that describe platform changes are provided in English and Russian languages.

Syntax Assistant

The Syntax Assistant is a development tool that provides quick hints on

script syntax while you are writing the script.

The Syntax Assistant is implemented as a part of Designer. It contains

information on script objects, their properties, methods, and related events. At the top of the Syntax Assistant window, a tree view of a list of script elements is displayed. It includes operators, procedures, functions, system

Page 61: Document1c

Tutorial

61

constants, and so on. For the purposes of convenience all the script elements are grouped by type in the tree branches.

For each property, method, or event the lower part of the Syntax Assistant window provides details on its syntax, parameters, and usage. The Syntax

Assistant supports hyperlinks to descriptions of other script objects, which allows quick navigation to required information.

Selection by Context

The Syntax Assistant can display all available information, or just its part

that is related to the selected execution contexts:

For example, you can choose to view only objects, methods, and properties

that are available in the thin client.

You can choose contexts directly from the Syntax Assistant window.

Alternatively, on the Tools menu, click Settings, click the Help tab and then select the check boxes next to the contexts that you want to use.

Page 62: Document1c

Core Development Techniques

62

Search by the Beginning of a Phrase

The Syntax Assistant allows you to perform text search by the beginning of

a string and then select the script object from the list of matching ones:

Page 63: Document1c

Tutorial

63

Full-Text Search

The Syntax Assistant supports full-text search. The search strings are highlighted.

Page 64: Document1c

Core Development Techniques

64

Context Help on Script Text

In the software module text editor, you can view the Syntax Assistant entry

for any script element by moving the cursor to this element and then using a hotkey or a shortcut menu item.

Then you can use the Find current tree element button to open the

Syntax Assistant tree for this element.

Page 65: Document1c

Tutorial

65

Inserting Script Blocks to Modules

You can drag script elements from the Syntax Assistant window to the

module text editor.

This inserts a template of the selected method or function into the module.

Quick Help in the Properties Palette

In the properties palette, you can quickly access reference information on

the selected method, property, or event using the shortcut menu.

Page 66: Document1c

Core Development Techniques

66

Note that this option is only supported for properties, methods, and events

that can be accessed using the script.

Runtime tools

Comfortable user experience is a major target of a business application. A clumsy user interface might negate all your efforts on creating an optimized

data storage structure and internal application streamlining.

Comfortable user experience includes the following:

Quick and easy learning

The user is not afraid to use the new software, and the learning curve should be gentle. The software provides hints on actions that the user

attempts to perform.

Quick interface customization

Whatever forms we may create, users still have their individual habits, and a customizable interface eases adapting the software to their needs. Users feel more comfortable when they are given tools

for customizing forms and the application interface.

(This may be compared to a driver adjusting the seat and rearview

mirrors for him or herself).

Quick data entry and search

Tasks such as customer service requests should be processed swiftly,

especially when support is provided by phone.

Visually compelling data view

Users should be able to quickly find the information they need in a list. Therefore, the information should be presented in accordance

with certain rules, hierarchically if needed, or filtered, or highlighted.

Access restriction system

Commands whose execution would result in "access denied"

messages should be hidden from the user.

Page 67: Document1c

Tutorial

67

1C:Enterprise 8 contains a number of tools and features that help you solve the abovementioned interface-related issues.

Window interface

The graphical tools available in 1C:Enterprise 8 ensure the highest level of efficiency for the following data presentation methods:

MDI (multiple document interface) where windows reside under a single parent window.

The main application window is the window that is opened when the

application is started in 1C:Enterprise mode.

SDI (single document interface) where individual windows are

handled separately.

Auxiliary windows include those that are opened by running commands that perform data input or object editing, as well as by

running reports and data processors.

Page 68: Document1c

Core Development Techniques

68

Task-oriented interface

Users start their work from the main window. It contains a high-level view of the application structure (the Sections panel) and the Desktop:

The Desktop is a standard application section that contains frequently used documents, reports, catalogs, and so on. This is a sort of user's assistant.

Each working day starts with some type of interaction with the Desktop. The Desktop informs the user of what’s going on and answers the user’s

questions, such as:

What needs to be done today?

What’s new?

What requires attention?

The Sections panel shows the largest functionality areas of the applied

solution. It is located in the upper part of the main window, and it contains the subsystems included in the configuration. It allows switching between the sections of the applied solution.

Page 69: Document1c

Tutorial

69

When you select a section, the entire functionality of the subsystem, including the embedded subsystems, is displayed as a set of commands8

grouped on two panels:

The Navigation panel can be referred to as the "contents" of a section. It contains commands that allow you to navigate to any part of the section.

Navigation commands usually open lists. When you run a navigation command, the program displays the list in the workspace of the current

section, replacing its previous content.

The Action panel contains the most frequently used commands for quick creation of new objects, performing standard data processing and building

common reports. Such commands are called action commands because running them opens a new window and switches you to another task.

8 Commands are actions that a user can perform. Some of them, known as standard

commands, are provided by the platform itself. Other commands have to be created by the

application developer.

Page 70: Document1c

Core Development Techniques

70

System commands

Buttons that run system commands are located in the title bar of the main window:

One of these buttons opens the main menu:

All your navigation choices are automatically saved in the history section of

the main window, and you can move across them just like you do with the web pages in your browser history. You can use the drop-down list to view

the entire list of navigation places and go to any of them:

Page 71: Document1c

Tutorial

71

You can add any section, list, database object, report, or data processor to the Favorites menu, so that you can go back to them later:

The right part of the title bar contains general commands that are not

related to any particular application:

You can obtain a link to any section, list, database object, report, or data

processor. You can send this link to your colleagues to let them quickly open the same data and make their changes.

Page 72: Document1c

Core Development Techniques

72

Page 73: Document1c

Tutorial

73

You have the option to add other commands to the title bar.

Additional features

The Information panel is displayed in the bottom of the main window:

History is a common interface feature. It is provided by the platform and is

available to users of any application. History contains the list of all user

Page 74: Document1c

Core Development Techniques

74

actions related to adding or editing data, including operations with catalog items, documents, and so on. You can always open the list of changes and

navigate to any object listed there. It can be useful, for example, if you want to make sure that the data have been modified correctly:

Performance indicators are a development tool. They let the developer see the number and duration of server calls and the amount of data sent

and received in real time, in 1C:Enterprise mode.

Server call delay emulation mode allows you to estimate actual

performance of your application from the user’s side.

This mode does not require Internet connection. All you have to do is turn

this mode on, and the platform (even in the file mode on a local computer) will start operating with the delays similar to delays of a real communication channel.

You can turn the server call delay simulation mode on or off while the client application is running. The session running in this mode is marked with an

icon in the information panel.

Recent notifications is a feature designed for quick access to recently entered data. If the last action includes data modification, clicking the

notification opens the form containing these data (for example, the form of a posted document):

Page 75: Document1c

Tutorial

75

Managed forms

Managed forms are the essential feature for displaying data in 1C:Enterprise 8.2.

Managed forms can display information in the desktop area of the main window:

You can add or remove forms. However, you cannot add arbitrary forms.

You only can add forms from the list created by the developer (the Available forms list).

Page 76: Document1c

Core Development Techniques

76

You can change the order of forms, or move them from one column to another (if your desktop has two columns). You cannot change the number

of columns on the desktop.

In a section, running a navigation panel command opens the associated list

in the workspace area, replacing any previous contents of this area.

But you have the option to open lists in new windows9:

9 To open a list in a new window, click the navigation command while holding down Shift.

Page 77: Document1c

Tutorial

77

The application dynamically creates managed forms. Users can customize

the appearance of managed forms by using the Change form command.

However, this option only allows you to add or remove form elements that were defined by the application developer, or by form autogeneration rules:

Page 78: Document1c

Core Development Techniques

78

Therefore, if you want to add some elements to display new data, you have to create and use your own managed form:

The added elements are displayed in the list of form elements that you can

add or remove.

Page 79: Document1c

Tutorial

79

You may want to use a calculation formula to perform some actions in the form, like calculating the total price based on the number of items and their price.

The platform itself does not know how the total amount should be calculated (information from the contract or the customer card may be

needed, for instance). To deal with it, you will need a form created by the application developer with a calculation algorithm included:

Page 80: Document1c

Core Development Techniques

80

&AtClient

Procedure SpecificationNumberOnChange(Element)

LineBeingChanged = Elements.Specification.CurrentData;

LineBeingChanged.Sum = LineBeingChanged.Count

* LineBeingChanged.Cost;

EndProcedure

In addition to that, you have the option to customize the view of list items. You can change not only the column set, but also how lines are displayed.

Page 81: Document1c

Tutorial

81

You have the following customization options:

Filter (setting data display filters)

Sorting (setting data sorting rules)

Page 82: Document1c

Core Development Techniques

82

Grouping (displaying data using hierarchies)

Any list can be shown hierarchically. Your data might look like this:

Conditional appearance (modifying data display rules and choosing to show additional data)

Page 83: Document1c

Tutorial

83

Your list might look like this:

Any of these settings can be defined both in development mode and individually for each user at run time.

You can also change the view of any list based on hierarchical data storage structure.

Page 84: Document1c

Core Development Techniques

84

Developing data storage structure

In 1C:Enterprise, applications are not written with a programming language directly. Naturally, the programming language is used, but only when this is absolutely necessary (for instance, to calculate taxes or verify input data,

etc.).

The entire application is described with metadata as a set of application

objects from a strictly determined collection of prototypes (classes). You can refer to created objects as to "business components", and their prototypes as "patterns".

A prototype is used to provide applications with a collection of subject-specific objects or processes with similar behavior and roles.

Catalogs, Documents, and Accumulation registers are examples of prototypes in 1C:Enterprise. The number of such prototypes is rather small

(about two dozen). This lets you quickly master them and use them to handle any subject-specific tasks.

Page 85: Document1c

Tutorial

85

Defining configuration types

You already know that there are various 1C:Enterprise 8 user groups

dealing with the application:

End users work with the data whose storage structure is defined in the configuration.

Developers determine the application model through the configuration.

Administrators use configuration and update files to modify the structure of the application.

In addition:

Developers must not interrupt end users’ work and must be able to save their own work. This implies that the developers must have their

own storage for intermediate configuration versions.

Administrators must be able to upload updates to appropriate recipients, i.e., the system must be able to "understand" to which

configuration the update is targeted.

Therefore, the technological platform must be able to support several types

of configurations within a single application to meet the demands of various user groups:

For end users: the configuration defining the current infobase

structure and the application model for the execution mode (with scheduled modifications only).

For developers: the configuration that stores real-time changes in the application model during the development and does not impact operations being performed by users (can be modified by a developer

at any time).

For administrators: the configuration that stores the structure of the

parent configuration (if available) to support updates (can be modified only when the main configuration is updated).

To deal with these challenges while taking into account integrity,

sustainability and safety requirements, the platform supports three configuration types:

Database configuration (for end users): cannot be edited interactively and is built by the platform itself based on the main configuration. It is present at any time.

Vendor configuration (for administrators): cannot be edited and is defined by the platform at the creation or update of the application.

Main configuration (for developers): changes can be introduced interactively or from other configurations.

Page 86: Document1c

Core Development Techniques

86

All three options are presented visually in the platform:

All three configurations can have different structure.

Page 87: Document1c

Tutorial

87

The main configuration window is used for editing the main configuration:

To view the configuration structure in the configuration window, upload it into Designer from the infobase by clicking Open Configuration on the

Configuration menu.

Designer then opens the main configuration in the configuration window.

You can use Designer for development of objects stored outside the configuration (such as external data processors and reports). In this case,

viewing the main configuration is not necessary.

The windows that display database and vendor configurations are only shown when the user accesses these configurations.

Page 88: Document1c

Core Development Techniques

88

How to view database configuration:

How to view vendor configuration:

Page 89: Document1c

Tutorial

89

Each configuration is represented by a tree-like structure, each branch describing a specific aspect of the configuration. Configuration objects can

be identified by their names in the configuration window. For example, on the following figure the Charts of characteristic types branch hosts

objects of all charts of characteristic types that are present in the configuration, while AdditionalDataAndAttributes describes a single chart of characteristic types of this name.

In the main configuration window, you can interactively create and delete

configuration objects, change their order, copy and move them, and filter them by subsystems unless the configuration window is locked, which means that making interactive (manual) modifications are disabled. The

blocking can be turned on due to the following:

The configuration is on full support.

The group development feature is turned on.

Page 90: Document1c

Core Development Techniques

90

The configuration is used for defining the structure of a distributed infobase and therefore cannot be edited.

The main configuration, which can be modified, can have one of the

following types:

A fully editable configuration (without a vendor configuration): all actions are allowed.

A partially supported configuration with certain restrictions on modifying it (the original objects cannot be deleted).

A configuration on group development with modifications enabled (the lock is present but it is unlocked, for more information see

"Chapter 7. Group Development" in part 2 of this tutorial):

You can use the shortcut menu of the configuration window (which is opened by right-clicking the window heading) to make the window docked, floating, or autohiding.

Page 91: Document1c

Tutorial

91

If the Dockable property of the window is turned off, the Docked and Autohide modes are unavailable.

To extend the area available for working with your objects, you can temporarily close the Configuration window.

Closing the Configuration window does not end your session with its

individual components that are open for editing: you close not the configuration, just the Configuration window.

With the Configuration window you can do the following:

create new configuration objects;

edit existing configuration objects;

delete configuration objects with checking if there are any references to the object being deleted;

place configuration objects within a group in your preferred order;

search the configuration tree for the object whose data is being edited (in the object editing window, or form/template/module

editor);

sort configuration objects that are subordinate to a specific

configuration object by name, synonym, or comment;

search for references to a configuration object in other configuration objects;

search for references to other configuration objects in a configuration object;

select configuration objects according to their membership in subsystems of the configuration;

start wizards related to a configuration object.

To make development faster and easier, there are four ways to modify the configuration:

by using shortcut menus;

by using keyboard shortcuts;

by using the toolbar;

by using the Actions menu of the configuration window.

Page 92: Document1c

Core Development Techniques

92

Each developer chooses the way they like most. Developers can switch from one way to another as they improve their skills. However, the perfect

scenario is when a developer uses various options depending on the context (this can be compared to knowing how to perform various tasks using a

mouse and using a keyboard).

First you have to determine the type of object you want to create. In the configuration tree, select the object type or any configuration object of that

type.

If adding objects is allowed, the Add button is available on the

Configuration window toolbar.

Adding objects is not allowed in the cases described earlier and also if the pointer is on the configuration name or on the Common branch.

In this example, neither an object type nor a configuration object is

selected. Some commands are unavailable when an object type (a first-level branch) is selected:

This restriction applies because no branches can be added or deleted.

When you create configuration objects that have complex structure, the

platform suggests using a wizard for editing configuration object properties.

Page 93: Document1c

Tutorial

93

The wizard allows you to do the following:

edit configuration object properties in the standard order, so that you

first specify property values that you can use later in the wizard;

edit configuration object properties in any order by navigating directly

to the desired property category;

edit predefined configuration object elements (if these are supported by the object);

open and edit object-related forms;

create objects that are subordinate to the object being edited

(resources, attributes, dimensions, forms, templates, and so on);

delete subordinate configuration objects with checking if there are any references to the objects being deleted;

search for references to the configuration object in other configuration objects;

search for references to other configuration objects in the current configuration object.

start wizards related to the configuration object.

Editable properties are organized into several tabs. Each tab contains a set of attributes for customizing the properties of a particular object type. You

can switch across the tabs using the Next and Back buttons.

Availability of certain tabs and controls on these tabs may vary depending on the configuration object type. Some objects types may have unique tabs.

For example, only documents have tabs Register records, Logs, and Sequences.

Page 94: Document1c

Core Development Techniques

94

The configuration object editing window displays many properties of the object, but not all of them. This is because this window is designed to help

you to create objects. Viewing all of the object properties at that time would be distracting.

You can then tweak object properties using a common tool for editing both complex and simple objects, the Properties palette. You can call the Properties palette from the shortcut menu of the configuration window:

or through the Edit menu of the main Designer window.

You can create new subordinate objects as follows:

1. Select an object where you want to add a subordinate object.

2. Open the object editing window (in the Configuration window, on

the Actions menu, click Change).

3. Specify the subordinate object types on the following tabs:

the Data tab contains subordinate objects of attribute and tabular section types;

Page 95: Document1c

Tutorial

95

the Forms tab contains subordinate objects of form type;

the Templates tab contains subordinate objects of template type;

the Commands tab contains subordinate objects of command type.

4. Click Add.

When the Properties palette is displayed for the configuration object being customized, the tabs display both main and additional property palettes.

The Properties palette allows you to edit all of the properties of a configuration object. The list of properties depends on the object type.

Page 96: Document1c

Core Development Techniques

96

The toolbar of the Properties palette has five buttons:

BUTTON ACTION

Sorts the properties alphabetically. If the

properties are sorted,

their categories are not displayed.

Groups the properties

by category.

Toggles between

displaying important properties only and all

properties.

Discards changes

made in the property

text box.

Page 97: Document1c

Tutorial

97

BUTTON ACTION

Saves changes made

in the property text

box

Categories of properties can be arranged into tabs or lists.

When properties are arranged in a list, it can be sorted by category or

alphabetically (in the latter case category names are not displayed).

When properties are displayed on tabs, the sort buttons ( and ) become unavailable.

The More menu item opens the additional properties palette.

The Comment menu item is used to display the detailed description of the selected configuration object property in the lower part of the properties

palette.

Page 98: Document1c

Core Development Techniques

98

Page 99: Document1c

Tutorial

99

The Display property names menu item toggles between displaying property names and property presentations:

Let us get back to the functions of the configuration editing window.

You can delete configuration objects only if they are not related to the parent configuration, i.e., the vendor configuration:

If object deletion is allowed and no other configuration objects contain references to this object, it is deleted.

Page 100: Document1c

Core Development Techniques

100

If there are references to the object (which means that the object is in use), the message "Object cannot be deleted, because other objects contain links

to it!" is displayed, and the message window displays the list of objects that refer to it.

To switch to an object that refers to the object you want to delete, double-click its name in the message window.

Page 101: Document1c

Tutorial

101

You can create an object by using the drag-and-drop functionality. When you drag an object (either within its branch or outside it), you create a new

object. At this moment, a check is performed to determine whether the object's original properties can be used in the resulting object. If the resulting object supports these properties, they are copied. For example,

attributes and templates of a catalog object are successfully copied to a document object.

If the original object contains subordinate objects (attributes, forms, templates, etc.), when you drag it to a "similar" level (for example, if you drag an object from the Currencies catalog to the Documents branch),

the attributes, forms, templates, and tabular sections are copied.

You can arrange configuration objects on the configuration tree in your

preferred order within their group of configuration objects. This order applies to various lists of configuration objects, too.

To move a configuration object, select it in the Configuration window and

then, on the Actions menu, click Move Up or Move Down. You can also sort configuration objects by clicking Sort on the Actions menu.

To search the configuration tree for the object that is being edited, on the Edit menu of the main Designer window, click Find in Tree.

To sort similar configuration objects subordinate to a specific configuration object, right-click a subordinate configuration object and then click Sort.

Select a property to sort by:

Name

Synonym

Page 102: Document1c

Core Development Techniques

102

Comment

Select the sorting direction:

Ascending

Descending

Judging from their interrelationship, all configuration objects can be divided into two groups: unlinked objects (for example, the Purchase price attribute, which has Number type), and linked objects (for example, the

Unit of measure attribute in the Items catalog, which is linked to the Units of measure catalog).

Sometimes it is useful to know which objects refer to a specific object, or which objects are linked to it. To do this, use the Find References to

Objects and Find References in Object commands from the Actions menu of the Configuration window. In the Find References dialog box, specify the search area and click OK. If there are references, they will be

listed in the message window.

The Find References in Object command on the Actions menu is useful

for objects that have composite types.

To follow a reference, double-click the line with the name of the linked object in the message window.

Page 103: Document1c

Tutorial

103

When the main configuration is uploaded to Designer, all Configuration menu items become available:

As you can see, there are many actions related to the main configuration besides editing.

Page 104: Document1c

Core Development Techniques

104

There is no need to open the main configuration to manage the database configuration.

In this case, only actions applicable to the database configuration are

available:

Open Database Configuration – view it in read-only mode.

Page 105: Document1c

Tutorial

105

Save Database Configuration to File (for instance, before updating from the main configuration).

If you want to manage the vendor configuration, first load the main configuration. Then, on the Configuration menu, point to Support and

click Support Options.

Page 106: Document1c

Core Development Techniques

106

The Support options window helps you check whether a vendor configuration is available:

Clicking the Enable modification button makes the main configuration available for modification.

If a vendor configuration is available, you can open and view it in a separate window:

Page 107: Document1c

Tutorial

107

Configuration objects and their classification

concepts

When a programmer wants to create an object representing some subject

area features, the common way is choosing the best prototype and then creating a metadata object (configuration object) based on it:

You can set various parameters defining the behavior of a prototype-based object, make some additions to the object data structure, implement the

methods that you need, define event handlers, specify display options for the object in the user interface, and so on.

By defining the object structure properly, you can enhance user experience and provide developers with better understanding of the application

Page 108: Document1c

Core Development Techniques

108

business logic, while reducing the number of code lines. If the right prototype for a configuration object is chosen, the platform itself provides a

variety of ways to process its data without extra programming.

Let’s go through an example to see what various configuration objects are

the best for.

First, look at the configuration object part that defines the data storage location and data structure.

Inventory information is stored as some data in the database. Real goods have some properties that have to be put into the program (not all of them

though) for they can help us identify products and find them rapidly in lists.

Product: ballpoint pen

PROPERTY VALUE

Product description Ballpoint pens

Item no. Р0100402

Product catalog

ITEM NO. DESCRIPTION

P0100402 Ballpoint pens

L0200101 Erasers

K0100101 Pencils

L0100101 Rulers

The data storage structure is defined at the level of applied object model description, not at table level.

Then the platform automatically creates all required tables based on this

description and uses them for storing the product information.

Page 109: Document1c

Tutorial

109

As you can see from the table view above, the object has some attributes

that have not been defined by user. These are standard attributes.

The presence of some standard attributes depends on the configuration

object settings, while other standard attributes are always there and are used by the system.

Standard attributes are defined at the system level; you can set their values

for specific configuration elements in Designer. They can be divided into mandatory properties (for instance, Ref, Predefined, and DeletionMark

for catalogs) and conditional properties (Owner, Parent, Code, and Description for catalogs).

Despite the fact that the platform stores data as tables, this data is

provided to users at run time not as tables but in the way familiar to them.

For example, a user who wants to view a product catalog will see a list with

available operations:

Page 110: Document1c

Core Development Techniques

110

If you want to view product details, you can open a form with properties of the selected product and available commands for filling the properties.

This form has several options to output object data, for example, through printing:

As you may have noticed already, each configuration object has its mandatory set of properties (Name, Synonym, and Comment) both in the

configuration object editing window and in the properties palette.

Page 111: Document1c

Tutorial

111

Name is always mandatory and must be unique.

It is used for creating links between objects.

Object names are also required to specify data processing rules. For example:

MyGoods = Catalogs.Goods.Select();

Synonyms define the user view of applied objects at run time. For example, you can see synonyms in the All functions menu.

Page 112: Document1c

Core Development Techniques

112

Synonyms can be set according to the particular UI languages:

Properties can be used for additional customization of object presentations in the command interface of managed applications:

Page 113: Document1c

Tutorial

113

The values of these properties (similarly to synonyms) can vary depending on the UI language.

Page 114: Document1c

Core Development Techniques

114

Comment is a property of the configuration object that points to its use cases. Some examples are:

Comment as a short description of the purpose of an applied object.

Comment as a reference to the code of an object creation request (in project implementations).

You can use comments not only in configuration object properties, but also in modules for documenting your algorithms:

Text = "Good evening!"; //Define message text

//Show message

Message(NStr(Text));

All configuration objects are combined by their type in the configuration tree.

Configuration objects can be divided into three major groups according to

their purpose:

Common objects: these objects define the ways of interaction

between users and the 1C:Enterprise information system (command interface, selection criteria, access rights, etc.) Common objects are grouped into a separate group of the metadata tree:

Page 115: Document1c

Tutorial

115

Applied objects: these objects represent entities from the application business area:

Page 116: Document1c

Core Development Techniques

116

Subordinate objects: these objects define the structure of complex configuration objects (such as applied objects),

and they also define the structure of some common objects:

Page 117: Document1c

Tutorial

117

You can define the structure of some configuration objects using the Type

property. Such objects are known as typed objects. Among the typed objects there can be applied objects (e.g., constants):

Page 118: Document1c

Core Development Techniques

118

and subordinate objects (e.g., catalog attributes):

You can choose one or several types for each value:

Composite type – the Composite datatype check box with several

types selected.

A type set – AnyRef type, CatalogRef type, and so on. The

structure of the set is defined by the platform automatically.

Page 119: Document1c

Tutorial

119

At run time, a type set can be converted to a composite data type or any

single data type.

For example, if CatalogRef is set as a type for the ManagementAccountsCurrency constant, and the configuration contains

a single catalog, i.e., Currencies, the result will be as follows:

In this scenario, there is only one way to define an empty value.

However, as soon as you add one more catalog, the type set will be

transformed into a composite type, and the empty value will be different.

Page 120: Document1c

Core Development Techniques

120

The platform verifies whether definitions of composite data types are correct. Composite types cannot contain the following types of values:

Page 121: Document1c

Tutorial

121

If you are trying to use an invalid type as a composite one, you will see one of the two possible messages:

When you are trying to include an invalid type in the composite type:

When you are trying to include a new type in a type that contains an invalid type:

Configuration objects can create new types of values.

For instance, when the Currencies catalog is created, a new type called CatalogRef.Currencies (used in the ManagementAccountsCurrency

constant) appears:

Such configuration objects are called type-forming objects.

If you try to delete a configuration object, the platform will check whether

its data types are found in the configuration structure, and if so, it will report an error.

Page 122: Document1c

Core Development Techniques

122

If no references to the object to be deleted are found in the configuration

structure, the platform will delete the object. But before deleting the object, it will ask the developer to approve the operation, since some data types

related to this object may be used in algorithms, and this cannot be checked by the platform at the development stage.

To avoid such problems, it is recommended that you perform a check across all modules before deleting (or renaming) a configuration object to make sure the object is not used in any of them. The most convenient way to

check that is using the global text search feature:

Page 123: Document1c

Tutorial

123

Tutorial: designing configuration structure

At the stage of configuration structure design, you are going to implement

as many features as you can using the standard platform mechanisms. This requires almost no programming. You will have to start programming later, when you need to process data or customize interface features.

You will perform the development in managed application mode. Therefore, before you start, you have to set up Designer and the configuration itself.

1. Configure Designer for the development of managed applications.

Page 124: Document1c

Core Development Techniques

124

2. Define rules for object creation in a managed application.

The tutorial parts that describe creation of configuration objects will only cover topics related to data storage structure.

Using common applied objects

The first step towards development success is the correct choice of

configuration objects. We will discuss other steps later.

There are lots of subject entities10 that you can use in different areas of

accounting and document flow at the same time. We will talk of configuration objects for storing these entities as of common applied objects.

Constants

Constants are application objects storing data values that do not change in time, or change rarely, while legacy values are no longer required in the

infobase. Each constant provides storage for a single value.

Task 3

Create a constant in the configuration to store the value of the

Company name parameter. The parameter will be entered as plain text, up to 1024 characters. The parameter value is ALPHA.

10 A subject entity is a way for representing an accounting object in the information system

for performing specific tasks.

Page 125: Document1c

Tutorial

125

Solution

1. Right-click the Constants item in the configuration tree, and then

click Add.

2. Specify the name, synonym, length, and type.

3. Run the application in the 1C:Enterprise mode, enter the value

"ALPHA", and write it.

Task 4

Create a constant in the configuration to store the value of the Connection limit parameter. It is a number in the range between 0 to 5. The parameter value is 3.

Solution

1. Right-click the Constants item in the configuration tree, and then

click Add.

Page 126: Document1c

Core Development Techniques

126

2. In the General property group, specify the name, synonym, and type.

3. Specify the numeric value range in the Presentation group of

properties.

4. Run the application in the 1C:Enterprise mode, enter the value "3", and write it.

If you attempt to enter a value that is out of the specified range, the following warning will appear:

Page 127: Document1c

Tutorial

127

Task 5

Time: 20 minutes

Create the following constants:

# DESCRIPTION DATA TYPE VALUE

1 ActivityBeginDate Date (composite date)

01.01.1980

2 MaintainInventoryAccounting Boolean True

3 CompanyLogo ValueStorage

4 TechnologyServicesDayOfWeek String (10)

5 DataExchangeInterval String (10)

6 ParentOrganization String (10)

Enumerations

Enumeration is an auxiliary data type that is not used separately, but often

used together with other data types.

Enumeration objects store value sets that should not be changed at run time.

You can create as many enumerations in your application as you want.

To simplify viewing of enumeration data, the platform supports two kinds of enumeration forms: list form and selection form. The list form gives you

advanced view of the enumeration values, while the selection form presents enumeration values in a format that makes selecting one of them easier

(unless the list is too long). You can select an enumeration from a form, or by using the quick selection feature.

You can use enumerations to eliminate possible errors (the human factor)

when all possible values are known.

Page 128: Document1c

Core Development Techniques

128

You can specify enumeration values only by entering them in Designer. You cannot create, modify, or delete enumeration values at run time. Names of values are unique, and you can use synonyms to present values in various

locales. If a synonym is not set, the presentation is created automatically based on the value name (consider this when developing multilanguage

applications).

If you cannot determine a complete set of possible values in advance, do not use enumerations because otherwise your users will not have the option

to add their own values at run time.11

Task 6

Redefine the method for setting the

MaintenanceDayOfWeek constant from specifying a string value to selecting from a set of possible values.

Solution

1. Create an enumeration called DaysOfWeek.

2. Specify that the values for the MaintenanceDayOfWeek constant

should be chosen from the enumeration you have created.

11 We will discuss this case in the "Catalogs" section on page 129.

Page 129: Document1c

Tutorial

129

3. On the Data tab, add the enumeration value as shown on the following figure:

Task 7

Time: 3 minutes

Add the following data as values of the enumeration DaysOfWeek:

NAME SYNONYM

Day2 Tuesday

Day3 Wednesday

Day4 Thursday

Day5 Friday

Day6 Saturday

Day7 Sunday

Create another enumeration named Gender with the following values:

NAME SYNONYM

M Male

F Female

Catalogs

Catalogs are used mostly to store lists of relatively constant data. For

example, value sets that allow adding data, such as lists of goods and materials, employees, contractors, and so on.

Page 130: Document1c

Core Development Techniques

130

Catalogs can have hierarchical structure. The number of hierarchy levels can be unlimited, or you can use platform tools (with no programming) to limit the number of levels up to 10:

A hierarchical catalog can have a group or an item as its parent:

A catalog can be subordinate to another catalog, chart of characteristic types, chart of calculation types, or chart of accounts12, or to several

objects at the same time:

12 You can think of charts of characteristic types, charts of calculation types, and charts of

accounts as catalogs tailored for specific tasks.

Page 131: Document1c

Tutorial

131

Groups inside a parent catalog can have subordinate items in other catalogs:

The length of the standard catalog attribute Code is limited by 50 characters for string values and 38 characters for numeric values. The length of a catalog description must not exceed 150 characters. If the code

length or catalog description length is set to 0, these attributes are disabled.

You can use the properties palette to set an additional parameter Allowed Length for a string code.

Page 132: Document1c

Core Development Techniques

132

Catalog items can be presented at run time (for example, in selection fields) only as codes or descriptions:

You can use the standard platform feature Check uniqueness to ensure that catalog codes are unique.

Depending on the catalog settings, some standard (system) attributes13 are

enabled or disabled. You can view and customize these attributes in the list of standard attributes in Designer:

13 Catalogs are not the only objects that have standard attributes.

Page 133: Document1c

Tutorial

133

Names of standard attributes are predefined and cannot be changed.

However, you can specify their synonyms.

Besides the standard attributes, you can also define attributes and tabular sections14 to implement the business logic of the application. Tabular

sections of a catalog are responsible for storing data that is related to specific catalog items but does not need to be referenced from other

objects.

A catalog can have any number of attributes and tabular sections.

An attribute is a property of an item with a single value.

A tabular section is a property of an item with multiple values.

14 Names of attributes and tabular sections must not match the names of standard

attributes.

Page 134: Document1c

Core Development Techniques

134

You can define how an attribute or a tabular section should be used.

In some cases you might need to enable attribute indexing15:

Catalog attributes can have the following data types: primitive, reference, composite, ValueStorage, and UUID:

15 For example, if you want to use an attribute in the "Input by string" feature, or search for

an item by an attribute. Note that this is not available for some attribute types.

Page 135: Document1c

Tutorial

135

When you define an attribute, you can set the default attribute value for new items.

For primitive types:

Page 136: Document1c

Core Development Techniques

136

For reference types using predefined items:

1С:Enterprise 8 catalogs may contain predefined items and groups of items (for hierarchical catalogs)16:

16 For a catalog with owner, you cannot create predefined items. Also, you cannot specify an

owner for a catalog with predefined items.

Page 137: Document1c

Tutorial

137

They can be used, for example, to directly reference a specific catalog item (by its name) in Designer, or to set some items explicitly at the

development stage.

Predefined items cannot be deleted by users working in 1C:Enterprise

mode.

When a predefined item is deleted in Designer, the item is not deleted physically. Instead, it is transformed from a predefined item into a common one marked for deletion. A common item marked for deletion can be

deleted physically later (only at run time).

Only basic properties (name, code, and description) can be specified for

predefined items in Designer.

You can use the item name in script expressions.

Values of other attributes of a predefined item are specified in 1С:Enterprise mode.

The icons of predefined items in 1С:Enterprise mode look different from the

icons of user-created items.

Page 138: Document1c

Core Development Techniques

138

The Designer operates with configuration objects, while 1C:Enterprise

(runtime) mode operates with catalog items.

You can delete an item using the platform user interface:

or using the script:

The platform supports interactive object deletion (by pressing Shift+Del). However, this feature is disabled in standard solutions by user right settings. It can be very useful if enhanced with custom algorithms.

Do not confuse marking for deletion with the actual deletion of an object. If an item (or a group) is marked for deletion, it will remain in the catalog but

will be shown with a special mark.

Items with deletion marks are included in the search and, in most cases,

are visible to users. To delete the catalog item completely, in the All functions list, under Standard, click Delete Marked Objects.

Page 139: Document1c

Tutorial

139

Task 8

In this exercise you will optimize setting the value of the

DataExchangePeriod constant by selecting values instead of entering a string. You will let users to select values from the

options defined at the development stage (in Designer) and implement a feature to let users extend the list of available options in 1C:Enterprise mode. In this case enumerations will

not do anymore, so we are going to use a catalog. However, from the users' point of view it looks the same as when we

used the MaintenanceDayOfWeek constant.

Complete the previous examples before proceeding with this

one.

Solution

1. Create a catalog named TypesOfExchangePeriodicity.

2. Change the constant type to CatalogRef.TypesOfExchangePeriodicity.

Next, let us customize the TypesOfExchangePeriodicity catalog to set up user interaction pattern similar to working with enumerations.

3. Turn on the standard platform feature Check uniqueness to ensure that catalog codes are unique. Select to use the standard attribute Code as a string and disable the standard attribute Description. Set

the default presentation to As code.

4. Change the code synonym (its name as it is displayed to users) and enable the system fill check for your code.

Page 140: Document1c

Core Development Techniques

140

5. Turn off code autogeneration for new catalog items.

6. Enable quick selection of this catalog upon all calls and disable input

by string by description.

Page 141: Document1c

Tutorial

141

7. Create a predefined item (which is similar to enumeration value).

Page 142: Document1c

Core Development Techniques

142

8. Check the result in the 1C:Enterprise mode.

You can see the Value column in the list, and the Value field in the item

form. If a user attempts to create an item with the existing value (code), the platform displays a warning:

Let us add a new value Once An Hour to the catalog at run time.

You can select values while editing a constant in the same way as you did with enumerations:

Task 9

To learn catalogs a little deeper, optimize setting the value of

the ParentOrganization constant and create the Contractors catalog. Select data for the constant from the

Contractors catalog, but only from items that represent branches of your organization (for which the Branch property

is TRUE). Use the quick selection mode for the ParentOrganization constant. In other catalog calls the selection mode can be different.

Page 143: Document1c

Tutorial

143

Solution

1. Create the Contractors catalog.

2. Change the value editing method for the ParentOrganization constant to using the Contractors catalog.

3. Create an attribute named Branch with the Boolean type.

4. Limit value selection options for the ParentOrganization constant.

Page 144: Document1c

Core Development Techniques

144

As a result, you will have the following setting:

5. In the Quick choice list, select Use to enforce quick selection of values without opening a selection form when editing the constant

value.

Page 145: Document1c

Tutorial

145

6. Switch to the 1C:Enterprise mode and create the following items in the catalog:

While filling the constant values, you only see the items marked as

branches:

Now you will learn how to work with hierarchical catalogs. Let us optimize the way of storing data in the Contractors catalog. Define this catalog as a

hierarchical one with a limit of 2 hierarchical levels and two predefined groups, Businesses and Individuals.

Page 146: Document1c

Core Development Techniques

146

Enable the use of hierarchical data storage structure:

If you attempt to update the configuration, you will see the following

warning:

In 1C:Enterprise mode, move the elements to the Businesses group:

Next, create an item named Smith in the Individuals group:

Page 147: Document1c

Tutorial

147

Disable creation of new groups and creation of new items in the catalog root by turning on the fill check for the Parent field:

Now hierarchy limitations will prohibit users from creating new groups

within the existing groups. Creating a new group in the root folder is also impossible, since there is no way to fill the Parent field of this group.

For user convenience, set the synonym Included in the group for the

Parent field:

Task 10

Enable the quick selection of contractors by their TIN (in the

form for editing the value of the Parent Organization constant).

Page 148: Document1c

Core Development Techniques

148

Solution

1. Add an attribute named TIN:

2. Customize the attribute type (String, 9 characters, fixed length). Enable indexing; you will need it for quick input. Customize the value

input by setting a mask (digits only):

3. Add TIN to the Input by String box, and remove Code from this box.

Page 149: Document1c

Tutorial

149

4. To check the result at run time:

Fill in TIN for our items.

Navigate to Parent Organization constant and enter 90 in the box.

Due care should be taken when creating catalogs, since incorrect design of

catalog types and their properties may result in the need for excessive programming and limited business logic of your applied solution. Let us

review a similar situation with the Contractors catalog that you created earlier.

Page 150: Document1c

Core Development Techniques

150

We can see that this catalog is intended for storing data about our accounting objects (contractors, in this case). However, these objects may

be presented with different object entities in the system.

On the other hand, data duplication in the Contractors catalog may cause

accounting problems, while duplication is strictly necessary for customer and vendor bases. As far as the timeframe is concerned, the customer and

vendor may start cooperating with the company before the contractor, which makes use of the subordination mechanism impossible.

Let us create the following catalogs to deal with this task: Customers and

Vendors.

Add the Contractor attribute to catalogs Customers and Vendors.

Task 11. Creating and Using Catalogs

1. Create attribute AllowReserve for the Customers catalog and set the value for new items to TRUE.

2. Create the Items and UnitsOfMeasurement catalogs with the

following data:

Page 151: Document1c

Tutorial

151

3. Create catalog Contacts and make it subordinate to catalogs

Customers and Vendors. A contact may be assigned for a group of customers. Contacts are numbered individually (for each owner) and

checked for uniqueness, and the numbering is generated automatically by the platform.

Input the following data:

4. Create a hierarchical catalog Positions that contains a predefined

group Managers, and enable creation of groups at the root level only.

Input the following data:

Page 152: Document1c

Core Development Techniques

152

5. Create catalog Agreements and make it subordinate to catalogs Customers and Vendors. An agreement can be assigned to a

catalog item only. Disable using the code, and set the maximum allowed description length. Use the following structure of attributes

and tabular sections:

TABULAR SECTION ATTRIBUTE TYPE

StartOfActivity Date

EndOfActivity Date

Manager CatalogRef.Positions

CustomerRepresentative CatalogRef.Contacts

Details StartDate Date

Details EndDate Date

Details Item CatalogRef.Items

Details Amount Number (10, 3, non-

negative)

Details Total Number (10, 2, non-negative)

For the Manager attribute, enable quick selection of items from the

Managers group.

For the CustomerRepresentative attribute, restrict the selection to contacts that are related to the owner of the agreement.

Input the following data:

Page 153: Document1c

Tutorial

153

6. Create catalog DocumentTemplates to store the following information:

Page 154: Document1c

Core Development Techniques

154

7. Create the Accounts catalog to store data on contractor bank accounts.

8. Create the Contracts catalog to store the following information:

Contract number prefix D10- cannot be changed by end users.

A quick selection is used to populate the Condition column, with only the agreements related to the selected Partner shown.

Contract template is an item from the DocumentTemplates catalog.

Templates are selected from group Document templates only.

Bank accounts are selected from the drop-down list of accounts that

belong to the specified legal entity.

Page 155: Document1c

Tutorial

155

9. To add the capability to store retail store data to the groups of the Items catalog:

add the following data to the RetailStores catalog;

add the following data to the Items catalog (for groups in the RetailStores tabular section).

Information registers

An information register is an applied object for storing information that can vary depending on some conditions or time. For instance, you can create an information register to store inventory prices from the client’s perspective:

PRODUCT CLIENT PRICE

Ballpoint pen Johns 10 USD

Page 156: Document1c

Core Development Techniques

156

PRODUCT CLIENT PRICE

Ballpoint pen Smith 12 USD

In all previous examples with constants, catalog attributes, and tabular

section attributes you used unconditional values.

You know that catalogs can include tabular sections for storing multiple pieces of data based on any conditions. For instance:

So why you might need information registers?

First, an information register ensures that the values for a certain combination of conditions are unique (this is done by the platform, with no

programming), which is not available for tabular sections. Nothing stops you from creating one more entry for a client named Johns with a price of 15 in the tabular section of the catalog.

As a result, the system will not be able to determine which value is the

correct one.

But what do you get from the system that uses an information register if

you try to enter one more value for the same combination of conditions?

Page 157: Document1c

Tutorial

157

As you can see, adding another price value for the existing entry in the information register is prohibited.

Second, you can edit information register entries without changing the

object itself. However, the object must be stored in the base (which is not necessary with tabular sections):

If you try to fill an information register without having your object stored in the base, you will see the notification telling that doing so is prohibited, and you will be prompted to record your data into the base to continue working

with the information register.

Page 158: Document1c

Core Development Techniques

158

However, if an object is stored in the base, you can fill the information

register independently:

This feature provides the way to edit object properties without editing the

object itself.

Third, you can bind the mere existence of the value with some conditions.

In a tabular section, the presence of a price value only depends on the presence a product card. If there is no product, there is no price.

Page 159: Document1c

Tutorial

159

However, nothing can stop you from omitting the Client or deleting the

client's card from the base (unless you do not handle this issue programmatically):

You can avoid this by simply customizing the structure of an information register. It shortens the development time significantly and makes the logic of the applied solution more clear:

If these options are set, an information register entry related to a product

or client is automatically deleted when the product or client is deleted. Specifying the product and client in a new entry is mandatory.

Page 160: Document1c

Core Development Techniques

160

Finally, it is often required not only to store the current information in the database, but to remember the history of changes and be able to get the

value from a given moment in time.

If you use a tabular section, you can add, of course, another tabular section

attribute called On Date:

But what if you need to retrieve a value for a specific product and client for an intermediate date (e.g., January 10, 2011)? There is no value for this

date in the tabular section. Therefore, you will have to develop an algorithm to get this value. Probably it would have to retrieve the value from the Price column of the nearest entry in the past that has the specified

Product and Client values. To make it easier, the platform developers have provided you with such a feature in information registers.

Periodic17 registers are designed to deal with it.

17 Periodicity options are calendar-based and refer to the entire table.

Page 161: Document1c

Tutorial

161

The platform automatically adds the system dimension Period (of Date type) to the periodic information register. As a result, you can obtain both

current object data and data from a specific moment in time.

When you fill a periodic information register, entering a value in the Period

box is mandatory. The following options are available:

The user gets an error message about the empty value and is prompted to enter the mandatory data:

The system fills the Period box with default data from the Fill value property:

When you enter data into an information register, the Period value is automatically set to the beginning of the specified calendar period.

For obtaining data from a specific point in time, you can select a special table during form development:

Page 162: Document1c

Core Development Techniques

162

You can also use the script methods provided:

We will discuss these capabilities later in chapter "Creating a user-system interaction model" in part 2 of this tutorial, when talking about topics like

platform interface features, scripts, and the query language.

Now you know about the main purpose and applications of information

registers. Let us explore information register structure.

You can define the structure of an information register using the Data tab in the window for editing the configuration object, or using the metadata

tree. The structure is defined by three types of subordinate configuration objects: dimensions, resources, and attributes.

Dimensions

Dimensions are used to define conditions for data stored in the information register. The order of information register dimensions is important. Place

dimensions that you want to access quickly on the top of the list.

Page 163: Document1c

Tutorial

163

For dimensions, the following data types are supported:

It is recommended that you use the Master option for reference types in

dimensions.

If a user deletes data from register dimensions with the Master option enabled, the entries are deleted from the register automatically, which

preserves the reference integrity of the base.

If a dimension value is mandatory and you need persistent filling control

(during both programmatic and interactive entry creation), you need to prohibit specifying empty values.

If you do not always need to prohibit empty values, but you still need this in

some scenarios, use the following dimension option:

Page 164: Document1c

Core Development Techniques

164

Resources

Resources are used for storing data. Information register resources can

store the following types of data:

The type of data stored in a resource can also be determined by parameters of a chart of characteristic types (for more information about this, see

section "Charts of characteristic types" on page 172).

Page 165: Document1c

Tutorial

165

Use this option to control how the resource value is filled:

Attributes

In addition to dimensions and resources, you can define attributes when you create an information register. Attributes contain service information for

each register entry. Attributes can have the same data types as resources can have.

Attributes store additional service information, which helps users to

understand the meaning of an entry quickly, or can be used by some of the algorithms of the applied solution.

Specifying attribute options is similar to specifying information register options.

However, to retrieve values using the script methods, the system uses

dimensions and resources.

Attribute usage is discussed in more detail in the practical part of this

section.

Creating information register records

The platform provides two methods for recording data to information registers:

Select Independent if you do not need to track why the entries appear in the information register.

Subordinate to recorder connects an entry with the document that

registers the entry. In other words, the recorder is the reason why an entry appears in the information register. When this mode is selected, the

following standard attributes become available:

This mode lets you use an additional periodicity option By recorder position. It allows recording even more detail than the Within a second

option.

Now let us have some practice to reinforce your knowledge.

Page 166: Document1c

Core Development Techniques

166

Task 12

Implement storage for the parameter that contains the

current shareholder list. Shareholders are taken from the Contractors list, and the parameter values should be unique.

No empty values are allowed, too.

Solution

To solve this task, you need an information register and the Contractors

catalog that you have created before.

1. Create the Shareholders information register.

2. To ensure that the parameter values are unique, use the integrated feature for the uniqueness control in the information register

dimensions. Create a dimension of reference type called Shareholder. Set the No Empty Values option to prohibit empty strings.

Then check how it works.

If you try to enter an empty register entry value, you will see the following warning:

Page 167: Document1c

Tutorial

167

You will also receive a warning if you try to enter a value that is not unique:

Then enter the correct data:

You have finished this task.

Task 13

Next, you have to register the offices of your company. Note

that there are both headquarters and industry-specific branches. But for now, you are only interested in actual addresses of the offices. At run time, users should be able to

add branches and link office addresses to them.

Solution

1. First of all, you need a nonhierarchical, nonsubordinate catalog to store the types of industries and to control the uniqueness of their names (use Code with the Name synonym).

Page 168: Document1c

Core Development Techniques

168

2. Create a nonperiodic information register OfficesOfCompany with an independent record mode and the following structure:

To check how it works, enter the following data:

Task 14

Create an information register for storing the current

additional settings of infobase users:

workday start time;

workday end time;

company (to specify in documents and use as a separator for settings);

person responsible (to specify in documents);

greeting line (to enhance authorization);

Page 169: Document1c

Tutorial

169

response line (to enhance authorization);

program header;

unique database user ID.

Solution

Define the following structure for the UserSettings information register.

Page 170: Document1c

Core Development Techniques

170

You will learn about customizing forms and determining user IDs later in

this course.

Page 171: Document1c

Tutorial

171

Task 15

Creating and using information registers

1. Develop the Exchange Rates information register to store the

history of exchange rates. An exchange rate changes once a day or less frequently. An exchange rate is a 7-digit number value with 4

digits after the decimal separator.

Add the following data:

2. Create an information register to store the lists of shareholders

(shareholders are taken from the Contractors catalog). The list is updated annually.

Add the following data:

3. Create a register to store the information on the product range available at the stores. The data changes once a day or less frequently.

Add the following data:

4. Create a mechanism to store the following parameters of an

enterprise: postal address, legal address, phone number. The history of changes (once a year) should be stored in the system.

Add the following data:

Page 172: Document1c

Core Development Techniques

172

Charts of characteristic types

Charts of characteristic types were introduced as a logical development of

catalogs for particular tasks that require some properties you cannot define for catalog elements, and some new ways of handling configuration objects.

Charts of characteristic types are generally used for storing descriptions of characteristics (or object properties) created by users:

Page 173: Document1c

Tutorial

173

The system limits the value types that you can use for characteristics. You

can see it in Designer when you set up charts of characteristic types.

Page 174: Document1c

Core Development Techniques

174

You have possibly noted that some types (for example, types available for

object attributes) are now missing from the list. And there is another limitation: you cannot set unlimited length for a string type. This is due to the main purpose of the chart of characteristic types stated above.

In addition to the limitations that you see in Designer, developers of applied solutions can set their own limitations.

You can only see the types available for use in the list. Use the check boxes, including the composite type check box, to define the types that are required for describing the characteristics according to the business logic of

your solution.

The limitations come into effect in Designer once you try to create a predefined element of the characteristic type.

Page 175: Document1c

Tutorial

175

Only the data types you have selected before will be available in this case.

Page 176: Document1c

Core Development Techniques

176

You can also meet this type of limitation when you set up a characteristic in 1C:Enterprise mode:

In addition, a user may face the problem when data types provided by the

system are simply not enough for them. In this case, they can use an auxiliary catalog created by the developer beforehand and specified by the developer in the Additional characteristic values property of the chart of

characteristic types:

Page 177: Document1c

Tutorial

177

As you can see, there is only one catalog shown in the list. So where are the rest?

The only reason why the ValuesVariants catalog is displayed is that it is subordinate to your chart of characteristic types (this is required to enable

its selection as a source for additional characteristic values):

Also, remember to include the catalog in the Characteristics value type list (otherwise it would be impossible to select the catalog when you create

a characteristic).

If you forget to add the catalog specified in the Additional characteristic values list to the Characteristics value type list,

Page 178: Document1c

Core Development Techniques

178

the system will remind you of this by displaying an error message when you

try to update the database configuration:

Page 179: Document1c

Tutorial

179

In a chart of characteristic types, characteristics can be stored hierarchically, but only folder hierarchy is available:

Hierarchies help to divide the characteristics of a chart of characteristic types based on their purpose, for example, by using a number of predefined

groups:

If there are characteristics to be defined at the development stage (for example, you want to be able to deal with them programmatically), you

have to create them in the corresponding groups.

Other characteristics can be defined at run time.

Page 180: Document1c

Core Development Techniques

180

Or, if you select the reference value type,

you can fine-tune it in the Values Variants catalog:

Page 181: Document1c

Tutorial

181

You will have to specify a characteristic type for each new value variant while adding new value variants to the catalog:

As you may have already noticed, your Object Properties chart of characteristic types only stores characteristic types for the following

accounting objects:

Page 182: Document1c

Core Development Techniques

182

and their settings:

But where are the values of your properties if you only see their

descriptions here? Nowhere yet!

You have to use a data storage mechanism you are already familiar with to create property value storage. In this case, a value is related to a pair of

conditions at the same time. This relationship can be described as:

Object — Property — Value

Of course you have to use an information register to store your values. Give it a name CharacteristicsOfItems and specify Characteristics as a synonym.

A combination of conditions to be stored is defined by dimensions.

The Item dimension will be used as an object.

Page 183: Document1c

Tutorial

183

For your Property dimension, select the values from the Object

Properties chart of characteristic types (but only those from the predefined group PropertiesOfItems).

Then proceed to the resource Value.

However, you may ask, "What type should I specify when I set data type for

my resource?"

Page 184: Document1c

Core Development Techniques

184

Please remember where you were setting available types for your chart of characteristic types.

In the data type of your Value resource, you have to access the Characteristics value type setting of the chart of characteristic types. This can be done using a special type called Characteristic.

Now there are only two more little things to take into account.

To illustrate the first one, consider the following situation. The Term of Warranty property type is set explicitly, but while you are selecting a

value, all types are available within the chart of characteristic types.

Page 185: Document1c

Tutorial

185

You have to limit the set of types available during property selection. To do

this, link the Value and Property fields by type:

Page 186: Document1c

Core Development Techniques

186

As a result, the system will not prompt you to select the type, but it will define the value type automatically, and you will only have to enter the

correct value:

Second, consider scenarios with properties where Values Variants is

specified as a value type.

In 1C:Enterprise mode, create two new characteristics with the Values Variants type: Color and Type Of Pencil.

Set the following options for the type of pencil:

Page 187: Document1c

Tutorial

187

Then define color options:

Then, define a characteristic for the Pencils item:

Select the characteristic value:

You can see some extra lines from your global catalog Values Variants in your selection form. You only need those, though, that are related to the

selected property (in this case, the Type Of Pencil property). In Designer, set a filter by the value of the Property field for the selection form.

Page 188: Document1c

Core Development Techniques

188

Now, let us check if everything works right. Create a new characteristic for

Pencil.

Now the system automatically selects valid values for the Type Of Pencil

property from the Values Variants catalog.

Task 16

Creating and using charts of characteristic types

Create a feature to store characteristic values for Clients and Suppliers. This should be done in separate information registers with

a single chart of characteristic types.

Add the following data:

Page 189: Document1c

Tutorial

189

Documents

Objects of Document type help to store information about the commercial transactions or other events in the enterprise.

1C:Enterprise 8.2 uses the standard document attributes Number and Date and supports customization of their presentation:

These attributes are important document characteristics, which make it

different from others objects. In 1C:Enterprise 8 values of Date type also include time. The maximum length of a number is increased to 50

characters (for a string data type):

The system supports automatic numbering of the documents, i.e., it can

generate numbers for newly created documents.

Page 190: Document1c

Core Development Techniques

190

By default, numbers are generated when you write the document into the system. This operation is connected with a special event. If autonumbering

is enabled, the OnSetNewNumber event is activated.

In addition, the system controls the uniqueness of document numbers and does not allow you to create documents with identical numbers:

You can use platform tools (without programming) to set the general rules for the uniqueness control and autonumbering features.

Since the documents are always connected to some point in time by the Date attribute, the system should "know" the time interval in which it should check the numbers for uniqueness and when to restart the

numbering. If the value is set to Non-periodic, the number uniqueness is checked for all documents of the specified type stored in the database, and

autonumbering is never reset.

To describe the rules of continuous document numbering, use a metadata object of Document numerator type.

Page 191: Document1c

Tutorial

191

To use a single numerator in your documents, select the numerator in the

Numerator box on the Numbering tab.

After that, individual numbering customization for configuration objects will

be disabled as the numbers will be taken from the numerator.

However, in addition to using a single numerator for different types of

documents, you may need the opposite functionality. For instance, you may need to have separate numbering of documents belonging to the same time, taking into consideration both the document’s position in the timeline

and some data from it, i.e., to implement separate order numbering for individual customers.

Page 192: Document1c

Core Development Techniques

192

1C:Enterprise 8 also supports this feature, but now you have to do some programming:

1. Open the object module of your document.

2. Click Procedures and functions.

3. Type the procedure to be used as a handler for "set new number"

events:

Note. Set the Prefix attribute of the Clients catalog before performing this step.

4. Open the configuration in 1C:Enterprise mode and add several documents of Customer Order type. Note that a number is

automatically assigned to each new document.

Page 193: Document1c

Tutorial

193

Each document can have several attributes and tabular sections with different structure.

There are no other common document attributes. The support of common attributes used to slow down system performance during intensive

document input, and the rest of the common attributes were removed from version 8. However, this functionality can be implemented using another feature – information registers with charts of characteristic types.

Posting support is one of the most important characteristics of a document.

Page 194: Document1c

Core Development Techniques

194

The Post property of configuration objects is used to turn this feature on.

In 1C:Enterprise mode, a tool for bulk document posting or re-posting is available.

Page 195: Document1c

Tutorial

195

In the Document Posting dialog box

you can specify the following:

period (a time interval for searching for documents);

posting mode;

types of documents to be posted.

There are two posting types:

real-time posting18 (this can be disabled);

regular posting.

18 Posting a document changes its date to the current date, you cannot post a document to a

future date.

Page 196: Document1c

Core Development Techniques

196

When a document is posted, it can change the state of some data records.

If a document is not postable, this means it represents an event that is not

relevant to accounting in this particular applied solution.

A list of available registers and a list of registers used for posting specific

document types are available on the Register records tab of the configuration object editing window.

Only information registers with the following setting are displayed in the list of available registers on the Register records tab:

If the list of registers used for posting a specific document type is empty (the list is filled automatically when you select check boxes in the list of

available registers), it is impossible to form records related to this type of document in the register. The system will display an error if you try to

implement an algorithm to form records in the register.

The algorithm that introduces some changes to the state of accounting data when posting documents is described by the script at the development

stage.

The system includes a wizard that helps developers to create document

posting algorithms. You can call the wizard only from the shortcut menu of the metadata tree:

Page 197: Document1c

Tutorial

197

Another option is pressing the button on the

Register records tab in the configuration object editing window.

If no type of register is selected, you cannot run the Wizard19:

19 Whether a document can be posted or not, it does not change the availability or the

Wizard or the functionality it provides.

Page 198: Document1c

Core Development Techniques

198

The Register Records Wizard only works with registers that use the selected document type as a recorder:

either the document types are selected on the Recorders tab in the register settings,

or the registers are selected on the Register records tab in the document settings.

If two or more types of registers are selected, at the first start of the wizard the system will prompt you to select the register to be used to create the algorithm:

Page 199: Document1c

Tutorial

199

When the register is selected, the system opens the Wizard:

Fill in the record creation rules in the Expression column with mappings

between register fields and document attributes, or with arbitrary expressions.

Page 200: Document1c

Core Development Techniques

200

Then you can proceed to establishing the next algorithm creation rule (if

registers where the document can create records are still available):

Fill the Expression column:

Page 201: Document1c

Tutorial

201

You can switch to the previous rule if you need.

When you have defined all rules, click OK to generate the algorithm and

view the output of the Register Records Wizard.

Page 202: Document1c

Core Development Techniques

202

If you run the Wizard again, the system will give you a warning:

If you have not made any manual edits to the algorithm, it will be loaded to the Register Records Wizard for further adjustment when you click Yes.

Use the Register records tab in the configuration object editing window to define a rule that will delete register records for the document:

This property is only available when the value of the Posting property is set to Enable. This option defines that all records entered during posting are

automatically deleted when the document is reposted or unposted. Automatic deletion is performed by the system when a previously posted document is reposted (before writing new records), or when a document is

deleted, or when document posting is canceled.

We will discuss the system behavior during document posting later, when

customizing the behavior model of your applied solution.

Page 203: Document1c

Tutorial

203

Task 17

Create a new document and name it Payment from

Customer. Use the numbering system from the numerator PaymentForServices.

ATTRIBUTE NAME VALUE TYPE VALUE

Author CatalogReference PeopleResponsible

Customer CatalogReference Customers

Tabular section attributes (tabular section name is ServiceAcceptanceActs)

Act DocumentReference ServiceAcceptanceAct

TotalSum Number 10.2

Document journals

Journals are used to group documents of different types that are implicitly

connected, for instance:

To create a new document journal, right-click a branch of the metadata tree

named Document journals, and then click Add.

On the Main tab, specify a name and a synonym for the document journal,

for example, HRDocuments:

Each document type can be shown in multiple journals.

Page 204: Document1c

Core Development Techniques

204

You can include documents of certain type when customizing a document journal and view the ones already included on the Data tab:

A document journal includes a set of standard attributes.

You can also view additional information from the documents by customizing the appropriate columns20. A single attribute from each

document can be taken to customize the journal columns.

20 Their names must not match standard journal attribute names. It recommended that you

do not put mixed data into a column (for example, contractor name and document total).

Page 205: Document1c

Tutorial

205

Define the documents to be registered in the journal on the Data tab, and specify any additional journal columns in the Graphs list.

Task 18

Create a document journal named Global Journal. Create a journal column named Author.

Page 206: Document1c

Core Development Techniques

206

Document sequences

Objects of Sequence type are used for checking whether the changes made to the accounting data by the documents are correct.

In addition, you can use sequences to recover the change history (in

1C:Enterprise mode).

You can think of the sequence recovery process as of selective reposting of documents of a certain type.

The document posting algorithm usually records information contained in a

document for accounting purposes. However, in some cases, the document posting algorithm also analyzes the current totals and uses these results in

posting.

For example, if a document is used to write off goods or materials at average cost, the posting algorithm analyzes the balance of the goods at

the moment of write-off both as the quantity and the totals in order to calculate the amount to be written off.

For example, 10 items of merchandise at a price of 26 USD are entered into an invoice. The remainder of the merchandise at the enterprise from the

point of view of the totals is 260 USD. The merchandise was then sent to the customer. When this invoice was posted, the remainder of the merchandise was analyzed and the average cost of an item of this

merchandise was calculated to be equal to 26 USD. Therefore, the remainder of the merchandise at the enterprise is equal to zero from the

point of view of both the quantity and the totals.

Page 207: Document1c

Tutorial

207

A few days later, a mistake was discovered in the invoice: the cost of a merchandise item is not 26 USD, but 20 USD. The required changes were made to the invoice, and it was posted again. The data in the accounting

system turned out to be wrong, since all the subsequent documents introduced changes based on the old cost of goods, therefore they were not

"aware" of the cost change.

To avoid this, you can unite these two documents in a single sequence. In this case, the system will automatically detect that the document sequence has changed and will be able to re-post all the subsequent documents that

can depend on the posting results of the invoice in case an invoice changes. In other words, the invoice will be posted again, and a new cost (20 USD)

will be obtained as a result of the remainder analysis to be used later in the merchandise write-off.

Page 208: Document1c

Core Development Techniques

208

Let us assume that a StockAccountingSequence with ReceiptOfMaterials and ReceiptForServicesRendered documents has

been created in the configuration.

The Move the boundary when posting property value has been set to

Move. This means that when you post a document registered in this sequence, it will try to move the boundary of the sequenced documents. If the Do not move value is selected, the document posting will not move the

boundary of the sequenced documents.

The Register records affecting the sequence property specifies register

records that will influence the reposting of documents in the sequence, i.e., which accounting records or totals are used when the sequenced documents

are posted. For example, register records might be used.

Sequences may have subordinate objects called dimensions. You can create them on the Data tab of the sequence editing window.

Create a new dimension named Subdivision to match the Subdivision attribute of the documents in the sequence.

In the 1С:Enterprise mode the platform automatically maintains a sequence

boundary for each document sequence in the configuration. The document position acts as the sequence boundary. When documents are posted one by one, the sequence boundary is placed on each newly posted document.

However, if you post a document that relates to this sequence but is placed later than another posted document that relates to the same sequence, the

sequence boundary will not be moved forward, since this violates the document posting sequence.

When documents are posted post factum, or when document posting is

canceled, or when documents are deleted, or if register records that influence a sequence are deleted or recorded, the sequence boundary is

moved to the time of the modified document.

Page 209: Document1c

Tutorial

209

Therefore, the sequence boundary will move forward with sequential

posting of documents in this sequence and will move back if register records for this sequence are modified post factum.

There is a special feature for restoring the document posting sequence in the document reposting mode (All functions — Standard — Post Documents). When this feature is used, the system automatically reposts

all documents related to this sequence (the posting mode is regular) from the sequence boundary up to the specified location.

Input on basis

You can enter new documents in the 1С: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.

Page 210: Document1c

Core Development Techniques

210

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.

Page 211: Document1c

Tutorial

211

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 indicators21 using multiple reports and printed forms.

This is similar to driving a vehicle, where a driver has to watch the speed,

21 An indicator shows the current state of an object.

Page 212: Document1c

Core Development Techniques

212

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.

Page 213: Document1c

Tutorial

213

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.

Page 214: Document1c

Core Development Techniques

214

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.

Page 215: Document1c

Tutorial

215

Then we need to create a document form.

Add the InventoryBalance accumulation register to the document form to

be displayed as a tabular section.

Page 216: Document1c

Core Development Techniques

216

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.

Page 217: Document1c

Tutorial

217

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 Запись In ThisObject Do

Record.Period = DocumentDate;

Record.RecordType = RecordType;

EndDo;

EndProcedure

Check the document in 1C:Enterprise mode:

Page 218: Document1c

Core Development Techniques

218

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.

Page 219: Document1c

Tutorial

219

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()

Page 220: Document1c

Core Development Techniques

220

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 functions — Standard — Totals 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.

Page 221: Document1c

Tutorial

221

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.

Page 222: Document1c

Core Development Techniques

222

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.

Page 223: Document1c

Tutorial

223

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.

Tools for scheduled reporting and accounting

1C:Enterprise 8 provides a number of tools for creating a system of scheduled indicators that can be used for:

scheduled reporting;

accounting in accordance with local and international standards;

tax accounting;

budgeting;

etc.

You can implement the following:

adding new types of indicators in real time;

a system of connected indicators (i.e., changes in one indicator

impact another indicator);

various methods to group indicators by different parameters to generate reports.

If we use the accumulation registers to handle these tasks, to add a new indicator we will need to create a new accumulation register with the

structure customized in Designer, define the indicator dependence algorithm, and develop a new report.

This is why the best method for handling these tasks is to use the following

group of configuration objects:

charts of accounts: the structure and types of indicators;

charts of characteristic types: storing conditions for indicator values and types of accounting objects;

accounting registers: storing general conditions and changes in the indicator values.

From a technical point of view, any chart of accounts can be viewed as a

kind of catalog (with new capabilities and limitations) optimized to store the structure and types of indicators at the system level:

Page 224: Document1c

Core Development Techniques

224

Page 225: Document1c

Tutorial

225

For instance, any chart of accounts is a hierarchical entity with a hierarchy of elements22 that does not have any system limitations for its hierarchical

levels (without an option to change this rule by object customization, that is why the configuration object editing window does not contain a Hierarchy

tab); however, you can see the Parent field in the list of standard attributes.

Or you can note that the code is now of string type only, with new types of

attributes (Accounting flags and Extra dimension accounting flags), new standard attributes, and a standard tabular section having been added,

as well as a new Extra Dimension tab and other properties and methods.

An applied solution may contain any number of charts of accounts.

A chart of accounts is a configuration object, so you can only create a new chart of accounts or delete an existing one in Designer mode.

Task 20

1. Create a chart of accounts to store additional management and scheduled indicators, and name it Types of indicators.

2. Specify the code length (= 150) and the description length (= 200).

3. Set the default presentation of the account to As description:

22 1C:Enterprise 8 allows posting by group accounts (or parent accounts).

Page 226: Document1c

Core Development Techniques

226

4. Set the system to check the uniqueness of account numbers within a group:

You can fill a chart of accounts (create new chart elements) both at the

configuration stage (predefined accounts) and at run time (1C:Enterprise mode).

Task 21

1. Create Trade and Financial groups of indicators in Designer.

2. At run time, create CashAvailable and DebtToClients elements in the Financial group:

You cannot delete a predefined element of a chart of accounts in 1C:Enterprise mode:

Page 227: Document1c

Tutorial

227

You cannot mark the item for deletion either.

In 1C:Enterprise mode, you cannot change the values of some standard

attributes of chart of accounts elements, as well as change or delete predefined strings of a standard tabular section. The following warning

appears when you try to perform these actions, i.e., try to write a predefined account with the changes you made in 1C:Enterprise mode:

Any predefined account has a name by which it will be called in software modules:

TradeIndicators =

ChartsOfAccounts.IndicatorTypes.SelectHierarchically

(ChartsOfAccounts.IndicatorTypes.Trade);

You can use registers to register any changes of indicator values in the 1C:Enterprise 8 system (accumulation registers were reviewed previously).

When working with accumulation registers, we used a separate accumulation register for each indicator. We will need to use configuration

objects to implement a system of indicators:

An accounting register is a system that registers changes in indicator values. Records are entered into the accounting register (just as in the accumulation register) to change indicator values. A record may increase or

decrease the value of an indicator.

To increase the value, use Debit (+), which is similar to the Receipt

accumulation register.

Page 228: Document1c

Core Development Techniques

228

To decrease the value, use Credit (–), which is similar to the Expense accumulation register.

An accounting register has to be connected with a specific chart of accounts:

Information on the type of value change is stored in the standard attribute named RecordType:

The structure of an indicator value is defined through a set of resources of

the accounting register. The resources (value components) may only be numerical. The CashAvailable and DebtToClients values are changed and

analyzed in the totals view, so we need to create a Total resource of type NUMBER 10.2.

An accounting register may exist in the database configuration if it has at

least one resource.

To change indicators, we will need a document that cannot be posted, but with record registration enabled in the SystemOfIndicators accounting

register.

Page 229: Document1c

Tutorial

229

You will also need to enable interactive access to the DocumentForm register:

If you try to save a document that contains a record in the accounting

register in 1C:Enterprise mode, the system will display the following warning:

This warning is displayed due to a property of the resource contained in the Balance accounting register, which is set to TRUE when a resource is

created in the register structure:

Page 230: Document1c

Core Development Techniques

230

This resource property is necessary to create a balanced system of indicators, i.e., a system in which a change in any one indicator value necessarily brings about changes in one or more other indicators in such a

way that the total of all changes (all receipts and expenses) within a single document and for a single time period (a specific Document+Period

moment) is equal to 0.

Creation of independent indicators may be enabled in two ways:

Option 1. A global rule for the system of indicators (in Designer mode, in the accounting register)

To enable registration of independent indicators, disable the balance

feature for both resources.

Afterwards, the system will record any correction made to indicators,

even for a single record. You can verify this by opening a list of records in the IndicatorsList accounting register (for example, via the All functions menu).

Option 2. Individual settings for an indicator (in Designer and

1C:Enterprise modes, in the account settings).

You can disable the "balanced indicators" rule for an individual

account by clearing the Off-balance check box.

Page 231: Document1c

Tutorial

231

Limitations to changing the check box value:

You can only select and clear the check box in 1C:Enterprise mode

for a non-predefined account if there are no records for this account in the accounting registers.

You can select and clear check boxes for predefined elements only in the Designer mode. In this scenario, the system does not control the availability of records in the accounting registers. (CAUTION!)

Accounting registers (AR) allow you to define the scope of your indicators (I):

To define a list of available indicators for your scope, you need to specify the object from which the system will take different types of indicators. In our example, the Types of indicators chart of accounts functions as such

object.

Page 232: Document1c

Core Development Techniques

232

Therefore, the definition of an accounting register is closely connected with

the chart of accounts. It does not make sense to use an accounting register without a chart of accounts, since the chart of accounts stores types of indicators to be changed through the accounting register.

To create the connection with a chart of accounts, you need to select a data type for the standard Account attribute.

The standard Account attribute may not be of composite type, that is why the accounting register may be connected with a single chart of accounts

only. However, this does not prevent us from using a single chart of accounts in different accounting registers:

Page 233: Document1c

Tutorial

233

When you create a system of indicators, you can define three basic models for the scope of indicator values:

a system of independent indicators (similar to accumulation registers);

a system of connected indicators (a bundle of 2 indicators);

a system of balanced indicators (bundles of indicators groups).

Task 22

1. Create an accounting register named

SystemOfIndependentIndicators and connect it to the Types of indicators chart of accounts.

2. Create an accounting register named SystemOfBalancedIndicators and connect it to the Types of indicators chart of accounts.

3. Create an accounting register named

SystemOfConnectedIndicators and connect it to the Types of indicators chart of accounts.

Page 234: Document1c

Core Development Techniques

234

Before we continue specifying register settings, review the specific features of your models in greater detail.

Model 1. A system of independent indicators: when one indicator

changes its value, another indicator does not necessarily have to change its value immediately.

Page 235: Document1c

Tutorial

235

To implement this model, you need to do the following:

1) Disable use of correspondence in the accounting register settings.

2) Clear the Balance check box in the accounting register resource

settings.

Model 2. Connected indicators: if we change the value of one indicator, it will immediately change another one, i.e., the indicators

always function as a bundle. Integration of two indicators is defined by the Correspondence setting of the accounting register.

1C:Enterprise 8 provides tools for creating a combined model based on the correspondence model (model 2).

Page 236: Document1c

Core Development Techniques

236

To enable the use of an unbundled (independent) indicator in this model, the standard attribute OffBalance of Boolean type is provided in the indicator (account) settings.

Using this attribute only makes sense in this indicator system model.

You cannot change the value of the OffBalance attribute for predefined

accounts in 1C:Enterprise mode.

Page 237: Document1c

Tutorial

237

Task 23

1. Set the correspondence rules for the accounting registers that you

created.

2. In 1C:Enterprise mode, create the Stored Goods account in the Trade group to be able to use the account without correspondence

with other accounts.

Page 238: Document1c

Core Development Techniques

238

If you try to update the database configuration (F7) at this stage, you will receive the following warning:

and the following messages:

As you see, we need to define resources for the accounting register.

From the physical point of view, resources are used in accounting registers to define the measurement system for the values of your indicators:

For example:

The value of the CashAvailable indicator is measured with the total:

The value of the InventoryBalance indicator is measured with the total sum and the amount:

Therefore, you will need two resources for your system (for the simplest scenario): the total sum and the amount. Resources of the accounting registers can be of Number type only (similar to the accumulation register).

Page 239: Document1c

Tutorial

239

Task 24

Create TotalSum and Quantity resources in the accounting registers

that you created.

Task 25

Create the CorrectingIndicators document with posting prohibited for manual editing of indicator values through accounting registers.

Specify this document as the recorder for your accounting registers: SystemOfIndependentIndicators and

SystemOfConnectedIndicators.

Page 240: Document1c

Core Development Techniques

240

Then update the database configuration.

In 1C:Enterprise mode, we will only see two fields in the Correcting Indicators document: Number and Date.

To enable interactive access to your registers through the Correcting

Indicators document, you need to create a document form in Designer mode.

Task 26

1. Start the Document Form Wizard for the document:

2. On the wizard page that is opened, click Finish.

If you look at the resource settings in the accounting register, you will see a new resource property — Balance.

Complex periodic calculation features

Periodic calculations are calculations performed with certain periodicity, closely connected with one another by certain rules, and mutually influencing each other within a certain period of time.

Periodic calculations are mostly used to calculate wages.

As a rule, employees’ wages consist of many components (salary, bonuses,

sick leaves, penalties, etc.). Each of these is calculated using a certain algorithm. For example, bonus amounts may be calculated as a percentage

Page 241: Document1c

Tutorial

241

of salary, while salary might be calculated based on a number of workdays in a month or a number of days actually spent at work. Each accrual may be

matched with a certain calculation type. An algorithm for each calculation type is generally based on two parameter categories: a period for which we

need to get final data and a set of certain source data used in your calculation.

In the real world, different calculation types generally do not exist by

themselves, but rather exert certain influence on other calculations. Since a calculation type depends on two different kinds of parameters, this influence

is also of a twofold nature.

First of all, source data used in the calculation may be affected. For

instance, when a salary changes, the bonus amount should also be recalculated based on the new salary amount, i.e., the salary amount is the basis for calculating a new bonus. In addition, since the salary is calculated

for a given period, when calculating bonuses we need to know not just the basic salary amount, but rather the total that is calculated for the period

affecting the bonus calculation. We’ll refer to such a period as a base period, and the corresponding dependency between calculation types will be referred to as being dependent on a base period.

The second factor that may be influenced is not the source data, but the calculation period itself.

Imagine a rather common real-life situation: an employee schedules a leave for one of the months of the year. Leave allowance was accrued and paid before the beginning of the leave. Calculation of the leave allowance is

registered for the one-month period (when the calculation was made) that precedes the month when the leave was taken. The month for which the

leave allowance was accrued is called an action period.

Assume that the leave allowance is calculated based on the employee’s average salary (taking into consideration the accruals for the 3 months that

precede the leave). The period we use to calculate the accrual is called the base period.

Let us present the rules described above graphically on the time scale.

Page 242: Document1c

Core Development Techniques

242

You can see that the actual action period of the salary has changed and requires recalculation. This is called displacement by action period.

Thus, based on the two kinds of mutual influence of calculations, we can

say that there are generally three periods associated with each calculation type: the action period, the actual period, and the base period.

The action period is the "requested period", that is, by specifying the action period, we say, "We would like the result to be valid for that period."

The actual period is an action period modified in the analysis of all calculation action periods that displace your action period.

The base period is a period within which we analyze the results of other calculations that influence ours by base period.

Therefore, mutual influence between different types of calculations is

differentiated and multilevel.

Obviously, these tasks call for some kind of universal feature that will allow

you to define each of these calculation types (its algorithm, influence on other calculation types, and dependencies), to provide storage of data obtained as a result of these calculations, and to monitor the need to

recalculate the results of dependent calculations in the event of changes to the results of "primary" calculations.

Configuration objects Charts of calculation types and Calculation registers provide such a feature in 1С:Enterprise 8.

The Chart of calculation types configuration object is an applied object designed to define structures for storing information on the available

calculation types. Based on a Chart of calculation types configuration

Page 243: Document1c

Tutorial

243

object, the platform will create an information structure in the database to store information about what calculation types exist, and what their

interrelationships are.

An applied solution may contain any number of charts of calculation types

depending on the accounting model implemented. Each chart can have a number of characteristics typical for the calculation types that it contains.

The Chart of calculation types object properties are edited in the editing

window and in the properties palette.

On the Data tab, you can enter a set of attributes that contain additional

information on the calculation type. A set of attributes can be seen in the configuration tree as well.

Let us review the content of the Calculation tab.

The Chart of calculation types configuration object has a property called Uses action period. This property defines whether an action period is used by the calculation types of a chart of calculation types. If at least one

calculation type in the chart will have the action period property, the Uses action period property will be set to TRUE. You can also set a list of

replacing calculation types for each calculation type.

Another important property of the Chart of calculation types

configuration object is Dependence on base. It indicates whether this chart of calculation types contains calculation types that are dependent on a base period. If at least one calculation type has a calculation base, the

property will be set. If that property is set, you will be able to indicate which chart of calculation types will contain the base calculation type, and likewise

indicate how that dependence will be defined.

Page 244: Document1c

Core Development Techniques

244

Calculation types may be created and edited by a developer (predefined calculation types) or a user working with the applied solution. However, the

user may not delete the calculation types created by the developer.

Predefined calculation types are entered in the Predefined Calculation

Types window that is opened by clicking the Predefined button on the Other tab.

You can see predefined tabular sections by adding a new calculation or editing an existing one in the Predefined Calculation Types window.

A chart of calculation types contains the following predefined tabular sections: base calculation types, displacing calculation types, and leading

calculation types.

Base calculation types. The calculation types that define the structure of the calculation base of the current calculation type are

specified in the Base calculation types tabular section.

For instance, a predefined calculation type Salary may be the base for a predefined calculation type Leave.

Page 245: Document1c

Tutorial

245

Availability of the Base calculation types tabular section is defined with the Dependence on base property. If the Dependence on

base property is not defined, the base calculation types concept makes no sense. You can specify calculation types from other charts

that are defined as base charts of calculation types.

Displacing calculation types. The calculation types that displace the current calculation type by action period are specified in the

Displacing calculation types tabular section. Only the calculation types that belong to the same chart of calculation types may be

displaced.

For instance, Salary is displaced by Absence and Leave.

Leading calculation types. The calculation types that require recalculation of the current type when they are entered or modified will be specified in the Leading calculation types tabular section. If

several charts of calculation types are specified in the configuration, calculation types from other charts of calculation types may be

specified as the leading ones.

For instance, Salary is the leading calculation type for Bonus.

The Action period as a base period property of predefined calculation

types is set in Designer and may not be changed by users in 1C:Enterprise mode.

The calculation register is a configuration object that supports accounting of calculation results obtained in the course of calculations specified in the chart of calculation types. In other words, calculation registers are used to

accumulate information on periodic calculations.

When you edit a calculation register, you need to specify the list of

calculation types, action period and basic period support, and periodicity, and to develop its structure: sets of dimensions, resources and attributes, as well as screen forms and print forms for viewing register records.

Each calculation register is connected to one of the charts of calculation types that exist in the applied solution. Because of this connection, each

register record has a Calculation type field. The register uses this field to monitor the mutual impact of different register records. You can specify only one chart of calculation types for the calculation register.

Information in the calculation register is stored as records, each of which contains dimension values and the corresponding resource values. Register

dimensions describe the sections where information is stored, while register resources contain this stored information (numerical values only).

Page 246: Document1c

Core Development Techniques

246

The calculation register stores data by dimensions and by time. This is why each record of the calculation register contains another mandatory parameter — Action period. If the Action period check box is selected,

the calculation register record will have the following properties available: ActionPeriod, BegOfActionPeriod, EndOfActionPeriod, and Schedule.

At the calculation register development stage, the developer may set the minimum periodicity of adding records into the register. It should be noted that the ActionPeriod property is a date that takes discrete values

depending on the periodicity of the calculation register. The value of the ActionPeriod property is cast to the beginning of the period (month) after

the BegOfActionPeriod date and does not always match the BegOfActionPeriod date.

If the Base period check box is selected, the properties BegOfBasePeriod and EndOfBasePeriod of the calculation register record become available.

Page 247: Document1c

Tutorial

247

The state of the calculation register is usually changed when a document is posted. This is why each register record matches a certain document (the

recorder) and some lines in the tabular section of this document. In the register, you only can simultaneously add, modify, or delete all of the

records related to a single document.

The system checks the uniqueness of the records stored in the calculation register. Therefore, the calculation register cannot contain two records related to a single line of a single document.

You can specify a connection between a calculation register and a time scale. The Schedule property is available if the Action period property is

set. A time scale is an information register that contains a time model of the source data used in calculations. The data used as a time scale cannot be periodic. Instead, it will have a dimension of Date type. The dimensions of

that information register may, for example, be a work schedule and a date, while the resource may reflect the number of work hours on that date. Then

we will be able to connect a calculation register record with some specific work schedule and later obtain information on the number of work hours that is required to perform the calculations with the help of a script.

A calculation register can include objects called recalculations.

In recalculations, the system will store information about which calculation

register records are no longer up-to-date and should be recalculated due to the following features: dependence on the base period and displacement by

action period. Several recalculations of different structures intended for handling different tasks may be supported for a single calculation register. A subordinate object of a Recalculation register can have several

dimensions, each of which can set the connection between the dimensions of this calculation register and the leading calculation registers. In some

cases it can be the same register.

Page 248: Document1c

Core Development Techniques

248

Calculation registers implement the following features:

Displacement by action period

Dependence on base period

The displacement by action period feature helps define the actual action

period of the calculation register record by analyzing other records that this register contains.

As a rule, a calculation register record contains two dates that define the period to which this record is applicable. This period is called a record action period. However, if a calculation type to which this record refers may be

displaced by another calculation type, the action period of this record is only a "requested" period, i.e., "we would like the record to be valid for that

period". In reality, the actual action period for this record may only be defined after all the records of calculation types that displace this calculation type by action period are analyzed. The actual action period is a set of

periods that are a subset of the source action period of this record. If no record that displaces this one by action period is found, the actual action

period of this record will be equal to its action period. Another extreme in this scenario, i.e., displacement by action period, is full displacement of this record by other records. In this case, a record will not have any actual

action period.

Each calculation register record contains a calculation type to which it

relates. In order to identify which records will displace this record by action period, the calculation register uses the connection to a chart of calculation types that describes the mutual influence of calculations upon one other.

The calculation register uses this connection to define the actual action period for each record.

The dependence on the base period feature helps obtain the base value for the calculation register record by analyzing the other records that this

register contains.

Page 249: Document1c

Tutorial

249

The base is a numerical value used to calculate the result of the record. The base is calculated by analyzing the calculation results of other records on

which this record depends by base period. Therefore, as a rule, the calculation register records contains the base period, i.e., two dates defining

the period within which calculation type records should be analyzed. The connection to a chart of calculation types enables the calculation register to define the calculation types on which this calculation type depends by base

period.

Calculation registers support two dependencies by base period:

Dependence by action period

Dependence by registration period

If dependence by action period is used, the records for which an intersection is found between their actual action period and the base period of the record will be selected for the base. The base value received from a

specific record that impacts the calculation will generally not match the result contained within that record. The base will be calculated in proportion

to the part of the impacting record’s actual period that intersects with the specified base period. The data of the schedule connected to this record will be used.

If dependence by registration period is used, the calculation results of those records whose Registration period field values match the base period of

this record will be selected to form the base. If the record’s registration period (a registration period is a date that has discrete values depending on the periodicity of the calculation register, i.e., it matches the beginning of a

month) matches the base period, the record will be accounted in full. Otherwise it will be excluded from processing in full.

The most complex scenario of dependency by base period is when the Base period as action period property is set for the calculation type of the record. This property means that an actual action period of the record

obtained through the displacement by the action period feature and generally presented by a set of certain periods will be used as the base

period of this record instead of the base period specified in the appropriate fields of this record.

The recalculation record generation feature monitors the appearance of new

records in the register that impact the calculation result of existing records. To identify whether new records may impact existing ones, you need to

analyze the mutual impact of different calculation types and consider how the displacement by action period and dependence by base period features function.

The recalculation record generation feature outputs a set of recalculation records that contains the list of register records to be recalculated.

A recalculation record contains information on RecalculationObject — a reference to the document that created records to be recalculated, the calculation type, and the recalculation dimension.

Page 250: Document1c

Core Development Techniques

250

Recalculations are registered by the system automatically or with the help of a script.

In 1C:Enterprise 8 recalculations function on a "per-notification" basis, i.e., the developer may decide on their own whether the register records need to be recalculated.

Below is a list of major calculation register functionalities that developers can use:

selecting records in the specified interval by the specified criteria;

selecting records by recorder;

obtaining the base value for the register records complying with the

specified filter;

obtaining the schedule data for the register records complying with

the specified filter;

obtaining data on the records to be recalculated;

reading, modification, and writing of a set of records into the register.

Working with calculation registers with script tools

You can retrieve data from a calculation register using queries or script methods. A selection of calculation register records can be created with the

Select and SelectByRecorder methods of the CalculationRegisterManager object. By using the GetScheduleData(<Filter>,<PeriodType>) method, you can obtain the

number of actual work days of an employee (specify the actual action period in the <PeriodType> parameter) and the days norm (specify the

action period in the <PeriodType> parameter).

Use the GetAddition() method of a set of records of the calculation register to reverse records. This method gets additional data to reverse

records related to previous registration periods when the current record set is entered. The data is obtained as a table with the following structure: all

predefined calculation register record fields except the recorder and record number, all dimensions, resources and attributes, and additional fields such as reversing registration period, reversing start date, and reversing end

date.

An addition is the data that the system provides to add to the current

record set. This allows you to increase the actual action period of the current records by reversing records belonging to previous registration periods (if necessary). The additional reversing entries are generated based

on the action periods of the calculation register records and action period displacement rules, which are set by the displacement calculation type lists

in the register's chart of calculation types.

Page 251: Document1c

Tutorial

251

It is necessary to get an addition if you try to enter an accounting record with the action period that is "occupied" by another record, which has a

registration period that is less than yours. In the resulting table of values the fields are filled with data from the reversing entries (already existing in

the calculation register) and with other additional data: the reversing entry registration period (the registration period within which the system recommends registering a reversing entry) and reversing period start and

end dates (the period that the system recommends to enter as a reversing entry action period).