Makeup.  Hair care.  Skin care

Makeup. Hair care. Skin care

» Publications. Publications Printing on 1c form

Publications. Publications Printing on 1c form

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 began to be reinvented.

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 printable come from?

Where is the 1C printed form?

Let's go to the configurator. Find the required document in the configuration window. 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. Through 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. The result is a printed form.

In order to assign an area, select several rows (or several columns) and select Table/Names/Assign a name from the menu. To remove, 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

Sandbox

tough guy August 23, 2011 at 10:22 am

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

Let's say you need to display a report like this:

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


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

Now let's create a new report and call it “Employee List”. Let's go to the "Layouts" tab and create a new layout of the "TabularDocument" type.
A blank spreadsheet document will open in front of us, ready for use. Now we need to present the required report in the form of a layout.
To do this, first copy the source report into a blank spreadsheet document, i.e. to the report layout. You'll get something like this:

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

For each area, you must assign a corresponding name; to do this, you need to select the desired area (in this case, all areas are groups of rows) 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 indicated in the figure.
Now those table cells in which data from the infobase should be displayed must be designated as containing a template. To do this, select this field and select “Properties” in the context menu (right mouse button). In the “Fill” cell property drop-down list, you must select “Template” (example in the figure below).

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

My name is [MyName],

Then to display the text “My name is Ivan” the parameter is enough "My name" assign the value "Ivan".
In our case, the template will be the report output date, 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 because its author is not yet

So! There is a configuration (for example, “Trade Management”, edition 10.3), and for it it is necessary to develop an external printed form. For example, let's take the standard document "Invoice for payment to the buyer" (although external printed forms can be created not only for documents, but also for directories).

Example for 1C 8.3 (Managed forms)

An example of developing an external printed form for a managed application can be viewed.

Task

Develop an external printed form that will be available from the document “Invoice for payment to the buyer”, and which will contain the name of the organization, the counterparty and a list of goods with price, amount and quantity.

Go!

The first thing you need to do is create an external processing file. Processing should contain three main points:
  1. "Object Link" attribute with type "DocumentLink.Invoice for Payment to Buyer"
  2. The layout that will be printed
  3. Export Function "Print()" which returns a spreadsheet document
These actions are visible in Figure 1

"Drawing a layout"

Our layout will contain two areas:
  1. The title (header) of the document (in this area the names of the organization and the counterparty will be placed), and the table header (with the names of the columns)
  2. Table with goods (columns with name, quantity and amount)
Figure 2 shows the layout of the external printing form. Please note that the table and header cells contain parameters, not just text.

Function "Print()"

The form is almost ready. All that remains is to write the programmatic filling of the fields of the spreadsheet document. These actions are performed in the processing object module, in a function called “Print”, which MUST be exportable.
Stage No. 1. Receiving data for the header, filling out the header parameters, and outputting it to a spreadsheet document TabularDocument = New TabularDocument; Layout = GetLayout("OurLayout"); Data Request = New Request("SELECT | REPRESENTATION(Invoice for Payment to the Buyer. Counterparty) AS Counterparty, | REPRESENTATION(Invoice for Payment to the Buyer. Organization) AS Organization | FROM | Document. Invoice for Payment to the Buyer AS Invoice for Payment to the Buyer | WHERE | Invoice for Payment to the Buyer. Link = &Link"); Data Request.SetParameter("Link", ObjectLink); Header = DataRequest.Execute().Select(); Cap.Next(); Area = Layout.GetArea("Header"); Area.Options.Fill(Header); TabularDocument.Output(Area); Stage No. 2. Receiving tabular data and line-by-line output of products
Data Request.Text = "SELECT | _Products.Line Number, | REPRESENTATION(_Products.Nomenclature) AS Nomenclature, | _Products.Quantity, | _Products.Price, | _Products.Amount |FROM | Document.Invoice for Payment to the Buyer.Products AS _Products |WHERE | _Products. Link = &Link"; Fetch = DataRequest.Execute().Select(); Area = Layout.GetArea("Data"); While Selection.Next() Loop Area.Parameters.Fill(Selection); TabularDocument.Output(Area); EndCycle; Stage No. 3. Return spreadsheet document and print function return TabularDocument;

Adding our external printing form to 1C

Go to the menu "Service - External printing forms and processing - External printing forms"

In the element creation window that opens, perform the following actions:

  1. Loading the external processing file
  2. We indicate for which configuration document (or directory) the printed form is intended
  3. Recording changes

Let's print!

Open any document “Invoice for payment to the buyer” (with the tabular part “Products” filled in, because that’s where we get the data to fill out), click the “Print” button, in the window that opens, select OUR printed form, and click “Print”


ATTENTION! This development algorithm is ONLY suitable for a “Regular application”. The printables for Application Managed configurations are different!

