Creation of printed forms 1c 8.2. Publications. Creation of an external printing plate based on a standard one with minor changes

Implemented in accordance with the standard printable layout built into the application by the developers (called the "supplied" layout).

If necessary, you can change the standard layout and subsequently print the document based on your personal ("custom") layout. To edit the layout of the printed form, a mechanism is provided for uploading to a local computer. The layout is edited in the local version of the 1C: Enterprise application (in particular, you can use the free 1C: Enterprise - Working with Files) application.


To change the layout of the printable, do the following.




Editing of the layout of the printing form is completed, when the document is printed, the layout to which the changes were made will be used.

If you want to return to the previous layout of the printable, click the button Use standard layout... At the same time, the edited layout will still be present on the server, and it can be turned on again by pressing the button Edit.

We wish you pleasant work!

How to insert a company logo into a printed form layout?

Let's give a concrete example of editing a printable layout Invoices for payment, namely, we will consider how to insert an image into it, for example, a company logo (this image must first be prepared and saved as a graphic file, for example, in png or jpg format).


Thus, now the invoices for payment that you prepare for transfer to your counterparties will have your company logo. In order to add a logo to other documents, it will be necessary to repeat the described steps for the corresponding printed forms of these documents.

We wish you pleasant work!

I can only add that for the latest versions of BSP and, accordingly, configurations on managed forms, there has been a tendency to move procedures and printing functions from the manager module into common modules. Therefore, most often, the VPF created by the designer will have to be finished by transferring these same procedures and functions from the general modules to the VPF module.

Instructions for a managed application

Let's create a VPF, for example, for a document Buyer invoice, printed form Invoice-order(I am doing an example on the platform 8.3.8.1784 BP 3.0.43.247 DEMO base).

Creation of the VPF

I proceed from the fact that the one who creates the VPF is able to use the configurator, therefore we will not draw pictures from there. The result will be an external form that is no different from the typical printed form of the document.

So, point by point:

  1. Copy manager module document Buyer invoice,by opening it in the Configurator. Copied wholemodule , for example by clicking Ctrl +A, later Ctrl + C.
  2. Open the constructor in accounting mode, select Document type Invoice For Payment To Buyer and press the button Paste:
  1. We press the next button Analysis.We get on the bookmark Commands and functionsthe list of available print commands, the list of procedures and functions of the manager module, and the text of the selected procedures in the right window. In the upper left window, remove all the checkboxes (control buttons at the top) and mark the printing form we need Invoice Order.In the lower left window, the procedures necessary for printing the selected form will be marked in green automatically. If necessary, you can mark other procedures and functions using the button needed / not needed, they will be transferred to the final processing, but they will not be used automatically by the VPF, so think, do you need it? In the right window, you can view the text of the procedures and functions selected in the lower left window. The text can be changed, though I have never used this opportunity, but you never know who will need it ?:

  1. Next button To shape... Creates the text of the HPF processing module:

  1. We press Compile - nothing will change on the screen, just a VPF will be created.
  2. Button Save will offer to choose the path where to save the created processing and open the created VPF for checking. The VPF is created with a built-in processing form, so it can be debugged without resorting to additional tools. When opening a VPF, we immediately check the operability by selecting a document and forming a printed form:

As already mentioned, now it is no different from the typical one, and if you need to change something, you will have to do it by hand, which I will discuss below. I would like to note that the specified order of the formation of the HMF is minimal, try the rest yourself ... or do not try. It actually just lists the steps to quickly create a VPF for further refinement.

What surprised me, both the standard and the external, instead of the amount in words, give out the amount in the demo as a number:

Changing the resulting VPF

To fix the situation, and add something of our own to the VPF, let's start making changes:

  1. Insert the account layout into the VPF (by default the same is used as in the standard account form). To do this, let's see what layout is used. In the object module of the VPF:
