generate/cbs2.gifBack Order Control Centre Automatic Allocation Hook (R-ALLOCn.MAC)

Enterprise & Corporate Edition Only


 

These script files must be located in your CAPITAL program directory and must have the file names R-ALLOC1.MAC through to R-ALLOC9.MAC and R-ALLOC0.MAC. You need only include the scripts you intend to use.

The scripts R-ALLOC1.MAC through to R-ALLOC9.MAC are executed every time the system needs to determine whether a stock item should be allocated. It should be noted that all usual allocation constraints apply, so if, for example, stock is not available to allocate, the script will not cause the stock item to be allocated. In this sense the script's function is to provide additional filtering when allocating.

The script R-ALLOC0.MAC (if found on the system) can be used to control whether the normal OK button is enabled. If the script exists, the OK button is disabled, forcing the operator to select one of your predefined scripts. The script R-ALLOC0.MAC should return TRUE, otherwise script processing will be cancelled. If it exists, it is executed once, at the beginning of the allocation process.

For R-ALLOC1.MAC through to R-ALLOC9.MAC:

Entry Values

Variable

Purpose

ForceAlloc

Set this to TRUE if you want the system to allocate stock even if the stock quantity is not available. Set this to FALSE or do not assign otherwise.

Borders->X

You may query the contents of the back order file.

Stock->X

You may query the contents of the fields of the stock record.

Staux000->X

You may query the contents of any user fields if applicable.

Custrec->X

You may query the contents of the fields in the customer record.

Cuaux000->X

You may query the contents of any customer user fields.

Supplier->X

You may query the contents of the fields of the supplier record for the related stock item.

Suaux000->X

You may query the contents of the fields of the supplier record for the related stock item.

Return Values

If the script returns TRUE, the stock item is allocated provided that the other criteria entered on the Automatic Stock Allocation window are also matched.

Returning FALSE will prevent the back ordered item from being allocated. Returning any other value results in the script being ignored.

Comments

Up to 9 scripts can be associated with and added to the automatic allocations script menu. If CAPITAL does not find any scripts in the CAPITAL program directory, the Script button does not become visible. To execute a script, press the Script button and select the applicable script from the pop-up menu.

The first line of the script must be a comment line beginning with the symbol * (asterisk). The text that follows the script will be used as the menu entry description. You can place an ampersand (&) symbol in front of any letter in the description, which will then be used for the menu short-cut. For example:

* Allocate Priority Customers

To underscore the letter A so that it is highlighted as a short-cut on the menu, use the ampersand symbol:

* &Allocate Priority Customers

Example

This script only allocates stock if the back ordered item is a sales order and the stock user field RELEASEB contains the letter Y.

If Borders->Type == "O"

   If Staux000->ReleaseB == "Y"

      Return TRUE

   Endif

Endif

Return FALSE

The R-ALLOC0.MAC Initialisation Script

This script is executed once at the beginning of any script based allocation process. If the script exists, the normal OK button is disabled, so it can be used to disable allocations that are not script based. The contents of the script should return TRUE. For example:

Return TRUE

If you wish to preinitialise data in the R-ALLOC0.MAC script, and then determine that the allocation process cannot proceed for a specific technical reason, return FALSE. For example:

If .Not. IsFile("ALLOCLIST.DBF")

   EchoWarn("Sorry, allocation list not found.")

   Return FALSE

Endif

Return TRUE

____________________________

Related Topics:

Back Order Automatic Allocations

Scripting Hooks

Script Programming

 

 



Help Topic Map