Freigeben über


Step 6: Implement confirmation/posting of your document

Posting of your document usually consist of creating accounting entries in ledger and updating your document to posted state. Source Document Framework will help you create accounting.

a) Add code necessary to perform state update of your document during posting (for instance, you can add a field IsPosted to your document header and set it to Yes when the document is posted successfully) . This functionality will usually reside on a posting class specific to your document.

b) Wire your posting class to a “Post” button on your form through a menu item.

c) Make sure the source document implements parmCurrentVoucher() - this is used when generating accounting during document confirmation/posting.

d) Inside your confirmation/posting code, submit your document to the Source Document Framework calling:

SourceDocumentProcessorFacade::submitSourceDocumentImplementation(myDocumentHeader, true, SourceDocumentAccountingStatus::Completed);

 The code above will generate accounting.

 e) To validate the accounting, on your document form action pane you can add a “Voucher” button to view the voucher for your posted document.

  • The button should use LedgerTransVoucher display menu item.
  • The LedgerTransVoucher form needs to be modified to limit the vouchers to only those that are related to your document. Follow the pattern used for PurchTable: see form method named updateQueryForPurchTable() for an example of how to apply ranges on that form – your code should be very similar to code in that method. Name your new method updateQueryForMyDocument().

Apply your range during initialization of the form calling updateQueryForMyDocument() from the form init() method - you will find examples of that examining existing code in the LedgerTransVoucher form init() method.