generate/cbs2.gif Customer Special Pricing Hook (R-CSP.MAC) & (R-CSPGEN.MAC)

generate/enh73.jpg


 

These script files must be located in your CAPITAL program directory and must have the file name R-CSP.MAC and/or R-CSPGEN.MAC. You do not need to include either script if you do not need both.

Entry Values

Variable

Purpose

Quantity

The quantity being invoiced or ordered.

DateTran

The date of the transaction.

Stock->X

You may query the contents of the fields of the stock record.

Staux000->X

You may query the contents of any user fields if applicable.

Custrec->X

You may query the contents of the fields in the customer record.

Cuaux000->X

You may query the contents of any customer user fields.

Supplier->X

You may query the contents of the fields of the supplier record for the related stock item.

Suaux000->X

You may query the contents of the fields of the supplier record for the related stock item.

Return Values

If the script returns a numeric value this is used as the unit sell price. Returning any other value such as FALSE will result in CAPITAL ignoring the script. The system will then try to resolve the correct price by searching the Customer Special Price matrix and apply other discount calculations where applicable.

You may also optionally assign these variables values:

Assignable Return Values

Variable

Purpose

DiscName

A short code to describe the discount. This may be up to 6 characters wide.

DiscList

The default list price applicable to this price field. This must be returned as a numeric value.

Comments

The script R-CSP.MAC is executed (if it exists) before any Customer Special Price rules are searched for a match.

The script R-CSPGEN.MAC is executed (if it exists) after Customer Stock Item Price rules are searched for a match.

The order of precedence is therefore as follows:

1. Execute R-CSP.MAC if it exits. If it returns a numeric value this is used as the stock item's unit sell price. CAPITAL does not perform any further searching.

2. CAPITAL checks all Customer Stock Item Price rules. If a match is found, CAPITAL does not perform any further searching.

3. Execute R-CSPGEN.MAC if it exists. If it returns a numeric value, this is used as the stock item's unit sell price. CAPITAL does not perform any further searching.

4. The rules of the Customer Special Price table are scanned for a price match. If a matching rule is found, no further searching is performed.

5. Other discount settings relating to the account or system go into affect, otherwise the default sell price is used.

Example #1

In this example if the field 'Special' is ticked, stock control price E is returned. The discount is also recorded as 'XPROMO'

If Stock->Special = "Y"

   DiscName := "XPROMO"

   Return Stock->E

Endif

Return FALSE

Example #2

In this example a company sells by the sheet or fractions of sheets. If the customer purchases a whole sheet, then a special price is calculated. Sheet pricing only applies when the user defined field (Consult Screen Builder for further information on the topic of adding user fields) 'WTSM' contains a value that is not zero.

If Staux000->WTSM = 0

   Return FALSE

Endif

* If this is a full sheet then don't need

* to calculate portion of a sheet pricing

If Round(Quantity, 5) = Round(Quantity, 0)

   Return FALSE

Endif

Return Quantity * staux000->WTSM * Stock->D

____________________________

Related Topics:

Customer Special Pricing

Customer Stock Item Pricing

Discount Solver

Scripting Hooks

Script Programming

Supplier Special Pricing Hook



Help Topic Map