What are complex periodic calculations? Mechanism of complex periodic calculations

The task

Salaries of the company's employees are calculated monthly. All employees work a five-day work schedule, but the solution must allow for the ability to work multiple different schedules.

For conducting classes at their main place of work, employees of the educational enterprise receive payment at an hourly rate. The tariff accrual amount is calculated as the tariff rate multiplied by the number of hours actually worked. The initial value of the tariff rate can change no more than once a day, but is taken at the beginning of the billing period

Employees can conduct on-site training. In this case, the tariff for the period of on-site training does not accrue, and the accrual

employee consists of two parts:

Some fixed amount to compensate for his transportation costs;

Accruals directly for training in the form of remuneration, calculated as the total amount of payments made by students in the current billing period, multiplied by a certain percentage. The percentage value can be specified in the document “Payroll.

In December, at the end of the year, employees of the enterprise may be awarded a bonus as a percentage of the amount of all accruals made over the past year. The bonus percentage is the same for all employees of the enterprise. The percentage value is determined at the time the accrual information is entered into the information base.

There is no need to use the recalculation mechanism within the framework of this task.

All accruals are entered using the “Payroll” document. Consider that all data is entered only within one month, for example, you can indicate the accrual for the tariff from 10.01 to 31.01, but the entry: tariff from 10.01 to 03.02 cannot be entered.

To analyze accruals made to employees of an enterprise in the configuration, it is necessary to provide a report of the following type:

The report can be generated for any billing period. To analyze the accruals made for training students on-site, the configuration must provide a report of the following type:

The report can be generated for any billing period.


Solution

1. Let’s start solving the calculation problem by determining what types of accruals and deductions need to be created in the configuration and what formulas should be used to obtain the result of each type of calculation. According to the task, we will need to create four types of calculations:

· Accrual for training of students at the main place of work Result = Tariff Rate * Number of Hours Worked;

Please note that for the annual bonus, the method for calculating the total amount of all accruals made over the past year is immediately indicated - “Receiving the base”.

2. At the next stage, for the above types of calculations, we will indicate the dependencies between them.

Table No. 5.1. Setting up displacement and base dependencies between the types of calculations required to solve the problem

Type of calculation Displacing Base
TRF KMD -
TRN - -
KMD - -
PRM - TRF, TRN, KMD

3. Let’s create the above types of calculations in the configuration. Let’s set up the “Calculation” section for each calculation plan used;

4. Create settlement registers;

5. We will make the necessary changes to the structure of the “Payroll” document;

6. Let’s move on to the “Payroll” document:

a. Let's add the required number of entries to the register:

i. Let us determine the boundaries of the intervals of all existing periods for each record;

ii. We indicate the values ​​of measurements and register details;

b. Let's calculate the records of the generated sets for the primary types of calculation:

i. If transport costs are entered, the result of the accrual

we will determine immediately, according to the document;

ii. Calculation according to the tariff at the main place of work

1. Using the query mechanism, for each record with the specified type of calculation we will receive data on hours worked and the current tariff rate;

2. We organize a cycle based on the records of the set. For each record, we implement direct positioning to the desired row in the query selection. Let's calculate the result of the accrual;

3. We will record the set without recalculating the actual validity period;

iii. Calculation of charges for departure

1. Let’s create a negotiable register of accumulation of “Payments

listeners";

2. We will make changes to the algorithm for processing the “Money Receipt” document, during which this register must be filled out;

3. Using the query mechanism, for each employee who worked on the field and indicated in the document, we will obtain data on trainee payments;

4. We organize a cycle based on the records of the set. For each record, we implement direct positioning to the desired row in the query selection. Let's calculate the result of the accrual;

5. We will record the set without recalculating the actual validity period;

d. Let's repeat the steps described in paragraph 4 for records of secondary types of calculation of each level:

i. Calculation of annual bonus

1. Let's create a constant to store the premium percentage. Let's enable the mode of using the main form of constants by default;

2. Using the query mechanism, for each record with the specified type of calculation we obtain data on the database;

3. We organize a cycle based on the records of the set. For each record, we implement direct positioning to the desired row in the query selection. Let's calculate the result of the accrual;

4. Let's write down the set;

e. Let's transfer the program code associated with the calculation to a common module;

7. Let's build the reports required in the task based on the data from the calculation registers, using the data composition mechanism.


Managed Forms

The task

In the forms of all documents used in the task, it is necessary to add the ability to view movements in registers associated with the document whose form is open at a given time.

In the employee selection form, called from the “Payroll” document form, the list of selected employees must be supplemented with information about their tariff rates. When selecting an employee, information about the appropriate rate should appear in the “Size” column. For the “Payroll” document, it is necessary to create a main list form, in which, for the current document, the entries made by it in the calculation registers should be reflected.