The file of the printed form shown in the example can be

Life goes on, legislation changes, the developer releases configuration updates and we again have a choice: install the update ourselves or again call the programmer to “install a new release”...

Let's get acquainted with the mechanism for changing printing forms without changing the configuration.


In the practice of every accountant using 1C, there has ever been a need to modify the configuration for themselves: some adjusted the accuracy of the price or amount in the invoice, some inserted a logo and adjusted the appearance of the invoice. Everything would be fine, but a great many such changes accumulate over time and when the time comes to update the release, a dilemma arises: either lose all the changes made, or call a programmer to transfer all the changes to the new release (of course for an additional fee). How to be? To somehow simplify updating configurations, the developers created a new mechanism: “External processing, printed forms, processing for filling out tabular parts.” Today we will look at only part of this mechanism - printing forms.


Any subject is best learned by example. Let's set ourselves the following task: add to the configuration the ability to print an invoice (document “Sales of goods and services”) with our company logo. In addition, it is necessary that in the header of the document the inscriptions "provider" And "buyer" were highlighted in bold and finally, it is necessary that at the bottom of the document there is a place for the signature of the security service that authorized the shipment.


Let us introduce two additional conditions:

  • The new printed form should replace the old form "Invoice"
  • The configuration cannot be changed, since we want to use auto-update of the configuration in the future

Well, what's the task? Seems too complicated? Well, the more complex it is, the more interesting it is, and the more you want to solve it. Then get to work.


We launch our database in Configurator mode. Open the configuration by selecting the command in the main menu "Configuration > Open Configuration". We will not change the configuration itself under any circumstances. We will use it as a prototype. We will do the main work here, but we will edit external processing. We create external processing with a command in the main menu "File > New". Selecting the type of document "External processing". For the first processing, let's set a name "Branded Invoice"


Important! The processing name must not contain spaces, just like variable names.


