Contacts

Skd layouts. Scd layouts Creating a report in 1s 8.2 from scratch


Keywords: Universal report, General report, Balance & Turnover report, ListCrossTable report, Balances and Turnover, Cross / table list

Most of the reports are built on the same basic principles. Most quick way to develop a report is to use the "Output Form Designer" built into the platform. However, when developing (or revising) a typical configuration, programmers are required to unify the program code, as well as forms of reference books, documents and output forms of reports. Therefore, in typical configurations, the often used program code they are taken out into common modules, and special "universal" reports are used to unify the output forms of reports.
The whole set of reports in typical configurations can be divided into reports generated on the basis of general reports, when all functions for generating the output form and settings are transferred to external module general report and generated using the builder, when all functions that form the output form are contained in the object module.
In UT and UPP there are two general reports: "Report of balances and turnovers (Report of Balances and Turnovers)" and "Report of the list cross table (ReportListCrossTable)". The first "Report of balances and turnovers (Report of Balances and Turnovers)" is designed to generate linear reports of the type "Initial balance - Income - Expense - Final balance", while the groupings are displayed by lines. The second report "List / Crosstab (ReportListCrossTable)" is designed to display crosstabs when groupings are expanded not only by rows, but also by columns.

Structure of universal reports

Let's consider the details, form elements and procedures of the universal reports modules. The composition of the details and functions of the reports is somewhat different, therefore, the differences between the "List / Cross Table (ReportListCrossTable)" from the "Report of balances and turnovers (Report of Balances and Turnovers)" will be given below the description of general details, functions, form elements.
Universal report details:
  • "RegisterName" - a string, the name of the accumulation register from which we receive data
    "DateStart" - the date from which the data sampling starts
  • "DateCon" is the date by which the data is sampled. Those. period of generating reports from "DateNach" to "DateConc"

  • "Report Builder" - the Report Builder type, this variable contains an instance of the Report Builder object with which the information is output to the tabular section, the report settings (groupings, selections, sorting) are managed, and appearance report (display totals for all levels, coloring groupings)
  • "UsePropertiesAndCategories" - boolean, intended to refine the selection of report data by properties and categories of objects. After specifying this parameter in the report settings, it is possible to select certain properties and categories of objects for groupings, selections and ordering

  • "SavedSettings" is a structure that contains settings that are saved when the report is closed and restored when the report is opened again
  • "ColorizeMeasurements" - boolean, setting this variable to True indicates that when displaying grouping lines and fields, colorize them for better presentation of information on the screen

  • "DisplayPointsVSString" - boolean, indicates the ability to display groupings in one line
  • "DisplayAdditionalFieldsIn a SeparateColumn" - boolean, if additional fields are specified in the report settings, they need to be displayed in different columns

  • "DisplayTotalsByAllLevels" - boolean, for some groupings it is possible to specifically prohibit displaying figures by indicators, this attribute removes this prohibition
  • "ShowHeader" - boolean, indicates whether or not to display the title on the screen (adjusted by the "Title" button on the report form)

  • Tabular section "Indicators" - contains a list of displayed indicators

  • In the "CrosstabList / Table (ReportCrossTableList)" report:
  • "Use interval groupings (UseIntervalGroupings)" - boolean, indicates the ability to display data by period intervals
  • Tabular part "Intervals" - contains a list of intervals

Forms of a universal report:
"FormBasic" - the main form of data output.
Details "FormOsnovnaya":
  • "ReportObject" - the main object of the report, a link to the "BalanceAndTurnover Report" or "ListCrossTable Report"

  • The form module contains the following variables:
  • "HeaderHeight" - number, the number of lines in the title, this variable is used when you need to hide / show the report title in a spreadsheet document
  • "Decryption Window Identifier"

  • "Settings Form" - a link to the settings form
  • "Do notFillSettingsOnOpening" - boolean, the variable is used when it is not necessary to fill in the initial report settings. At the first opening, the variable is FALSE, when decrypting the report, the variable will be set to TRUE

  • "DataElementLinksStructure" is a structure that contains data indicating which form elements correspond to the report details

  • Elements of the "FormBasic" form:
  • "CommandPanelForms" - contains control buttons of the form:
    o Menu "Submenu" (Actions) - contains a list of possible actions of the form
    o "Generate" button - when pressed, generates a report
    o Button "Selection" - opens / closes the selection panel
    o Button "Title" - opens / closes the row with the report title in the tabular section
    o Button "Settings" - opens the form of report settings
    o Buttons "Restore Settings", "Save Settings" - save and restore report settings
    o Button "Help (Action1)" - calls help on the report
  • "Period from: (Start Date)", "to: (DateCon)" - input field, entry of the start / end date of data selection for the report

  • "Accounting section (RegisterName)" - a selection field, the name of the register for which the report is generated
  • "Selection Panel" - a panel on which elements are placed to implement the mechanism quick access to report selections

  • "DocumentResult" - spreadsheet document where the report data is output
Form module "FormBasic":
Let's list the procedures:
  • "BeforeOpening" - an event handler before the opening of the form. Contains the code that is executed to initialize initial settings report. Restores the saved data, the "Register Name" variable

  • "OnOpening" - event handler when the form is opened
  • "UpdateReport" - the procedure generates a report and updates the tabular document "Result Document"

  • "ShowSelection" - show / hide the panel of the form of selection
  • "FillObjectByDialogue" - fills in the details of the report on the details of the form

  • "FillDialogueByObject" - filling in the form details according to the details of the report
  • "OutputHeader" - output the title of the report

  • "GenerateFormHeader" - generates the text of the title
  • "AfterRestoreValues" - after restoring values ​​on the form. In this procedure - the form event handler, you can insert code that will set the values ​​of the report and form attributes after opening the report form. Saved values ​​are usually placed in the SavedSettings attribute, and after restoring the form, all settings are placed in the SavedSettings attribute.

  • "BeforeSavingValues" - handler - form events, executed when the form is closed and values ​​are saved from the SavedSettings attribute
  • "AlertProcessing" - Alert Handler

  • "PeriodPressingSettingButton", "Settings1OnChange "," SettingsFieldC1OnChange "," SettingsBy1OnChange "," ComparisonViewField1OnChange "- event handlers of form elements
  • "DocumentResultResultProcessingDecryption" - event handler "Processing of decryption" of the field of the tabular document "DocumentResult"

"Settings form" - a form intended for setting up a report, is called when you click the "Settings" button in the main form of the report.
Details "FormNastroyka":
  • "ReportObject" - a report, a link to the "BalancesAndTurnover Report" or "ReportListCrossTable"


  • "CallerReport" - arbitrary type
  • "IntervalGrouping" - type string

  • "IntervalField" - arbitrary type
  • SelectedIntervals is a type of table of values. Linked to the "SelectedIntervals" form element on the "Grouping Intervals" tab

Elements "FormSetup":
"Report Panel (Report Panel)" contains the following tabs:
The "General" tab contains the following elements:
  • "Period from: (DateStart)", "to: (DateCon)" - input field, start and end date of data selection from the report. The data is associated with the details of the report "DateStart" and "DateCon"

  • "Accounting section (RegisterName)" is a selection field, the item data is associated with the "RegisterName" report attribute, contains the name of the register by which the report is generated. If the "Settings Form" is called from an external report, then this field is unavailable for viewing and editing.
  • "Use properties and categories (UsePropertiesAndCategories)" - the checkbox, sets the flag of using properties and categories of objects, the data of this checkbox is associated with the data of the report attribute "UsePropertiesAndCategories"

  • "Colorize dimensions (ColorizeDimensions)" - checkbox, the data is associated with the details of the report "ColorizeDimensions", if the checkbox is checked, then the grouping levels displayed in the spreadsheet document will be highlighted
  • "Display totals for all levels (DisplayTotalsBy AllLevels)" - the checkbox, if checked, then totals for all levels of groupings are displayed in the spreadsheet document, linked to the report attribute "DisplayTotalsByAllLevels"

  • "Display in different columns (DisplayInDifferentColumns)" - checkbox, by default the values ​​of indicators are displayed in one cell, when this box is checked, the values ​​of indicators will be displayed in two cells
  • "List of Indicators (Indicators)" - tabular part, contains a list of indicators

  • In the List / Crosstab (ListCrossTable Report) report:
  • "Period (StartDate)" - a date input field intended for selecting a period. The visibility of this field is regulated by the module variable "PeriodEnterMode", depending on the value of this variable, in this field you can select a period with a day, month, quarter, year