If Print Control.You need to Print a Layout (Collection of Print Forms, "InvoiceOrder") ThenInvoiceInvoiceInvoiceTable \u003d GetInvoiceInvoiceInvoiceTable (ArrayObjects); Print Management.OutputTableDocumentInCollection (CollectionPrintForms, "InvoiceOrder", "Invoice for Payment", Printing of Trade Documents.Printing Invoices for Payment (Invoice for Payment, Print Objects), "General Layout.PF_MXL_Invoice"; Output Parameters.Insert ("Generate ED", True); EndIf;

From the Print procedure, we see that we need a general layout PF_MXL_AccountOrder. We copy it in the configurator. Branch General - General layouts:

Then in processing we get up on Layouts and insert, now the layout is in the VPF, you need to change the module code to use it, and not the general layout:

  1. We analyze the text of the printing procedure and add the procedures and functions of the general modules used in the formation of the printing form:
#Area AddedProcedures AND Functions // between these lines paste the procedures copied from common modules #EndArea
  • We save what happened (or click on the syntax control). We receive an error message:

(ExternalProcessing.InvoicePaymentBuyer_ExternalPrinted.ObjectModule (371,3)): Procedure or function with the specified name is not defined (PrintHeaderWarning)

<\u003e DisplayWarningHeader (Document Information.Recipient, TabularDocument, Layout); (Check: Server).

Since the procedure is not defined without specifying through a dot, we deduce that it is in the same general module as the function we copied before. PrintInvoicePayment - we find it there, and copy it to the VPF module. And again we try to save. In this case, we are lucky - there are no more errors. In general, this is a rarity, by and large, this is the most time consuming moment. It happens that you may need to copy several procedures and functions, and maybe not even from one module. The main thing is not just to copy, but also to call them correctly later. I have no universal recipe for this.

  • Remove the line “ Printing Trade Documents."- now this function will be called from the VPF module.
  • We save the VPF, check it in the accounting mode - everything works, only now, everything that is needed for changes is in the VPF. Now you can make the necessary changes.
  1. Changing the text of the VPF module:
  • Calling the built-in layout instead of the general layout - find the line "General Layout.PF_MXL_InvoiceOrder",we see that it is in the added function from the common module, and without changing the common module Printing of Trade Documents (keeping the typical configuration on full support) change the function of the VPF module:
// Layout \u003d Print Management. Print Form Layout ("General Layout.PF_MXL_InvoiceOrder"); // Was Layout \u003d Get Layout ("PF_MXL_InvoiceOrder"); // Became

Attention: After each change, it is better to save the HMF and check the performance, if you change everything in a row, then it may turn out that it will be easier to start from the beginning than to fix what was changed. Another tip, when everything works, and you are going to finish something, create a new version of the VPF, and change it - the working version will remain, and the current one, with an attempt to finish it)))

  • Let's correct the amount in words - now for some reason it is displayed as a number, there are many options, you can, for example, use a format string in a layout cell Suma in cuirsive,but this is ugly, so let's try to find the place in the module text where this parameter is filled in and fix it. We see the line:
PrintDataSumWord.SumWord \u003d GeneralPurposeBPCallServer.GenerateSumInWords (AmountKRecord, Document Information.Currency);

With the debugger we look where the dog rummaged. It looks like everything is filipers, but we see a number instead of a string. We see that when calling the function of the common module GeneralPurposeBPCallServer.GenerateSumWordin parameter Document Information Currencyempty. There are many options for fixing - you can pull out the procedure GenerateSumWordinto the VPF module, you can see the filling of the line Document Information and fill in the currency there, you can check the filling of the currency, and if it is empty use the default currency from the constant. I'm too lazy, so let's take the currency from the contract:

PrintDataSumWord.SumWord \u003d GeneralPurposeBPServerCall.GenerateSumWord (AmountToRecord, InformationAbout the Document.Contractor Agreement.CurrencyMutual Settlements); // InformationAbout the Document.Currency);

We save, check:

  • Now let's add a new parameter to the layout, for example, Comment and display it after the final line (a conditional example, just as an example)))):

This article will tell you in detail how a beginner who does not know much about 1C 8 create a printing plate. For example, let's take one of the most common 1C 8 configurations - Accounting 2.0... Creating a printable 1C stages of writing:

  • Creation of a file of an external printing plate;
  • Creation of a printable layout;
  • Writing program code for displaying printable data on the screen;
  • Creation of parameters for automatic registration of a printable;
  • Connecting an external printing plate to the base 1C Enterprise.

Creation of a printing form 1C. Formulation of the problem

We are required in the configuration Accounting 2.0 create a printable for the document Receipt of goods and services... Print the following data in the header of the printable:

  • Organization;
  • Counterparty;
  • Counterparty agreement;
  • Date of admission.

