Transaction Columns Hook (R-xxITEM.MAC) ![]()
The script file must be located in your CAPITAL program directory and must have a file name corresponding to one of the names in the File Table. It is executed just after a transaction column is edited by an operator. The script is not executed if the operator cancels any changes made to the column.
File Table
|
File Name |
Purpose |
|
R-INITEM.MAC |
Invoices or stock transfers. |
|
R-POITEM.MAC |
Purchase orders. |
|
R-RQITEM.MAC |
Requisitions. |
|
R-OEITEM.MAC |
Sales order entries. |
|
R-REITEM.MAC |
Stock Returns. |
|
R-RPITEM.MAC |
Stock Receipts. |
|
R-QUITEM.MAC |
Quotations. |
Entry Values
|
Variable |
Purpose |
|
Focus |
The name of the field column the user has just changed. This is always stored in upper case. |
|
Value1 |
The contents of the column.
|
Return Values
You must return FALSE if you do not wish to alter the contents of the column. Otherwise the return value will be pasted into the column. (This may include blank or empty characters.)
Comments
The Focus variable will contain the column ID. To view the list of available column ID's, consult the topic: Transaction Columns. Only those columns relating to the particular transaction type will be applicable to the hook.
Do
not use the WriteItemValue() inside this hook. If you wish to change the value of the column, use the
Return command to return the value you wish to place in the column.
Example #1
The following script adds the characters 'ABC' to every product code entered in the system.
If Focus == "PCODE"
Return "ABC" + Value1
Endif
Return FALSE
Example #2
This script hook checks to see if you have entered a quantity of zero against a stock item and warns you if so.
If Focus = "QTY"
If Val(Value1) = 0 .And. .Not. IsEmpty(ReadItemValue("STOCKID"))
EchoWarn("You have entered a zero quantity!")
Endif
Endif
Return FALSE
Example #3
____________________________
Related Topics:
Transaction Column Script Functions
![]() |