the Internet Windows Android

The structure of the program module in 1C consists of. Common modules

Hello everyone.
Today we consider platform modules 1C enterprise 8.2They became more than in version 8.1 and sometimes it is sometimes not so easy.
Example:

If you look at the 1C help, we will see the following definition of the module:
The module is called the program in the embedded language of the system 1C: Enterprise.

And if it's easier: in modules 1C.the executable code is required to respond to any way to respond to the actions of the system or the user when visual means are not enough to describe the interaction of objects in the configurator. Also in the rogram modules you can describe your own methods.

Any line of code is in any module, this is the difference from 1C7.7, where the program code could also be located in the cells of the layout tables and in the properties of the form elements.

We list the modules that are in 1C 8.2

Platform modules 1C enterprise 8.2:

The controlled application module
Module of the usual application
The module of the external connection
Session module
Common modules
Object module
Module form
Module Manager Object
Module manager of values
Modules of record sets

The main sections of the module:
1. Section of the description of local variables this module, You can specify the compilation directive (not for all modules).
2. Section of procedures and function procedures. If you do not write a compilation directive, it is the default - & the ground, the order of procedures and functions does not have any meaning.
3. Section of the main program of the module (contains some operators). This section is performed when referring to the module (there is not for all modules).

Not all modules contain sections of the description of variables and the section of the main program.
For example: Common module or session module.

Module compilation rules:
1. Some modules are compiled by either on the client side, or on the server side. All methods in them are either client or server. An example of a client module - a controlled application module.
2. Some modules can combine client and server methods. In this case, for each method, you must specify the compilation directives - & Change or & Nasserver. Example - modules of controlled forms.

Classification of modules:
1. Server. Only the server side is compiled - the object module, the manager module, the entry set module.
2. Client. Complete only on the client, for example, the module of the managed application.
3. Combined. Can be compiled on the server and on the client - the module of the form and general modules.

Module compilation location:
1. Slim client (provides the ability to use a web browser).
2. Server.
3. Thick client.

As you can see the modules not so much, almost every configuration object has a module that has its purpose.

Purpose of each module 1C 8.2

PS Thought to buy 1c enterprise and do not know who? The LBS company is included in the 20 best 1C: franchisee. Engaged in the automation of accounting on the basis of Products "1C". Buy 1C products from LBS and get high-quality support and 1C service.

P.S. Mix over anecdotot from Lukashenko))

In the new versions of the 1C system configurations: the company, many functions and procedures moved from object modules (documents, reference books, etc.) in the manager modules. Consider the differences between these two modules.

According to the theory of object-oriented programming, object methods are divided into two groups: static and simple. Simple methods have access to only a specific class instance. Static methods do not have access to objects of objects, and work with the class as a whole.

If you translate all this in terms of the 1C system: Enterprise, then Object module contains simple methods. To use them, you must first get a specific object: the element of the reference book, document, etc. Module Managercontains static methods. To use it, there is no need to separately receive each specific object, it allows you to work with the whole collection at once.

Object module May have procedures and functions that can be used from outside. To do this, such a procedure or function is indicated by the word Export.

Function New Function () Export

In order to use such a function from the object module, you must first, having a link to the required object, get it using the function Receive ().



Per \u003d object. New feature ();

Similarly, you can create new variables that can be used from various configuration objects.

For new permeated export

Element Advice \u003d References. Nomenclature. Found contact ("000000001");
Object \u003d Element Advixer. Reference ();
An object. New permissed \u003d);

Thus, you can complement standard procedures, functions and properties (variables) of objects. Such variables are dynamic, they are not saved in information base And exist only while working with the resulting object.

Module Manager It has all the same features, the difference is only that it does not need to receive a specific object for use, the manager's module allows you to work with the entire collection of objects of a particular type.

New Company Procedure () Export

Element Advice \u003d References. Nomenclature. New Company ();

Or for variable:

For new permeated export

Element Advice \u003d References. Nomenclature. New permissed;

