Using Server Procedures for Layouts
Attributes Output from Data Set Fields
Attribute fields are located after the Attrs (attributes) or AttrsEx (additional attributes) field. Attributes of the Enumeration type are supposed to have 2 fields. For example, for the 1C Document Type attribute: Hdr_F6\DocType1C is the document type id, Hdr_F6\DocType1C_itext_ is the document type name.
An example of attributes and additional attributes for the delivery note header, the Hdr data set.
Retrieving Data via SH5 Server Procedures
If the data sets lack or have insufficient information about certain attributes, or properties, or other data, it can be displayed with the help of SH5 server procedures. The procedures can retrieve the entire data list or only the data based on the ID.
See the list of existing procedures, data set and field numbers, and other attribute identifiers in the Sdbman.exe app.
Retrieving Entire Data List
Example 1 — you need to retrieve a legal entity's name and OKPO while the data set contains only a department ID.
To do this, use the Departs and LEntities server procedures which retrieve full lists of departments and legal entities respectively, as there are not many of those — the lists are short. Search for the required line in the received lists and enter the data to the variables that will later be displayed in the layout.
Example 2 — you need to retrieve the OKEI code of the product measurement unit. For this, create and upload a once-off list of all measurement units (OnStartReport), then select the OKEI code (MasterData1OnBeforePrint) for each product line and close the procedure (OnStopReport).
Retrieving Data Based on ID
Example 1 — you need to retrieve a correspondent's name and OKPO, while the data set contains only the correspondent's ID. The correspondents list could be exceptionally long, so it is not a good idea to download it all. So, use the Corr server procedure which retrieves information only for a specific correspondent based on its ID. This speeds up the data receiving process. Then, record the data into the variables which will later be displayed on the layout.
Example 2 — you need to retrieve KPP and the license while the data set only has the KPP ID. Use the CntrSpec procedure which has two data sets (114 and 115).
Example 3 — Retrieving the selling price from the product card
You need to retrieve the selling price from a product card: Additional Parameters > Sales > Price without taxes or Price with taxes. You can see an example of such data output in the Sales Report with Planned Pricing (Without Tax) and Sales Report with Planned Pricing (Tax Included) in the Sales Act report.
There could be two options here: with enterprise exceptions included or not — depending on the required output.
If there is a need to include the exceptions — and exceptions could be set for some separate items — you need to first define the enterprise and then select the product price within this enterprise. You also should select the selling price without exceptions. For each product, you should then retrieve either one price, or the other. If the product has an exception price, you should retrieve it. If not, then retrieve just the selling price.
The method of finding the enterprise depends on what report or delivery note layout is used. It could happen that the enterprise ID is visible in the data set field, then the solution is simple: you simply need to enter it in the respective procedure. The suggested example deals with the most difficult case: enterprise exceptions need to be taken into account, depending on the filters selected by the user (specific departments, legal entities, or enterprises) and/or the selected grouping.
All codes of the suggested layouts contain comments. It is strongly recommended to read them.