Solution

1. Let's create the basic forms of documents. Let's open each form in the form editor window. On the “Command Interface” tab, expand the “Navigation Panel - Go” branch. Set the Visibility checkboxes for the registers.

2. Let’s create a non-main form for selecting the directory “Individuals”;

a. We will make the necessary changes to the structure of the “Employee Information” register;

b. Let's create a new form;

c. Let's open the properties palette of the main form attributes;

d. In the “Object” section, set the “Custom request” flag;

e. Let's open the list settings;

f. We will make the necessary changes to the request text;

g. When creating a form on the server, we will determine the values ​​of the external request parameters;

h. Let's define our own processing for selecting a value from the lookup form;

3. Organize calling the directory form from the document form

a. Let’s create the main form of the “Payroll” document;

b. We indicate the created directory form as the value of the “Selection Form” property of the document form element “Basic AccrualsEmployee”;

In this article, we will consider the theoretical foundations of working with calculation registers, and also calculate the employee’s wages in proportion to the number of hours worked.

Theory

Calculation register (RR)- a configuration metadata object used to implement periodic calculations in the 1C system. The obvious areas of application of calculation registers include the following: payroll calculation, rent calculation, rent calculation.

In their structure, calculation registers are similar to accumulation registers or information registers. They, just like accumulation registers, have measurements, resources, details, but the principle of operation of calculation registers is completely different.

At their core, measurements in the accumulation register serve as “ filter» in the context of which we receive data from the accumulation register. As an example, when we take “remains” according to the accumulation register “Remaining goods” in the context of a certain item or a “cut of the latest” according to the information register “Employee salaries” in the context of a certain employee. In contrast to the accumulation register, measurements in the periodic calculation register serve to implement ““(this is when time-extended calculation types compete with each other over the interval of the record’s validity period, i.e., as an example, the business trip calculation type displaces the salary calculation type for the validity period) and ““(this is when the type of bonus calculation depends on the type of salary calculation for previous periods).

repression mechanism by period of action«:

Here we see that the calculation type “Business trip” has a duration in time and is valid from April 10 to April 20, “Business trip” is indicated as a displacing calculation type for the calculation type “Salary”. The “salary” also extends over time and is valid from April 1 to April 30. Since “Business trip” is indicated as a displacing type of calculation for the calculation type “Salary” (has a higher priority than salary) and is valid for the period of validity of the salary, then the salary is displaced by a business trip and the “Actual period of validity of the salary” is formed.” Actual period of validity of the salary “This is the period of validity of the salary after displacement by a business trip, in our case it consists of 2 periods - from April 1 to 9 and from April 21 to 30 and in total is 19 days. The period-based displacement mechanism only works for long-term calculations.

The figure above graphically shows the principle of " dependence mechanism by base period«:

Let’s say at the end of April 2017 we want to give an employee a bonus in the amount of 10% of their salary. Salary is indicated as the basic type of calculation for bonuses.

But as a “base” for calculating the premium, we will not take the entire month of April, but only the interval from April 10 to April 20 (11 days). Let's calculate the base for the bonus, the employee's salary is 60,000 rubles, there are 30 days in a month, daily salary = 60,000/30 = 2,000 rubles. Next 2000*11 = 22000 rub. The basis for calculating the premium is 22,000 rubles.

Let's calculate the premium: (22000/100)*10 = 2200 rubles. A bonus of 10% of the salary is 2,200 rubles.

The application metadata object “Plan of calculation types” is closely associated with the calculation register.

Plan of calculation types (PVR)- a configuration metadata object that stores information about the types of calculation types and determines the influence of different calculations on each other.

One calculation type plan can be used in several calculation registers, but one calculation register cannot use several calculation type plans at the same time.

The calculation register is a table in which calculated data is stored, and in terms of calculation types, algorithms for calculating this data are stored. The calculation register must have at least one document registrar that makes movements in the calculation register (for example, Payroll).

The calculation mechanisms in the 1C Enterprise system are designed in such a way that you first need to make entries in the calculation register and only then perform the calculation based on this data. For example, it is impossible to calculate a bonus based on a salary until this same salary is recorded in the calculation register.

Practice

Let's take a closer look at the calculation registers in practice:

Step 1 Let's start with a plan for the types of calculations. You must create a calculation type plan before creating a calculation register. We create a plan for calculation types before the calculation register because before creating a table for storing calculated data (i.e., a calculation register), it is necessary to specify algorithms for calculating this data (i.e., a plan for calculation types).

