Developing your own add-ons

For the DIY kinda people.

Requirements

In order to start writing add-ons for Ivan's Accounting Tools, you need to have Visual Studio 2015(or newer) installed.

Interface

The plugin interface only allows the generation of journal entries in the ivact syntax.


Getting Started

Start by creating a new Class Library project in Visual Studio. You can choose to code in either VB or C#.

Click "Okay" to create the project and you should see something like this:

Public Class Class1

End Class

Now you need to replace everything with the template for IVACT Add-ons.

Public Class MainClass
Public appname As String = "APP NAME HERE"
Public Function init(ByVal int1 As Integer, ByVal int2 As Integer) As String
	If int1 + int2 = 3 Then
		Return appname
	End If
End Function
Public Function MainFunc(ByVal int1 As Integer, ByVal int2 As Integer, ByVal int3 As Integer) As Object
	If int1 + int2 = 5 Then
		Dim az As New ArrayList
		az.Add("<J>" & int3.ToString("D4"))
		az.Add("</J>")
		Return az
	End If
End Function
End Class

Key in the name for your add-on in "appname". This will be the name of your add-on in the menu.
"int3" will be the journal entry no. for the journal entry that will be created through this add-on.
In the template, we have an arraylist, this allows us to "print" our journal entries in the ivact syntax by adding a new line to the arraylist.
Building the code above will add an empty journal entry in the General Journal, which is not possible through the conventional method.


Sample Code

This is an excerpt from the source code of the Transaction add-on.

Public Class MainClass
Public appname As String = "Transaction"
Public Function init(ByVal int1 As Integer, ByVal int2 As Integer) As String
	If int1 + int2 = 3 Then
		Return appname
	End If
End Function
Public Function MainFunc(ByVal int1 As Integer, ByVal int2 As Integer, ByVal int3 As Integer) As Object
	If int1 + int2 = 5 Then
		Dim z As New frmaddon
		If z.ShowDialog = System.Windows.Forms.DialogResult.OK Then
			Dim az As New ArrayList
			az.Add("<J>" & int3.ToString("D4"))
			az.AddRange(z.zee)
			az.Add("</J>")
			Return az
		Else
			Return Nothing
		End If
	End If
End Function
End Class

Download Sample Source Code

Download the source code for the Transaction plugin.