Now let's do a little "plagiarism". Let's copy the layout "Invoice" from document "Sales of Goods and Services". To do this, we will find it in the branch "Documentation" configuration tree. Expand this thread by clicking on the icon «+» and find the layout we need "Invoice"(it's in the thread "Layouts"). In order to copy this object, you need to select this layout in the tree and run the command "Edit > Copy"(the same action occurs with the combination CTRL+C). Now let's go to the processing we created, select a label in the tree "Layouts" and in the main menu select the item - "Edit > Paste" (CTRL+V). The result should look like Figure 1.


Now double-click to open the layout.

What is a "layout"

Let's say a few words about the purpose of the layout.

Layout- storage "building blocks", areas from which, like bricks, a tabular document is built, which we are accustomed to calling a printed form. Areas are defined using horizontal and vertical sections or their intersections. Our layout has only horizontal sections: “Header”, “Supplier”, “Buyer”, “Table Header”, “Row” (see Fig. 2). An area is a set of cells. As in MS Excel, cells can be merged, text and background colors, fonts, and so on can be changed. All cell settings can be viewed and changed in the cell properties window. You can call the settings window by right-clicking on the cell and selecting the context menu item "Properties"(the same result is achieved by the keyboard shortcut Alt+Enter).


A cell can contain one of three types of values:

  1. text– a value of this type will be printed in the same form;
  2. parameter– a cell of this type contains the name of a variable whose value will be printed.
  3. sample– cells of this type are a combination of the first and second options. The cell can contain text and variables. In order for a program to distinguish text from a variable, variables must be enclosed in square brackets: "Today is [Date]".

Important! The table editor displays the values ​​of cells of the second and third types in triangular brackets. In Figure 2 there is a cell with text "Buyer"- looks like text, and to the right of the cell "Buyer's Presentation"- parameter.

Why am I telling all this? Now you know in which cells you can easily change the contents, and in which it is undesirable to change anything, since you will need to make changes to the printing algorithm.

Let us now return to our task. We created the processing, copied the layout and are ready to modify it to suit ourselves. First, let's take a closer look at it.

What's included in the printable layout

The layout structure of all documents is very similar. Having carefully examined one document, we can deal with others. First section "Title". When this section is displayed, a document header will be generated, consisting of the type, date and document number. It is followed by sections "Supplier" and "Buyer", in which the program will display information about the supplier and buyer, respectively. Next is a more interesting section "Additional information", which developers use to display other information on the document, for example, information about the contract with its number and date. The peculiarity of this section is that it can be displayed many times, and each time it can contain different information. What exactly to print and when is described in the printing algorithm.

This completes the header of the document. The header is usually followed by a tabular section. Interestingly, the layout describes two options for displaying the tabular part: "Table Header", "String" and "HeaderTablePlaces" And "StringPlace". Depending on whether your column is filled or not "Mest" in the document, the first or second option for displaying the tabular part of the document will be used. The curious reader has probably already wondered: why in the header output section "Price" And "Sum" are placed in triangular brackets as if they were variables? That’s right – these are variables in which, depending on the document settings, the inscription will be displayed "Price", "Price with VAT" or "Price without VAT" and similarly for the amount.

Well, below in the layout there are sections with the help of which the results of the document and signature are displayed.

Editing the layout

It would be nice to place the logo above the information about the supplier and buyer. I suggest editing the layout area "Title". It is necessary to reduce the size of the cell containing the contents "TitleText". This cell consists of several merged cells. We change the size as follows:

  1. Let's carefully copy the contents of the merged cell "TitleText"(to do this, you need to select the cell and use the command “Edit > Copy” or the keyboard shortcut CTRL+C)
  2. Having selected this cell, select the item in the main menu "Table - Merge", which will lead to the opposite effect - the merged cell will be split into many original cells
  3. Now let's select a smaller number of cells - instead of cell 2 of column, we will start merging from column 6, ending it at column 32 - and click on the button again "Merge"
  4. Team "Edit > Paste" (CTRL+V) insert the contents of the previous merged cell into the new merged cell
  5. We simply clear the vacant cells in columns 2 – 5 (select them and press the Delete key)

Now you can insert a picture with a logo into the free space. To do this, select the item in the menu “Table > Pictures > Picture...”. Find the file with our logo on the disk and click “ OK" Now let's move the image to the free space. The result should look like in Figure 3.


Now let’s highlight the values ​​in the cells in bold "Provider" And "Buyer"(Fig. 4). To do this, find the parameter in the cell properties "Font" and set the style to bold.



And finally, it remains to add the signature of the security service. We will post this information in the section "Signatures". To get space for signatures you need to expand the section. Select line 37, right-click on it and select "Expand", and so on twice. In one of the added lines we will place a place for the signature of the security service. As a result, everything should look like in Figure 5.



Important! In a typical configuration, two languages ​​are used: Russian and Ukrainian. The layout stores the text representation in both languages ​​(the cell design is general). In order to enter the Ukrainian version of the inscription we added, you need to go to the cell properties and to the field "Text" press the button "search". A window will open for entering text representations in different languages ​​(Fig. 6).

How to ensure printing

So, the layout is ready. Now is the time to work on the algorithm for printing it.

In order for us to painlessly integrate this layout into the configuration and use it, the processing that we created must satisfy the following conditions:

  1. You need to create props in processing "Object Link" with type "AnyLink"
  2. You need to create a procedure in the processing module "Print() Export" without parameters and be sure to specify the keyword " Export"

The first point is needed so that the printing algorithm knows where to get data for printing, and the second is the printing algorithm itself. Let's fulfill these conditions.

In the window panel, select the window for editing our processing (in Figure 7). A window will open with a tree of objects for our processing. Selecting a branch "Requisites" and press the button "Add",. The attribute properties window will open. Let's enter the name - "Object Link" and indicate the type "AnyLink". Now we can move on to the text of the print module. We won’t write it from scratch; instead, we’ll copy it from the document "Sales of Goods and Services".



To do this, find in the configuration tree among the documents "Sales of Goods and Services", right-click on it and select "Open object module"(see Figure 8).



This will open the document module. We need the first function "PrintDocument". Its text must be selected and copied. It is very convenient to highlight the text of a function when it is collapsed, but you must also highlight the line below it, otherwise you risk copying only the title.

See Figure 9, we have highlighted the title and the line below it. After that, copy it to the clipboard. Main menu "Edit > Copy" (or CTRL+C).



We have memorized the text on the clipboard, now let’s move on to our processing again "Branded Invoice". Click on the button "Actions > Open Object Module"(Fig. 10).



Paste the copied text: "Edit > Paste" (or CTRL+V).

Now it is necessary to slightly edit the copied text, since it was written for printing a document from the document itself, and we are collecting it from external processing. To do this you need:

  1. Rename function to "Print"
  2. Replace "ThisObject" on "Object Link"
  3. Replace "ThisObject" on "Object Link"
  4. Replace "Organization Bank Account" on “Link to Object.Organization Bank Account”
  5. Replace "Products. Summary" on "LinkToObject.Products.Total"

For these actions you can use the main menu item "Edit > Replace".

After this, you must check for syntax. There is a magic combination for this: CTRL+F7. As a result, the following message should appear: "No syntax errors found!"

Well, with this we have completed all the dirty work. Now we can save the results of our work in a file, for example "BrandedInvoice.epf". To do this, you need to make the window for this processing active and save it using the main menu of the program "File > Save As...". Processing file name – "BrandedInvoice.epf"(it will be offered by default). You can save it temporarily to your desktop so you can find it faster later.

Important! As you saw, we did not make any changes within our configuration. For all the actions described above, you don’t even need to remove it from support (that is, enable the ability to change).

Connecting external processing to the configuration

Now we can connect processing to our invoice. To do this, launch in mode. Go to the menu "Service", where there are three points related to the mechanism “External processing, printing forms, processing for filling out tabular parts”. In our case, we only need the item "External printing forms"(see Fig. 11).



This will open the directory. "External processing", with selection by type "printed forms". It will store a list of all external printed forms, indicating which documents they are for and in what cases they need to be shown.



Important! The processing itself will be stored in the database along with other data, that is, after saving the processing inside the database, we will not need an external file.

We need to create a new element in the directory. Click Insert. Now let's look at the contents of the element. In the name we include a meaningful brief description of the essence of this form, for example, "Company invoice". Like any other directory, it also has a code. Let's leave it as default. The type attribute is filled in by default and cannot be edited – "Print form". And the last element of the header is a comment. Here, as usual, there is more detail about the purpose of the printing form. In addition to the header, the elements of this directory have two bookmarks. The second contains information about restricting access rights to this processing. This topic is beyond the scope of this article (we will talk about this and other settings of access rights without modifying the configuration in one of the upcoming issues).

Let's take a closer look at the first tab.

The tab contains four columns. Object representation– the type of document for which we would like to use our printing form,

Selection– a condition under which this printed form should be available. For example, we redesigned the printed form of the invoice and translated it into English. And we want for clients from the folder "European" instead of a standard printed form "Sales Invoice" A new form was printed in English. To do this, you can use the column "Selection". An example of such selection is shown in Figure 13.



But in our task no selections are needed.

Printable Form File– indicates the file from which to take the layout and printing procedure. In this cell you need to select the file we saved on the desktop.

Replaceable printing plate– if we want the printed form we created to replace one of the standard ones for this document, then we need to indicate which one needs to be replaced. If there is nothing to select, an additional printed form will appear.

In our case, we need to "Branded Invoice" was printed instead of the usual invoice. To do this, select in this field "Sales Invoice".

Now let's save this element. And open any invoice.

It should look like shown in Figure 14.



Well, this concludes the task that we set for ourselves at the beginning of the article. We believe that we were able to illustrate the possibilities that the use of the external processing mechanism opens up for the user.

To consolidate your skills, you can try to independently add to the configuration an additional printed form “To the warehouse” for the document “Receipt of goods and services”, which would repeat the usual invoice, but without prices and amounts, and would also contain fields for entering the accepted quantity.

Colleagues!

We continue the topic of creating reports in 1C. Recently, our client had a problem transferring documentation from 1C 8.3.

Entering additional information into a printed form, numbering print sheets, indicating the date, time and user who issued the report.

We discussed a similar example in configuration 8.2 in the previous release. Now we will look at the print settings, which allow us to do all this in configuration 8.3.

Moreover, much of this is automated in 8.3.

So how can you incorporate the above information into your print? What should be done in this case?

We offer our review of options; perhaps it will also be useful to you.

Option 1. Directly from the printed form of the generated report or document:

Create a printed invoice form for payment and call it through Ch. menu – Table – Printing settings – Header and footer and configure as needed.
This is done once for any FORMED printing form.

Setting up header and footer fields

Pay attention to the icons in the upper left corner of the form:

These are in order: page number, number of pages, date and time. Position your mouse at the desired location in the header or footer and click on the desired icon. After clicking on the button. OK, when printed, this data will be displayed in the printed form where you indicated.

Option 2. Configured for any printing (reports, documents, certificates) from the program

If you do not want to manually configure headers and footers each time, you can use the Administration – Header and Footer Settings section to configure the general appearance of headers and footers for printing.

It looks like this:

There are more options for displaying information in printed forms: the “Report Name” and “User” data is added. This is exactly our case.

Selecting data for the header and footer is carried out as described in option 1, only instead of icons we select the text buttons “Time”, “Date”, “Report Name”, etc. But the essence does not change. After specifying the required information in the required places on the form, the setting is saved.

When the printed form is printed, all specified data will be displayed in it.

Option 3: Edit the layout in custom mode

Why am I considering this method here, which has its own functionality and which, strictly speaking, does not relate to the topic under consideration.

Because it often happens that you have to use a combination of this method and print settings to achieve the desired result. Editing the layouts of printed forms allows us to draw some things we need right in the layout of this printed form.

Layouts can be changed in the Administration – Printed forms, reports, processing – Printed form layouts section.

Here is an example of editing the layout of an Order Invoice (document Invoice for payment to the buyer):

We select a layout, indicating at the entrance that we will edit it and add some text information at the end.

For example, like this:

Save the changes and create the printable form.

And we print with the changes.
But the possibilities for such editing are limited.)

So option 3 is convenient to use for entering constant, unchangeable information; everything else will require modification of the printed form by a programmer.

But often this is enough. 🙂