Help! Using VB.NET Post Transaction. What wrong with my code?

Dec 13, 2005 1 Replies

Hello everyone,



I have convrerted Antonia's C# saample to VB.Net as follows in order to post a transaction into RMS Via Qsrules (for a vey critical project in our company)



The database connection executes ok The batch number is being generated ok I have vaidated the items and they are okay HOWEVER NO TRANSACTION IS GENERATED Where did I go wrong with my function?



Declaration: Private info as QSRules.ConnectionInfo = New QSRules.connectionInfoClass Private mySession as QSRules.SessionClass =New QSRules.SessionClass


Function PostTrans()



info.RegisterNumber = 1 info.Provider = "SQLOLEDB.1" info.UserID = "sa" info.Password = "" info.InitialCatalog = "RMSDatabase" info.DataSource = "RMSServer" info.ConnectTimeout = "30"



Dim result As Boolean = False



mySession.LogIn(1, "password")



If mySession.Database.OpenConnection(info, result) = False Then Return False End If



Dim isPos As Boolean = True Dim r As QSRules.StatusCategoryEnum = mySession.Build(1, isPos) ' isPos = Manager mySession.License.MarkAsRegistered() ' for license control..



Dim currentBatch As QSRules.Batch = mySession.Register.Batch



If Not currentBatch Is Nothing AndAlso currentBatch.BatchStatus CInt(QSRules.batchstatusEnum.batchstatusClosed) Then Dim zzBatch As Boolean = False Dim batchNumber As Integer = 0 currentBatch.MakeNewBatch(zzBatch, batchNumber)



End If MessageBox.Show(currentBatch.BatchNumber) mySession.Transaction.SetTransactionType(transactiontypeEnum.transactiontypeSales) mySession.InitializeTransaction() mySession.Transaction.Entries.Add(7, "25000-010101", 1, 0, True,



12.99, "", "", False) Dim TotalAmountIn As Double = 10000 mySession.Transaction.Tenders(1).AmountIn = TotalAmountIn mySession.Transaction.Post(1, Now, False)

End Function


Are you sure the transaction is not being posted?

In RMS, when you post a transaction using code, it will not show up in the journal. However, it will appear in sales reports.

This, in my humble estimation, is a problem with RMS. There is now way to programmatically generate a journal entry via code.

mySession.Transaction.SetTransactionType(transactiontypeEnum.transactiontypeSales)

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required