|
C++ |
|
#include "stdafx.h"
#include "CppClient.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
#include <atlbase.h>
#include <ATLComTime.h>
#import "Venice\Bin\ClSdk.dll"
using namespace std;
using namespace ClSdk;
int _tmain(int argc, TCHAR* argv[], TCHAR* envp[])
{
OleInitialize (NULL);
try
{
// These are not 'real' pointers, but 'smart' pointers, looking as pointers but acting as objects, so do not use 'delete'!
IVenicePtr pVenice;
IDossierPtr pDossier;
IYearPtr pYear;
ISndryPtr pSndry;
eAccessMode eAM;
// Create the Venice object interface
pVenice.CreateInstance(__uuidof(ClSdk::Venice));
// Is option 'Access Management' installed?
eAM = pVenice->GetAccessMode ();
// Logon into Venice, allowing user interface
if (eAM == amSecure)
pVenice->LogonSecure ("13.30_", "MyApplication", lngNld, true, "ClSdkUser", "ClSdkPassword");
else
pVenice->Logon ("13.30_", "MyApplication", lngNld, true, "SDK", "ClSdkUser", "Software engineer");
// Create Dossier Context, use the default filing cabinet 'Data' and the dossier 'MyCompany'
pDossier = pVenice->CreateDossierContext("", "MyCompany");
// Create Year Context
pYear = pDossier->CreateYearContext (2024);
// ----------------------------------------------------------------------------------------------------
// This example creates a sundry document containing the opening balance.
// - See Purchase and Sales for examples on adding Analytical details.
// - See Finan for an example on ticking entries.
// The opening balance used here is the example used in Appendix 1 of the manual 'Accounting' (from
// the main menu choose category Documentation - panel Documentation - item Accounting).
// ----------------------------------------------------------------------------------------------------
// Create context for sundry documents
pSndry = pYear->CreateSndry (true);
// Prepare the creation of a new Sundry document.
pSndry->PrepareDocument (paInsert);
// Initialize with default values.
pSndry->Init ();
// In order to obtain a valid sundry document header, the following properties must be assigned a value:
// Book and Book date.
// This does not imply however that these properties need to be set in code, they can also be assigned via the standard values.
// Note: A document number is not required. If it is set to zero, a new successive number for the given book will be assigned automatically.
// Note: While those are the only properties that are required to be filled in, other properties may require a value for the document to pass the internal validation checks.
// These are the same validation checks that are applied when manually entering a document in Venice.
pSndry->pBook = "OPEN";
pSndry->pDocNum = 0; // 0 = Automatically determine the document number
pSndry->pBookDate = COleDateTime (2024, 1, 1, 0, 0, 0).m_dt;
// Add your code here for assigning additional properties of the document header.
// pSndry->Xxx = yyy;
// Create detail lines...
pSndry->InsertDetail (0, -140000.00, 0.00, 0.00, "100", "", "", -140000.00, "EUR", 0);
pSndry->InsertDetail (1, -2500.00, 0.00, 0.00, "140", "", "", -2500.00, "EUR", 0);
pSndry->InsertDetail (2, 74000.00, 0.00, 0.00, "221", "", "", 74000.00, "EUR", 0);
pSndry->InsertDetail (3, 35000.00, 0.00, 0.00, "230", "", "", 35000.00, "EUR", 0);
pSndry->InsertDetail (4, 20000.00, 0.00, 0.00, "241", "", "", 20000.00, "EUR", 0);
pSndry->InsertDetail (5, 13500.00, 0.00, 0.00, "340", "", "", 13500.00, "EUR", 0);
pSndry->InsertDetail (6, 5000.00, 0.00, 0.00, "5500001", "", "", 5000.00, "EUR", 0);
pSndry->InsertDetail (7, 2500.00, 0.00, 0.00, "5600001", "", "", 2500.00, "EUR", 0);
pSndry->InsertDetail (8, 1100.00, 0.00, 0.00, "5700001", "", "", 1100.00, "EUR", 0);
pSndry->InsertDetail (9, 10000.00, 0.00, 0.00, "408", "", "", 10000.00, "EUR", 0);
pSndry->InsertDetail (10, -18600.00, 0.00, 0.00, "448", "", "", -18600.00, "EUR", 0);
// Write (or cancel) the document
pSndry->WriteDocument (rmErrorReport);
// If you do not use WriteDocument() because you do not want to save the document (maybe because of an error) you should call CancelDocument() instead.
}
catch (_com_error CE)
{
printf ("\nError while executing application.\nReason: %s\nSource: %s", (LPCSTR)CE.Description (), (LPCSTR)CE.Source ());
}
// All objects must be out of scope (or destroyed) before calling OleUninitialize ()!
OleUninitialize ();
}
|
|
C# |
|
using System;
using ClSdk;
namespace Example
{
class Example
{
[STAThread]
static void Main(string[] args)
{
try
{
eAccessMode eAM;
// Create the Venice object
Venice oVenice = new Venice();
// Is option 'Access Management' installed?
eAM = oVenice.GetAccessMode ();
// Logon into Venice, allowing user interface
if (eAM == eAccessMode.amSecure)
oVenice.LogonSecure ("13.30_", "MyApplication", eLanguage.lngNld, true, "ClSdkUser", "ClSdkPassword");
else
oVenice.Logon ("13.30_", "MyApplication", eLanguage.lngNld, true, "SDK", "ClSdkUser", "Software engineer");
// Create Dossier Context, use the default filing cabinet 'Data' and the dossier 'MyCompany'
Dossier oDossier = oVenice.CreateDossierContext ("", "MyCompany");
// Create Year Context
Year oYear = oDossier.CreateYearContext (0);
// ----------------------------------------------------------------------------------------------------
// This example creates a sundry document containing the opening balance.
// - See Purchase and Sales for examples on adding Analytical details.
// - See Finan for an example on ticking entries.
// The opening balance used here is the example used in Appendix 1 of the manual 'Accounting' (from
// the main menu choose category Documentation - panel Documentation - item Accounting).
// ----------------------------------------------------------------------------------------------------
// Create context for sundry documents
Sndry oSndry = oYear.CreateSndry (true);
// Prepare the creation of a new Sundry document.
oSndry.PrepareDocument (ePrepareAction.paInsert);
// Initialize with default values.
oSndry.Init ();
// In order to obtain a valid sundry document header, the following properties must be assigned a value:
// Book and Book date.
// This does not imply however that these properties need to be set in code, they can also be assigned via the standard values.
// Note: A document number is not required. If it is set to zero, a new successive number for the given book will be assigned automatically.
// Note: While those are the only properties that are required to be filled in, other properties may require a value for the document to pass the internal validation checks.
// These are the same validation checks that are applied when manually entering a document in Venice.
oSndry.pBook = "OPEN";
oSndry.pDocNum = 0; // 0 = Automatically determine the document number
oSndry.pBookDate = new DateTime (2008, 1, 1);
// Add your code here for assigning additional properties of the document header.
// oSndry.Xxx = yyy;
// Create detail lines...
oSndry.InsertDetail (0, -140000.00, 0.00, 0.00, "100", "", "", -140000.00, "EUR", 0);
oSndry.InsertDetail (1, -2500.00, 0.00, 0.00, "140", "", "", -2500.00, "EUR", 0);
oSndry.InsertDetail (2, 74000.00, 0.00, 0.00, "221", "", "", 74000.00, "EUR", 0);
oSndry.InsertDetail (3, 35000.00, 0.00, 0.00, "230", "", "", 35000.00, "EUR", 0);
oSndry.InsertDetail (4, 20000.00, 0.00, 0.00, "241", "", "", 20000.00, "EUR", 0);
oSndry.InsertDetail (5, 13500.00, 0.00, 0.00, "340", "", "", 13500.00, "EUR", 0);
oSndry.InsertDetail (6, 5000.00, 0.00, 0.00, "5500001", "", "", 5000.00, "EUR", 0);
oSndry.InsertDetail (7, 2500.00, 0.00, 0.00, "5600001", "", "", 2500.00, "EUR", 0);
oSndry.InsertDetail (8, 1100.00, 0.00, 0.00, "5700001", "", "", 1100.00, "EUR", 0);
oSndry.InsertDetail (9, 10000.00, 0.00, 0.00, "408", "", "", 10000.00, "EUR", 0);
oSndry.InsertDetail (10, -18600.00, 0.00, 0.00, "448", "", "", -18600.00, "EUR", 0);
// Write (or cancel) the document
oSndry.WriteDocument (eReportMode.rmErrorReport);
// If you do not use WriteDocument() because you do not want to save the document (maybe because of an error) you should call CancelDocument() instead.
}
catch (Exception ex)
{
Console.WriteLine ("Error while executing application.\nReason:" + ex.Message + "\nSource: " + ex.Source);
}
}
}
}
|
|
VBS |
|
Const amMin = -1
Const amNormal = 0
Const amSecure = 1
Const amMax = 2
Const lngMin = 0
Const lngNld = 0
Const lngFra = 1
Const lngEngNld = 2
Const lngEngFra = 3
Const lngAuto = 4
Const lngMax = 5
Const paMin = 0
Const paInsert = 0
Const paDuplicate = 1
Const paUpdate = 2
Const paView = 3
Const paMax = 4
Const rmMin = 0
Const rmNoReport = 0
Const rmErrorReport = 1
Const rmFullReport = 2
Const rmMax = 3
Const smMin = 0
Const smFirst = 0
Const smLess = 1
Const smLessOrEqual = 2
Const smEqual = 3
Const smGreaterOrEqual = 4
Const smGreater = 5
Const smLast = 6
Const smMax = 7
' Call main
Main
sub Main
Dim oVenice
Dim oDossier
Dim oYear
Dim oSndry
' Create Venice object
Set oVenice = CreateObject("Clsdk.Venice")
' Dummy code to activate Intellisense
If False Then
Set oDossier = CreateObject("ClSdk.Dossier")
Set oYear = CreateObject("ClSdk.Year")
Set oSndry = CreateObject("ClSdk.Sndry")
End If
' Login
If oVenice.GetAccessMode() = amSecure Then
Call oVenice.LogonSecure("13.30_", "MyApplication", lngNld, true, "ClSdkUser", "ClSdkPassword")
Else
Call oVenice.Logon("13.30_", "MyApplication", lngNld, true, "SDK", "ClSdkUser", "Software engineer")
End If
' Create Dossier Context, using the default filing cabinet 'Data' and the dossier 'MyCompany'
Set oDossier = oVenice.CreateDossierContext("", "MyCompany")
' Create Year Context
Set oYear = oDossier.CreateYearContext(2024)
'----------------------------------------------------------------------------------------------------
' This example creates a sundry document containing the opening balance.
' - See Purchase and Sales for examples on adding Analytical details.
' - See Finan for an example on ticking entries.
' The opening balance used here is the example used in Appendix 1 of the manual 'Accounting' (from
' the main menu choose category Documentation - panel Documentation - item Accounting).
'----------------------------------------------------------------------------------------------------
' Create context for sundry documents
Set oSndry = oYear.CreateSndry(true)
' Prepare the creation of a new Sundry document.
Call oSndry.PrepareDocument(paInsert)
' Initialize with default values.
Call oSndry.Init()
' In order to obtain a valid sundry document header, the following properties must be assigned a value:
' Book and Book date.
' This does not imply however that these properties need to be set in code, they can also be assigned via the standard values.
' Note: A document number is not required. If it is set to zero, a new successive number for the given book will be assigned automatically.
' Note: While those are the only properties that are required to be filled in, other properties may require a value for the document to pass the internal validation checks.
' These are the same validation checks that are applied when manually entering a document in Venice.
oSndry.pBook = "OPEN"
oSndry.pDocNum = 0 ' 0 = Automatically determine the document number
oSndry.pBookDate = #1/1/2024#
' Add your code here for assigning additional properties of the document header.
' oSndry.Xxx = yyy
' Create detail lines...
Call oSndry.InsertDetail(0, -140000.00, 0.00, 0.00, "100", "", "", -140000.00, "EUR", 0)
Call oSndry.InsertDetail(1, -2500.00, 0.00, 0.00, "140", "", "", -2500.00, "EUR", 0)
Call oSndry.InsertDetail(2, 74000.00, 0.00, 0.00, "221", "", "", 74000.00, "EUR", 0)
Call oSndry.InsertDetail(3, 35000.00, 0.00, 0.00, "230", "", "", 35000.00, "EUR", 0)
Call oSndry.InsertDetail(4, 20000.00, 0.00, 0.00, "241", "", "", 20000.00, "EUR", 0)
Call oSndry.InsertDetail(5, 13500.00, 0.00, 0.00, "340", "", "", 13500.00, "EUR", 0)
Call oSndry.InsertDetail(6, 5000.00, 0.00, 0.00, "5500001", "", "", 5000.00, "EUR", 0)
Call oSndry.InsertDetail(7, 2500.00, 0.00, 0.00, "5600001", "", "", 2500.00, "EUR", 0)
Call oSndry.InsertDetail(8, 1100.00, 0.00, 0.00, "5700001", "", "", 1100.00, "EUR", 0)
Call oSndry.InsertDetail(9, 10000.00, 0.00, 0.00, "408", "", "", 10000.00, "EUR", 0)
Call oSndry.InsertDetail(10, -18600.00, 0.00, 0.00, "448", "", "", -18600.00, "EUR", 0)
' Write (or cancel) the document
Call oSndry.WriteDocument(rmErrorReport)
' If you do not use WriteDocument() because you do not want to save the document (maybe because of an error) you should call CancelDocument() instead.
' Error
MsgBox("Finished!")
end sub
|
|
VB.NET |
|
Imports ClSdk
Module Example
Sub Main()
Try
Dim oVenice As Venice
Dim oDossier As Dossier
Dim oYear As Year
Dim oSndry As Sndry
Dim eAM As eAccessMode
' Create the Venice object
oVenice = New Venice
' Is option 'Access Management' installed?
eAM = oVenice.GetAccessMode()
' Logon into Venice, allowing user interface
If eAM = eAccessMode.amSecure Then
oVenice.LogonSecure("13.30_", "MyApplication", eLanguage.lngNld, True, "ClSdkUser", "ClSdkPassword")
Else
oVenice.Logon("13.30_", "MyApplication", eLanguage.lngNld, True, "SDK", "ClSdkUser", "Software engineer")
End If
' Create Dossier Context, use the default filing cabinet 'Data' and the dossier 'MyCompany'
oDossier = oVenice.CreateDossierContext("", "MyCompany")
' Create Year Context
oYear = oDossier.CreateYearContext(2024)
' ----------------------------------------------------------------------------------------------------
' This example creates a sundry document containing the opening balance.
' - See Purchase and Sales for examples on adding Analytical details.
' - See Finan for an example on ticking entries.
' The opening balance used here is the example used in Appendix 1 of the manual 'Accounting' (from
' the main menu choose category Documentation - panel Documentation - item Accounting).
' ----------------------------------------------------------------------------------------------------
' Create context for sundry documents
oSndry = oYear.CreateSndry(True)
' Prepare the creation of a new Sundry document.
oSndry.PrepareDocument(ePrepareAction.paInsert)
' Initialize with default values.
oSndry.Init()
' In order to obtain a valid sundry document header, the following properties must be assigned a value:
' Book and Book date.
' This does not imply however that these properties need to be set in code, they can also be assigned via the standard values.
' Note: A document number is not required. If it is set to zero, a new successive number for the given book will be assigned automatically.
' Note: While those are the only properties that are required to be filled in, other properties may require a value for the document to pass the internal validation checks.
' These are the same validation checks that are applied when manually entering a document in Venice.
oSndry.pBook = "OPEN"
oSndry.pDocNum = 0 ' 0 = Automatically determine the document number
oSndry.pBookDate = New DateTime(2024, 1, 1)
' Add your code here for assigning additional properties of the document header.
' oSndry.Xxx = yyy
' Create detail lines...
oSndry.InsertDetail(0, -140000.0, 0.0, 0.0, "100", "", "", -140000.0, "EUR", 0)
oSndry.InsertDetail(1, -2500.0, 0.0, 0.0, "140", "", "", -2500.0, "EUR", 0)
oSndry.InsertDetail(2, 74000.0, 0.0, 0.0, "221", "", "", 74000.0, "EUR", 0)
oSndry.InsertDetail(3, 35000.0, 0.0, 0.0, "230", "", "", 35000.0, "EUR", 0)
oSndry.InsertDetail(4, 20000.0, 0.0, 0.0, "241", "", "", 20000.0, "EUR", 0)
oSndry.InsertDetail(5, 13500.0, 0.0, 0.0, "340", "", "", 13500.0, "EUR", 0)
oSndry.InsertDetail(6, 5000.0, 0.0, 0.0, "5500001", "", "", 5000.0, "EUR", 0)
oSndry.InsertDetail(7, 2500.0, 0.0, 0.0, "5600001", "", "", 2500.0, "EUR", 0)
oSndry.InsertDetail(8, 1100.0, 0.0, 0.0, "5700001", "", "", 1100.0, "EUR", 0)
oSndry.InsertDetail(9, 10000.0, 0.0, 0.0, "408", "", "", 10000.0, "EUR", 0)
oSndry.InsertDetail(10, -18600.0, 0.0, 0.0, "448", "", "", -18600.0, "EUR", 0)
' Write (or cancel) the document
oSndry.WriteDocument(eReportMode.rmErrorReport)
' If you do not use WriteDocument() because you do not want to save the document (maybe because of an error) you should call CancelDocument() instead.
Catch ex As Exception
Console.WriteLine("Error while executing application." + vbCrLf + "Reason:" + ex.Message + vbCrLf + "Source: " + ex.Source)
End Try
End Sub
End Module
|
|