The algorithm of selecting the price for a purchase document item can be divided into four main stages. The system starts searching for the price from the first stage. If during this stage it is not able to set the price, it proceeds to the next on and so on, until it sets the price.
Stage 1
At the first stage, to set the price for a document, only those price lists are taken into account, which meet all the criteria listed below:
- they have been created on the basis of price types that are at the same time:
- available for a center in which a document is being issued (a logged-in center)
- available for a center on behalf of which a document is being issued (a center being a document owner)
- available for an operator group to which a currently logged-in operator, who issues a document, belongs
- the vendor indicated on the document is assigned to them on Vendors tab
- they are active
- If the system does not find such price lists, it proceeds to stage 2
- If it finds price lists meeting the criteria of the stage 1, it searches for price lists containing an item with exactly the same item, unit and features as the ones defined on a document item. If it finds such price lists, it selects the one that is the most up-to-date, retrieves a price type and a price from it and set them on a document item.
- If it does not find a price list at point 2 and the unit defined in a document item is:
- a basic unit of an item, then it proceeds to the stage 2
- an additional unit, then, from among price lists meeting the criteria from stage 1, it searches for a price lists containing an item with exactly the same item and features, but with a basic unit of measure. If it finds such price lists, it selects the one that is the most up-to-date, retrieves a price type and a price from it, recalculates it to a price for an additional unit (using the conversion calculator of basic and additional units of this item) and sets them on a document item.
- If it does not find a price list at point 3, it proceeds to the stage 2
Stage 2:
If the price is not set at the first stage, the proceeds to stage 2, in which it starts from selecting a price type that meets all the criteria listed below:
- default for a center on behalf of which a document is being issued (a center being a document owner – field Owner on a document form)
- available for a center in which a document is being issued (a logged-in center)
- available for an operator group to which a currently logged-in operator, who issues a document, belongs
- not associated with any vendor (available for all vendors)
- If the system does not find such a price type, it proceeds to the stage 3
- If it finds a price type meeting the criteria of thestage 2, it searches for price lists created on the basis of that price type and containing an item with exactly the same item, unit and features as the ones defined on a document item. If it finds such price lists, it selects the one that is the most up-to-date, retrieves a price type and a price from it and set them on a document item.
- If it does not find a price list at point 2 and the unit defined on a document item is:
- a basic unit of an item, then it sets that type on a document item and sets the price equal to 0
- an additional unit, then, from among price lists created on the basis of a price type meeting the criteria from stage 2, it searches out price lists containing an item with exactly the same item and features, but with a basic unit of measure. If it finds such price lists, it will select the one that is the most up-to-date, retrieve a price type and a price from it, recalculates it to a price for an additional unit (using the conversion calculator of basic and additional units of this item) and sets them on a document item
- If it does not find any price list at point 3, it sets that price type on a document item and sets the price equal to 0
Stage 3:
If the price is not set at the second stage due to the lack of price type meeting the basic criteria of that stage, the system proceeds to the third stage, in which it tries to fix the price on the basis of price lists that meet all of the following criteria:
- they have been created on the basis of price types that are at the same time:
- available for a center in which a document is being issued (a logged-in center)
- available for a center on behalf of which a document is being issued (a center being a document owner)
- available for an operator group to which a currently logged-in operator, who issues a document, belongs
- not associated with any vendor
- If the system does not find such price lists, it proceeds to the stage 4.
- If it finds price lists meeting the criteria of stage 3, it searches for price lists containing an item with exactly the same item, unit and features as the ones defined in a document item. If it finds such a price lists, it selects the one that is the most up-to-date, retrieves a price type and a price from it and sets them on a document item.
- If it does not find a price list at point 2 and the unit defined on a document item is:
- a basic unit of an item, then it proceeds to the stage 4
- an additional unit, then, from among price lists meeting the criteria from stage 3, it searches for a price lists containing an item with exactly the same item and features, but with a basic unit of measure. If it finds such price lists, it selects the one that is the most up-to-date, retrieves a price type and a price from it, recalculates it to a price for an additional unit (using the conversion calculator of basic and additional units of this item) and sets them on a document item.
- If it does not find a price list at point 3, it proceeds to the stage 4
Stage 4:
If the price for an item has not been set at the preceding stages, it will eventually be set as a result of stage 4.
At this stage, the system sets a price type that is default for a center on behalf of which a document is being issued (a center being a document owner – field Center on a document form) even if this price type is not available for a center issuing a document (a logged-in center) or an operator group to which a currently logged in operator belongs. It does not search for any price list; on a document item, it sets the price that equals to 0.