Consider the differences in the application of the object module and the manager module on the example of the creation procedure printed form Document.

When using the object module, the code will look as follows:

Printing Function (link) Export
// This feature must be sent to a specific document.
Refund;
Endfunction

On the form of the document, you need to create a procedure that would transmit a link to the document to the print function.

& Svalette
Procedure Printing (Team)
TABO \u003d printing server ();
Tabd. Show ();
Extrudresses
&On server
Function printing server ()
Dock \u003d requisite / object ("object");
Return dock. Printing Course (object. Reference);
Endfunction

Disadvantage this method It is that it allows you to print only one object. If you want to print multiple documents immediately, you need to get each of them, and then call the function from the object module. This requires significant system resources, because when receiving an object, it is entirely placed in RAM.

From the point of view of performance, it is much better to use the manager module when possible. In our example, the task solution will look like this.
Function printing server ()
Return documents. NOV Document. Sealdocument (arrays);
Endfunction

In the case of using the manager module, the printing procedure can be called both from the document form and from the list form, transmitting links to several documents in the array. At the same time, the system does not need to receive each document from the array, which significantly saves system resources.

So when to use the object module, and when the manager's module?

It all depends on the task. If there is enough reference to the object (for example, the print task) is enough, then it is better to use the manager module. If the task is to change the data, such as filling out the document, then it is necessary to get it and use the object module.

Printing (Ctrl + P)

Objects located in the configuration tree branches Common modules are designed to be placed in them texts of functions and procedures that can be called from any other configuration module.
ATTENTION! The general module may contain only definitions of procedures and functions..
Procedures and functions of a general module for which the headlines are indicated keyword Exports are one of the components of the global context. For more information on writing procedures in a shared module, you can find out in the "Format of the source text format of software modules" and "operators" of references in the built-in language.
To edit a shared module, you must in the Type object properties palette of the General modules of the Configuration window in the Module property, click the Open link. The text of the general module will be issued to edit in the text editor of the "1C: Enterprise" system in the text editing mode of the software module.
The common module, being part of the configuration, is saved only in the configuration.
The global property determines whether the exported methods of the general module are part of the global context.
If the global property is set to truth, the exported general module methods are available as a global context methods.
If the global property is set to a lie, the global context creates a property with the name corresponding to the name of the general module in metadata. This property is read only. The value of this property is the object of common. Through this object Exported methods of this common module are available. Thus, contacting the methods of non-global common modules looks like xxxxx.yyyyy, where xxxxx is the name of the property corresponding to the context of the general module, and yyyyy is the name of the exported method of the general module.
Example:

Workstorgovyovyovanie.Instrichtrichkodov ();

Various context and general modules

Using the properties of general modules and instructions of the preprocessor, you can organize execution various methods common modules in the desired context.
Each property of a shared module is responsible for the possibility of compiling (and execution) of a shared module in a particular context.
The following properties are available that are responsible for the context in which the methods of a shared module are available:
Client ( normal app) - General module methods will be available for a thick client in a regular application mode;
● - General module methods will be available for thin client, web client, as well as for a thick client in
controlled application mode;
● Server - General Module Methods will be available on the server;
External connection - General module methods will be available in external compound.
If multiple properties are installed simultaneously, this means that the general module methods will be available in several contexts.
If a common module has a server property and any other property, it means that the common module will be available simultaneously on the server and in the selected client. In this case, it is necessary to understand that in fact it will be several embodiments of the compiled code (according to the number of selected customers and actually for the server).
In this case, if the method located in such a general module is called from the client, the client copy of the shared module will be used, and if the server is from the server. In this case, using the preprocessor directives (for details, see here) you can "protect" the server from the code that cannot be executed on it.
Consider an example. In a common module (which can be executed on a thin client and on the server) there is a method that has several different behavior on the thin client side and on the server side. Let's see how it can be done:



