1C:Enterprise 8.3. Practical Developer’s Guide. Lesson 4 (1:30). Documents. The Services document

The Services document

Now let us create the second document: Services. You will follow the same procedure that you used to create the Goods receipt document.

In Designer mode

Let us create the Services document.

  1. Create a Document configuration object and name it Services.

    On the Main tab let us define the document names used in 1C:Enterprise interface. Do not specify Object presentation, the platform will use the object synonym instead.
  2. In the List presentation field, type Services.
  3. On the Subsystems tab, specify that the document is available in the Services and Accounting subsystems.
  4. On the Data tab, add the following document attributes:
    • Warehouse. Type: CatalogRef.Warehouses, fill value: Main (the predefined item of the Warehouses catalog)
    • Customer. Type: CatalogRef.Customers, fill check: display error
    • Technician. Type: CatalogRef.Employees, fill check: display error
  5. Create a tabular section named MaterialsAndServices with the following attributes:
    • MaterialOrService. Type: CatalogRef.MaterialsAndServices
    • Quantity. Type: Number, length: 15, precision: 3, non-negative
    • Price. Type: Number, length: 15, precision: 2, non-negative
    • Total. Type: Number, length: 15, precision: 2, non-negative
  6. For the entire tabular section and for all its attributes, set the Fill check property to Display error.
  7. On the Forms tab, create the default document form.
  8. For the MaterialsAndServicesQuantity field, create the OnChange event handler that is executed on the client.

    Later you will add a call of the CalculateTotal procedure from the DocumentProcessing common module to the handler.

    Once you create a handler, the form module with a template for the MaterialsAndServicesQuantityOnChange event handler is opened. Do not fill the handler procedure body at that point.
  9. In the form editor window, click the Form tab and create the OnChange event handler for the MaterialsAndServicesPrice field in a similar manner.
  10. Replace the script in the Services document form module with the following (listing 4.5).

    Listing 4.5. Services document form module

    Procedure MaterialsAndServicesQuantityOnChange(Item)
        TabularSectionRow = Items.MaterialsAndServices.CurrentData;
    Procedure MaterialsAndServicesPriceOnChange(Item)
        TabularSectionRow = Items.MaterialsAndServices.CurrentData;
    Finally, let us edit the command interface to make the document creation commands available in the Services section.
  11. Open the editor of the Services subsystem configuration object and click the Command interface button.

    This opens the window that lists all commands of the selected subsystem.
  12. In the Actions panel.Create group, select the check box next to the Services: create command (fig. 4.26).

    Lesson 4 (1:30). Documents / The Services document / In Designer mode
    Fig. 4.26. Specifying subsystem command interface settings

    The Services document now looks as follows in the configuration object tree (fig. 4.27).

    Lesson 4 (1:30). Documents / The Services document / In Designer mode
    Fig. 4.27. The Services document in the configuration object tree

In 1C:Enterprise mode

Let us check the Services document.

  1. Start 1C:Enterprise in the debug mode.
  2. In the Services section, on the Create menu, click the Services command.
  3. Fill the document as follows (fig. 4.28).

    Lesson 4 (1:30). Documents / The Services document / In 1C:Enterprise mode
    Fig. 4.28. Creating a Services document #1

    Note that the Main warehouse is selected by default and the fill check is applied to the Customer and Technician fields. Also when you enter the price and quantity in the tabular section of the Services document, the total is recalculated according to the specified algorithm.

Leave a Reply

Your email address will not be published. Required fields are marked *

1C:Enterprise Developer's Community