Recording expenses for materials only

In lesson 6, when you created the Services document records in the BalanceOfMaterials accumulation register, we mentioned that these records were not entirely correct because they included not only expended materials but also rendered services (listing 10.3).

Listing 10.3. The Posting() procedure of the Services document

Procedure Posting(Cancel, Mode)
    // 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;

Let us modify the document so that only material expense records are added to the register.

First, you have to change the posting procedure in Designer to add only material expense records to the register, and then you have to repost all the Services documents in 1C:Enterprise mode to have the register data modified in compliance with the new document posting algorithm.

This enhancement is not optimal in terms of performance but it ensures that the BalanceOfMaterials register stores the correct data.

Note. We will discuss a more efficient algorithm of posting this document in lesson 14, after we study how 1C:Enterprise processes queries.

Next page: In Designer 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.