Display tabular section data in the form of a table Productsdocument. The table should include the following columns:

  • Nomenclature;
  • Amount;
  • Price;
  • Amount;
  • And also the price of the item for the current date (according to the type of prices from the document).

External processing file

Let's move on to solving the problem. First, let's open 1C 8 in the mode Configurator... It is in this mode that all developments on the 1C 8 platform are carried out. Now we need to create an external processing file. To do this, click on the menu File -\u003e New ... or by the new file icon.

In the window that opens, select the item External processing.

Further in the field Name it is necessary to enter the name of the external treatment. In our case, let's call it simply: "Printable Form", the synonym field will be filled in automatically. Note that in the field Name,external processing, you should write the name without spaces and punctuation marks.

Add a props for external processing LinkOnObject and select for him type DocumentLink.Arrival of GoodsServices... To do this, in the metadata tree of external 1C processing, select the item Requisites and press the button Add to (green plus button). On the right side of the screen, the property window will open, in the field Name write - ReferenceObject. IN field A type press the button with three dots.

Open the branch in the type tree DocumentLink, and find there the item Receipt of goods and services, put a tick in front of it and click OK.

Let's save the external processing file to the hard disk, for this we use the menu File -\u003e Save, pictogram Save (blue diskette), or a keyboard shortcut Ctrl + S... Let's name the saved file "Printing Form".

Creation of a printable layout

Let's start creating a layout of the 1C printing form. The layout serves as a template for the output of the printable, so if you want your printable to look good, you should pay attention to it.

In the external processing metadata tree, add a new layout; in the layout designer window, we will not change anything, and click the button Done.

In the new layout that opens, create several areas necessary for the output of the printable. All the areas of the layout we need will be horizontal, so to create a new area, select the required number of layout lines and go to the menu Table -\u003e Names -\u003e Assign Name or use the keyboard shortcut Ctrl + Shift + N, then enter the name of the area in the box. When creating a layout area, do not be afraid to make a mistake with the number of lines, you can always add or remove them. To delete a line in the 1C layout, select the required line and select the item in the context menu Delete... To add a new line to the layout, select any line in the layout and select the item Push apart.

Adding a layout header

First of all, let's create an area Cap, the data for the header of the printable will be displayed there. For this area, we need seven lines of the layout. Select them and, as I wrote above, press the keyboard shortcut Ctrl + Shift + N, in field Name write "Hat" and press the button OK.

Let's fill the layout area with the data we need. Usually no printable is complete without a header, so let's create one in our header as well. Since in the title, in addition to the name of the printable, we will also display the number of the document from which it was printed, we will set the title text in the layout with a parameter. The layout parameter is a specially designated cell of the layout, into which various data can be displayed using the built-in 1C 8 language. The heading should be displayed on the entire width of the printing form, so let's determine how many layout cells will be enough for us to print on the standard landscape orientation of the sheet.

Usually thirteen or fourteen layout cells are enough, select them in the first line of the area Cap and combine into one cell ( Context Menu -\u003e Merge). After that, double-click on the resulting large cell and write the name of the parameter, in our case "TitleText". In order for the entered text to become a full-fledged parameter, right-click on the cell and select the item in the context menu Properties... On a bookmark Layout find the field Filling and choose the value Parameter... Parameters in the 1C layout are indicated by brackets "<>».

The title of the printable should stand out among other text, so once again select the cell and, using the icons on the layout formatting panel, set the text alignment Center and font size 14.

After the title text, we display it in the area Capdata on the organization, counterparty, contract of the counterparty and the date of receipt of the goods. Since all this data is also taken from the document, we will also arrange them with parameters. In addition, an explanatory text should be written before each parameter so that the user can easily understand where the organization is, and where is the counterparty, etc. All these actions are similar to creating a title, so I will not dwell on them in detail, I will give only a picture with what should be the result.

The figure shows how the layout parameters differ from normal text.

Adding a layout table header

The last thing we need to create in this area of \u200b\u200bthe layout is the table header, into which the data of the tabular section will be displayed Products... The columns required for the table were described in the "Problem Statement" section. We will also create the table header using the concatenation of cells and writing text (column names). Select the borders of the table header using the tool Framewhich is located in the layout formatting pane.

