In Designer mode

Let us use a procedure similar to setting up register records for the Goods receipt document.

  1. Open the configuration object editor for the Services document.
  2. Click the Posting tab and select the BalanceOfMaterials checkbox.
  3. Click Register records wizard.
  4. In the wizard window, set Register Record Type to Expense.

    Indeed, the Services document is intended to record expenses of materials. Note that the icon to the left of the register name changed to the minus sign .
  5. In the Tabular Section list, select MaterialsAndServices.

    It is the only tabular section in the document. Its attributes are added to the list of document attributes.
  6. Click Fill Expressions.

    In the bottom pane, the mapping between the register fields (dimensions and resources) and the expressions for calculating their values is generated. But the Material field is not filled automatically.

    This is because the name of the tabular section field (MaterialOrService) does not match the name of the register dimension (Material). If you leave it as is, products will not be recorded to accumulation register rows with Expense register record type. Let us fix that.
  7. Select the Material register field and then, in the Document attributes list, double-click CurRowProductList.MaterialOrService.

    This ensures that the materials for the accumulation register records are selected from the document tabular section (fig. 6.18).


    Fig. 6.18. Selecting a document tabular section and filling the expressions for calculating register records
  8. Click OK.

    The wizard generates a procedure in the Services document module (listing 6.2).

    Listing 6.2. Posting() procedure

    Procedure Posting(Cancel, Mode)
        //{{__REGISTER_REGISTERRECORDS_WIZARD
        // This fragment was built by the wizard.
        // Warning! All manually made changes will be lost next time you use the wizard.
    
        // register BalanceOfMaterials Expense
        RegisterRecords.BalanceOfMaterials.Write = True;
        For Each CurRowMaterialsAndServices In MaterialsAndServices Do
            Record = RegisterRecords.BalanceOfMaterials.Add();
            Record.RecordType = AccumulationRecordType.Expense;
            Record.Period = Date;
            Record.Material = CurRowMaterialsAndServices.MaterialOrService;
            Record.Warehouse = Warehouse;
            Record.Quantity = CurRowMaterialsAndServices.Quantity;
        EndDo;
    
        //}}__REGISTER_REGISTERRECORDS_WIZARD
    EndProcedure

It is the Posting event handler for the Services document configuration object.

Note that the line Record.RecordType = AccumulationRecordType.Expense defines the type of the accumulation register record generated by this document as Expense. The rest of the procedure is similar to the posting handler of the GoodsReceipt document (see listing 6.1) that we have discussed in detail earlier.

Finally, let us edit the command interface of the document. You will add the command that opens the Balance of materials list with records generated by that document to the navigation panel.

  1. Open the Services document form.
  2. In the upper left pane, click the Command interface tab.
  3. In the Navigation panel branch, expand the Go to node and select the Visible checkbox for the command that opens the Balance of materials accumulation register.
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.