# If thincotient then
// Show a warning
Confessing("On the client");
# Endox
Extrudresses
Then the code on the server will acquire the following form:
Procedure Methoduli () Export
// there is a different important code
Extrudresses
And on the side of the fine client the code will have the following form:
Procedure Method Module () Export
// there is a different important code
// Show a warning
Connecting the user ("on the client");
Extrudresses

To transfer control from the client to the server there are several ways:
● call the server shared module method;
● In the form module or command, call the method that is preceded by the compilation directives & Nasserver, & People

In this case, it is impossible to call the methods of client common modules (which have no server property) and client modules of the module or command module. Management will return to the client after the most external call to the server method is completed.
The exceptions are Module Module Module and Command Module, which are preceded by compilation directives. & Svaliennserver, & SvalientServerebereTeontext.
The following points should also be mentioned:
● If the common module is available more than one client, then when writing a program code, you should consider the maximum restrictions that can be superimposed by customers, or use the preprocessor instructions for the "insulation" of the code specific to one or another client.
● Preprocessor's instructions also make sense when one common module has several execution contexts, for example, an external connection and a thin client or (which is found much more often) any client and server. In this case, the preprocessor instructions will be framed by an interactive code that cannot be used on the server, but perhaps on the client (see example above).
For more information on the instructions of the preprocessser and compilation directives in the "Following procedures and functions" section of the Integrated Language.
The Server Call property is intended to control the possibility of calling the exported methods of the server shared module from the client code.
If the property is set, the exported server shared module methods are available for calling from the client. If the property is not installed, then such exported methods can be called only from server methods (both server common modules and server methods of module forms and modules of commands).
Council. It is recommended to set the server call property to the value in cases where the server common module contains methods that are undesirable to call from the client (for example, for security reasons).
Note. If properties are simultaneously installed Client (normal application), Client (Managed Application), External connectionThe server call property is automatically reset. If the server call is set, the properties are automatically reset. Client (normal application), Client (Managed Application) and External connectionIf these properties were installed simultaneously.
Property Privileged Designed to disable access control when performing a general module methods.
NOTE. If property Privileged Installed, the general module is automatically installed the server property and the remaining properties are reset ( Client (normal application), Client (Managed Application) and B. ensure connection). A privileged general module can only be executed on the server.

Reuse of returned values

If the general module is not global, it becomes available to the reuse of returned values. This property can take the following values:
● Do not use - reuse returned values \u200b\u200bfor the functions of this common module is not used.
● At the time of the call and for a session time - a method for determining the reuse of data is used for a common module. The essence of this method is that during the code execution, the system remembers the parameters and the result of the function of functions after the first call of the function. When you repeatedly call the function with the same parameters, the stored value is returned (from the first call) without performing the function itself. If the function changes the parameter values \u200b\u200bduring its execution, then the repeated function of the function will not do it.
The following features of saving call results can be selected:
● If the function is performed on the server and is called from the server code, the parameter values \u200b\u200band the call result is remembered for the current session on the server side;
● If the function is performed on a thick or thin client, the values \u200b\u200bof the parameters and call results are remembered on the client side;
● If the function is performed on the server side, and calls from the client code, the call parameters are remembered on the client side, and on the server side (for the current session).
Saved values \u200b\u200bare removed:
● If the property is set to call time:
● on the server side - when returning control from the server;
● On the client side - upon completion of the work procedure or the function of the embedded language top level (called by the system from the interface, and not from another procedure or the function of the embedded language);
● If the common module property is set to a session time:
● on the server side - at the end of the session;
● On the client side - when closing the client application.
Saved values \u200b\u200bwill be removed:
● On the server, in a thick client, in an external connection, in a thin client and in a web client with a conventional connection speed - 20 minutes after calculating the value of the value or 6 minutes after the last use;
● In the thin client and the web client with a low connection rate - 20 minutes after calculating the value of the value;
● When lacking random access memory in the server's workflow;
● when restarting the workflow;
● When switching the client to another workflow.
After removing the values, the call of the exported function is performed as when the first call is first.
To execute procedures this property General modules do not affect - procedures are always performed.