Adding a table to the layout

Let's create another area in the layout - Data... It will display the data table of the tabular section Products.For this area, we only need one line of layout. To display all the rows of the tabular section in a printable form, we will fill in and display this area as many times as needed. Columns in the area Data must match the columns of the table header, so filling it out is easy. The only difference is in the area Data we need parameters, not just text. Also note that, by default, numeric parameters are right-aligned and text parameters are left-aligned. To select columns, you also need to use the tool Frame.

Adding a footer to the layout

The last layout area we need is Basement... It will display the totals by quantity and amount. Creation is similar to area creation Data, but in addition, the totals should be highlighted in bold.

As a result, you should get the following layout:

Creation of a printing form 1C. Programming

Let's start programming - this is the most important stage in creating a printing plate. First of all, let's go to the module of the object of the external printing form, this is where we will program. To do this, in the main window of external processing, click Actions -\u003e Open Object Module.

In the module of the object of the external printing form, you need to create an export function Print ().

Function Print () Export End Functions

Please note that this feature is required for external printables in configurations using a regular application. We will write all the subsequent program code necessary for printing a printable inside this function.

Initializing Basic Variables

Let's create a variable TabDoc, which will contain the spreadsheet document - it is he who is the printable in which we will display the filled areas of the layout.

TabDoc \u003d new TabularDocument;

Into a variable Layout we get the layout of the printing plate we created. For this we use the built-in function Get Layout (<ИмяМакета>).

Layout \u003d Get Layout ("Layout");

We will get all the areas of the layout into variables. For this we use the layout method GetArea (<ИмяОбласти>) .

Header Area \u003d Layout.GetArea ("Header"); DataScope \u003d Layout.GetScope ("Data"); AreaFooter \u003d Layout.GetArea ("Footer");

Output of the printable header into a spreadsheet document

All required variables are initialized. Let's start filling and displaying the layout areas in a spreadsheet document. First of all, let's fill in the header of the printable, for this we need to pass in the parameter TextHeader, which we created in the layout, the text we need. To fill in the parameter values, the layout area has a special collection, which is called so - Parameters.From which through "." you can get any parameter. In the title text we will transfer the text: "Printable", as well as the document number.

AreaHapki.Parameters.TextHeader \u003d "Printable" + ReferenceObject.Number;

We fill in the rest of the header parameters in a similar way, we get all the values \u200b\u200bnecessary for them from the props ReferenceObject, which contains a link to the document being printed.

AreaHaps.Parameters.Organization \u003d ReferenceObject.Organization; AreaHaps.Parameters.Contractor \u003d ReferenceObject.Contractor; AreaHaps.Parameters.ArrivalDate \u003d ReferenceObject.Date; AreaHaps.Parameters.Contractor Agreement \u003d ReferenceObject.Contractor Agreement;

All header parameters are filled in, we will display it in the spreadsheet document we created, for this we use the method Output (<Область>) .

TabDok.Display (AreaHap);

Writing a request for a printable handicap

Let's fill in and output the area Data... Creating a 1C printable also means writing a request, we need it to get the data of the tabular section Products and prices Nomenclatures for the current date we will use Request... The 1C 8 query language is similar to SQL, or rather practically copies the capabilities of its SELECT operator, but the entire query is written in Russian. Therefore, if you are even remotely familiar with SQL, then you will easily understand the 1C 8 query language.

In this printed form, the request will be quite simple and many will say that it would be possible to do without it, but knowledge of the query language and the ability to use it correctly is one of the main skills of a 1C programmer. Queries allow using less resources to get the most complex data samples, and the query text is much easier to understand than in the program code written without using a query (or with minimal use of it). In addition, 1C 8 has a very good query designer that allows you to interactively collect a query from the required tables.

Let's create a variable that will contain the request.

Request \u003d New Request;

We will compose the request text using the query constructor. First, let's write:

Request.Text \u003d "";

Put the mouse cursor between the quotes, press the right mouse button. In the context menu that opens, select the item Query constructor, it will help us a lot in creating a 1C printing form. After that, the query designer window will open, it contains many tabs, but for our query only four are needed: "Tables and Fields", "Relationships", "Conditions", "Joins / Aliases".

For our query, we need two tables: the tabular section Products document Receipt of goods and services and a slice of the latest information register for the current date Item prices.

