Stock Transactions

It is important to note that Stock Transactions is only available with the TASLink/TASflex Plus product. So, you need to ensure adequate error trapping for situations where this feature has not been enabled in the end-user runtime environment.

All types of Stock Transations are held within the TASBooks Stock Ledger. There are 6 main types of Stock Transaction in TASBooks (a 7th and 8th type are not available in TAS); most of them are handled by TASLink and they are all as set out in the table below:

#SourceTypeNotes
1StockStock Adjustment +/-Only applies to products that are “Regular” stock type product records – cannot be used to adjust Assembly or Non-Stock types of product/service.
2StockBuild/Unbuild AssemblyOnly applies to products that are “Assembly” type product records
3Sales Order Processing (SOP)Sales InvoiceSales Invoices generated in another system can be posted in full by TASLink, including all body line items; TASLink auto-generates the related Financial Journal, VAT Register, Stock etc updates.

NOTE you cannot print/post a TASBooks Sales Order to a Sales Invoice using TASLink
4Sales Order ProcessingSales Credit NoteSales Credit Notes generated in another system can be posted in full by TASLink, including all body line items; TASLink auto-generates the related Financial Journal, VAT Register, Stock etc updates.
5Purchase Order ProcessingGoods Receipt
6Purchase Order ProcessingPurchase Invoice

Stock Transactions can be accessed through the StockTransactionHeadersStockTransactionHeaderStockTransactionLines and StockTransactionLine objects. The StockTransactionHeaders and StockTransactionLines objects expose standard TASLink Collection properties and methods which are used to navigate the collection and retrieve the StockTransactionHeader and StockTransactionLine objects which we require.

First create a valid data connection (see Setup and Login for the TASLink Object).

Now create a reference to a StockTransactionHeader object and set it to the StockTransactionLines object exposed through the TASLink Object Model.

Dim oStockTransactionHeaders As TASLink.StockTransactionHeaders
Set oStockTransactionLines = oSDK.StockTransactionLines

Stock Processing

You can set the order in which the Stock Transaction Lines are sorted upon retrieval.

Post Stock Adjustment

TASLink lets you post adjustments to Regular-type Products stock values, thus increasing or decreasing the Quantity in Stock value. This process adjusts these and the Products summary In/Out values, creates Stock Transaction records and auto-creates the required Financial Journals with related updates to the summary records.

Set oStockHeader = oSDK.StockTransactionHeader

If oStockHeader.MakeStockAdjustment ("Product01", "Stock Adjustment", 10, 5, "SA1", CDate("10 Sep 2004")) Then
	MsgBox "Stock Adjustment made"
Else
	MsgBox oSDK.Status.userReadableDescription
End If

Build/Unbuild Assembly

TASLink lets you increase or decrease the Quantity in Stock values of Assembly-type Products by using the BuildAssembly function. This process adjusts these values, not only for the parent assembly product, but also for the component parts, as defined in AssemblyParts. The function updates all the involved Products summary In/Out/Used values, creates Stock Transaction records and auto-creates the required Financial Journals with related updates to the summary Financial records based on the products unit cost prices.

In this example, 5 of the assembly ASSEMBLY01 is being built (to unbuild 5, simply change the signage to negative, i.e. -5):

Set oStockHeader = oSDK.StockTransactionHeader

If oStockHeader.BuildAssembly ("Assembly01", "Assembly Build", 5, "GMV1", CDate("25 Dec 2004")) Then
	MsgBox "Assembly Build made"
Else
	MsgBox oSDK.Status.userReadableDescription
End If

SOP Sales Invoice Processing

You can use TASLink to process the full Invoice Header and Body line items into TAS. This not only updates all the involved Products summary In/Out/Used values, creates Stock Transaction records and auto-creates the required Financial Journals with related updates to the summary Financial records based on the products unit cost prices, but it also lets the user drill-down to view the Invoice from within the Financial Ledger sections within TAS.

TAS Invoice Numbering System

In most cases you will have created your invoice in your own system and simply wish to post it to TAS with your invoice number using the DocumentReference property. However TASLink will let you use the TAS Invoice numbering system. If you set the StockTransactionHeader property UseTASInvoiceNumbering to True, the value of DocumentReference passed into SetHeaderInfo is ignored and the next Invoice Number in the TAS system is used. When the invoice is successfully posted the Next Invoice Number in TAS is also incremented as if the invoice had been printed/posted from TAS.

If objST.SetHeaderInfo ("A C S", Sale, StockTransactionType_Invoice, CDate("15 Aug 2004"), "Customer Ref", 1234580, "Test Sales Order Transaction", 123457) = False Then
	MsgBox oSDK.Status.userReadableDescription
	GoTo cmdPostSalesInvoice_Click_Exit
End If

Important Note:

If the TAS Customers Price Type is flagged as Retail including VAT and TAS is not set up so that VAT is calculated per line (rather than on the total net amount of the invoice) an error will be returned because TAS must be set up to calculate VAT per invoice line if Retail pricing is used. Also, with such customers, all unit prices passed in are set as including VAT.

You can set other Invoice Header properties here, e.g.

objST.InvoiceAddressLine1 = "Baird House"
objST.InvoiceAddressLine1 = "Eastfield Business Park"
objST.InvoiceAddressLine1 = "Glenrothes"
objST.InvoiceAddressLine1 = "Fife"
objST.InvoicePostCode = "KY7 4NS"

Then you can add Line items:

If objST.AddStockTransactionProductLine("Product01", 2, 100, 10, 2.75, "Product number 01") = False Then
	MsgBox oSDK.Status.userReadableDescription
	GoTo cmdPostSalesInvoice_Click_Exit
End If

If objST.AddStockTransactionProductLine("PRODUCT02", 5, 50, 0) = False Then
	MsgBox oSDK.Status.userReadableDescription
	GoTo cmdPostSalesInvoice_Click_Exit
End If

Finally you can Save/Post the invoice:

If objST.Save() = True Then
	MsgBox "Successfully posted SOP Sales Invoice as posting number " & objST.PostingNumber
Else
	MsgBox oSDK.Status.userReadableDescription
End If