"Groupings" tab:
  • "RowDimensions (RowDimensions .RowDimensions)" - the type ofReplotDimensions, dimensions that are plotted by report rows

  • In the "List / Crosstab (ReportListCrossTable)" report:
  • "ColumnDimensions (ReportBuilder .ColumnDimensions)" - typeReporterDimensions, dimensions that are plotted by the report columns

  • In the report "List / Crosstab (ReportListCrossTable)": if the attribute
  • "UseIntervalGroups" is set to "True", then the tab becomes available.
Grouping Intervals:
  • "Name (IntervalField)" - selection field. When the form is opened, it is filled in with those dimensions from the "Report Builder.AvailableFields" collection whose names begin with "ID"

  • SelectedIntervals is a table of values. When changing "Name (IntervalField)", the list of selected intervals is filled
Selection tab:
  • "Filter (Report Builder. Filter" - type Filter. Filter Report Builder)

Fields tab:
  • SelectedFields (ReportBuilder.SelectedFields) is a type of ReportBuilder Field. Fields for output to the report

  • "Display additional fields in a separate column (Display AdditionalFields IN a separate column)" - checkbox, when installed, displays fields in separate columns
Sorting tab:
  • Order (ReportBuilder.Order) - the Order type. Sorting groupings in a report

The "FormSettings" module contains the following procedures and event handlers:
  • "FillDialogueByObject" - fills in the dialog by the values ​​of the report details

  • "Before Opening" - event handler for the "Before opening" event of the report form
  • "ImyaRegistraPriIzmenenii", "KnopkaNastroykaPeriodaNazhatie", "OsnovnyeDeystviyaFormyOK", "IspolzovatSvoystvaIKategoriiPriIzmenenii", "KomandnayaPanelSpisokPokazateleyUstanovitVse", "KomandnayaPanelSpisokPokazateleySnyatVse", "OtborZnachenieNachaloVybora", "OtborPeredUdaleniem", "DataNachPriIzmenenii", "DataKonPriIzmenenii" - handlers corresponding form element event

  • In the form module, the RegisterList variable is also initialized (the GetListRegistersList function) and is specified as a list for selecting an element of the "Accounting section (RegisterName)" form

  • In the "List / Crosstab (ReportListCrossTable)" report:
  • "SelectIntervals" - the procedure creates a list of selected intervals in the "SelectedIntervals" variable, it is called when the "Name (IntervalField)" selection field is changed
  • "InsertIntervalsBy Name" - the procedure is called before generating the report, fills in the tabular section "Intervals"

  • "PeriodSettingButtonPressing" - handler for pressing the period setting button
  • "PlusPeriodPressing", "MinusPeriodPressing" - handler for pressing the "+", "-" buttons of the period

  • "IntervalFieldOnChange", "SelectedIntervalsAfter Deletion", "SelectedIntervalsOn Editing Finish", "SelectedIntervalsOnBoundaryOnChange" - event handlers of the elements of the "Grouping Intervals" tab

  • The "IntervalField" selection field is initialized in the form module.
Report object module:
Module variables that affect the generation of the report:
  • "MTableParameters" - a table of values, contains all possible indicators, by default it is filled with indicators from the "Indicators" tabular section

  • "NP" - setting the period, used when calling the "PeriodSettingsButton"
  • "MAssignmentsMatch" - a match containing assignments of properties and categories to names

  • "MStructureRelationship of IndicatorsAndDimensions" - correspondence, contains the relationship of indicators and measurements. Used when you need to display the values ​​of certain indicators only in rows with certain groupings
  • "MArrayColumnWidths" - an array of column widths of the spreadsheet document to be saved between report generations. It is used when updating the report in order to keep the width of the columns, including the one set by the user

  • "SourceReportLayette" - the layout used for the report, the default is "Layout", but can be overridden. The variable is needed if you intend to use a layout different from the original layout of the "Layout" universal report
  • "ReportName" - string, report name

  • "MSelectRegisterName" - boolean, sign of selection (change) of the register name (report type), affects the visibility of the "Accounting section (RegisterName)" setting form element
  • "MSelectUsingProperties" - boolean, sign of selection (change) of the checkbox for using properties and categories

  • "StructureFormatFields "- a structure that stores the format of fields of primitive types, used to format fields of type date in string representation
  • "MStructureForSelectByCategories" - a structure intended for linking the Builder's selections with categories from the joined tables

  • In the "List / Crosstab (ReportListCrossTable)" report:
  • "MStructureUncategorizedGroups" - a structure that stores a list of those groupings that do not need to be displayed. It is used in cases when it is necessary to skip totals, for example Nomenclature - Characteristics - Series: no nomenclature totals are needed, only for all three
  • "RangeFieldType Matching" - match

Report module procedures and functions:
  • "FillInitialSettings" - the procedure fills in the initial settings of the report. Called in the report form module before opening the form ("BeforeOpening" event handler)

  • "ProcessingDecryptionStandardReport" - a procedure called by the event handler "ProcessingDecryption" of the field of the spreadsheet document "DocumentResult"
  • "FillMainAttributeFields" - a procedure called upon initialization of the main report form (form module)

  • "Configure" - a procedure that configures the report according to the passed parameter structure, is called when the report is decrypted
  • "GetReportBuilder" - function, returns the report builder

  • "GetMainForm" - function, returns the main form of the report
  • "GenerateStructureForSavingSettings" - a procedure that forms the "SavedSettings" structure for saving report parameters. Called before saving the settings in the BeforeSavingValues ​​event handler. The structure consists of the following fields:
    o "RegisterName" - contains the name of the register
    o "Builder Settings" - contains builder settings: available fields, selections, order, etc.
    o "Indicators" - tabular section "Indicators"
    o "UsePropertiesAndCategories" - a sign of using properties and categories
    o "Display Additional Fields IN A Separate Column" - a sign of displaying additional fields in a separate column
    o "DisplayTotalsAll Levels" - display totals for all levels
    o "DisplayParametersInstring" - display indicators in a row
    o "ColorizeDimensions" - colorize dimensions
    o "TitleMagged" - show or hide the title
  • "RestoreSettingsFromStructure" - procedure, fills in from the settings structure Common parameters reports. Called after restoring settings in the "AfterValuesRestoration" event handler

  • "GenerateReport" - executes the request and generates a tabular document-result of the report

  • In the "List / Crosstab (ReportListCrossTable)" report:
  • "Fill in Indicators" - a procedure that fills in a special table "mTable Indicators". Called in the "FillInitialSettings" procedure, before opening the report
  • "GenerateHeader" - a procedure that generates a title plate

  • "DisplayColumnHaps" - procedure, displays the table header
  • "Display Indicators" - a procedure that displays indicators in a line of the report

  • "GetParameters" - a procedure that gets the values ​​of the indicators to be displayed in the table
  • "DisplayString" - displays a line of the report