On the left side of the designer window, find the column Database... It contains a tree of all metadata objects, we will find the ones we need. To do this, open the branch Documents and find the document Arrival of goods and services, open it and find the tabular section Productsby dragging it to the query designer column Tables... You can drag in three ways: by dragging and dropping itself, by double-clicking on the table, or by selecting it and pressing the "\u003e" button. Let's open the branch Information Registers and find the table there PricesNomenclature.SliceLast, also drag it to the column Tables... These two tables are enough for our query.

Let's select the fields we need from the resulting tables. To do this, in the column Tables open the table and find the fields: Nomenclature, Amount, Price, Quantity and drag them to the third column of the constructor - Fields... Let's open the table , find the field Price and also drag it to Fields.

The structure of the tables and fields of our query is ready, now let's deal with the conditions. We need the data of the tabular section Products were taken not from all receipts, but only from the one that we print. To do this, we impose a condition on the table Arrival of goods... Let's go to the "Conditions" tab of the query designer. In a collumn Fieldsthe tables we selected earlier are located, for the condition we need a field Link from the table Receipt of goods, services, goods, drag it to the Conditions window.

In 1C requests, you can use parameters, they are needed in order to transfer data to the request. For example, if we want to restrict the selection of documents to a specific document, we can use a parameter to pass a link to this document to the request and use this parameter in the condition. This is exactly what we will do in our request.

After out the window Terms we added a field Link, the query builder will itself create a parameter with the same name and place it after the "\u003d" sign. This parameter can be renamed if desired. In the query text, parameters are marked with "&", but in this case you don't need to do this, since it is assumed that the second part of the condition contains a parameter, you just need to remember it. How to transfer a value to a 1C request parameter will be described below.

Since in the request we do not use a complete table of item prices, but a virtual one (a cut of the latter in this case), we need to set the conditions for the formation of this virtual table, in our case this is the cut date and the condition for the price type (prices must be selected that have a strictly defined price type - the one that is specified in the receipt document that we print).

To fill in the parameters of the virtual table, go to the tab Tables and fields query constructor, in the column Tables select the table PricesNomenclatureSliceLast and press the button Virtual table parameterslocated at the top. In the window that opens, in the field Period you should set the parameter to which the date will be transmitted, for which the prices will be cut. In our case, this will be the current date (that is, today), therefore we will name the parameter "& CurrentDate". In the condition field, we will write conditions for the price type, we will also pass it in the parameter, which we will call "& Price Type". The resulting condition will look like this (where Price Type - register measurement Item prices):

PriceType \u003d & PriceType

The virtual table parameters are filled, press the button OK.

Now that we have limited the selection to only the document we need, we will create links between the query tables. If you do not do this, then the prices from the ItemNomenclatureSlicePrices table will not be linked to the item from the receipt. Let's go to the tab Connectionsquery constructor. Create a link across the field Nomenclature between our two tables. To do this, press the button Add to, in field Table 1select the table Arrival of goods, and in the Table 2 field - PricesNomenclatureSliceLast. In the communication conditions, select the fields Nomenclature from both tables.

It should also be noted that in the query selection, we need to get all the rows from the tab part Products and prices only if available for the current date by type of document prices. Thus, these tabs Products are required, but the price cut data is not. Therefore, in the links between these tables it is necessary to use the so-called LEFT JOIN, and the left (or required) table will be Arrival of goods, and the right (or optional) PriceNomenclatureSliceLast. In order for the left join of the query tables to work as I described above, you must check the box All after the field Table 1.


The query is almost ready, there is only a little work left on the field aliases. Let's go to the bookmark Unions / Aliases and set an alias for the field PricesNomenclatureSliceLast.Price... The alias name will be - PriceToday, it is needed so that the names of the query selection fields and the names of the parameters in the layout of the printable are the same.

This completes the work in the query designer, press the OK button. After the designer window closes, you will see that the line with the request text is filled and looks like this:

