generate/cbs2.gif Back Order Invoice Hook (R-BORELI.MAC) generate/en711.gif


 

The script file must be located in your CAPITAL program directory and must have the file name R-BORELI.MAC. It is executed for each invoice that is generated when orders are released from the Back Order Control Centre.

Entry Values

Variable

Purpose

Mode

0 = manual release. (User has selected previewing of each transaction.)

1 = automatic release. (No preview.)

Invoice->X

The fields of the table Invoice will be available for inspection.

Custrec->X

The fields of the customer account will be available for inspection.

Return Values

None.

Comments

This script hook is useful for sending a confirmation email that goods have just been dispatched. It is called for each invoice that is created when back orders are released.

In the following example, a script is created to pass the transaction number to a Visual Builder form called Confirm. This assumes that the form confirm.sty exists and that a valid email address has been placed in the customer's email address field (Custrec->Cusemail). Confirm.sty is based on Invoice.sty created using the Visual Builder Form Wizard.

Example #1

Declare MyScript Type Character

MyScript := ""

MyScript := MyScript + "Declare FirstTran Type Transaction" + CHR(13) + CHR(10)

MyScript := MyScript + "FirstTran := '" + Invoice->Invoiceno + "'" + CHR(13) + CHR(10)

MyScript := MyScript + "Declare LastTran Type Transaction" + CHR(13) + CHR(10)

MyScript := MyScript + "LastTran := '" + Invoice->Invoiceno + "'"

CreateEmailJob("Confirm", Custrec->Cusemail, "Dispatch Confirmation: " + TranStr(Invoice->Invoiceno),,,,, MyScript)

Example #2

Declare MyScript Type Character

MyScript := ""

MyScript := MyScript + "Declare FirstTran Type Transaction" + CHR(13) + CHR(10)

MyScript := MyScript + "FirstTran := '" + Invoice->Invoiceno + "'" + CHR(13) +

CHR(10)

MyScript := MyScript + "Declare LastTran Type Transaction" + CHR(13) + CHR(10)

MyScript := MyScript + "LastTran := '" + Invoice->Invoiceno + "'"

Declare MyFax Type Logical

Declare MySend Type Character

* If the user wants it sent via email check that

* there is an email address (otherwise it will still be

* sent via fax)

If Cuaux000->Conftype = "Y" .And. .Not. IsEmpty(Custrec->Cusemail)

   MyFax := FALSE

   MySend := Trim(Custrec->Cusemail)

Else

   MyFax := TRUE

   MySend := Trim(Custrec->Cusfax)

Endif

* Do nothing if customer wants fax and there is no

* fax number

If IsEmpty(Mysend)

   Return

Endif

* Which spooler to send to

Declare MySpool Type Character

MySpool := "EPOST"

CreateEmailJob("Dispatch", MySend, "Dispatch Confirmation: " +

TranStr(Invoice->Invoiceno),,,,, MyScript, MySpool,, MyFax)

generate/mistake1.gifgenerate/hardware1.gif This script may potentially be triggered from a wireless/remote data collection terminal. In these cases the operator will not have access to a PC screen and will be unable to respond to pop-up windows and message boxes. Do not create scripts that require user interaction, e.g., scripts that prompt to ask questions, if the application will be used with wireless/remote data collection terminals.

____________________________

Related Topics:

Scripting Hooks

Script Programming



Help Topic Map