If a common module has a reuse of returned values, a number of limitations are superimposed on the types of parameters of exported functions. Types of parameters can only be:
Primitive types (Uncertain, , boolean, number, row, date).
● any links to database objects.
● structures with the values \u200b\u200bof the properties listed above. In this case, the identity of the parameters is controlled by "on the content" of the structures.
If the exported function returns any object, then the reference to the object is actually returned in the Keshe. If, after receiving this link, a change in the state of the object will occur, then the subsequent call to the same function will return the reference to the already modified object without actually executing the function. This behavior will be observed before removing the saved value (for any reason). In other words, changing the state of the object obtained as a result of the call of the function from a shared module with reuse returned values \u200b\u200bis not the basis for the actual function call. It should also be remembered that the cache of returned objects is indifferent to
The state of the adjusted mode at the time of calling the function with reuse returned values. This feature can lead to the following behavioral feature:
● The actual call to call a function with reuse returned values \u200b\u200b(first call) was performed when the adjusted mode is enabled.
● When executing the function, an object was obtained that cannot be obtained with a disconnected adjoind mode.
● Subsequent features of the functions were performed without installing the adjoind mode.
● However, before cleaning the cache of returned objects or a re-actual call, the function will return a formally inaccessible object.
● Also true behavior is also true when the first call is performed without installing the adjusted mode, and the object that could be obtained in the adjointed mode cannot be returned.

If a common module property Reuse of returned values Set to the value of the session, then in the values \u200b\u200breturned by the functions of this module, you cannot use the values \u200b\u200bof the type Manager Distribution.
If the function of a shared module, with re-use installed, is called from the same common module (for example, with the name of the common module), then the following feature should be remembered: if the function is called by the name of washing (), then the execution of the function will occur with each function call . In order to be used saved values, the function should be called full name:
ORGANMOUS.MIO Function ().
The global context method removes all the reused values, both on the server side and on the client side, regardless of the method of calling the method. After performing the method UpdateTransmitted () The first call to the function will be fully fulfilled.

The module is intended for integration with solutions containing the configuration "ERP Enterprise Management 2". Indispensable for design and oriented enterprises and organizations!

Functionality Systems:
  • Project management
  • Planning the content and timing of the project
  • Planning volume and project shipments
  • Planning subcontracts and material costs of the project
  • Personnel planning and project work
  • Manage download and working time for projects
  • Registration of actual data and project events
  • Financial management projects
  • Description of design work
  • Project Versionation
  • Plan-Fact Project Analysis
  • Project Communication Management
  • Knowledge management
  • Project assessment and calculation of the contract price
  • Management of project contracts
  • Document management project
  • Project risk management
  • Management of portfolio and project programs
  • Project Management Resource Management

Project data can be entered into a system in several ways:

  1. manually through the Project Management Panel;
  2. load / unload data from / to MS Project;
  3. download data from the template stored in the system;
  4. combined way: part manually, part of MS Project.

You can plan work in different ways:

  • so that the project manager ruled the project plan, and the functional is to perform work. Labor resources are distributed taking into account the roles performed;
  • the project manager manages the project plan and work. Labor resources are appointed without roles.

The visual system toolkit allows the manager to receive information about the project in different views: tabular, data tree, Ganta diagrams, design milestone, network schedule. The system allows you to assign the head of a specific design task, and automatically its subtasks other than the project manager as a whole.

The decision is intended for the owners of commercial real estate, managers, construction and development organizations. The product allows you to improve the efficiency of the business of companies through the automation of processes for maintaining the registering of real estate objects, the management of lease agreements and calculations with tenants, the operation of real estate facilities. The program ensures the solution of the tasks of accounting, managerial, legal and administrative accounting.

