Previous Topic

Next Topic

Book Contents

Book Index

PP Script Editor

Navigator > Setup > Purchase Pricing > Pricing Script Editor

The Pricing script determines how PP rules are collected, selected, applied and ranked. The pricing script provided sorts rules by priority and effective price, then chooses the lowest price at the highest priority. A default script PPDefault.pfs is provided with Accredo.

The PP Script Editor is a version of the MaxBasic Script Editor. You can use it to create a new script, or modify the provided script.

The PP Script Editor includes the Context object, available under the Objects menu, which contains properties for the context in which the script is triggered to return a price. The Context object may be documented from the Automated menu, select Automated > Context > Document Context.

For example, you can rank and select PP Rules according to the business process or write information back to custom TD fields in the context object.

Within the script editor, to cancel writeback of Purchase Pricing, use a silent Abort statement.

Important: If you edit the provided PPDefault.pfs script or one of the other example scripts, save it under a different file name, as the provided scripts are overwritten when an Accredo server install is performed.

The Pricing Script file set in PP Settings will be executed whenever a price is returned if Apply Purchase Pricing is selected and in PP Price Query when the Query (F9) button is clicked.

Purchase Pricing Context Object

The Purchase Pricing Context object appears in the Objects menu in the PP Script Editor, and may be documented from the Automated menu (Automated > Context > Document Context).

The Context object is used to Collect Purchase Pricing rules matching the properties of the Context and then to return pricing values after evaluation.

When a pricing decision is triggered the Context.Initial... properties return the starting point before Purchase Pricing rules are evaluated, e.g. in a PO Order the prices and discount that would apply if there is no purchase pricing.

Rules are collected using Context.Collect then evaluated.

After evaluating Purchase Pricing the Context.Purchase... properties are set to return the values from the context. Context.PurchaseMessage can be set to return a status hint.

Context sub objects can be located on different records and Context.Collect called to collect rules that apply the record. Set Context.UpdateDependantTables set True to apply the change to related sub objects.

For an example see the PPDefaultWithBillTo.pfs script which is provided, this first collects rules for the Creditor, then if the Creditor has a BillToAccountCode locates the BillToCreditor to collect rules applying to that Creditor. If UpdateDependentTables is set True then locating the BillToAccountCode would also update APCategory1, APCategory2, CreditorGroup, etc to the ones from the BillToAccountCode creditor record.

Note: For Manually Costed Products if Use Cost Prices for Manually Costed Products is Unselected in AP Settings the Cost Price passed to the PP Context is the Cost Price from the line not re-read from the Supplier Cost Product.