Other Transaction Pre-Saving Hooks 
The script file must be located in your CAPITAL program directory and must have a file name matching the
contents of the following table:
|
File name |
Transaction |
|
R-ORDTOT.MAC |
Sales Order |
|
R-QUOTOT.MAC |
Quotations |
|
R-PURTOT.MAC |
Purchase Order |
|
R-RECTOT.MAC |
Stock Receipts |
|
R-RETTOT.MAC |
Stock Returns |
|
R-REQTOT.MAC |
Requisitions |
|
R-TRATOT.MAC |
*Stock Transfers
*Enterprise & Corporate Edition Only |
It is executed just before a transaction is saved.
Entry Values
None.
Return Values
Return FALSE to cancel saving the transaction.
Example
* R-ORDTOT.MAC
* Check to see if an order
number reference already
* exists for the same customer
Declare cMsg Type Character
Declare cRef Type Character
Declare cAccount Type Character
Declare cTranNo Type Character
cRef := Upper(Alltrim(ReadTranValue("REFERENCE")))
cAccount := ReadTranValue("ACCOUNT")
cTranNo := Orders->Oorderno
If IsEmpty(cRef)
Goto End
Endif
Orders->(Find(cRef, "OREF"))
:Loop
If Orders->Ocode
# cAccount
Goto End
Endif
If Upper(Alltrim(Orders->OReference))
== cRef
If cTranNo # Orders->Oorderno
cMsg := "CAUTION: This order number already exists on sales order "
cMsg := cMsg + TranStr(Orders->Oorderno) + " for this customer."
cMsg := cMsg + ";;Do you wish to proceed?"
If .Not. Echo(cMsg, TRUE)
Return FALSE
Endif
Goto End
Endif
Endif
Orders->(Skip())
Goto Loop
:End
Return TRUE
____________________________
Related Topics:
Credit
Limit Check Hook
Other
Transaction Post-saving Hooks
Other
Transaction Save Action Hooks
Scripting
Hooks
Script
Programming
Transaction
Columns Script Functions
Transaction
Script Functions