Let’s create a plan for the types of calculation “Basic charges”. Let’s immediately go to the “Calculation” tab. Here we immediately see the flag " Uses validity period", when this flag is set, all types of calculations included in this plan will have length in time(for example, Salary, Business trip), and also for this plan of calculation types, “ repression mechanism by period of action". If the flag “Uses the validity period” is not set, then the types of calculation will not have an extension in time (for example, Bonus, Fine) and the “displacement mechanism by validity period” will not operate. Also on this tab there are sections “Dependency on the base” and “Basic plans for calculation types” - they serve to implement “ dependence mechanism by base period“, but we’ll talk about it later. For now, let’s leave “Dependency on the base” in the “Independent” mode.

Let’s create a predefined calculation type “Salary”. On the “Basic” tab, everything is simple. Set the name and code of the calculation type.

Thanks to the fact that we set the flag " Uses validity period"We now have a tab" Displacing" and turned on " period-based repression mechanism«.

On this tab we indicate the types of calculations that will displace the salary by validity period (for example, Business trip).

Note: in “Displacing” you can add calculation types that belong only to this plan of calculation types.

There is also a tab " Presenters»—it indicates the types of calculations that, when changed, must recalculate the current type of calculation. Here you can also specify calculation types from other calculation type plans. For example, the “Salary” calculation type is the leading one for the “Bonus” calculation type, i.e. When the salary changes, we must also recalculate the bonus because The bonus is calculated depending on the salary. In this case, the “Salary” calculation type belongs to the “Basic Accruals” PRP, which uses a validity period, and the “Bonus” calculation type belongs to the “Additional Accruals” PRP, which does not use a validity period.

Step 2.Let's create a directory “Graphs” with the default structure. In the “Schedules” directory we will store the working hours of employees (five-day, six-day, etc.).

Step 3.We also need an object in which we will store the Production calendar (working days and weekends). For these purposes, we use a non-periodic independent register of information.

Let’s create a non-periodic independent information register “Work Schedules” with 2 dimensions “Date” and “Schedule” and the resource “Number of Hours”.

Thanks to the “Work Schedules” information register, we will be able to calculate wages from the salary in proportion to the number of days worked.

Step 4.Create a “Payroll” document with the details structure shown below:

Requisites:

Operational execution is set to “Prohibit” because it does not make sense for the mechanism of periodic settlements in 1C - we never calculate bonuses, salaries, or fines in real time.

Let's create a document form with default settings.

Step 5. Finally, we got to the point of creating calculation registers.

The calculation register metadata object is located in the “Calculation registers” branch of the configurator.

Let’s create a calculation register “Basic charges”. Let's look at the calculation register settings below:

1. In the “Plan of calculation types” field, indicate the PVR “Basic charges” created in step 1.

2. Set the “Validity period” flag to “True” because The PVR specified in step 1 has extension in time.

After setting this flag, the standard details “Action Period”, “Action PeriodStart”, “ActionPeriodEnd” immediately become available to us, which means that the types of calculations registered in this calculation register also have length in time and we have access to " repression mechanism by period of action«.


P.S. If you specify a PVR that has length in time for a RR with the “Validity Period” flag set to “False”, then this PVR will work as a PVR that does not have extension in time.

3.After setting the “Validity period” flag to “True”, the fields “Chart”, “Chart value”, “Chart date” become available to us.

In the “Schedule” field we indicate the “Work Schedules” information register created in step 3.

In the “Schedule Value” field we indicate the “Number of Hours” resource in the “Work Schedules” information register.

In the “Schedule Date” field, indicate the “Date” dimension of the “Work Schedules” information register.

4.In the “Frequency” field we indicate the value “Month”, this means that the data will be entered into the register on a monthly basis.

Below is the registry metadata structure:

The “Basic” flag for a dimension only affects performance; you don’t have to set it, but if you do, the “Employee” field will be indexed.

The "Employee" dimension - it is used in " repression mechanism based on the period of action" And " mechanism of dependence on the base period«.

Resource “Amount” - the calculated salary will be recorded there.

The “Chart” attribute is indicated as an attribute, and not a register dimension, because neither it nor it displaces anything - essentially a reference field. Important!!! Don't forget to fill out the "Schedule Link" field at the “Schedule” attribute, the “Schedule” dimension of the “Work Schedules” information register must be indicated there, otherwise the salary amount will not be calculated.

The “Parameter” attribute will store the salary value.

Now that we have indicated the connection with the “Work Schedules” MS, we will calculate the employee’s salary in proportion to the number of days worked.

We indicate the document as the registrar " Payroll", created in step 4.

Step 6. We make movements according to the calculation register “Basic charges”.

Let's return to the “Payroll” document created in step 4.

Let us describe the processing of posting in the document object module:

