Quantity Calculation Hook (R-STCnn.MAC) ![]()
Stock Tracing Component Only
The script file must be located in your CAPITAL program directory and must have the file name R-STCnn.MAC, where nn is the ID number of the stock tracing property for which you wish to calculate a quantity.
Entry Values
|
Variable |
Purpose |
|
Quantity |
The quantity allotted. |
|
nBackOrder |
The invoice quantity back ordered (if applicable). |
|
nID |
The stock tracing property ID number. |
|
cProperty |
The property allotment description. |
|
stock-> |
Stock control fields of the transaction line item. |
|
staux000-> |
Stock control user fields of the transaction line item. |
Return Values
If the script returns a numeric value, this is used as the quantity invoiced, ordered, purchased, etc.
Description
This script hook is used to calculate a quantity to sell, order, quote or purchase based on a Stock Tracing Component list of selected allotments.
You must incorporate into the script name the Stock Tracing Property Maintenance ID. The ID is the number in the first column of the Stock Tracing Property table. For example, the serial number property has an ID reference of 1, so the script name would be R-STC001.MAC. For the batch number property, which has an ID of 2, the script name would be R-STC002.MAC and so on.
You must also untick the property setting Maintain Quantity Relation to ensure that CAPITAL will permit the quantity relationship you calculate with this script.
The script is executed for every allotment made for each line item.
Example
You have created a property called "sheets" which tracks sheets of varies lengths and widths. You also wish to track the quantity carried of each stock item by the sheet. So if the Stock In quantity is 10 this means 10 sheets are held in stock.
In order to manage this relationship, you have created a user defined field in Stock Control called SQRMETRE which holds a number that indicates how many square metres make up a sheet of standard length and width.
The script property assignments typically take the following form:
10x5.0
12x3.0
08x2.5
The following script converts the assignment description to a square metre value by multiplying the length by the width. E.g., 10 x 5 = 50 square metres. It then divides this by the standard square metre size (held in SQRMETRE), to calculate the quantity sold in sheets or portions of sheets.
Related Topics:
![]() |