StockAnalysis() generate/enh74c.jpg


Returns transaction value and quantity information for stock items.

Syntax

StockAnalysis(<nType>, <nInfo>, <dDate1>, <dDate2>, [<cProduct>], [<cGroup>], [<cSupplier>], [<cLocation>], [<cFor>]) --> xRet

Arguments

<nType> --> is the transaction type to retrieve data on.

0 = invoice sales

1 = purchases and receipts of stock

2 = sales orders

3 = quotations

<nInfo> --> is the type of information to return.

0 = return a three element array containing the quantity, dollar value in Australian dollars, and cost in Australian dollars or originating currency if the transaction does not have an exchange rate specified against it.

generate/notepad1.gifAustralian dollar values only apply to invoice sales. Other transactions are always returned in their originating currency.

1 = return the quantity moved.

2 = return the dollar value in Australian dollars.

generate/notepad1.gif Australian dollar values only apply to invoice sales. Other transactions are always returned in their originating currency.

3 = return the dollar value in the originating currency.

4 = return total cost value in originating currency.

generate/notepad1.gifThe dollar value and cost value is the same amount for purchase orders and stock receipts.

<dDate1> --> the first date to include in the range.

<dDate2> --> the last date to include in the range.

<cProduct> --> optionally specify the specific product code to match. If not specified all product codes are included in the analysis.

<cGroup> --> optionally specifies the specific stock group to match. If not specified all stock groups are included in the analysis.

<cSupplier> --> optionally specifies the specific supplier group to match. If not specified all supplier groups are included in the analysis.

<cLocation> --> optionally specifies the stock location to match. If not specified all stock locations are included in the analysis.

<cFor> --> optionally specifies a valid expression to evaluate when matching. If the expression evaluates to TRUE, the transaction item is included in the analysis. The expression must evaluate to TRUE or FALSE.

Returns

The return value depends on the value of the nInfo parameter. A two element array containing a quantity and a value, or a quantity or a value is returned. If the StockAnalysis() function fails, FALSE is returned.

Description

This function retrieves quantities moved and values for one of four different areas of CAPITAL:

The function can be used to calculate the total value of all quotations raised between two dates, or the total value received (purchased) of a specific stock group, and so on.

Certain tables must be open before the StockAnalysis() function can be used:

Stock            Must always be open

Contents      If nType = 0

Invoice            If nType = 0

Audit_5            If nType = 1

Orders            If nType = 2

Ostock            If nType = 2

Quotes            If nType = 3

Qstock            If nType = 3

Example

This example can be placed in the Form Properties|Questions|Postscript section of a Visual Builder form:
 

* Open required tables

OpenTable("Stock")

OpenTable("Contents")

OpenTable("Audit_5")

OpenTable("Invoice")

 

* Declare variables to store results

Declare StkOut1 Type Numeric

Declare StkPur1 Type Numeric

 

* Retrieve value sold

StkOut1 := StockAnalysis(0, 2, dDate1, dDate2)

 

* Retrieve value purchased (received)

StkPur1 := StockAnalysis(1, 2, dDate1, dDate2)

 

CloseTable()

Notes

____________________________

Related Topics:

Business Function List

ExpenseAnalysis()



CAPITAL VISUAL BUILDER