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

    &AtClient
    Procedure MaterialsAndServicesQuantityOnChange(Item)
        TabularSectionRow = Items.MaterialsAndServices.CurrentData;
        DocumentProcessing.CalculateTotal(TabularSectionRow);
    EndProcedure
    
    &AtClient
    Procedure MaterialsAndServicesPriceOnChange(Item)
        TabularSectionRow = Items.MaterialsAndServices.CurrentData;
        DocumentProcessing.CalculateTotal(TabularSectionRow);
    EndProcedure
    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).


    Fig. 4.26. Specifying subsystem command interface settings

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


    Fig. 4.27. The Services document in the configuration object tree

Comments
0
Add comment