Financial Transactions (the Single Ledger)

All types of Financial Transations are held within the TASBooks Single Ledger. There are some 50 different types of transaction or journal. They can be accessed through the FinancialJournal and FinancialJournalLines objects. The FinancialJournalLines object exposes standard TASLink Collection properties and methods which are used to navigate the collection and retrieve the FinancialJournalLine object we require.

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

Now create a reference to a FinancialJournalLine object and set it to the FinancialJournalLines object exposed through the TASLink object model.

Dim oJournalLines As TASLink.FinancialJournalLines
Set oJournalLines = oSDK.FinancialJournalLines

Retrieving Journal Transactions

You can set the order in which the Journal Lines are sorted upon retrieval; details of the options available are held within the table in Financial Collections Objects Methods section:

oJournalLines.SortBy = CompletedTransactionFlag_AND_TradingPartnerCode_AND_NominalLedgerAccountNumber_AND_PostingDate

Now set the filter properties:

oJournalLines.FilterBySourceLedger_Filter = True
oJournalLines.SourceLedger_Filter = TargetLedgerCodes.SalesLedger
oJournalLines.FirstLinesOnly_Filter = True
oJournalLines.IncludeClosedItems_Filter = True
oJournalLines.IncludeOpenItems_Filter = True
oJournalLines.PostingDateFrom_Filter = 0
oJournalLines.PostingDateTo_Filter = 0
oJournalLines.PostingNumber_Filter = 0
oJournalLines.TradingPartnerCodeFrom_Filter = oCustomer.Customer_AccountCodeID
oJournalLines.TradingPartnerCodeTo_Filter = oCustomer.Customer_AccountCodeID

Posting Journals

There are almost 50 different types of Journal in TAS Books; see the Transaction Types enumeration for more details on these. Most of them are handled by TASLink.

Dim oJournal As TASLink.FinancialJournal
Dim sJournalType As String
Dim lnPostingNumber As Long
Set oJournal = oSDK.FinancialJournal

Set the type of Journal that you want to post – in this example a Cash Book Payment for a Home Purchase:

oJournal.SetTransactionType(CashBook_Payment_HomePurchase)

You can get a user friendly name for the type of Journal in this way:

sJournalType = oJournal.Get_Transaction_Type_As_String()

Set the Header information for the Journal – the requirements vary depending on the type of Journal, e.g. only Sales Ledger and Purchase Ledger journals require a Trading Partner Code ID:

oJournal.SetHeaderInfo(CDate("10 Jan 2005"), "1st Posting", 150, Now, "B S C", "DocRef", "RecRef", 0, "VATNum", 20, 10, 1, 0)

Full details of the required Header information can be found in the relevant table in the Financial Journal Methods section.

Add the VAT information – in this case we have two VAT Rates involved in our £150 (excl VAT) transaction, the Standard Rate and the Zero Rate, so we need to specify this with two calls:

oJournal.AddVATInfo(1, 100, 17.5)
oJournal.AddVATInfo(3, 50, 0)

Some types of Journal need no further information at all, others have to be supplied with further information. However, this type of journal needs at least one, a Nominal Account to which the purchase (cost) is to be analysed in the TAS Nominal Ledger. In fact, this journals £150 needs to be analysed to two Nominal Accounts:

oJournal.AddJournalLine(5010, "100", 80, "Line2")
oJournal.AddJournalLine(4010, "100", 70, "Line3")

Save the Journal, with the possibility that the posting failed:

If oJournal.Save Then
	MsgBox "Posted " & sJournalType & ": " & oJournal.PostingNumber
Else
	MsgBox sJournalType & " posting failed. " &
	oSDK.Status.userReadableDescription
End If

Set oJournal = Nothing
Set oCentralInfo = Nothing
Set oSDK = Nothing

Cashflow Forecast Reporting

With the advent of FirstBooks and TASBooks in 2009, TAS introduced Cashflow Forecast reporting. To achieve this, a new property, ExpectedPaymentDate, has been included in the Financial Journal. Only certain types of Financial Journal hold a real value for this property and, when you post a Journal and if you wish to include a value (optional because TASLink populates it with a default value if you do not), you should only do so for those types.

They are listed here:

Journal TypeNote
Sales Order Processing Invoicevia Stock Transactions
Sales Order Processing Credit Notevia Stock Transactions
Sales Ledger Debit Journal
Sales Ledger Debit Journal WriteBack
Sales Ledger Invoice
Purchase Ledger Credit Journal
Purchase Ledger Credit Journal WriteBack
Purchase Ledger Invoice
Purchase Order Processing Invoice

Foreign Currency Journals

TAS supports Foreign Currency transactions in its Financial Ledgers.

'As we want to demonstrate a Foreign Currency posting we add the following AFTER any VAT lines (though there are none for this type of transaction);
'NB - the € exchange rate is the only currency in TAS expressed as units of Base currency per Foreign; normally it is N units of Foreign Currency per 1 unit of Base Currency.
'If you do not specify an exchange rate, SDK uses the current rate in TAS.

If Not oJournal.AddForeignCurrencyInfo("EUR", 0.714286, "Test FC transaction") Then
	MsgBox "AddForeignCurrencyInfo failed: " & oSDK.Status.userReadableDescription
	GoTo freeResources
End If

Payment Allocations for Cash & Credits

You can allocate Sales and Purchase Ledger cash payment/receipt and other credit Financial Journal transactions to invoice and other debit Financial Journal transactions for a particular customer. The allocation reduces the Remaining Balance value of both Financial Journal transactions by the amount of the allocation.

It is important to note that payments/receipts and other credits can have multiple allocations, e.g. when a payment is made to cover several invoices. Similarly, a payment might represent a part-payment of an invoice. We refer to the payment/receipt and other credit as the source posting and the invoice or debit transaction as the target posting.

Dim SourcePosting As Long
Dim TargetPosting As Long
Dim Amount As Currency

Set oJournal = oSDK.FinancialJournal

'assuming Posting number 10089 is a suitable sales ledger payment and posting number 100029 is a suitable invoice for the same customer then
'you can allocate the 10.00 payment to the invoice as follows

SourcePosting = 100089
TargetPosting = 100090
Amount = 10#

If oJournal.AllocateSalesLedgerCredit(SourcePosting, TargetPosting, Amount) = False Then
	MsgBox "oJournal.AllocateSalesLedgerCredit failed. " & oSDK.Status.userReadableDescription
	GoTo freeResources
Else
	MsgBox "Successfully allocated £" & Amount & " from " & SourcePosting & " to " & TargetPosting & "."
End If