generate/cbs2.gif Statement Send Hook (R-CSSEND.MAC | R-SSSEND.MAC)

Electronic Document Exchange Only


 

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

Area

R-CSSEND.MAC

Customer Statements

R-SSEND.MAC

Supplier Statements

Entry Values

Variable

Purpose

EmailAddress

Blank. Set this to an email address if you want the current statement to be emailed.

FaxNumber

Blank. Set this to the fax number if you want the current statement to be faxed. (Requires that suitable Fax Server software be installed.)

SendToPrinter

Set this value to TRUE if you want the statement to be printed to paper. Otherwise leave it unassigned.

Custrec->X

You may query the contents of the fields of the customer account, but only if you are processing customer statements.

Cuaux000->X

You may query the contents of the customer account's user fields if applicable, but only if you are processing customer statements.

Supplier->X

You may query the contents of the fields of the supplier account, but only if you are processing supplier statements.

Suaux000->

You may query the contents of the supplier account's user fields if applicable, but only if you are processing supplier statements.

Return Values

If the script returns TRUE the statement will be emailed, faxed or printed, based on the settings made by the script. If the script returns any other value or CAPITAL cannot determine your variable settings, or no output options are specified, no action will be taken.

To Email a form set the email address like so:

EmailAddress := Custrec->Cusemail

To fax a form set the fax number like so:

FaxNumber := Custrec->Cusfax

To print a form set the SendToPrinter variable to TRUE.

SendToPrinter := TRUE

Example

* Check a user defined field for emailing

* This assumes the field 'Sendtoemail' has been

* added to the system using the Screen Builder

If Cuaux000->Senttoemail == "Y"

   If .Not. IsEmpty(Custrec->Cusemail)

      EmailAddress := Custrec->Cusemail

      Return TRUE

   Endif

Endif

* Otherwise send to printer

lSendToPrinter := TRUE

Return TRUE

____________________________

Related Topics:

Scripting Hooks

Script Programming

Statement Reference

 



Help Topic Map