Solutions:
  • maintaining settlements with tenants based on invoices (planned debt), monitoring billing accounts with analytics on facilities, services and periods;
  • separate purpose and control of payment timing for a constant and variable part of the rent;
  • the possibility of calculating the penny for the delay in payment on the basis of both the actual (by acts) and the planned (on accounts) of the debt;
  • the use of arbitrary formulas for calculating the cost of the services of the variable part (for example, the accrual of interest from the trading turnover of the tenant in various algorithms);
  • the use of several consumption volume counters for one unit of the variable part;
  • the possibility of appointing both individual and uniform tariffs for the services of the variable part;
  • management of real estate inspections;
  • opportunity sharing With preparing for the release of solutions "ERP Management of the Construction Organization 2.0" and "Module 1C: Realtor. Real estate sales management for 1C: ERP" within a single configuration.
Solution Opportunities "Module 1C: Motive Transportation for 1C: ERP & RAQUO:
  • Accounting of orders for vehicles;
  • Extract and processing of travel sheets;
  • Calculation of the regulatory and actual fuel consumption. All algorithms for calculating the regulatory fuel consumption are implemented in accordance with the order of the Ministry of Transport dated July 142015 N on-80-p. The solution allows you to record fuel consumption for cars with an unlimited number of equipment and trailers.
  • Accounting for the receipt, consumption and write-off fuel;
  • Accounting of license tires and batteries;
  • Integration with satellite monitoring systems.
  • Calculation of development in travel sheets in various parameters. The main parameters (mileage, weight of cargo, cargo turnover, time in the dress, simple, etc.) are predetermined in the system. Using directories, you can configure any arbitrary generation parameters and to further analyze this information;

Any program consists of a program code, that is, actually written in any language of the sequence of actions that must be completed.

However, this program must be somewhere written, that is, somewhere to be. In most cases, the program code is written in ordinary text files. The only difference is that the expansion of them is not.txt, A.CPP or.PHP.

Where is the 1C program writes?

What is 1C module?

Of course, 1C code could also be written in some text file. However, there is a Configuration Configuration 1C - which includes not only the list of settings, form templates, etc., but also 1C software code. Therefore, 1c code is stored in the configuration.

The configuration consists of 1C objects, as we have already considered in previous lessons. Each 1C object contains invested objects, such as the directory has several forms.

Each object 1C, including some nested, has its own module - a certain text file that contains the program code.

Also, there are independent modules from objects in which a program code that is independent of a particular object can be written.

Thus, in 1C there is no "unified" program. There is a set of modules for writing a program code for each 1c configuration object.

How are 1C modules used?

The entire program can be roughly divided into two types:

  • Object method
  • Reaction to events.

Methods. As we have already spoken earlier - the 1C object is a one-piece structure, which includes both data and methods for processing. These ways are a set of actions (methods) that can be called for data processing. An example of such actions Directory object. Record () - writes an element of the reference to the database.

Methods of many objects 1C can be standard (i.e., programmed in 1c platform) and written by a programmer in 1C. Using the second - you can expand the functionality of 1C objects at your own desire.

Events. Events are in many other means of development. The goal of the program is not only something to calculate when starting, but also support the user.

User events - user pressed a button. In response, some part of the code will be completed by following the response to the user actions.

System Events - We recorded the 1C object to the database. There was a system event "Recording Object". It is possible to configure the reaction that will arise on events caused by the user (which pressed the button or did something else), but the system itself. A vivid example of such an event - when starting the program.

The procedure for performing modules 1c

In many languages \u200b\u200bthere is such a concept as a "entry point". This is the very first line or function that will be performed when the program is started.

In 1C of such input points somewhat - for each type of client. That is, when you start a thick client, the entry point is one, when starting a thin client - the other. This allows you to program features, different in different types of customers.

The entry point in the corresponding module is the system event handlers in front of the protrusion () and the receivers (), respectively (i.e. in order). These functions are performed first, they can run something automatically.

If nothing has been running automatically, then the user opens 1c interface and then it all depends on it. It presses the button - the handler is executed by pressing this button (which in turn can also run something automatically).

Working with 1C modules

Performed in the configurator. You can open the module using the Configuration window.