Fragment of document processing processing code

1C (Code)

Procedure ProcessingProcessing(Failure, Processing Mode) // register BasicAccruals of Movement.MainAccruals.Write = True; Movements.MainAccruals.Clear(); Registration Period = Start of Month (Date); For Each TechLineMainAccruals From MainAccruals Cycle Movement = Movements.MainAccruals.Add(); Move.Reversal = False; Movement.CalculationType = TechLineMainAccruals.CalculationType; Movement.ActionPeriodStart = TechLineMainAccruals.StartDate; Movement.ActionPeriodEnd = EndDay(TexLineMainAccruals.EndDate); Movement.Registration Period = Registration Period; Movement.Employee = TechLineMainAccruals.Employee; Movement.Chart = TechStringMainAccruals.Chart; Movement.Parameter = TechStringMainAccruals.Size; EndCycle; End of Procedure

ProcessingProcedure(Failure, Mode)

// Main Accruals register

Movements. BasicAccruals. write = true;

Movements. BasicAccruals. Clear() ;

Registration Period = Beginning of Month (Date) ;

For each TechLine BasicAccrualsFrom BasicAccrualsCycle

Movement = Movement. BasicAccruals. Add() ;

Movement. Storno= False;

Movement. Calculation Type=TexLineMainAccruals. Calculation Type;

Movement. PeriodActionStart = TechLineMainAccruals. Start date;

Movement. ActionPeriodEnd=EndDay(TexLineMainAccruals.EndDate) ;

Movement. Registration Period = Registration Period;

Movement. Employee = TechLineMainAccruals. Employee;

Movement. Chart = TechLineMainAccruals. Schedule;

Movement. Parameter = TechStringMainAccruals. Size;

EndCycle;

End of Procedure

Let's create a test document and run it:

Let’s go to “Document Movements”:

We see that the registration period is set to the beginning of the month because The periodicity of the RR is indicated as “Month”. We also see that all fields except the amount have been filled in (the salary has not yet been calculated).

Step 7.Let's write the payroll calculation code.

Let's create a general module "Calculation" with the following flags:

The calculation itself will take place in this general module.

Let’s write the export function “Calculate charges” in the “Calculation” module:

Since we filled out the fields “Schedule”, “Schedule value”, “Schedule date” in the settings of the RR “Basic charges”, a virtual table of the calculation register became available to us DataGraphics, in a query to a virtual table we are interested in the following fields:

“Number of Hours Actual Action Period” — contains the number of hours actually worked calculated based on the schedule data

"Number of HoursAction Period" - contains the number of working hours calculated based on the schedule data in the calculation period

Payroll calculation procedure

1C (Code)

Procedure CalculateAccruals(Registrar, Set of Records) Export //Salary Request=New Request; Query.Text="SELECT | ISNULL(BasicAccrualsGraphicsData.NumberofHoursActualActionPeriod, 0) AS HoursFact, |BasicAccrualsGraphicsData.Parameter, | ISNULL(BasicAccrualsGraphicsData.NumberofHoursActionPeriod, 0) AS HoursPlan, |BasicAccrualsDataGr afika.Line Number |FROM |Calculation Register.Basic Accruals.Graphics Data(| Registrar = &Registrar | AND Calculation Type = &Calculation TypeSalary) AS Basic AccrualsDataGraphics"; Request.SetParameter("Registrator", Recorder); // pass the document to the registrar so that the search is performed only on the current document Request.SetParameter("Calculation TypeSalary", Plans of Calculation Types. Basic Accruals. Salary); //set the type of calculation salary because calculate the salary Selection=Request.Run().Select(); SearchStructure=NewStructure; SearchStructure.Insert("RowNumber",0); //create a structure for searching data for calculation by line number For Each Record From RecordSet Cycle //cycle through the set of records of the current documentSearch Structure.LineNumber=Record.LineNumber; //fill in the line number for search If Selection.FindNext(Search Structure) Then //we look in the sample for data for calculation based on the current line number Record.Sum =?(Selection.HoursPlan=0.0, Sampling.HoursFact/Sample.HoursPlan * Sampling .Parameter); //calculate salary in proportion to days worked, in Parameter - current salary EndIf; Selection.Reset(); //reset the selection, we need the next record of the recordset to search through the selection first EndCycle; Recordset.Write(, True); //write the calculated records to the database, pass the parameter Replace = True EndProcedure

//Salary

Request=New Request;

Request. Text="SELECT

| ISNULL(BasicAccrualsDataGraphics.NumberofHoursActualActionPeriod, 0) AS HoursFact,

| BasicAccrualsDataGraphics.Parameter,