The "Balances and Turnovers (Balances and Turnovers Report)" report contains the following layouts:
"Layout" - is a layout for displaying information in the spreadsheet document "Result Document", consists of the following sections:
  • "Title" - a horizontal section, contains cells in which information is displayed on the name of the report, the period of formation, the list of displayed indicators and groupings

  • "TableHap "- contains cells in which the headers of the table columns are displayed. This section includes the following vertical sections: "Field" - displays the name of groupings and additional fields, "Initial Balance" - indicators of the initial balance, "Income" - indicators of receipts, "Consumption" - indicators of consumption, "Final Balance" - indicators of the final balance. The section also includes horizontal subsections: “TableHeader” - includes one line of cells “Field”, “Initial balance”, “Income”, “Expense”, “Final balance”, “TableBottom ”- displays the name of additional fields. If there is no need to display additional fields, only the "TableHeader" section is displayed
  • "Footer" - a horizontal section, used as a final section when displaying a table, does not display data, but contains a solid line, thereby completing the border of the table with solid lines

  • "Hierarchy Line" - the horizontal section is displayed only if the way of displaying the grouping of references "by hierarchy" displays a group of catalog elements
  • "Line" - horizontal section, display the grouping line

  • "LineDetails" - horizontal section, if the settings specify to display additional fields, in given line additional fields are displayed
  • "General Totals" - horizontal section, this line displays the general totals

  • "Dimension Design" - the horizontal section contains dimensions design, if the "Colorize dimensions (ColorizeDimensions)" checkbox is selected in the settings to display groupings and fields different levels the settings for the design of cells from the section "DesignDimensions" are used
  • "Detail Detailing" - the horizontal section contains detail decoration

  • "ReportParameters ..." - layouts in which parameter settings for the output of individual reports are indicated. Filling in the initial settings of the report by layout is called by the function "FillInitialSettings by Layout".
In the layout, you can specify the composition of indicators, groupings and fields for output to the report, contains two sections:
  • "Indicators" - a horizontal section, cells in which the composition of indicators and parameters for displaying indicators in the report are indicated. In this section, you can also specify calculated indicators

  • "Grouping" - horizontal section, contains cells with a list of groupings displayed in the report
The Crosstab List (CrosstabList Report) report contains the following layouts:
"Layout" - is a layout for displaying information in the spreadsheet document "Result", consists of the same sections as the layout of the report "Report balances and turnovers (Balances and Turnovers)", with the exception that the vertical sections "Initial Balance", "Income", " Consumption ”,“ Final Remaining ”were replaced by the“ Indicator ”section and a horizontal section“ TableHeaderRow ”was added to display the names of groups in a line.

Building custom output forms based on universal (general) reports

Now that we are familiar with the structure of generic reports, let's look at using them to build other output forms.
"Balances and turnovers (Report of Balances and Turnovers)" (hereinafter O&O) and "List of cross / table (ReportListCrossTable)" (hereinafter SKT) are independent reports, they can be used to obtain various information on all accumulation registers that are in the configuration. But often there is a need to generate more detailed reports based on complex queries and selections (we will call such output forms custom). For this, a separate output form is created, in which, using general reports, we can organize the output of the necessary information.

Main form

Let's take a look at how custom reports interact with general reports. The first thing to pay attention to is that the report data contains the "GeneralReport" variable, which has the "ReportObject.ReportAndTurnovers" or "ReportObject.ReportListCrossTable" type; ... The main attribute of the custom report form "General Report" also has the type O&O or SKT. To refer to a custom report object, the "ThisReport" form attribute is used.
The structure of the main form is the same as that of the parent general report:
  • "Command Panel (CommandPanelForms)" - command panel, contains control buttons: "Forge" - generates a report, "Selection" - show / hide the selection panel ("Selection Panel"), "Title" - show / hide the title in the spreadsheet document (element form "Result Document"), "Settings" - opens the report settings form, "SaveValues" - saves the values ​​of the report settings, "RestoreValues" - restores the values ​​of the report settings, access to all of the above buttons can be obtained through the "Actions" submenu

  • "Period from: (DateStart)", "to: (DateCon)" or "As of date: (DateCon)" - the input field is date, the data is related to the details of the general report "DateStart" or "DateCon"
  • "Selection panel (Selection Panel)" - a panel on which elements for quick selection are placed. To configure the selection, you need three elements of the checkbox form, a selection field and an input field, the name of each element begins with a specific name plus the name of the selection as it must be specified in the report builder:
    o "CheckboxSettings ..." - the checkbox associated with the "Use" selection attribute, when this checkbox is checked, the corresponding selection will be enabled in the report builder
    o "ComparisonViewField ..." - a selection field, associated with the "ComparisonType" selection attribute, contains a way to compare the selection value with the selected values
    o "Field Settings ..." - an input field associated with the attribute of selections "Value", contains a value by which filtering is carried out

  • Usage example:
    Set selection by dimension "Nomenclature". Add three form elements to the selections panel, name them as follows: checkbox "SettingsNomenclature", selection field "ComparisonViewNomenclature", input field "SettingsNomenclature". We check that in the event handler of the form "BeforeOpening" the procedure "SetSelectFieldsAssignFieldsOnForm" is executed, which binds the form elements with the selection data of the report builder. Everything. If the report data contains a selection "Nomenclature", then we will be able to manage the selection on the filter panel, without calling the report settings form.
  • "Tabular document (DocumentResult)" - the actual tabular document where the report data is displayed
The first time you open a custom report, an instance of the GeneralReport object is created. It should be clearly understood that within the framework of a custom report, we operate with two GeneralReport objects - an instance of a general report object and "ThisReport" - an instance of a custom report object.
That is, if you need to call the procedure of the custom report module “FillInitialSettings ()”, then write the following construction “ThisReport.FillInitialSettings ()”, and to call the general report procedure “FillFields of the Main Attribute ()”, write “GeneralReport. FillMainAttributeFields () ". Note that in the form module to call the procedures of the general report, simply specify the name of the procedure, and in the module of the custom report object, you need to write "GeneralReport." and the name of the procedure.
An example of using a custom report from the "Contractors" directory:
Contractor = Form Elements.ReferenceList.CurrentData.Ref; Report = Reports.LearnmentMutual settlements with counterparties.Create (); Form = Report.GetForm (); Form.ThisReport.FillInitialSettings (); Form.ThisReport.GeneralReport.Report Builder.Selection ["Counterparty"] .Usage = True; Form.ThisReport.GeneralReport.Report Builder.Selection ["Account"] .Value = Account; If Counterparty.ThisGroup Then Form.ThisReport.GeneralReport.Report Builder.Selection ["Account"] .ComparisonType = ComparisonType.Hierarchy; Otherwise Form.ThisReport.GeneralReport.Report Builder.Selection ["Contractor"] .ComparisonType = ComparisonType.Equal; EndIf; Form.UpdateReport (); Form.Open ();
Let's list the main procedures and functions of the main form of a custom report:
  • When the form is initialized, the procedure "FillMainAttributeFields" is performed, which fills in the fields and details of the main object of the form. Form variables are also set

  • "RefreshDisplay" - procedure, form data refresh handler
  • Before opening the form, the procedure of the custom report module "FillInitialSettings" is called, the values ​​of form parameters are restored and the connection between form elements and selections of the report builder is performed:

  • "OnOpening" - event handler procedure when the form is opened

  • Saving and restoring report parameters is carried out by the following procedures:
  • "AfterRestoreValues" - the event handler procedure after restoring the saved values, calls the procedure of the report module "RestoreSettingsFromStructure"
  • "BeforeSavingValues" - an event handler procedure before saving values, calls the function of the report module "GenerateStructureForSavingSettings", in which the structure of the saved settings is formed and assigned to the variable "SavedSettings"

  • In all reports based on O&O or SKT, the saving of settings is implemented as follows. In the properties of the form, "Save values" is specified, and the "SavedSettings" attribute is selected in the "Stored values" list. In the event handler "Before saving values", "After restoring values", insert the code that calls the procedures of the general report module: "GenerateStructureForSaveSettings" to save the settings and "RestoreSettingsFromStructure" to restore the report settings. The structure of the settings has already been described in the section on universal reports.
    Usage example:
    After generating the report, users can adjust the width of the columns of the spreadsheet document (by pressing Ctrl + positioning the width with the mouse cursor). In general reports, the array of column widths is stored in the variable mArrayColumnWidths; when the report is refreshed, the column widths are adjusted based on the data stored in this array. The task is to save the array of column widths when closing the report, and after opening the report, restore the column widths, as it was specified by the user before closing. To do this, in the event handler, before saving the values ​​of the "BeforeSavingValues" form in the "SavedSettings" structure, add an array, which is formed as follows:
// Should be remembered if the document is not If Form Elements.DocumentResult.TableHeight> 0 Then empty For Nr = 1 By Form Elements.DocumentResult.TableWidth Loop ArrayColumnWidths.Add (Form Elements.DocumentResult.Area (1, Nr) .ColumnWidth); End of Cycle; EndIf; SavedSettings.Paste (" ArrayWidthSpeakers", ArrayColumnWidths);
In the "AfterValuesRestoration" handler procedure, add the following code:
ThisReport.ReturnSettingsFromStructure (SavedSettings, ShowHeader); SavedSettings.Property (" ArrayWidthSpeakers", GeneralReport.ArrayColumnWidths); // Restore the array of column widths
  • "OnClose" - a procedure that handles the event when the form is closed. This procedure usually adds functions for saving form parameters.
  • "AlertProcessing" is a message handler procedure. It is used to update the filter elements on the form, if the filter settings in the report builder have changed when the settings form is called

  • "DocumentResultDecryptionProcessing" is a procedure-handler for the "ProcessingDecryption" event of the field of the tabular document DocumentResult. Calls the procedure of the general report module "Decryption Processing"
  • The form module also accommodates event handlers for selection items, date selection, etc., the composition of these handlers depends on the type of the custom report.
  • General purpose procedures and functions:

    • "ManageFormElementDisplay Options" - controls the labels of the buttons on the toolbar

    • "RefreshReport" - updates the report table, is called when you click the "Generate" button, and also when you need to remove / set the report title (the "Title" button), in the latter case, only the report title is displayed. The procedure calls the "GenerateReport" report module procedure
    • "OutputHeader" - procedure - controls the output of the header, calls the "GenerateReport" procedure from the report module

    • "GenerateFormHeader" - a procedure that sets up the formHeader, calls the function common module"GenerateMainFormHeader". The title returned by this function consists of the name of the report, the start date and the end date of the report generation. Typically, "GenerateFormHeader" calls the form display update event handler

    Report module

    Consider a custom report module. The most important procedure of the report module "FillInitialSettings" this procedure is called before opening the form and contains commands that customize the list of indicators, groupings, selections and order that will be present in the report:
    • Initialization of variables:
      "StructurePresentationFields" is a structure into which the views of fields are entered, where the key is the name of the indicator / grouping / field from the data source, and the value is the textual representation of the indicator / grouping / field.
      Usage example:
      StructurePresentationFields.Insert (" FeatureNomenclature", "Description of the nomenclature"); StructurePresentationFields.Insert (" A document base", "A document base");
      “ArrayOf Selection” - an array of selection, an array in which we include selections that are present in the report settings by default.
      Usage example:
      We add two selections by item and warehouse, these selections can be linked to elements in the selection panel of the main form. When adding elements of quick access to filters on the report form, in the report settings, it is advisable to add the names of these filters to the "Selection Array"
      ArrayObtain.Add ("Nomenclature"); Array of Selection.Add ("Warehouse");
    • Report parameters:
      "GeneralReport.Register Name" - if the report is generated on the basis of a certain register, then we indicate the name of this register.
      "GeneralReport .ReportName" - the name of the report, which will be displayed in the title of the spreadsheet document.
      Usage example:
      GeneralReport.RegisterName = " ProductsIn Warehouses"; GeneralReport.ReportName =" Analysis of the availability of goods in warehouses";
    • Request for the report builder:
      The reports provide for the formation of the query text for the builder based on three sources: register metadata, layout and directly assign the query text to the report builder.
      - Query based on register metadata
      If we have indicated the name of the register in "GeneralReport.RegisterName", then by calling the procedure "FillInitialSettingsBy Register Metadata" we can fill in the query builder settings and the details of the general report
      Usage example:
      Forms the text of the request to the register "Goods in Warehouses" and fills in the settings for the details of the general report:
      GeneralReport.RegisterName = " ProductsIn Warehouses"; FillInitialSettingsBy Registry Metadata (StructureFieldsPresentation, SelectionArray, GeneralReport," ListCrossTable");
      - Request based on layout
      As already described in the section "Structure of universal reports", report settings can be specified in a specially designed layout. The convenience of the layout is that you can adjust the output of indicators, groupings and fields without resorting to building a query through the constructor.
      Usage example:
      Report Builder = GeneralReport.Report Builder; FillInitialSettingsBy Layout (Get Layout (" ParametersReportsProductsOrganizations"), StructureFieldsView, SelectionArray, GeneralReport," ListCrossTable");
      - Specifying a query as the data source of the Report Builder
      Using generic reports to generate custom output forms, you can create your own query and specify its text as a source for the report builder. This method very convenient in that you can build queries of any complexity and structure.
      Usage example:
      ReportBuilder.Text = " CHOOSE | SalesObototy.Nomenclature AS Nomenclature, | SalesTurnover.CostTurnover AS CostTurnover | (SELECT | Nomenclature. *, | SalesTurnovers.Nomenclature characteristic. * | // PROPERTIES |) | FROM | Accumulation Register.Sales.Turnooms (& StartDate, & DateCon,) AS SalesTurnovers | // CONNECTIONS | GROUP BY | SalesRobot.Nomenclature | // LOAD BY| (WHERE | SalesTurnovers.Nomenclature. *, | SalesTurnovers.Nomenclature characteristic. * | // PROPERTIES | // CATEGORIES |) | (ORDER BY | Nomenclature. *, | SalesTurnovers.Nomenclature characteristic. * | | // PROPERTIES |) AMOUNT (CostTurnover) | Software | GENERAL, | Nomenclature | (TOTALS ON | SalesTurnovers.Nomenclature. *, | SalesTurnovers.Nomenclature characteristic. * | // PROPERTIES |)"
      When forming requests, you should follow several rules:
      o In the request, you can specify two predefined parameters: "DateStart" and "DateCon", into which the value of the corresponding report details is passed. These parameters are used to restrict data samples by period.
      o The report should always contain general totals: "RESULTS ... IN GENERAL"
      o In order to be able to manage the report settings from the settings form, it is necessary to indicate the appropriate settings for the report builder, in curly quotes "(" and ")" or on the "Builder" tab of the query builder.
      o You can specify special directives in the request: "// PROPERTIES", "// CATEGORIES", "// CONNECTIONS", "// GROUP BY". Next, using the procedure "AddInTextProperties andCategories", selections of fields of properties and categories of objects are added to the query.
      Usage example:
      In the request given above by the "// PROPERTIES" directive, we indicate that in the request text you need to add a selection, grouping and conditions by object properties, "// CATEGORIES" - add a condition by categories, and using "// CONNECTIONS" we provide connections to the information register "ObjectPropertiesValues", "// GROUP BY" - we group by the selected object properties
    • Procedures for filling in the fields of the report builder:
      After the request has been generated, you need to fill in the corresponding details of the report builder and the general report.
      In the array "ArrayOtbora" we enter the array of selections, to fill out the selections in the report builder we use the procedure "FillSelection".
      If we plan to use properties and categories we must add the procedure "AddInTextProperties andCategories".
      Usage example:
      AddInTextPropertiesAndCategories (FieldsTable, Text, StructureFieldsPresentation, mValueConformance, StructureParameters, TextDataSources = "" ,CategoriesFieldText = "" ,PropertiesText = "", FieldsTextGroupBy = "", ReplaceProperties = " // PROPERTIES ", ReplaceCategories =" // CATEGORIES ", ReplaceConnections = " // CONNECTIONS ", ReplaceGroup By =" // GROUP BY ", ParameterIdsForCategoriesByCategories = "") Export
      You can also use the FillView procedure to fill in the FillViewFields field views.
      Usage example:
      FillView ("Nomenclature", "Nomenclature", TRUE, TRUE); FillView (" FeatureNomenclature", "Description of the nomenclature", FALSE, FALSE);
    • Additional procedures for setting up a report:
      "ClearAdditionalBuilderFields" - a mandatory procedure, it removes indicators, groupings from the "ReportBuilder.SelectedFields" attribute
      "GeneralReport. DisplayParametersVSRow = True" - displays indicators in a row
      "MStructureRelationship of IndicatorsAndDimensions" - to fill in the structure of linking indicators and measurements
      Usage example:
      It is necessary to display the indicator "Amount of Remaining" only for the dimension "Nomenclature" and "Characteristic of Nomenclature":
      GeneralReport.StructureMeasurement and Measurement Links.Insert (" Quantity Remaining", New Structure (" Nomenclature, Characteristics of the Nomenclature "));
      If you want to display all the totals regardless of the setting of the structure “mStructureRelationship of Indicators and Measurements”, set the following attribute:
      GeneralReport.DisplayTotalsAll Levels = True
      If you need to skip some of the groupings, then you should fill in the structure "mStructure of Non-DisplayGroups".
      Usage example:
      It is necessary to display the dimensions "Nomenclature characteristic" together with the dimension "Nomenclature", for this we add the following function call
      GeneralReport.Structure of UndrawableGroups.Insert ("Nomenclature", New Structure (" FeatureNomenclature"));
      As a result, the report will display the dimensions separated by a comma: "Nomenclature, Nomenclature characteristic"

    • Other procedures of the custom report module are similar to the procedures for generic reports b described in the section "Generic reports". What you should pay attention to is the parameters in the request, before generating the report (the "Generate Report" procedure), you should specify these parameters for the report builder:
      Usage example:
      Report Builder.Parameters.Insert (ParameterName, ParameterValue);

    Conclusion

    It is quite simple to use O&O and SKT to generate custom output forms, if you correctly compose a query in the designer and pass it to the builder, we will get a ready-made report. Also, a big plus of using common reports is the unification of data output to the report form, flexible settings for groupings, selections and sorting, presentation of dimensions and indicators.
    Practice shows that 90% of the functionality for the formation of any custom form is implemented in universal reports, you can also take ready-made standard reports as a basis and "refine" them according to the requirements of customers.

    List of links

    Below is a list of some links to Knowledge Books articles (

    They say that the name 1C originally meant the phrase "one second", i.e. programs should issue reports quickly, "in one second." The speed of the reports is very important, but it is even more important that the reports give the correct information - let's figure it out using the example of creating a simple report in 1C 8.3 based on the Trade Management 10.3 configuration. To create correct reports, it is desirable (even strongly recommended) to be able to configure 1C and be able to program a little in the internal language and the 1C query language, although, on the other hand, creating reports is a great opportunity to start mastering these skills.

    This description is educational for understanding the basic principles of creating 1C reports

    How to create a report in 1C 8.3

    To create a report, you need to open 1C in the configurator mode, for this, in the 1C launch window, select the desired base in the list and click the Configurator button:

    In the configurator itself go to the File menu and select the New item:


    In the menu that appears, select the External report item and press the OK button:


    This will open a new report window. In the Name field, enter the name of the report, it must be without spaces and special characters:


    How to make a report using a layout

    This method most of all requires programming skills in 1C, but here we will not analyze the mechanisms for receiving and processing data, we will make a simple report in order to understand the mechanism for launching a report and displaying a report form on the screen:

    In the report window (which opens when creating a report) in the lower list, place the cursor on the Layouts item and, by right-clicking, click Add in the menu that appears:


    In the opened layout designer, you can specify the name of the layout, Tabular Document should be selected as the layout type, and then click the Finish button in the designer:


    This will open a layout window that resembles an Excel sheet:


    In this layout, you need to create areas - groups of rows or columns that the program will use as templates, substitute data received from the database in them and display these templates on the screen, thereby collecting the report together from these parts.

    Let's make a report displaying a list of the nomenclature. To do this, we will create two areas of the layout: the report header and the item line.

    To create a header area, left-click on the line header (where the line number is indicated) to select the line like this (the entire line must be selected with one click on the header):


    After that, go to the Table menu of the main menu, go to the Names submenu and click on the Assign name item:


    The program will prompt you to specify the Name of the area, the name should also not contain spaces and special characters, then click OK, it should look like this:


    Now, in the created area, you need to enter the text that will be displayed in the report and format it. To do this, in the first cell, enter text, for example, "List of nomenclature". Working with cells is similar to Excel.

    To format the text in a cell, right-click on the cell and click on Properties. The cell properties window will open on the right. Scrolling down the contents of the window, find the Font field and click on the "..." button:


    In the window that opens, in the Style section, check the Bold box and click the OK button:


    The layout should look like this:


    In the same way, we create the area of ​​the item line, just do not highlight it in bold:


    In the line area, you must indicate that the Name is a parameter, i.e. that the real name of the item will be inserted there when the report is output. To do this, open the properties of the cell with the name and in the properties in the Filling field select the Parameter value, this completes the layout setting:


    We return to the main window of the report and in the lower list, right-click on the Forms item and click Add:


    In the opened report form designer, press the Finish button, the report form will open, double-click on the Generate button:


    As a result, the button properties window will open on the right side of the screen, in the Action field, click on the magnifying glass:


    After that, the form module will open, in which you need to program the generation of the report:


    First, insert the following code instead of the selected text:

    // create a spreadsheet document that will be filled with parts of the report and displayed on the screen
    TabDocument = New TabularDocument;
    // further, we get the layout that was created when creating the report
    Layout = Get Layout ("Layout");
    // now you need to display the report header, for this we get the header area from the layout and display it in a spreadsheet document
    AreaHeat = Layout.GetArea ("Header");
    TabDocument.Display (AreaHap);
    // using a query, we get a selection of item names that should be displayed in the report
    Request = New Request;
    Request.Text = "
    | CHOOSE
    | Name
    | FROM
    | Directory.Nomenclature
    |";
    // get the nomenclature line area from the layout - we will refer to it in a loop to display each item
    AreaString = Layout.GetArea ("Line");
    // process each item from the resulting selection in a loop
    Selection = Query.Run (). Select ();
    While Fetch.Next () Loop
    // to display the next line, you need to specify the next name in the area parameter (we set the parameter itself when creating the layout)
    RegionString.Parameters.Name = Selection.Name;
    // the parameter was filled in, now you can display the string
    TabDocument.Output (AreaString);
    End of Cycle;
    // the spreadsheet document is formed, now we display it on the screen
    TabDocument.Show ("List of items");

    When the text is copied into the form module, the lines starting with a double slash "//" will be highlighted in green - these are comments, they describe what each line of code does:


    Let's summarize what lines of program code are needed to generate a report:

    1. It is necessary to create a spreadsheet document, which will be filled with parts of the report and displayed on the screen, this is done by the line "TabDocument = New Tabular Document;"
    2. You need to get the report layout, from it we will get the structure of the report in parts (areas), this is done by the line "Layout = Get Layout (" Layout ")"
    3. To display each of the areas, you need to get it from the layout and display it in a spreadsheet document, this is done with the lines "AreaHap = Layout.GetArea (" Header ")" and "TabDocument.Out (AreaHap)"
    4. If you need to fill in the parameters, which become known only when the program is running, then before displaying the area, you need to fill in such parameters, this is done by the line "AreaString.Parameters.Name = Selection.Name"
    5. And only when the spreadsheet document is filled with all the necessary parts of the report, it is displayed on the screen, this is done by the line "TabDocument.Show (" List of items ")"

    And now you can check the operation of the report - open 1C in enterprise mode (the 1C: Enterprise button in the 1C launch window). In the main menu, go to the file menu, click Open:


    Find and open the saved report file. In the form that opens, click the Generate button:


    and we get a list of the nomenclature:


    This is just one of the ways to create reports in 1C. In the following articles, we will analyze others.

    Consider creating an external report in 1c 8 without using a data composition system. To create an external report, we will use the Accounting 2.0 configuration, the initial data: “Write a report on 62 accounting accounts in which the turnovers for the specified period will be displayed in the context Counterparties and Contractor agreements.

    1. Create a report

    First of all, we will create an external report file, for this we go to 1c 8 in the mode Configurator, go to the menu File -> New, or click on the icon new document.

    In the list, select the item External report... After creating the external report, give it a Name (for example Simplest Report) and save it to disk. We'll also add two props: Beginning of period and End of Period type date, we will need them to limit the time interval for data sampling when generating a report.

    2. Creating a layout for an external report

    To generate a report in 1c 8, you need a layout, this is a template for outputting data in which all the necessary parameters are set, tables are drawn, etc. Let's add a new layout, for this, in the report metadata tree, select the item Layouts and press the button Add, when creating we select the type for the layout Spreadsheet document.

    Our layout will have 4 areas:

    • Header - in this area we will display the name of the report, the period for which it was generated and the header of the table;
    • DataContractor - in this area we will display data on the counterparty in the table;
    • Contractor Agreement Data - in this area we will display data on the counterparty agreement in the table;
    • Basement - in this area we will display the totals for the entire report for the Income and Expense fields.

    Let's start creating the layout areas. In order to create an area in the layout, select the required number of lines and press Table Menu -> Names -> Assign Name(Or Ctrl + Shift + N). To the area Cap write the name of the report: Turnover 62 accounts, let's draw with the tool Borders report header, as well as set the parameters Beginning of period and End of Period... Using the parameters, you can display the necessary data in the report, we will deal with this at the next stage of development, namely when writing the program code of the report. To create a parameter in the layout, select the desired cell, write the name of the parameter in it (without spaces), right-click on it, in the menu that opens, select the item Properties... In cell properties on a bookmark Layout select filling Parameter.

    After that, the parameter name in the cell will be enclosed in angle brackets (”<>“). As a result, the area Cap should look like this:

    In the area of DataContractor we will create parameters for displaying the name of the counterparty, as well as for the income and expense for 62 accounts, using the tool Borders Let's arrange the area in the form of a table row.

    In the area of DataContractor Agreement we will create parameters for displaying the name of the contract, as well as for receipts and expenditures on account 62, using the Borders tool, we will arrange the area in the form of a table row. Let's make a small indent in front of the parameter Contractor's Agreement(This can be done by splitting and merging cells. Right-clicking on a cell -> To combine or Break cell), it is needed so that it can be seen in the report that the line under the contract is lower in the hierarchy than the line for the counterparty.

    In the area of Basement Let's create parameters for receipts and expenditures totals.

    As a result, we should get a layout like this:

    3. Creating a report form

    For data output, setting the formation period and buttons To shape our report will need a form. To create a form, find the item in the metadata tree of the external report Forms and press the button Add... On the first page of the form designer, you do not need to make any changes, you just need to click the button Further.

    On the next page of the constructor, we will select both available props ( Beginning of period, End of Period) for placement on the form.

    As a result, we get the following form:

    But in this form, it does not suit us, we will make some changes to it:

    • Drag the button To shape from the bottom pane of the report to the top one (this will be more convenient for the user);
    • Stretch the shape vertically and horizontally;
    • Arrange the fields Beginning of period and End of Period horizontally;
    • Add to the form a control element Field of a spreadsheet document (our report will be displayed in it), give it a name TabDoc;
    • Let's create a button for selecting a period (when you press it, a dialog with a convenient choice of the required period will be displayed). We will not write the program code for it yet, so we will simply place the button next to the fields of the period.

    As a result, our form will look like this:

    4. Programming

    After creating the report form, let's start programming. To begin with, we will create a procedure for displaying the period selection dialog (we have already created a button for this in the previous step). Right-click on the button and select the menu item Properties, in the properties of the button, go to the tab Events, where, using the button with the magnifying glass icon, create a procedure Button 1 Press in the form module.

    You can switch between the form and its module using the tabs at the bottom of the form

    To call the period selection form, we will use the standard procedure Accounting 2.0 from the general module WorkingWith Dialogs - HandlerSettingPeriodPressing, you need to pass the report details into it as parameters Beginning of period and End of Period.

    Procedure Button 1 Press (Element) WorkingWith Dialogues.HandlerPeriodSettingPressing (PeriodBeginning, PeriodEnd); End of Procedure

    Now let's move on to writing the code that will generate and display our report. There is already a procedure in the form module ButtonShapePress which will be executed when the button is pressed To shape, that's where we'll write our code. Let's start by initializing the required variables. First of all, let's create a variable for spreadsheet document fields into which we will output the data, this is not necessary, just the recording of calls to it will become shorter, which means the program code will be more understandable for reading.

    TabDoc = Form Elements.TabDoc;

    Get the layout of the external report using the function Get Layout (<ИмяМакета>) , we will pass the name of the layout to the parameter, and if such a layout exists, then the function will find it.

    Layout = Get Layout ("Layout");

    After the layout is received, we will create variables for each of its areas, we will use the layout method for this GetArea (<ИмяОбласти>) .

    AreaHeat = Layout.GetArea ("Header"); ScopeDataContractor = Layout.GetScope ( "DataContractor"); ScopeDataContract = Layout.GetScope ("ContractData"); AreaFooter = Layout.GetArea ("Footer");

    Let's clear the field of the spreadsheet document. This is necessary so that with each new generation of the report, the old data is deleted.

    TabDoc.Clear ();

    Now that the initialization of the variables is complete, let's move on to alternately filling and displaying areas of the layout. Let's start with the cap. If you remember, we created two parameters in this area. Beginning of period and End of Period, we will transfer the values ​​of the report generation period there, for this we will use the property Parameters area of ​​the layout.

    AreaHead.Parameters.PeriodStart = PeriodStart; AreaHead.Parameters.EndPeriod = EndPeriod;

    No more action on the area Cap the manufacturer is not necessary, so we display its field in the spreadsheet document.

    TabDok.Display (AreaHap);

    Next, we will write a query to the database, with which we will take the turnovers on the account 62 from the accounting register Self-supporting... Let's define a variable in which our request will be located.

    Request = new Request;

    Before we start writing the request text, let's pass the required parameters to it. Since we are writing an invoice request 62 accounting, then first of all we will create a parameter for it

    Request.SetParameter ("Account62", Account Plans. Self-supporting.FindByCode ("62"));

    It is also necessary to transfer the report generation period to the request. Do not forget that for the formation period we have special details of the report, and we pass them as parameters.

    Request.SetParameter ("PeriodBeginning", PeriodBeginning); Request.SetParameter ("EndPeriod", EndPeriod);

    Let's start writing the request text, we will do this using the query constructor. In many teaching aids write that you need to be able to write a query both manually and using a constructor, but in practice this is not the case. In the tasks that are constantly faced by the 1C programmer, the priority is to quickly and efficiently write code, and when writing a request to the database manually, this is almost impossible to achieve, you will spend a lot of precious time trying to correctly reproduce all query constructs, find typos which you did while writing, etc. Therefore, do not waste your time trying to write queries manually, but use the query constructor. It will save you time and allow you to write complex queries effortlessly. To start writing the request text, write in the code:

    Request.Text = "";

    After that, put the cursor between the quotes, press the right mouse button and select the item Constructor request. The query designer window will open.

    Now we need to select the table of the 1C 8 database we need. We need a virtual table Turnovers accounting register Self-supporting... Let's find it on the left side of the constructor window

    Let's move it to the area Tables and let's fill in the parameters. For all virtual query tables, there is a special set of parameters that allow you to select the desired data from the main table (in our case, the main table Accounting Register Self-supporting). Let's open the virtual table parameters window.

    Let's fill in the parameters of the period that we passed to the request. To use a parameter in the request text, write the symbol before its name ampersand (&)

    It remains to fill in the condition for the account bukh. accounting. To do this, we will find in the parameters of the virtual table the line Account Condition and write there

    Account in the HIERARCHY (& Account62)

    You can also use the constructor for drawing up conditions by clicking on the button with three dots.

    There is no need to impose any more conditions on the virtual table, so press the button OK in the virtual table parameters window. Next, you need to select the fields we need from the table Self-supporting.Turnovers(namely: Counterparty, Counterparty Agreement, Income and Expense). To see the list of fields available in the table we have selected, press the "+" symbol next to its name. After that, drag the required fields to the rightmost area of ​​the query designer, which is called Fields. If we open the chart of accounts of accounting, we will see that for the account 62 analytics for Counterparty is Subconto1 and by Contractor's Agreement - Subconto2.

    Therefore, from the fields of the virtual table, we select Subconto1 and Subconto2... Since we need the income and expense by the amount, we also select the fields AmountTurnoverDt and AmountTurnoverKt

    Fill in the aliases of the fields we have chosen, for this we go to the tab Unions / Aliases and set the required field names.

    Since in our report the data will be displayed hierarchically (the Counterparty is at the first level, and all his contracts are at the second), we will set up the data output in the hierarchy using Totals. Let's go to the bookmark in the constructor Outcomes... In the grouping fields, drag sequentially Counterparty and Contractor's Agreement, and in the final Coming and Consumption.

    This completes the work in the query constructor, press the button OK and we see that the text of our request has appeared in the program code.

    Request.Text = "SELECT | Self-supporting Turnovers.Subkonto1 AS a Counterparty, | Self-supporting Turnovers.Subkonto2 AS A Contractor's Agreement, | Self-supportingTurnover.AmountTurnoverDt AS Receipt, | Self-supportingTurnover.AmountTurnoverKt AS Consumption| FROM | Ledger of Accounting. Self-supporting.Turnovers (& Beginning of Period, & End of Period, Account IN HIERARCHY (& Account62),) AS Self-supporting Turnover| RESULTS | SUM (Arrival), | AMOUNT (Consumption) | Software | Counterparty, | Contractor's Agreement ";

    After we have finished writing the request, let's start filling in the areas DataContractor, DataAgreementContractor and Basement... We will fill all these areas with the data obtained when executing the request. Since our query contains groupings ( Counterparty and Contractor's Agreement) select data from it as follows:

    SelectContractor = Query.Run (). Select (QueryResultIndo.OnGroups);

    Thus, we will receive records with totals for all counterparties.

    Before traversing the sample data using a loop, we initialize the variables designed to calculate the total totals for the report:

    TotalIncome = 0; Total Consumption = 0;

    In order for the report data to be displayed with a hierarchy (and spreads along "+"), we will set the beginning of the autogrouping of the rows of the spreadsheet document:

    TabDoc.StartAutoGroupLines ();

    All preparations are over, now let's start traversing the query results. We will carry out the traversal using the loop Till

    WhileSelectionContractor.Next () Cycle EndCycle;

    At the beginning of the cycle, set the parameters to zero Coming and Consumption areas DataContractor... What is it for? Imagine a situation that for a counterparty Uncle Vasya, income 10, and expense 5, and for it the next counterparty Uncle Petya there is neither income nor expense, in this case, if we do not reset the parameters Coming and Consumption, then by in line by counterparty Uncle Petya will get income 5 and expense 10.

    ScopeDataContractor.Parameters.Prihod = 0; ScopeDataContractor.Parameters.Expense = 0;

    After that we fill in the area DataContractor sample item data

    FillPropertyValues ​​(ScopeDataContractor.Parameters, SelectionContractor);

    After filling with data, you can display the area in Spreadsheet document Since we use autogrouping of lines, we need to indicate the level of the line in the grouping (in our report there will be two levels, for contractors the first for contracts is the second).

    TabDok.Withdraw (ScopeDataContractor, 1);

    Now, for this counterparty, we will make a selection according to his contracts.

    SelectionContractorAgreement = SelectionContractor.Choose (BypassResultResult.On Groupings);

    We will carry out the traversal using the loop Till.

    While SelectionContractor Agreement.Next () Cycle End of Cycle;

    In the cycle under contracts of counterparties, we will reset the parameters Coming and Consumption, fill the area Data Agreement from the selection and display it in a spreadsheet document at the second level of records.

    ScopeDataContract.Parameters.Prihod = 0; ScopeDataAgreement.Parameters.Expense = 0; Fill inProperty Values ​​(ScopeDataContract.Parameters, SelectionContractorAgreement); TabDok.Withdraw (ScopeDataContract, 2);

    Also, in this cycle, we add the current values ​​to the variables for calculating the total values ​​for income and expense.

    TotalIncome = TotalIncome + SelectionContractor Agreement.Income; TotalExpense = TotalExpense + SampleContractor Agreement.Expense;

    This completes the output of the data in the area DataContractor, DataAgreementContractor completed, it remains to complete the autogrouping of the rows of the spreadsheet document.

    TabDoc.FinishAutoGroupLines ();

    Fully loops responsible for outputting data in the area DataContractor and DataAgreementContractor look like this:

    TabDoc.StartAutoGroupLines (); While SampleContractor.Next () Cycle RegionDataContractor.Parameters.Prihod = 0; ScopeDataContractor.Parameters.Expense = 0; FillPropertyValues ​​(ScopeDataContractor.Parameters, SelectionContractor); TabDok.Withdraw (ScopeDataContractor, 1); SelectionContractorAgreement = SelectionContractor.Choose (BypassResultResult.On Groupings); While SelectionDogovKontragenta.Sleduyuschiy () Cycle ScopeDataDogov.Parametry.Prihod = 0; ScopeDataAgreement.Parameters.Expense = 0; Fill inProperty Values ​​(ScopeDataContract.Parameters, SelectionContractorAgreement); TabDok.Withdraw (ScopeDataContract, 2); TotalIncome = TotalIncome + SelectionContractor Agreement.Income; TotalExpense = TotalExpense + SampleContractor Agreement.Expense; End of Cycle; End of Cycle; TabDoc.FinishAutoGroupLines ();

    It remains to output the totals to the area Basement and display the area itself in Spreadsheet document.

    AreaBoard.Parameters.TotalIncoming = TotalIncoming; AreaBoard.Parameters.TotalExpense = TotalExpense; TabDok.Display (Area Basement);

    This is the process of writing an external report for 1C 8 without use of ACS completed. Now it can be generated in 1C: Enterprise 8 mode and added to the directory ExternalProcessing You can download the report file considered in the article by.

    Watch a video on creating an external printable for a managed application:

    Sandbox

    jeweler August 23, 2011 at 10:22 AM

    Layouts in 1C 8.2 are not difficult (Part 1 - Creating a layout)

    • Lumber room *

    Let's say you need to display a similar report:

    This report can be easily built using the data composition system (ACS), especially if all the necessary data is stored in one directory. However, let's try to render the same report using a layout.


    To form of this report you need one reference book "Employees" with the details "Date of Birth", "Position". Let the last name, first name and patronymic of the employee be stored together in one field by default - "Name". To indicate the position of an employee, there is another simple directory "Positions" with default fields. The structure of the required reference books is shown in the figure below.

    Now let's create a new report and name it "EmployeeList". Let's go to the "Layouts" tab and create a new layout of the "Tabular Document" type.
    Before us will open a blank spreadsheet document, ready to work. Now we need to present the required report in the form of a layout.
    To do this, first copy the original report into a blank spreadsheet document, i.e. to the report layout. You end up with something like this:

    Let's put the layout in order - we will align the headers in the center, set the display of borders for the table and delete all data from the table, except for the first record. We will have it for a sample.
    Let's break the finished report into areas as follows:

    For each area, you must assign a corresponding name, for this you need to select the desired area (in this case, all areas are groups of lines) and click on the button with the icon, or the key combination Ctrl + Shift + N. In the window that appears, you need to enter the name of this area. Let's name the areas as they are shown in the figure.
    Now those table cells in which data should be displayed from information base must be designated as containing a template. To do this, this field is highlighted, and in the context menu ( right key mouse) select "Properties". In the drop-down list of cell properties "Filling", select "Template" (example in the figure below).

    After that, if an expression in square brackets is found in the text of the cell, then it will be perceived by the 1C system as a parameter. For example, if the cell text is as follows:

    My name is [MyName],

    To display the text "My name is Ivan", the parameter "My name" assign the value "Ivan".
    In our case, the template will be the date of the report output, as well as all columns from the row containing the employee's data. As a result, after all the manipulations, the report layout will look like this:

    This completes the creation of the layout. Now you need to programmatically generate a report from the generated areas and display it.

    Tags: 1C 8, layout, reports, layouts

    This article is not subject to comment, since its author is not yet

    « Open data composition schema»Or, which is equivalent, click on the magnifying glass sign.

    3. Since the report that we are creating does not yet have a data composition schema, the platform will offer to create new scheme ... The data composition schema is a mock in terms of configuration, so a mock designer will open, prompting you to select a single layout type -> Data composition schema... Press the button Ready.

    The framework will create a new layout containing the data composition schema and immediately open the data composition schema designer.

    3. The designer has large quantity opportunities for visual design of reports, but now we will use only the simplest of its capabilities and simply define the data that we want to see as a result of our report.

    Let's add a new dataset -> query .

    4. In order to create a query text, run the query constructor → button Query constructor.

    5. In the list " Database»The composition of the database objects is presented; based on the data of these objects, we are able to build a report.

    If you expand the branch “ Accumulation Registers", Then we will see that in addition to the register table" Remains of materials"There are several more in this thread. virtual tables generated by the system.

    6. Since we want to see both the remnants of materials and information about their receipt and consumption, we will be interested in the virtual table " Remains of Materials. Remains and Turnovers". Let's open it.

    As you can see (and if you don’t see it right away, then scrolling), this table contains the material, the warehouse and, in addition, the initial and final balances, as well as the values ​​of receipts, consumption and turnovers for all resources of the “Material Remains” register.

    7. Let's start to select the fields of the table in the order we need by double-clicking. First let us choose Warehouse and Material... Then choose Quantity Initial Balance, Number of arrival, Quantity Consumption in conclusion QuantityFinal Balance

    As a result, the Fields window should be filled in as follows:

    8. After that, on the tab Grouping specify a group field Warehouse.

    9. Press OK and return to the data composition schema constructor.

    The platform will place the request text that was created using the constructor in the field Inquiry.

    This field represents text editor where you can manually edit an existing query. Alternatively, you can call the query designer again and use it to edit the query.

    Let's pay attention to the list of fields of the data composition system, which the platform filled in at the top of the constructor.

    It displays the fields available for the current dataset. In our case, the 1C: Enterprise system filled in this list automatically, from the request text, and there is no need to manually configure it.

    10. Let's go to the tab Settings and add grouping (context menu New grouping).

    In this case, we will not specify the grouping field, but simply click OK.

    The report will display detailed records from the infobase → records obtained as a result of executing a query without totals.

    11. Now let's set up the fields that will be displayed in the report result.

    To do this, go to the tab Selected fields and out the window Field transfer from the list of available fields:

    • Warehouse:
    • Material;
    • Quantity Initial Balance;
    • Number of arrival;
    • Quantity Consumption;
    • Quantity Final Balance.

    12. Let's start 1C: Enterprise in debug mode and see how the report works.

    13. Run the command Operations in † ’Report in †’ Materials.

    The system will automatically generate a report form and a settings form for it.

    14. Click To shape.

    As you can see, our report is quite “presentable” and fully reflects the movement of materials that has taken place in our organization.

    Document Layout Creation Service

    1. Open the configuration object editing window in the configurator Document Provision of Services.

    2. Go to the bookmark Layouts and run Print Designer:

    3. On first step we will point out that the new procedure, which will be created by the designer to generate the printed form of the document, will be located in the form module.

    4. In the second step by pressing the double arrow, we will determine that all the details of our document will be displayed in the header of the printing form.

    5. On third step in the same way, we will define that all the details of the tabular section of the document will be displayed in printed form.

    6. In the fourth step the designer will offer us to form the basement (lower part) of the printing plate. Since we won't be using the basement in this case, let's move on right away.

    7. On fifth step we indicate that the designer should insert a new button into the document form to call the procedure for generating the printable, and click OK.

    8. The document form and its layout will open in the configurator:

    9. Let's check the layout in operation. Start 1C: Enterprise in debug mode and open the document Provision of service No. - 1... Notice that in the lower right corner of the document appeared new button Seal which the constructor added.

    10. Click on this button and you will see printed form our document.

    As you can see, the designer has generated a perfectly suitable printable for our document. The only thing missing in this form is the total amount of the document.

    Editing the layout of the document Rendering Services

    1. Open the configurator, expand the document tree Services and double click on layout Seal.

    As you can see, the document layout consists of named areas , which are printed in a specific order.

    2. Add new area to display the total amount of the document:

    • select with the mouse two empty lines in Document Rendering Services: Printing;
    • execute the command Table in † ’Names in †’ Assign name ... ¦

    3. Let's name the area Total.

    4. In the created area:

    • in a collumn Price, we will write Total;
    • in a collumn Sum write TotalBy Document.

    5. Calling the properties palette for the last cell we filled in, we indicate that this cell will contain not text, but parameter :

    Each cell of the spreadsheet document we are editing can contain either text, or some parameter, or a template.

    Text contained in the cell will be shown on the screen.

    Parameter will be replaced by some value that can be assigned to it by means of the built-in language. The text contained in the cell is the name of this parameter.

    Sample is a text string where the parameter values ​​will be inserted in certain places.

    Therefore, specifying for the cell as padding Parameter, we have defined a scope parameter named TotalBy Document, to which we will assign the value we need when forming the printing plate.

    6. Now let's open module document form RenderingServices → Document Form.

    7. Find the procedure in it Seal and after the loop, add the following lines to it:

    The meaning of the added fragment is simple: we get a new area Total(the one we just added to the layout).

    Then the parameter TotalBy Document located in this area, we assign the value of the sum of the tabular section of the document by column Sum(access to the tabular section of the document is performed by name → List of Nomenclature).

    Finally, we output the area into a final spreadsheet document that will be shown on the screen and printed by the user.

    Similarly, using the properties of the layout cells and controlling the order of their output, the developer can create a printable of any design.

    Now, in order for our document Services, looked completely finished, let's add the total amount for the document and on the screen form so that the user can see it in the process of filling out the tabular section of the document.

    Editing the form of the document Provision of Services

    1. Open in the configurator the form of the document Service Rendering → Document Form.

    2. Open the Properties palette for the table field located in the form and set the property Basement which determines whether the control has a footer Table field.

    3. Let's open the column properties Price:

    • set footer text → Total: ;
    • horizontal position in the basement → Press right;
    • in the footer font, change the style to Fatty.

    4. Let's open the properties of the Amount column:

    • set horizontal position in the basement → Press right;
    • set the flag DisplayTotalsIn the Basement;
    • in the footer font, change the style to Fatty.

    5. Start 1C: Enterprise in debug mode and see how the form of the document Rendering Services No. 1 looks now.

    Similarly, using the properties of controls and setting their values, the developer can create a display of any design and behavior.


    They find us: creating a report in 1s 8 2 from scratch, 1 Open the configuration object editing window in the configurator Document Rendering Services 2 Go to the Layouts tab and launch the print designer In the window that opens, at the first step, we will indicate that a new Print command will be created to generate a print, how to make a report in 1 s, document designer development, Create a report using the designer of the output form, creating reports in 1c 8 002, a workshop on creating reports in subd 2007, a workshop on the creation of methodological materials in the field of tourism, a report on the remains of materials in the warehouse 1c creation, open the layout designer 1c




    Did you like the article? Share it