# AccountService
This is the API used for accounting tasks. You can save entries directly to the journal or to the registration module in 24SevenOffice and also get account and tax lists.
TIP
This is our newest version of the API. If you're looking for details on the previous version see: old version
TERMINOLOGY
In the following documentation the terms Entry and Transaction are used somewhat interchangeably. In the scope of the AccountService Entry is the main term used, while the TransactionService refers to Transaction. The refer to the same thing: lines i the journal of the client.
Account Service (opens new window)
Account Service WSDL (opens new window)
# Guides
# Saving accounting entries
The method SaveBundleList (opens new window) is used to save financial transactions.
To create an transaction there are some steps that need to be considered:
- Please make sure that the accounting year (YearId) has been set up in the client accounting setup.
- The SaveOption property can be either 1 or 0. Setting 1 saves the bundle as a journal which can then be reviewed and edited on the 24SevenOffice web site. Setting 0 saves the bundle directly to the ledger. Default value is 1.
- To set the TransactionNo of the voucher you need to get the next available number by sending a request to GetEntryId (opens new window). The method takes a Date property which must be some date within the given fiscal year of the voucher. It also takes a SortNo property, here you must provide an EntrySeriesId property value, which can be obtained by sending a request to GetTypeList (opens new window). The EntryNo property is the value that is returned from the method and does not need to be set. (it can be set to 0 if your programming environment requires a value here.)
TIP
Please note that the EntryNo property does not need to be set when sending a request to GetEntryId (opens new window), it is part of the response from the method.
If the response from GetEntryId (opens new window) returns -1, the fiscal year has not been set up on the client. This must be done first.
- When creating a bundle or a voucher the Sort property can be set to the TypeNo property by sending a request to GetTypeList (opens new window).
Below you see a list of default types on Norwegian clients:
PLEASE NOTE
You can only use positive valued TypeNos. Negative valued Types are system types and cannot be used with the SaveBundleList method.
Example of a SaveBundleList request:
<SaveBundleList>
<BundleList>
<AllowDifference>false</AllowDifference>
<DirectLedger>false</DirectLedger>
<SaveOption>1</SaveOption>
<DefaultCustomerId>0</DefaultCustomerId>
<Bundles>
<Bundle>
<YearId>2033</YearId>
<Sort>1</Sort>
<Name>This is a test bundle</Name>
<BundleDirectAccounting>false</BundleDirectAccounting>
<Vouchers>
<Voucher>
<TransactionNo>12345678</TransactionNo>
<Sort>5</Sort>
<Entries>
<Entry>
<AccountNo>1500</AccountNo>
<CustomerId>123</CustomerId>
<Date>2033-01-01T00:00:00</Date>
<DueDate>2033-01-01T00:00:00</DueDate>
<Amount>123.00</Amount>
<CurrencyId>SEK</CurrencyId>
<CurrencyRate>0.9</CurrencyRate>
<CurrencyUnit>1</CurrencyUnit>
<Comment>Comment 1</Comment>
<LinkId>00000000-0000-0000-0000-000000000000</LinkId>
</Entry>
<Entry>
<AccountNo>3000</AccountNo>
<Date>2033-01-01T00:00:00</Date>
<DueDate>2033-01-02T00:00:00</DueDate>
<Amount>-123.00</Amount>
<CurrencyId>SEK</CurrencyId>
<CurrencyRate>0.9</CurrencyRate>
<CurrencyUnit>1</CurrencyUnit>
<Comment>Comment 2</Comment>
<LinkId>00000000-0000-0000-0000-000000000000</LinkId>
</Entry>
</Entries>
</Voucher>
</Vouchers>
</Bundle>
</Bundles>
</BundleList>
</SaveBundleList>
# Bundlelist Model
Since the SOAP service does not display the whole model it is described in more detail here.
The BundleList model has the property Bundles which consists of an array of Bundle.
Inside the bundle model there is a property Vouchers which is an array of Voucher.
And inside the Vouchers model you have the property Entries which is an array of Entry.
# How to handle VAT/Taxes
When you are saving bundles with SaveOption 1 and have set TaxNo on an Entry the VAT lines are automatically calculated in the 24SevenOffice user interface. However, if you are saving bundles with SaveOption 0 (saving directly to the ledger without review in the user interface), you have to add the VAT Entry before sending your request. You can find a simplified example below.
Here TaxNo is set to 2 which in this example is a 25% VAT and a separate VAT Entry (Account 2700) has been added with the VAT amount:
<Entries>
<Entry>
<AccountNo>1500</AccountNo>
<CustomerId>123</CustomerId>
<Date>2033-01-01T00:00:00</Date>
<Amount>80.00</Amount>
<TaxNo>2</TaxNo>
</Entry>
<Entry>
<AccountNo>2700</AccountNo>
<Date>2033-01-01T00:00:00</Date>
<Amount>20.00</Amount>
</Entry>
<Entry>
<AccountNo>3000</AccountNo>
<Date>2033-01-01T00:00:00</Date>
<Amount>-100</Amount>
</Entry>
</Entries>
# How to handle partial deduction of VAT/Taxes
If the client is using partial deduction of VAT/taxes and already has this set up in accounting settings, these settings will be automatically applied unless Bundle property UseAutoBaseRate is set to false. When you are saving bundles with SaveOption 1, both VAT and partial deduction is automatically calculated in 24SevenOffice user interface:
<Bundle>
<YearId>2024</YearId>
<UseAutoBaseRate>default=true</UseAutoBaseRate>
<Vouchers>
<Voucher>
<TransactionNo>5</TransactionNo>
<Entries>
<Entry>
<CustomerId>0</CustomerId>
<AccountNo>6200</AccountNo>
<TaxNo>1</TaxNo>
<Date>2024-01-01T01:05:40.567</Date>
<Amount>1000.00</Amount>
</Entry>
<Entry>
<CustomerId>1</CustomerId>
<AccountNo>2400</AccountNo>
<Date>2024-01-01T01:05:40.567</Date>
<DueDate>2024-01-20T00:00:00</DueDate>
<Amount>-1000.00</Amount>
</Entry>
</Entries>
<Sort>10</Sort>
</Voucher>
</Vouchers>
<Sort>10</Sort>
</Bundle>
If you sare saving bundles directly to ledger using SaveOption 0, you must include original VatAmount on the entry where taxNo 1 is being used. As an example, if Invoice amount is 1000.00 including VAT/taxes, and the vat amount (before deduction) is 200.00 (25%), this is how the entries must in bundle must look in the request:
<Entries>
<Entry>
<CustomerId>0</CustomerId>
<AccountNo>6200</AccountNo>
<TaxNo>1</TaxNo>
<VatAmount>200</VatAmount>
<Date>2024-01-01T00:00:00</Date>
<Amount>1000.00</Amount>
</Entry>
<Entry>
<CustomerId>1</CustomerId>
<AccountNo>2400</AccountNo>
<Date>2024-01-01T00:00:00</Date>
<DueDate>2024-01-20T00:00:00</DueDate>
<Amount>-1000.00</Amount>
</Entry>
</Entries>
The system will both apply base rate for VAT based on settings that customer has defined, post the actual vat amount on account that is linked to taxNo 1, and also create a new entry on same expense account with the remaining non-deductible amount.
# How to link entries in SaveBundleList requests
In order to link entries you have to set the Links property:
<Links>
<LinkModel>
<LineId></LineId>
<LinkId></LinkId>
</LinkModel>
</Links>
Here you have LineId which refers to the existing entry. You can get the value through GetTransactions (opens new window). The LinkId property is a GUID that you generate on your end. The LinkId GUID has to be set in the LinkModel and in the Entry object. Below you see an example of this:
<Entry>
<LinkId>eba705a5-7814-4976-a88b-d94a807984d4</LinkId>
<Links>
<LinkModel>
<LineId>9b6cffe5-f4e6-4d0b-aac4-24d0164e5455</LineId>
<LinkId>eba705a5-7814-4976-a88b-d94a807984d4</LinkId>
</LinkModel>
</Links>
</Entry>
Here the GUID eba705a5-7814-4976-a88b-d94a807984d4
is the LinkId that you have generated and the GUID 9b6cffe5-f4e6-4d0b-aac4-24d0164e5455
is the Id that you have gotten from GetTransactions. Please note that it is not possible to link two entries when they are both in the bundle that is being saved. You can only link new entries to existing transactions that have already been created when using the SaveBundleList method.
# Linking existing transactions
There are methods available that let you create new LinkIds, connect existing Transactions to a LinkId or replace a LinkId for existing Transactions. You can get LineIds and existing LinkIds from the GetTransactions method.
If you want to create a new link between Entries you first send a request to CreateLink (opens new window) and then send a request to AddLinkEntries (opens new window) with the LinkId from the CreateLink (opens new window) response and the LineIds that should be linked.
If you want to add LineIds to an existing Link, AddLinkEntries (opens new window) is used with the existing LinkId and any LineIds you want to add.
You can also replace the LinkId for linked LineIds with the ReplaceLinkEntries (opens new window) method.
# Rounding functionality
If you receive difference errors when trying to run SaveBundleList you can use the rounding functionallity. This might happend due to different types of currencies in the entries or you are using values with more than 2 decimal places.
Here is an example of how it would look like on the 24SO web page.
Example of differenceOptions.
<DifferenceOptions>
<Threshold>0.5</Threshold>
<AccountId>1000</AccountId>
<DueDate>2019-04-09T00:00:00</DueDate>
<Date>2019-04-09T00:00:00</Date>
<Comment>Øreavrunding</Comment>
<Period>4</Period>
<DepartmentId>1</DepartmentId>
<ProjectId></ProjectId>
</DifferenceOptions>
Input name | Input type | Description |
---|---|---|
Threshold | This value defines if this functionallity should be used. If you have a threshold of 0.5 and you receive a difference higher than 0.5 or lower than -0.5 a new entry will be created with the difference | |
AccountId | Int | What account the difference should be added to |
DueDate | DateTime | The due date of the entry |
Date | DateTime | Date of the entry |
Comment | String | This is the comment that is added to the entry |
Period | Int | The period of the entry |
DepartmentId | Int | What department should be associated with the entry (Optional) |
ProjectId | Int | What Project should be associated with the entry (Optional) |
-->
# Set UserDefined Dimensions
You can specify UserDefined Dimensions for an Entry
<Entries>
<Entry>
<UserDefinedDimensions>
<Type>101</Type>
<Value>1</Value>
</UserDefinedDimensions>
</Entry>
</Entries>
The Type is set to the appropriate TypeId which can be fetched from GetUserDefinedDimensions (opens new window) and Value to the appropriate Value which can be fetched from GetUserDefinedDimensionValues (opens new window)
# Methods
Method | Input type | Return type | Description |
---|---|---|---|
AddLinkEntries (opens new window) | LinkEntryItem | AddLinkEntriesResult(bool) | Connect LineIds to a LinkId |
CheckAccountNo (opens new window) | accountList | AccountDataErrors[] | Check if an account exists |
CreateLink (opens new window) | - | CreateLinkResult(int) | Creates a new LinkId (integer) that can be used for linking Entries |
GetAccountList (opens new window) | - | AccountData[] | Returns a list of accounts |
GetEntryId (opens new window) | argEntryId | GetEntryIdResult | Get the next available EntryID which is used as TransactionNo on vouchers in SaveBundleList |
GetTaxCodeList (opens new window) | - | TaxCodeElement[] | Returns a list with all the tax codes |
GetTypeList (opens new window) | - | TypeData[] | Returns a list with all types |
ReplaceLinkEntries (opens new window) | LinkEntryItem | ReplaceLinkEntriesResult(bool) | Replace LinkId for all LineIds in array |
SaveBundleList (opens new window) | BundleList | SaveBundleListResult | Save Bundles either directly to the ledger or to the user interface for further review |
UpdateEntryDueDate (opens new window) | EntryItem[] | EntryItem[] | Update the due date of Entries |