Zapros.Tekst \u003d "SELECT | PostuplenieTovarovUslugTovary.Nomenklatura, | PostuplenieTovarovUslugTovary.Summa, | PostuplenieTovarovUslugTovary.Tsena, | PostuplenieTovarovUslugTovary.Kolichestvo, | TsenyNomenklaturySrezPoslednih.Tsena AS TsenaNaSegodnya | FROM | Dokument.PostuplenieTovarovUslug.Tovary AS PostuplenieTovarovUslugTovary | left join RegistrSvedeniy.TsenyNomenklatury.SrezPoslednih (| & CurrentDate, PriceType \u003d & PriceType) AS PricesNomenclatureSliceLast | ON Incoming GoodsServicesProducts.Nomenclature | \u003d PricesNomenclaturesSliceLatest.Nomenclature | WHERE | Incoming GoodsServicesGoods.Link \u003d & Link ";

Executing a request

Let's pass the necessary parameters to the request, for this we use the request method SetParameter (<ИмяПараметра>,<Значение>). To get the current date, use the built-in function The current date(), it returns the date and time of the computer.

Let's execute a request to get a selection with the data we need. To do this, we first use the request method Execute ()and then by the method Choose().

Selection \u003d Query.Run (). Select ();

Filling out the printable table

As a result, in the variable Sample will contain a selection of query results, you can navigate through it using the method Following(), and to bypass the entire loop you need Until... The construction will be as follows:

While Fetch.Next () Loop End of Loop;

It is in this loop that we will fill and display the layout area Data... But first, let's initialize two variables of the numeric type. In them we will collect totals for the quantity and amount that we need to bring to the area Basement.

TotalSum \u003d 0; TotalQuantity \u003d 0;

Inside the loop, we will fill the area Data data from the current selection element, into variables Total Amountand Total Quantity add the values \u200b\u200bof the amount and quantity, and finally, display the area in the spreadsheet document using the method already familiar to us Output ()... Since the field names of our query completely coincide with the names of the scope parameters Data, then for filling we will use the built-in procedure FillPropertyValues \u200b\u200b(<Приемник>, <Источник>), which copies the property values<Источника> in properties<Приемника>.

While Fetch.Next () Loop FillPropertyValues \u200b\u200b(ScopeData.Parameters, Fetch); TotalSum \u003d TotalSum + Sample.Sum; TotalQuantity \u003d TotalQuantity + Sample.Quantity; TabDok.Display (ScopeData); End of Cycle;

Outputting the footer of a printed form to a spreadsheet document

It remains to fill and display the last area of \u200b\u200bthe layout - Basement... We have already prepared the data for filling, filling in and withdrawal is carried out according to the same scheme.

AreaBoard.Parameters.TotalQuantity \u003d TotalQuantity; AreaBoard.Parameters.TotalSum \u003d TotalSum; TabDok.Display (Area Basement);

The spreadsheet document is completely filled, it remains to display it on the screen so that the user can view the printed form and, if necessary, print. But in typical 1C 8 configurations, the procedures of special modules are responsible for the output of external printing forms. Therefore, it is enough to return from the function Print () completed spreadsheet document.

Return of TabDoc;

At this stage, the programming is over and the creation of the printing plate 1c is almost complete. Full function text Print () I will not give it here, you can see it in the printable file, which can be downloaded at the bottom of the article.

Creation of a printing form 1C. Auto registration parameters

When connecting an external printing form to the base, the system does not automatically determine which document or reference book the printing form is intended for; it must be selected manually. And if another person wrote the printed form, and you were only instructed to connect it, then the choice may become ambiguous. In order to avoid such problems, it is necessary to create a layout with auto-registration parameters in all external printable forms. If it is created and correctly formatted, the system automatically determines which document or reference book the printed form is intended for.

