1C:Enterprise 8.3. Practical Developer’s Guide. Lesson 25 (0:30). Functional options. Accounting by customers option

Accounting by customers option

Note that functional options can affect not only the applied solution command interface but also the appearance of applied solution forms. Besides, functionality can be enabled or disabled without restarting the client application. You can also work with functional options using 1C:Enterprise script. With all that, the functional options feature makes deployment and customization simple and straightforward even for beginner users.

Now let us look into another example.

Some companies do not need to record customer names. Often only the fact that a service is rendered matters while the personality of a customer does not.

So let us implement the option to disable maintenance of a customer list to prevent users from having to specify the customer every time a service is rendered.

Let us also update existing functional options by including the Accounting and Payroll subsystems in these options. This is needed for the solution to look complete: if accounting is not needed, it should not be present anywhere.

In Designer mode

First, let us add subsystems to the functional options.

  1. Open Accounting functional option content and add the Accounting subsystem.
  2. Open Payroll functional option content and add the Payroll subsystem (fig. 25.11).

    Lesson 25 (0:30). Functional options / Accounting by customers option / In Designer mode
    Fig. 25. 11. Payroll functional option content

    Now let us proceed to creating a new functional option. You need a constant to store the option value.
  3. Add a constant named AccountingByCustomers of Boolean type (fig. 25.12).

    Lesson 25 (0:30). Functional options / Accounting by customers option / In Designer mode
    Fig. 25.12. AccountingByCustomers constant
  4. Add a functional option named AccountingByCustomers and specify that its value is stored in the AccountingByCustomers constant (fig. 25.13).

    Lesson 25 (0:30). Functional options / Accounting by customers option / In Designer mode
    Fig. 25.13. AccountingByCustomers functional option
  5. On the Content tab, specify the objects to be included in the functional option (fig. 25.14):
    • Customers catalog
    • Customer attribute of the Services document
    • Customer dimension of the Sales accumulation register 
    Lesson 25 (0:30). Functional options / Accounting by customers option / In Designer mode
    Fig. 25.14. AccountingByCustomers functional option content

    Let us update the GeneralSettings common form that is used to specify functional option values.
  6. In the GeneralSettings form editor, drag the AccountingByCustomers constant to the form controls (fig. 25.15).

    Lesson 25 (0:30). Functional options / Accounting by customers option / In Designer mode
    Fig. 25.15. GeneralSettings form

    Next you have to ensure that the applied solution interface is refreshed when new functional option values are applied.
  7. In the form controls tree, double-click the root Form item.
  8. In the property palette, find the After write at client event and click the Open Lesson 25 (0:30). Functional options / Accounting by customers option / In Designer mode button in that field.
  9. Specify that the handler is only executed on the client.
  10. In the form module that is opened, add a single line to the handler body, as shown in listing 25.1.

    Listing 25.1. AfterWrite form event handler

    &AtClient
    Procedure AfterWrite(WriteParameters)
    RefreshInterface();
    EndProcedure
    RefreshInterface() is a global context method that refreshes the command interface, the start page, and opened forms according to the current functional option values and their parameters.

    To simplify testing the functional options, let us modify the common form so that it does not block the main applied solution window.

    Currently, when you open the GeneralSettings form in 1C:Enterprise mode, you cannot change anything in the main applied solution window because it is blocked while the General Settings form is open. This happens because the form wizard selected the default Lock parent window value for the Window open mode property.
  11. Click the Form tab and then, in the form controls tree, double-click the root Form item.
  12. In the property palette, set Window open mode to Independent (fig. 25.16).

    Lesson 25 (0:30). Functional options / Accounting by customers option / In Designer mode
    Fig. 25.16. Window open mode property

In 1C:Enterprise mode

Let us test the changes.

  1. Start 1C:Enterprise in the debug mode.
  2. In the Quick menu section, click General settings.

    You can see that the Accounting by customers option is disabled (fig. 25.17).

    Lesson 25 (0:30). Functional options / Accounting by customers option / In 1C:Enterprise mode
    Fig. 25.17. Accounting by customers functional option is disabled

    Let us check how this affects the Services document.
  3. In the Services section, click Services and open any of the documents, for example, Services #2 (fig. 25.18).

    Lesson 25 (0:30). Functional options / Accounting by customers option / In 1C:Enterprise mode
    Fig. 25.18. Services document

    The document does not have the Customer field, and if you switch to the list of Sales register records using the navigation panel command, you can see that it no longer has the Customer column. Also, the Customers command is absent from the Enterprise section.
  4. Return to the General settings form, select the Accounting by customer check box, and click Save.

    This introduces some changes to the applied solution interface. Return to the Services #2 document (fig. 25.19).

    Lesson 25 (0:30). Functional options / Accounting by customers option / In 1C:Enterprise mode
    Fig. 25.19. Services document

    The document has the Customer field, the list of register records has the Customer column, and the Customers command is again available in the Enterprise section.
  5. In the General settings form, enable all functional options and click Save (fig. 25.20).

    Lesson 25 (0:30). Functional options / Accounting by customers option / In 1C:Enterprise mode
    Fig. 25.20. General settings

    This enables all of the applied solution features. Note that the applied solution interface is refreshed immediately once you save the settings.

    This completes the configuration development.

    The next two lessons are devoted to standard 1C:Enterprise development techniques. For some examples we will provide multiple implementation options, so it is up to you to decide which one to choose.

Leave a Reply

Your email address will not be published.

 

1C:Enterprise Developer's Community