In Designer mode

First, let us create a parameterized command for the Materials report configuration object.

  1. Open the configuration object editor of the Materials report.
  2. On the Commands tab, click Add  and create a command named BalanceByWarehouse.
  3. In the property palette that is opened, set Command parameter type to CatalogRef.Warehouses.
  4. Set the Group property to Form command bar.Important (fig. 27.37).


    Fig. 27.37. Creating a parameterized command

    So you have created a command with a parameter of CatalogRef.Warehouses type. This command is automatically added to the list of available parameterized commands of each form that includes an attribute of that type.
  5. In the command module that is opened, fill the handler as shown in listing 27.6.

    Listing 27.6. Parameterized command event handler

    &AtClient
    Procedure CommandProcessing(CommandParameter, CommandExecuteParameters)
     
        FormParameters = New Structure("Filter,PurposeUseKey,GenerateOnOpen",
            New Structure("Warehouse", CommandParameter), "BalanceByWarehouse", True);
        OpenForm("Report.Materials.Form", FormParameters, CommandExecuteParameters.Source,
            True, CommandExecuteParameters.Window);
     
    EndProcedure
    Let us examine this script.

    The CommandProcessing() procedure receives a CommandParameter that contains a value of the CatalogRef.Warehouses type. Next the structure of form parameters (FormParameters) is created. It includes the following parameters: Filter, PurposeUseKey, and GenerateOnOpen.

    A structure that contains the Warehouse item with the value passed in the command parameter (CommandParameter) is assigned to the Filter parameter. The PurposeUseKey parameter, which defines the form purpose, is set to BalanceByWarehouse. The GenerateOnOpen parameter is set to True, which defines that the report is generated immediately after opening.

    Next the form parameter structure is passed to the global OpenForm() method and the form specified in the first parameter of the method is opened with the Warehouse parameter. Since the fourth method parameter Uniqueness is set to True, every time the form is opened it is a new report form and the report is generated based on the warehouse filter passed in the command parameter.

    Now let us add the command to the document form.

    As we mentioned earlier, the forms of the GoodsReceipt and Services documents include the BalanceByWarehouse command because they include the Warehouse attribute of the CatalogRef.Warehouses type.
  6. Open the Services document form.
  7. On the Commands tab, click the Global commands tab.

    Here you can see the list of global parameterized commands available in the form.
  8. In the Parametrizable group, expand the Object item and drag the Report.Materials.Command.BalanceByWarehouse(Object.Warehouse) command to the command bar of the form controls.

    The part enclosed in parentheses (Object.Warehouse) is the value of the Warehouse attribute passed to the command (fig. 27.38).


    Fig. 27.38. Adding a parameterized command to a form

    Note that you have not created a report form nor have you added a filter by the Warehouse form parameter to the report settings. It is done automatically when the BalanceByWarehouse event handler is executed.
Next page: In 1C:Enterprise mode
Be the first to know tips & tricks on business application development!

A confirmation e-mail has been sent to the e-mail address you provided .

Click the link in the e-mail to confirm and activate the subscription.