| ISNULL(BasicAccrualsDataGraphics.NumberofHoursActionPeriod, 0) AS HoursPlan,

| BasicAccrualsDataGraphics.NumberLines

|FROM

| Calculation Register. Basic Accruals. Graphics Data (

| Recorder = &Recorder

I wonder when I will still read this book? 8.3 will be released then)))

What are complex periodic calculations?

Let's look at the words. The word “Calculation” - I hope it is clear that some numbers need to be calculated. “Periodic” means that this must be done from time to time, at some interval (which is called a “period,” as an inquisitive reader might guess). What is the difficulty? Well, the book gives an example of a woman’s salary. It is calculated once a month (as a rule), and the difficulty lies in the fact that the salary consists of some parts, such as salary, bonus, one-time bonus, sick leave, etc. And each of these parts is calculated according to its own algorithm, for example, salary is the cost of a standard hour multiplied by the number of hours worked minus tax, bonus is a certain percentage of the salary, etc.

What is the type of calculation, base?

Type of calculation - any part of a complex periodic calculation, for example, a bonus.

The base is what we start from when we see the calculation. For example, to calculate a bonus, we need to know the salary. Moreover, it’s not just the salary for the month that is random, but those numbers that are accrued in that period (base period), which will influence the calculation of the bonus.

What is the difference between the base period, the actual period and the validity period?

Validity period – specified by you, that is, data valid for the specified period.

The actual period is what remains of the validity period after calculations are made (for example, all non-working days are removed).

Base period – a period in which the results of other calculations that affect the calculation of the base period are analyzed.

In fact, I don’t understand this particular question. Some kind of verbal balancing act, honestly.

What is base period dependence?

Well, it seems more or less clear here. If we need to calculate the bonus as a percentage of the salary, then we will need not a salary in general, but a salary for a certain period, the salary in which affects the bonus. Then the period can be called the base period, and the dependence can be called the dependence on the base period.

What is period preemption?

Let's start with the fact that “crowding out” is an effect on the calculation. Next. So we think that someone worked for 20 days, calculated his salary, but it turned out that he worked only 10 days. Then the salary must be recalculated precisely for the period when the employee directly worked; this is what the Odesniks call displacement by period of action.

What is the purpose of the Calculation Types Plan configuration object?

The plan of calculation types is intended to describe the structure of storing information about possible types of calculations. Essentially, this is a table that stores information about what types of calculations exist and what the relationships between them are.

During operation, the user himself can add new types of calculations.

What are the main properties of the calculation type plan?

The following properties: Uses the validity period - this type determines whether the plan of calculation types contains calculation types that can be superseded by the validity period.

Dependence on the base – whether there will be calculation types dependent on the base period.

Dependency on the period of the action - those records will be selected for which the intersection of their actual period of action and the specified base period is found;

Dependency on the registration period – work will be carried out with those data whose entry in the Registration Period field falls within the base period;

What is the difference between basic, preemptive and leading types of calculations?

Basic – the results of basic types of calculations should be used for recalculation;

Displacing – displaces calculations based on the validity period;

Leading – if the result of the leading calculation has changed, then the entire calculation must be recalculated;

How to create a plan for calculation types?

The same as everything in 1C! In the configuration tree, right click.

What is the Calculation Register configuration object?

Intended to describe the structure of data accumulation, which are the results of calculations.

In the 1C:Enterprise system, calculation register objects are designed to record the results of calculations carried out with a certain periodicity, closely related to each other according to certain rules and mutually influencing each other within a certain period.

Calculation register properties

Along with the general properties inherent in all metadata objects, calculation registers have a number of specific properties.

Editing the calculation register is performed in the editing window.

When editing a calculation register, a plan for calculation types is determined, support for the validity period and base period, periodicity, the structure of the register is developed: sets of dimensions, resources and register details are created, if necessary, screen and printed forms for viewing register movements are created.

Plan of calculation types- the main characteristic of the register. Select one of the objects of the type "Plan of calculation types".

Validity- if the property is established, then the competing nature of the mutual influence of movements of a given register is established. Examples of competing movements include payroll and sick leave - you cannot be sick and work at the same time, i.e. receive both salary and sick pay. Such calculations are mutually exclusive in time, and the system must ensure that entering one of them will lead to the exclusion of the other.

Schedule Validity. The property represents a link to the information register, which describes the temporal scheme of the source data involved in the calculation. The schedule should be indicated for those calculations that depend on the initial data distributed within the validity period according to a certain rule. For example, this could be a schedule for recording the organization’s working hours broken down by day, recording lecture hours broken down by hour, etc.

Graph meaning- the property is available if the property is set Validity. In the property, the resource of the information register defined in the property is selected Schedule.