It is done as follows:

  • In external processing, we create a new layout. We call it "Auto-Registration_Parameters" (it's important not to be mistaken!).
  • In the first cell of the layout, write Documents. (or Reference books.) and the name of the document to which you want to connect the printable.

Connection to the base of an external printing plate

  • Run 1C 8 in mode Company;
  • Go to the menu Service -\u003e Additional reports and processing -\u003e Additional external printable forms;
  • Click the button Add to;
  • In the window that opens, click the icon Replace external processing file;
  • If you have created auto-registration parameters, then we agree to use them;
  • If you have not created auto-registration parameters, then in the tabular section Affiliation of the printing plate add the required document or directory;
  • Push the button OK.

After that, the external printable will be available in the menu Printing document Receipt of goods and services.The creation of the 1C printing form can be considered completed on this.

2016-12-01T12: 56: 42 + 00: 00

In 1C: Accounting 8.3 (revision 3.0) a wonderful opportunity has appeared. Now the user in 1C: Enterprise mode can easily edit the layouts of printed forms.

When can this be useful? Well, for example, there is some printed form, say, "Requirement-waybill" in which you make some changes after printing it. Change the font, print the margins, remove unnecessary things.

So why do this every time ?! If we can once make these changes to the layout of the printing form and the program will always display the printing form as we need it.

Below in steps I will show how to change the layout of the "Requirement-Invoice" printable. We will add a new field there: "Responsible".

1. Generate a printable (using the "Print" button) and click in the form that opens (on the right) "More" -\u003e "Change layout":

2. The layout of the printing plate will open. Make the necessary changes to it, but be careful not to work out like this. I will say right away that the fonts and sizes of the fields can be changed absolutely exactly, but you can delete the existing fields (especially those in<угловых скобках>) is not worth it. If you want to hide a field in<угловых скобках>, just make it invisible (by color or size), but it should remain on the form, as it is required by the 1C program code.

3. We will add the "Responsible" field and click the "Save and Close" button.

4. The printed form was re-formed in a new form as we wanted.

If after changing the printed form it stopped working, then you.

Respectfully, Vladimir Milkin (teacher and developer).

So! There is a configuration (for example "Trade Management", edition 10.3), and for it you need to develop an external printable. For example, let's take a typical document "Invoice for payment to a customer" (although external printable forms can be created not only for documents, but also for reference books).

Example for 1C 8.3 (Managed forms)

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

A task

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

Go!

The first thing to do is create an external processing file. Processing should contain three main points:
  1. Attribute "ReferenceObject" with the type "DocumentLink.InvoicePayment to the Buyer"
  2. Layout to be printed
  3. Export Function "Print ()" which returns a spreadsheet document
These actions can be seen in figure # 1

"Drawing the layout"

Our layout will contain two areas:
  1. The title (head) of the document (the names of the organization and the counterparty will be placed in this area), and the head of the table (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 plate. Note that the table cells and header cells contain parameters, not just text.

Function "Print ()"

Now the form is almost ready. It remains to write programmatically filling in the fields of the spreadsheet document. These actions are performed in the module of the processing object, in a function called "Print", which MUST be exported.
Stage 1. Obtaining data for the header, filling in the header parameters, and displaying it in a spreadsheet document TabularDocument \u003d New TabularDocument; Layout \u003d Get Layout ("Our Layout"); Data Request \u003d New Request ("CHOOSE | SUBMISSION (InvoicePayable to Buyer.Contractor) AS A Counterparty, | PRESENTATION (InvoicePointingBuyer.Organization) AS Organization | FROM | Document.InvoiceToPayment to Buyer AS Invoice | InvoicePayment | Data Query.SetParameter ("Link", LinkOnObject); Header \u003d Data Query.Run (). Select (); Hat.Next (); Area \u003d Layout.GetArea ("Header"); Region.Parameters.Fill (Heading); TabularDocument.Display (Region); Stage 2. Receiving tabular data and line-by-line output of goods
Data Query.Text \u003d "SELECT | _Products.LineNumber, | PRESENTATION (_Products.Nomenclature) AS Nomenclature, | _Products.Quantity, | _Goods.Price, | _Goods.Amount. | FROM | Document.InvoiceGoods_Goods | To the Buyer | Link \u003d & Link "; Fetch \u003d Data Query.Run (). Select (); Region \u003d Layout.GetScope ("Data"); While Selection.Next () Loop Area.Parameters.Fill (Selection); TabularDocument.Display (Region); End of Cycle; Stage 3. Return of spreadsheet document and print function Return TabularDocument;

Add our external printing plate to 1C

We 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. Load the external processing file
  2. We indicate for which document (or reference book) of the configuration, the printable is intended
  3. Recording changes

Let's print!

We open any document "Invoice for payment to the buyer" (with the filled tabular section "Products", because it is from there that we take the data to fill out), click the "Print" button, in the window that opens, select OUR printable form, and click "Print"


ATTENTION!This development algorithm is suitable ONLY for "Normal Application". Print forms for configurations in Application Guided mode are different!

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

 

It might be helpful to read: