Anyone who conducts their business officially knows such a routine operation as sending invoices and acts to counterparties. And with the increase in the number of partners in your business, the operation becomes more and more unpleasant.
To make routine work more pleasant, you need to automate it!In this article I will explain how I did the processing for 1C: Enterprise 8 for printing addresses for envelopes. In my work, I use the configuration of "1C: Simplified 8", so everything told will apply to it. For distribution of documents, C5 format envelopes with a window are used (the address is printed on a regular A4 sheet, which is inserted into an envelope).
')
For impatient at the end of the post there is a link to download the finished processing.
Create a print form
We start 1C-ku in the configurator mode and create a new
External processing :
In the processing window that opens, right-click on
Requisites and select
Add :
Enter the name
"LinkObject" and select the type
"DirectoryLink.Contractors" :
A link to the entry from the Counterparts directory will be stored here, from which information about the address will be extracted.
The next step is to create a printed layout. Right-click on
Layout and select
Add . We need the type Table document:
The layout depends on the type and format of the envelope on which you will print. For C5 with a window, it looks like this:
When finished with the layout, select the lines for printing and do this:
Enter the name "Address". In order to write values to the cells of the created layout, in the properties of the cell, in the
Layout section in the
Fill box, select
Parameter , and in the
Parameter write the name. I have the
name of the recipient , the
recipient of the recipient and
recipient index (see. Screenshot with the layout).
The layout is ready. We write the code that will fill it with data.
Writing the module code
To do this, on the processing form, we find the
Actions button (below) and select
Open object module( ) <br/> <br/> = ; <br/> . = " <br/> | <br/> | . <br/> | <br/> | . <br/> | <br/> | <br/> | . = & <br/> | . = & <br/> | . = & " ; <br/> <br/> . ( "" , ) ; <br/> . ( "" , . . ) ; <br/> . ( "" , . . ) ; <br/> <br/> = . ( ) . ( ) ; <br/> ? ( . ( ) = 0 , "" , [ 0 ] . ) <br/> <br/> // () <br/> <br/> ( ) <br/> <br/> = ; <br/> . = " <br/> | <br/> | . <br/> | <br/> | . <br/> | <br/> | <br/> | . = & <br/> | . = & " ; <br/> <br/> . ( "" , ) ; <br/> . ( "" , . . ) ; <br/> <br/> = . ( ) . ( ) ; <br/> ? ( . ( ) = 0 , "" , [ 0 ] . ) <br/> <br/> // () <br/> <br/> ( ) <br/> <br/> = ; <br/> . = " <br/> | <br/> | . <br/> | <br/> | . <br/> | <br/> | <br/> | . = & <br/> | <br/> | <br/> | . " ; <br/> <br/> . ( "" , ) ; <br/> = . ( ) . ( ) ; <br/> ? ( . ( ) = 0 , "" , [ 0 ] . ) <br/> <br/> // () <br/> <br/> ( ) <br/> = ; <br/> . = <br/> " <br/> | . , <br/> | . <br/> | <br/> | . <br/> | <br/> | . = & " ; <br/> . ( "" , ) ; <br/> <br/> = . ( ) . ( ) ; <br/> . ( ) ; <br/> <br/> = ; <br/> <br/> = ( "" ) ; <br/> = . ( "" ) ; <br/> <br/> . < > <br/> = ( . ) ; <br/> <br/> < > "" <br/> . . = + " (" + . + ")" ; <br/> <br/> . . = . ; <br/> ; <br/> <br/> = ( . ) ; <br/> = ? ( = "" , ( ) , ) ; <br/> <br/> . . = ( , 6 ) ; <br/> . . = ( , ( ) - 8 ) ; <br/> <br/> . . = . ; <br/> = ( ) ; <br/> <br/> . . = ( , 6 ) ; <br/> . . = ( , ( ) - 8 ) ; <br/> ; <br/> <br/> . ( ) ; <br/> ; <br/> <br/> // () <br/> <br/> ( ) <br/> = ( ) ; <br/> ; <br/> // <br/>
When the module is executed, the
Print () function is executed, which returns a print-ready form. Inside this function there is a single call to the
PrintDocument function
() , which is responsible for filling the layout with data.
What happens inside this function:
- According to the link to the item from the Counterparty directory, select the full name and contact person.
- We load our layout
- If the counterparty has a contact person, select its representation (full name). If it is not empty, something like Pupkin Vasiliy Kharitonovich (Horns and Hoofs LLC) will be written into the cell Name of the Beneficiary, otherwise simply Horns and Hoofs LLC
- In the Address of the Beneficiary we write down either the address of the contact person (if specified) or the actual address of the counterparty, after cutting out the index from there, which we write in the Beneficiary Index
At this work in the configurator is over. Remember to save our processing.
We connect the external printed form
Run 1C in normal mode. In the
Service menu, select
Additional reports and processing -
Additional external print forms .
In the
Source file, click on the
Open button and select our processed file.
In the
Affiliation section of the
printed form, click
Add and in the window that opens, select the
Counterparties on the
Directories tab.
Click OK.
Everything. Is done. You can take a breath. :)
Now, if you open the list of counterparties (
Enterprise -
Counterparties ) and go into any of them, a button for printing addresses will appear in the lower right part of the window. When you click on it, a window like this opens:
It can be printed through the menu
File -
Print.Finished processing can be downloaded here:
Address For Convert FI.zipSuccessful case management!