Schedule date- the property is available if the property is set Validity. In the property, select the dimension of the information register defined in the property Schedule and having the type Date. The value of this property is used to bind to the values ​​of the information register resource specified in the Chart Value property.

Base period- if the property is established, then the related nature of the mutual influence of the movements of a given register is established. Examples of related movements include the connection between calculating the accrual amounts based on the average of the accrual amounts in the base period.

Periodicity- defines the period with which movements are recorded and within which movements can influence each other (for registers that support an action period).

Recalculations- subordinate register objects that allow you to set rules for the mutual influence of register movements. In the object properties palette, in the Relationship in Property group Measurement register specifies the main dimension of the current register, which should be recalculated when changing the data of the leading registers specified in the property Data leading registers. For example, recalculation of the deduction amount for an individual will be formed when accruals (wages, bonuses) change.

If the property is set Base period, then the generation of recalculation data will be performed automatically. If the property is not set, then the generation of recalculation data must be done manually by the user (during design, a special form for entering recalculations and a mechanism for their execution should be developed).

On the "Other" tab, you set the object blocking mode (automatic or controlled) and set the full-text search feature for objects of this type.

Calculation registers

Calculation registers are designed to store calculation records (intermediate and final results). Register forms allow you to view settlement records. For example, the figure below shows the form of the Main Accruals register.

As you can see, the results of calculating basic accruals (salary, vacation), etc. are stored in this register for each individual. Double-clicking on an entry opens the recorder document that entered this entry into the calculation register.

Each settlement register is based on a specific plan of settlement types. When editing the calculation register, its other characteristics are also indicated, for example, the frequency of calculations, support for the mechanism for obtaining the base, support for the validity period (for the preemption mechanism), schedules by which the validity periods will be controlled, etc.

The structure of the calculation register determines what information and in what sections will be stored in the register. The developer specifies dimensions, resources and register details:

Dimensions are sections of stored information. For example, the Main Accruals register will have the dimensions Individual, Organization, Division, Position, while the Taxes register will have only two dimensions: Individual and Organization.

Resources - calculation results, for example, the resource Accrued for the Main Accruals register, the resource Withheld for the Taxes register, etc. Resources can only be of numeric type.

Details are an additional characteristic of the calculation record. Details can be of almost any type stored in the database. For example, the details Days and Hours for the Main Accruals register, the DocumentBase detail for the Withholding register. The figure below shows the structure of the Employee Accruals calculation register.

Charts

If the register has the “Validity period” checkbox selected, then you can fill in the “Schedule”, “Schedule value” and “Schedule date” properties. In fact, the graph is a non-periodic register of information that describes the time distribution of the initial data for the calculation. For example, this could be the organization’s work schedule broken down by working days and hours, the duration of work shifts, the schedule of lecture hours, etc.

Below is an example of an information register that serves as a work schedule.

Recalculations

The system allows you to automatically track records that require recalculation. This situation may arise when their results are somehow related to other types of calculations, and those have been changed (deleted or new records added).

For example, when an employee’s accruals change, taxes need to be recalculated. Then, for the “NDFL” calculation type, accruals will be the leading calculation types, which is configured in terms of calculation types on the “Leading” tab.

Let's say we have calculation registers for Basic Accruals, Bonuses and Deductions. Taxes are calculated after all accruals and bonuses, as their results are used.

To automatically track the relevance of tax records for each employee, you need to create a recalculation with the Individual dimension in the Withholding register. The Individual dimension from the Basic Accruals register and the Bonuses register is assigned as the base register data.

The example below shows how recalculation works:

Changed entries are highlighted in each register. Consequently, the associated entries in the Withholding register have become irrelevant, i.e. require recalculation, which is reflected in the conversion table.

Thus, recalculation is a table that stores the values ​​of the dimensions for which recalculation is required. In addition to measurements, this table stores types of calculations and links to record documents. Using the recalculation table, you can determine which records have become irrelevant and require recalculation (or at least more careful attention).

Queries to calculation registers

Queries on the calculation register data allow you to retrieve information about the calculations performed. You can access the following source tables in queries:

  • main table of calculation register entries,
  • table of actual validity period,
  • conversion table.

Using the query mechanism, you can group calculation results in the required sections, calculate totals, and select only the necessary calculation records. This allows you to generate the entire range of necessary reports, for example, Paysheets, Personal Accounts, Salary Payment Statements, etc. The query mechanism was described in detail in the “Queries” chapter. The list of fields in the calculation register source tables is given in the documentation.

Many 1C programmers have never encountered the “Calculation” component in their practice, therefore, when they have to take exams for a Specialist on Platform 8.0, where each task contains a task on complex periodic calculations, difficulties arise, primarily difficulties of understanding.

Let's try to figure out this component in 8.0. Instead of solving various calculation problems, let's try to understand this component so that we can solve any calculation problem. After studying this manual, you will understand how calculation registers are arranged and work.

For example, we will use the frame configuration installed during exams.

To be honest, I tried for a long time to figure out what else calculations were needed for, but I couldn’t figure it out, so let’s consider the problem of calculating salaries.

What are calculations

Basically, the final payroll product is a set of payroll register entries of the form:

Employee

Period

Type of calculation

Result

Data

A comment

Measurement

Official

Official

Props

The value in the “Data” column reflects the employee’s base salary (according to the employment contract), but this amount can be increased by bonuses, reduced by fines and absenteeism, etc., therefore, the actual amount to be paid is entered after the calculation in the “Result” column. This is the calculation. The amount in the “Resource” column for a given employee is the salary due to him.

Thus, the calculation register is essentially a set of records, similar in structure to the negotiable accumulation register. It’s just that in order to perform complex calculations, additional settings are specified for it, which then allow you to build many virtual tables for the calculation register, although, in essence, this register is just a set of records indicated in the figure.

Each entry in the settlement register relates to a specific type of settlement and time period.

Types of calculations

Each record of calculation types has a service attribute - calculation type.

A type of calculation can be thought of as an element of a special reference book such as “Plan of types of calculations” - it also has details, tabular parts, predefined and user-created elements. There may be several such “directories” in the system.

For example, let’s create a plan for calculation types Main and in it predefined calculation types salary, bonus, absence, business trip.

Calculation types are used functionally to reflect the influence of calculation register entries on each other. But in short they talk about the influence of calculation types on each other:

Type of calculation

Description

Example

By base period

The result of the dependent period calculation depends on the result of the base period. If the result of the base period changes, the result of the dependent period must be recalculated.

The bonus depends on the base period salary.

Wiping by period

The validity period of the dependent period supersedes the validity period of the base period, so the base period has an actual

Absenteeism affects the actual period of the salary.

Leading calculations

The calculation depends on the leading calculation, but not directly but indirectly, i.e. calculation A depends on the basic calculation B, and calculation B depends on the basic calculation B, therefore A indirectly depends on B, i.e. A depends on the leading calculation B. In fact, when calculation C changes, B may change and therefore A may change. The system does not automatically track such complex dependencies, so you need to indicate which calculations are leading.

The bonus depends on the base of the salary, but also indirectly depends on absenteeism.

Due to this influence, the validity period of the settlement register entry is divided into four periods:

Period

Description

Registration period

In what period was the event recorded, i.e. usually when a document is entered.

Validity

In what period does the event operate, i.e. what period the event belongs to.

Base period

Only meaningful for periods that have a base period - describes the interval of the base period.

Actual validity period

If the validity period is superseded by other types of calculations, then the actual validity period consists of several periods when this type of calculation is actually in effect.

The registration period is specified by one number - the beginning of the period, corresponding to the frequency of the calculation register. Even if we set a different date in this service field, it will still be replaced with the beginning of the period. The remaining periods are specified by two fields - the beginning and the end of the period. The actual period of validity is a set of periods, because it can consist of several date intervals.

Time Charts

The system has the ability to link data from calculation registers with time charts so that the number of working hours can be obtained for any period.

A timeline is a simple information register in which one dimension stores a date, another is associated with a dimension by a calculation register, and one of the resources is used to track time.

A dimension that associated with the calculation register usually carries meaning "type of graph".

date

Chart type

Meaning

11.01.05 Fri

Five days

11.01.05 Fri

Six days

12.01.05 Sat

Five days

12.01.05 Sat

Six days

Why use the date dimension rather than the periodic detail register? It’s all very simple - if on Friday, January 11, we have 8 working hours during a five-day period, this does not mean that the next day we will again have 8 working hours. But if we used a periodic register, the value for the next day would be taken from the previous day in the absence of records.

Thus, having a certain period (actual action, registration, base period, etc.) we can automatically obtain the number of hours for this period according to the schedule.

Recalculation

Recalculation is somewhat reminiscent of a sequence boundary. Since we have dependent calculations, when changing their base and leading calculations, the system must somehow note that we must recalculate the dependent calculations.

This is what recalculations are for.

If we calculate the base records, the system will note in the allocations that we need to calculate the dependent records. Once we calculate the dependent records, the allocations will clear.

Essentially, recalculations are a list of calculation register entries that need to be recalculated.

If you do not enter any measurements in recalculations, then when the basic calculations change, all dependent records will be added to the recalculation list.

If we create the “Employee” dimension in the recalculation, then when the basic calculation for an employee is changed, dependent records only for this employee will be added to the recalculations.

Practical task

Enough theory. Let's try to study the details in practice. Let's take the frame configuration as a basis.

Formulation of the problem:

Let the bonus be set as a fixed percentage of the salary (minus absenteeism and travel allowances).

Let travel allowances be paid in double salary + a fixed amount of payments for each day of the trip.

Let the employee be charged a fine in the amount of half the salary for the period of absence for absenteeism.

Progress:

Initial training

Let’s create a new plan for calculation types “Main”.

Let's define the types of calculations and the dependencies between them:

Basic

Displacing

Presenters

Salary

Absenteeism, Business trip

Prize

Absenteeism, Business trip

Salary, Absenteeism, Business trip

Business trip

Absenteeism

Let’s add these types of calculations to the “Main” calculation types plan and set the dependencies in the properties of the calculation types according to the table.

In the salary calculation register, we will create the “Employee” dimension of the “Individuals” type - so that the register has an analytics section for employees.

The configuration already contains the “Payroll” document.

It has two dates in the header - “date” and “registration period”, as well as two dates “start date” and “end date” in each line.

It is understood that the date is simply the date the document was executed, the registration period indicates for which month we are counting the salary, and the dates in each line describe the period of validity of each type of calculation.

Let’s add the initial setting of the “Data” attribute to the document module - we will enter the starting salary, setting the registration period, validity period and base period into it.

The document module will look something like this:

For To each TechStringList From List Cycle

// register Calculations

Movement = Movements .Calculations.Add();

Movement .S torno= False;

Movement .In idCalculation = TechStringList.CalculationType;

Movement .PeriodActionsStart= Start of Day ( TechStringList.StartDate);

Movement .PeriodActionEnd= EndDay();

Movement .Registration period = Registration Period;

Movement .BasicPeriodStart= Start of Day ( TechStringList.StartDate);

Movement .BasePeriodEnd= EndDay ( TechStringList.End Date);

Movement .Employee = TechStringList.Employee;

Movement .Schedule = TechStringList.Graph;

Movement .Result = 0;

Movement .Data = TechStringList.Size;

EndCycle ;

The Reversal attribute is needed to reverse entries (analogous to a minus sign).

We indicate the type of calculation, and set the dates to the beginning and end of the day. Of course, the base period can be entered only for calculation types dependent on the base, and Data can only be entered for the salary, but everything works that way.

We will date all documents 01/20/2003, the registration period will be set to 01/02/2003 (I specifically do not indicate the beginning and end data, this does not matter here, anyway, when recording in Registration Period converted to the beginning of the period 01/01/2003). We use January 2003 because the work schedules were completed for this period.

Let’s create a recalculation “Recalculation” and add to it the “Employee” dimension associated with the “Employee” dimension.

Playing with Recalculations.

To play the game, open the request console - processing " CustomRequest» in a frame configuration. Let's create a new query using the query constructor and add a virtual table there Recalculations. Calculations. Recalculation, the request text will be like this:

CHOOSE

CalculationsRecalculation.About the Recalculation object,

CalculationsRecalculation.In Calculation ID,

Calculations Recalculation. From employee

FROM

Calculation Register. Calculations. Recalculation HOW CalculationsRecalculation

Let's generate three documents - first we will calculate the salary of employees A and B. Employee A works from January 1 to 31, B works from January 1 to 20. We will be the second to assign a bonus to employee B for the period from January 1 to January 31, and the third will assign absenteeism to employee A from January 20 to January 25.

We play with the Actual validity period.

Let's create a new query - this time we will add table data to it Calculation Registers. Calculations. Actual Action Period.

Let's create a request and see that employee A's salary period is divided into two periods - from January 1 to 19 and from January 26 to 31. I hope you understand that the period was divided into two, because... absenteeism replaced salary.

I think the mechanisms of operation of the calculation register are becoming clearer before our eyes.

Let's study graphs.

Now let's try to calculate the salary based on the employee's salary.

Let's create a new query for the calculation register using a virtual table Calculation Registers. Calculations. DataGraphics. You can set a parameter for this virtual table - a condition for selecting records, for example Employee=&SelectEmployee And Calculation Type=&Calculation Type And Graph=&ViewGraphic.

Let's set specific employees, types of calculations and schedules in the request parameters and see how many hours are the result.

Result column

Meaning

ValuePeriodAction

For what period of validity in hours was the entry in the register.

ValueActualPeriodAction

How many hours did the employee actually work?

ValueBasePeriod

For salary it does not make sense, for bonuses - the number of working hours in the base period.

ValueRegistration Period

How many working hours are there in the registration period (month January)