Filling prices in documents upon selecting materials or services
Let us proceed to the next goal. The material and service prices are stored in an information register. When a user creates a Services document or modifies a list of services within a Services document, it is good to have the service price added or updated automatically based on the information register record that matches the document date.
This includes two steps. First, write a function that returns the current material or service price. Second, call the function when a service is added to the document and fill the price field with the returned value.
This feature will hardly be used exclusively in this document. You might need it for the development of other documents that contain materials and services in their tabular sections. So let us store the function to a place that can be accessed from any applied solution part: a common module.