Printable forms in 1s 8.3 configurator. Publications. Initializing Basic Variables

Let's consider writing the simplest printed form in 1s 8.1 - 8.2 using configuration example Enterprise accounting 2.0. Let's say you need to write an external printed form for a document: display the basic data of the document, as well as from the tabular part Goods: nomenclature, price, quantity and amount.

You can download the resulting example from .

In the configurator 1C Enterprises 8 create external processing ( File->New->External Processing), set the name, create the required details for the external printed form Object Reference with type DocumentLink. Sales of Goods and Services.

Creating a printed form layout

Add a new one layout, leave the layout type spreadsheet document. We create three areas on the layout: Header, Data And Basement. This can be done by selecting the required number of lines and clicking menu Table->Names->Assign name (Ctrl+Shift+N).

After this, we begin to place text and parameters in the areas. We'll put it in the header name of the printed form, document number And organization, and also draw the borders of the table header and write the names of the columns. When creating a parameter in the cell properties, on the Layout tab you should set the property Filling in meaning Parameter.

In area Data let's create parameters for displaying rows in the tabular section( Nomenclature, price etc.), and in the area Basement for totals by quantity and amount.

Programming

Let's go to the printing form object module Actions->Open object module.

Let's create an export function there that is mandatory for printed forms. Seal().

Function Print () Export EndFunction

In the function we will create a variable for spreadsheet document, into which the printed form will be output, we get layout And layout areas.

TabDoc = new TabularDocument; Layout = GetLayout("Layout" ); HeaderArea = Layout.GetArea("Header" ); AreaData = Layout.GetArea("Data" ); AreaFooter = Layout.GetArea("Footer" );

Let's fill in the parameters hats and bring it to spreadsheet document.

HeaderArea.Parameters.HeaderText = +LinkToObject.Number; HeaderArea.Parameters.Organization = LinkToObject.Organization; TabDoc.Output(HeaderArea);

To get table rows Goods we use the request.

Request = new Request; Request.SetParameter("Link", ObjectLink); Query.Text = "SELECT | Sales of Goods and Services Goods. Nomenclature, | Sales of Goods and Services Goods. Amount, | Sales of Goods and Services Goods. Price, | Sales of Goods and Services Goods. Quantity|FROM | Document. Sales of Goods and Services. Goods HOW to Sale of Goods and Services Goods|WHERE | Sales of Goods and Services Goods. Link = &Link";

We pass the details to the request parameter Object Reference, to indicate in the condition WHERE, that we need data only from the document from which we derive the printed form. To get a sample query, we first execute it and then select the rows.

Select = Query.Run().Select();

Next in the loop we fill in the area parameters Data for each line of the document sample and display them in spreadsheet document. We also calculate the total values ​​in the loop quantities And amounts. We will not fill in each parameter separately, but use the procedure Fill inPropertyValues((<Приемник>, <Источник>) from global context, it copies property values <Источника> to properties <Приемника> . Matching is done by property names. You can read more about this in syntax assistant 1C Enterprise 8.

TotalSum = 0 ; TotalQuantity = 0 ; While Selection.Next() Loop FillPropertyValues(AreaData.Parameters,Selection); TotalSum = TotalSum + Sample.Sum; TotalQuantity = TotalQuantity + Sample.Quantity; TabDoc.Output(AreaData); EndCycle ;

Fill and display the area Basement.

AreaFooter.Parameters.TotalQuantity = TotalQuantity; AreaFooter.Parameters.TotalSum = TotalSum; TabDoc.Output(AreaFooter);

Returning the completed spreadsheet document from the function Seal().

return TabDoc;

If you are using one of the standard configurations, then after returning the spreadsheet document 1C will display the printed form on the screen. You can also use the spreadsheet document method for output. Show().

5. Connecting a printed form to a document

IN standard configurations 1C 8 There is a directory for registering external printed forms ExternalProcessing. To connect, go to the menu in enterprise mode Service->Additional reports and processing->Additional external printed forms .

Add a new directory element, load the printed form from disk and select the document type.

Now in the document Sales of goods and services A new printable will appear.

Auto-registration of printed form

To ensure that when connecting a printing form you do not need to select the document type manually, you can configure auto-registration. To do this, add a new layout and call it Settings_Auto-registration(this is the only way) and in its first cell we write Documentation.<Наименование документа> (or Directories.<Наименование справочника> ).

Now, when connecting a printing form, we will be asked to use auto-registration parameters.

Instructions

Open the 1C:Enterprise program version 8. Pay attention to the menu item “Service” - “External processing and printing forms”. With its help, you can store external reports, processing, printed forms, as well as processing for filling tabular elements. Also you can connect external form instead of changing an existing one, which would entail interfering with the program configuration.

Launch the 1C:Enterprise program in configurator mode, then create external processing, to do this, execute the command “File” - “New”. In the window that appears, select “External Processing”. A new external processing form will appear on the screen. Give it the name “External”. Then add a new attribute called “Object reference”, specify the type for it – “Document. Link. Sales of goods and services." To create a printable for a different type of document, use the appropriate link type.

Add a new layout by clicking on the corresponding button in the window new form. Name it “Layout”, create an area called “Header”, give it the parameter “Header Text”. Then click on the “Actions” button, select the “Open object module” command. Then insert the module text, you can use the example posted on the website http://www.uasoft.com.ua/content/articles/315/.

Launch the 1C:Enterprise program, go to the Tools menu, select External Printing Forms. Add a new entry to the list of forms. To do this, select the created processing file, and in the tabular section, indicate that the form belongs to the “Sales of goods” document. Check that the new printing plate is working correctly. To do this, open the created document, trace it, then at the bottom of the screen click on the “Print” button, select the “External printing form” option.

Sources:

  • how to change a printed form in 1c

In order to create and edit object forms, the 1C:Enterprise program provides a special form editor (or Form Designer). Application solution object forms are designed to visually represent data while working with the program. The form editor contains several tabs that provide the ability to edit all form elements.

You will need

  • computer, 1C program

Instructions

Using the form editor, you can add one or more “Group – Pages” elements to the form; to do this, click on the green plus sign in the upper left corner of the editor while on the “Elements” tab.
In 1C:Enterprise mode, all existing group elements will be displayed each on a separate tab. To position it above or below the working one, in the “Properties” window of a particular group, in the “Display” item, select the appropriate command.

You can also add elements to the form by dragging the required details into the element tree. To make it easier to navigate form controls when editing or entering data, set the order that suits you, arranging elements in the tree and subordinating them to other elements, and setting the properties of group elements to suit your needs.
To edit form details - change them, create new ones or delete them, use the panel in the details tree area on the corresponding tab.

To edit the command interface, go to the appropriate tab. You will see a command tree, the main branches of which are the “Navigation Panel” and the “Command Panel”. Some commands are added to the command interface tree automatically, but you can also add them yourself by dragging the commands you need from the list of global (general) commands or from the list of form commands.

Form commands are edited in the corresponding list. You can add them, remove them from the list, set properties for each command using the properties palette, which you can call by clicking on the pencil icon in the command line of the list.
To edit form parameters, go to the “Parameters” tab, where you can also add them, delete them, and set the desired properties.

Video on the topic

Chart of accounts used in accounting to display economic activity enterprise, supports a multi-level hierarchy: account - sub-accounts. So that the user can view the data contained in the chart of accounts and correct them, the 1C system allows you to change the form of the account. In addition, the printed form of the invoice can be changed in any other document in 1C.

You will need

  • - personal computer with 1C.

Instructions

Analytical accounting is provided for each account or subaccount. Therefore, when creating and subsequently editing a chart of accounts in 1C, the required number of sub-accounts, that is, analytical accounting objects, can be supplied. Moreover, adjustments to accounts and subaccounts can be made by both the user working with automated system accounting and software developer.

As is known - without a piece of paper you... no serious business can do without. And when we say that 1C has some kind of electronic documents, the question immediately arises of how to print them in paper form.

The process of printing an electronic document 1C is called printing form 1C.

Each document can have several 1C printed forms. For example, the document Sales of goods and services (i.e. sale) is printed in 1C printed forms: TORG-12, Invoice, Consignment note, Certificate of services rendered, and so on.

The essence of the 1C printed form is a template (such as an Excel document) in which variables are specified. During the printing process, text from the electronic document is substituted for variables. The template is usually stored in the configuration.

The problem with changing a standard 1C printed form is that it is usually not advisable to change the standard configuration, otherwise it will be more difficult to update. Therefore, various methods for using external 1C printing forms appeared and began to reinvent the wheel.

An external 1C printing form is a printing template that is stored somehow separately from the configuration itself.

However, this is all theory. How to create your own printed form? Or better yet, how to make changes to an existing one?

How a 1C document is printed

To print any 1C document (which can be printed), you need to click the Print button in the document. 1C will offer to select a 1C printed form for this document from the list.

To the left of the Print button there is usually a quick access button to the last selected 1C printing form.

The print result looks like this. To print it to a printer, you need to place the cursor in the 1C printing form, press Ctrl+P or the printer button on the button panel or in the File/Print menu.

Print settings (margins, sheet orientation, etc.) are located in the File/Page Setup menu. You can also configure the user settings to print directly to the printer.

Where does this printing form come from?

Where is the 1C printed form located?

Let's go to the configurator. Find it in the configuration window required document. Let's expand its Layouts branch. It is they who turn into the 1C printing form when printed.

However, it will not be enough - we were offered to choose many more options when printing. The fact is that many 1C printed forms layouts are hidden in another place.

Let's go back to the top of the 1C configuration window. Let's open the General branch, and then the General Layouts branch. This is where most of the layouts are located. This is especially true for state-regulated printed forms 1C - TORG 12, Invoice, etc.

By the way, it’s not difficult to notice that you will see several layouts of TORG12 or Invoice. Why? It's easy to explain. Laws and requirements change periodically. But we can't just change the same layout - and if we have to print the document from a date that is earlier than the change date. Therefore, several layouts are made and, depending on the date of the document, the correct one is used.

But that's not all! There are also external layouts. Where are they stored?

Let's return to 1C Enterprise mode. Via the user menu with administrative rights Operations/Directories, select the External processing directory.

The lines of this directory, which have the form Printing form, add printing options for the document specified in the table Ownership of the printing form (in the picture this is Sales of goods and services).

In order for this to work, you must make an external processing that has a Print() procedure in its object module labeled Export, which organizes the printing process.
But we are getting ahead of ourselves. Let's first look at how the layout of the 1C printing form is organized.

Layout of printed form 1C

The layout of the 1C printing form looks like this.

As you can see, it is divided into blocks. Blocks can be horizontal (name on the left) or vertical (name at the top).

The layout itself, as it is, is not printed. Individual blocks are printed. The programmer in the print processing procedure specifies the order of blocks and the number of repetitions of each block. As a result, the printed form is formed.

In order to assign an area, select several rows (or several columns) and select Table/Names/Assign a name from the menu. To remove it, there is also the Remove name command.

The name is needed so that the area can be accessed from program code. The name can be assigned not only to rows or columns, but also simply to several cells. To do this, select the cells and select the same menu.

However, by default, custom cell names are not displayed. To see them, select the menu item Table/Names/Display named cells.

So, today we learned that a 1C printed form is formed using a layout. The layout consists of blocks – cleverly called areas.

Typical (commonly used) blocks for printing plates:

  • Header – the title of the document is displayed
  • Row – one row of the table is displayed, this block is repeated as many times as the rows need to be printed
  • Footer – the end of the document is displayed.

Now we need to deal with the

Every electronic document 1C can be printed on paper and this is done using 1C printing forms. Printables are made up of named blocks, such as Header, Row, and Footer.

How to make a printed form is already clear. How to break it into blocks - too. But how does printing of this whole thing happen in 1C? And especially - how to display not just the text of the layout, but the contents of the electronic document?

This is what we will look at right now.

Preparing a layout for printing in 1C

To begin with, you will have to start with the simplest thing and fill out the layout for printing in 1C with static text and table lines. After all, someone has to do this boring job?

We place static text for printing in 1C

A good place to start would be to place the name of our printable. Select several cells in a row and select the menu item Table/Merge. As a result, several cells will be merged into one.

Now in this cell we will write the name of the document. Since this is a heading, we apparently want to make it in bold, large font (see picture) and place it in the middle.

We place the design of the layout for printing in 1C

We have a named area String. In it, when printed in 1C, each row of the table of the Products document will be displayed. We would probably like the table to look like a table when printed in 1C? Then you need to draw boundaries for it.

To do this, select the row cells and select the Borders button on the panel. We chose the Border Everywhere option – it draws cell borders from all sides at once. If you need to limit yourself to only one side, then you need to select the appropriate button.

To ensure that the lines used to draw borders are not the same as the standard ones, select the cells and right-click. In the menu that appears, select Properties.

In the usual properties window, you can select the type and color of lines for drawing boundaries.

We place pictures and other tinsel for printing in 1C

Many people ask - how to place something other than text on a 1C printed form? For example, a picture.

And it's very simple. Moreover, I’ll say right away that the barcode (if you need to print it) is also a picture.

Let's place the cursor on any cell. Select the Table/Figures menu. This is a whole submenu that allows you to insert onto a layout for printing in 1C not only a picture or a drawn object, but also objects from outside 1C, registered on the computer using a COM class (for example, a drop-down list control).

For those who are interested in creating complex designs for printing in 1C on a layout, also take a look at the drop-down menu Table/Print Settings. Here you can set the repeat area on each page, header and footer, and print area.

How to place the contents of an electronic document when printing in 1C

To place the contents of an electronic document on a layout when printing in 1C, the substitution method is used. It consists of two parts.

Part one. It is necessary to place parameters on the layout into which you will substitute values ​​when printing in 1C.

Let's place the cursor in the cell. Let's enter the name of the parameter (in one word, without spaces or other garbage). Next, let's go into the properties of this cell (as mentioned above) and select Filling = Parameter.

Part two. Substitution of values ​​is carried out not when you are programming in the configurator, but at the time of printing the document in 1C. Accordingly, using programming, you need to indicate to 1C what needs to be substituted in this parameter.

This is done as follows:

Layout = GetLayout("LayoutName");
regionSomething = Layout.GetArea("AreaName");
regionSomething.Parameters.ParameterName = "What I want to substitute from the database";

As you can see, we simply get the layout itself by name, then one of its areas, and then we simply access the parameter by its name.

Naturally, the value can be either a string or a number, or the value specified in the document.

How to print a layout in 1C

After the layout is ready, it’s time to think about programming the printing process in 1C.

Printing in 1C is usually programmed by several procedures that are located in the document object module. .

The Print() procedure is usually marked Export and controls the printing of a document in 1C using the LayoutName parameter, which conveys what you would like to print.

For each layout option, the PrintLayoutName() procedure is performed, which specifies the printing of a specific layout. That's what we'll look at now.

Programming printing in 1C consists of three points.

Before printing an electronic document in 1C, we need to request its data from the database. Obviously, to print a document, the user usually “enters” it (opens its form) and clicks the Print button. Therefore, in the printing procedure, one could simply refer to the document details (what this is - discussed here) by name.

However, this is considered ugly, not universal, etc. For example, suddenly processing of mass printing of documents will be used (how often is this used?). Therefore, it is common in the printing procedure to make a database query that requests document data. For example, like this:

Request = New Request;
Query.Text = "SELECT
Date of,
Number,
Organization
FROM
Document.DocumentName
WHERE
Link = &DocumentForPrint";
Request.SetParameter("DocumentForPrint", Link);
Select = Query.Run().Select();
Selection.Next();

Point 2. Filling out the layout for printing in 1C

Printing in 1C is done in a spreadsheet document. This is a special 1C object that allows you to display tables, like Excel, on the screen and in print. Naturally, the layout is printed, or rather its areas one by one.

Accordingly, we first need to get a spreadsheet document, then a layout. We print the areas one by one, filling in the layout parameters.

TabDoc = New TabularDocument;
Layout = GetLayout("LayoutName"); //or GetGeneralLayout("")

areaHeader = Layout.GetArea("Header");
TabDoc.Output(regionCap);

regionRow = Layout.GetArea("Row");
While SelectingDocumentLines.Next() Loop
regionLine.Parameters.Product = SelectionDocumentLines.Product;
TabDoc.Output(regionString);
EndCycle;

areaCap = Layout.GetArea("Footer");
TabDoc.Output(regionFootroom);

Point 2. Printing a document in 1C

The last point is to output the received document to the screen or printer. In typical configurations, a standard procedure is used for this (each may have its own), for example, Universal Mechanisms.PrintDocument().

In other cases, you can simply use the standard functions of the TabularDocument object: TabDoc.Show() or TabDoc.Print() .

This article describes how to connect an external printed form to a 1C database using the example of the “Trade Management 10.3” configuration

The “Trade Management 10.3” configuration is a configuration on so-called “REGULAR” forms, and not on “MANAGED” forms like “Trade Management 11.2”; for “MANAGED” forms we recommend reading.

Our instructions “show” how to connect an external printed form in 1C with configuration on “REGULAR” forms, namely:

  • "Accounting 2.0"
  • "Trade Management 10.3"
  • "Salary and personnel management 2.5"
  • "Comprehensive automation 1.1"
  • "Control manufacturing enterprise 1.3"
  • "Retail 1.0"
  • and other similar configurations.

In order to connect an external printing form in 1C we will need to go through 11 steps.

1 - Menu "Service". 2 — Select “External printing forms and processing”. 3 — Next — “External printed forms” (see figure below ↓)

To convince you that this instruction suitable for other configurations on “REGULAR” forms - let’s imagine the same initial 1-2-3 step, but not in “Trade Management 10.3”, but in “Accounting 2.0” everything is the same there with the exception of slightly changed words in the subparagraphs, namely...

1 — “Service” menu (the same as in “UT 10.3”, and in others).
2 - Here “Additional reports and processing”, and not “External printed forms and processing” as in “UT 10.3”,
but still the meaning is the same and is located there in the “Service” menu.
3 - And then - “Additional external printing forms”, i.e. extra word “Additional” when compared with “UT 10.3” (see figure below ↓)

Next, we will continue using the example of “Trade Management 10.3” without unnecessary comparisons.
4 — Click on the “+” button i.e. "Add". 5 — A button where the folder is drawn (when hovered, a hint will appear: “Replace external processing file”).

In new versions of 1C (starting from August 2016), the program has a built-in warning mechanism about the danger of using unknown external processing that may contain “viruses”; in earlier versions of the program the warning will not appear! If it occurs, then to connect external processing it will be necessary - 6 - click the “Continue” button. (see figure below ↓)

7 — Select the directory in which the external printing form file we need is located. 8 — Select our file. 9 — Click “Open” (see figure below ↓)

10 — An external printed form may have auto-registration parameters, as in our case, here it makes sense to click “Yes” - thereby using these parameters during registration, i.e. automatically select those objects (documents or maybe, for example, directories) in which it will be possible to use a connected external printed form (see figure below ↓)

That’s all, we have filled out the table “Affiliation of the printed form”, thanks to the auto-registration parameters, we see the name of the connected external printed form, perhaps you will have the “Comment” field filled in, etc. You can add your objects to the “Print Form Ownership” table, for example, for our “Universal Printable Contract Form” processing, which supports printing of many documents and reference books, but auto-registration parameters are set only for the main ones: 10* — Click on the green “Add” button and select which objects to also place for processing. Now all that remains is - 11 - click on the “OK” button and (see figure below ↓)

Now it’s worth checking - did we do everything right?
To do this, we select an object to check, for example, the document “Sales of goods and services”, which is indicated in the table “Affiliation of the printed form”, this means that the connected printed form can be used in this document! Let's check... (see figure below ↓)

To check whether printing is possible, open any document of the form: “Sales of goods and services.” 13 — Click the “Print” button.
We see that a window for selecting printed forms has appeared, among them there is - 14 — external printing form connected by us (see figure below ↓)