Skip to main content

Sales transactions

info

In Twinfield there is a clear distinction between sales invoices and sales transactions. Sales invoices are the invoices, which will be sent to customers. Sales transactions are the related financial transactions that will be posted in the accounting part of Twinfield.

A sales transaction is made up of two elements in Twinfield:

  • General information (header), such as company, day book, transaction date, currency, etc.
  • Transaction lines (lines), of which there are three types:
    • Total line, with any relevant customer details.
    • Detail lines, which are an analysis of the total line.
    • VAT lines, with totals per VAT rate and the amounts on which the VAT was calculated.

A minimum of two transaction lines must be provided per day book.

Find

Web service type: Method driven

Resource location: /webservices/finder.asmx?wsdl

Lists unpaid invoices.

Method

public Message[] Search(
string type, // Finder type, See Finder type.
string pattern, // The search pattern. May contain wildcards * and ?
int field, // Fields to search through, see Search fields.
int firstRow, // First row to return, usefull for paging
int maxRows, // Maximum number of rows to return, usefull for paging
string[][] options, // See options below
out FinderData data) // Search results

Finder type

IVT

Search fields

Field IDFields searched
0Customer code, name, outstanding invoice amount and invoicenumber

The method will return an array containing validation messages. If there are no errors, then the data parameter will contain the actual search result.

Options

OptionTypeDescription
dim1codeFilters on the dimension on level 1.
dim2codeFilters on the dimension on level 2.
dim3codeFilters on the dimension on level 3.
valuemoneyFilters on the original invoice value.
openvaluemoneyFilters on the outstanding value.

Read

Web service type: XML Web Services

XML

This example reads the sales transaction of transaction type VRK and transaction number 202100001.

info

The used transaction type, in the example below VRK depends on the administration.

<read>
<type>transaction</type>
<office>001</office>
<code>VRK</code>
<number>202100001</number>
</read>

If the sales transaction does not exist an empty transaction element is returned containing an error.

Create/Update

If the sales transaction is not found it will be automatically created, otherwise it is updated.

Multiple transactions can be created at once by enclosing them by the transactions element.

XML structure
<transaction destiny="" autobalancevat="" raisewarning="">
<header></header>
<lines></lines>
</transaction>

Element name: transaction

NameDescription
@destinyAttribute to indicate the destiny of the sales transaction. Only used in the request XML.
temporary = sales transaction will be saved as provisional
final = sales transaction will be saved as final
@locationAttribute to indicate the destiny of the sales transaction. Only used in the response XML.
temporary = sales transaction is saved as provisional
final = sales transaction is saved as final
@autobalancevatShould VAT be rounded true or not false? Rounding will only be done with a maximum of two cents.
@raisewarningShould warnings be given true or not false? Default true.
headerContains information general to the sales transaction.
linesContains the sales transaction lines.
XML structure
<header>
<office></office>
<code></code>
<number></number>
<period></period>
<currency></currency>
<date raisewarning=""></date>
<duedate></duedate>
<invoicenumber raisewarning=""></invoicenumber>
<paymentreference></paymentreference>
<freetext1></freetext1>
<freetext2></freetext2>
<freetext3></freetext3>
</header>

Element name: header

NameTypeDescription
officecodeOffice code.
codecodeTransaction type code.
numberintegerTransaction number.
When creating a new sales transaction, don't include this tag as the transaction number is determined by the system. When updating a sales transaction, the related transaction number should be provided.
periodstringPeriod in YYYY/PP format. If this tag is not included or if it is left empty, the period is determined by the system based on the provided transaction date.
currencycodeCurrency code.
datedateTransaction date.
Optionally, it is possible to suppress warnings about 'date out of range for the given period' by adding the raisewarning attribute and set its value to false. This overwrites the value of the raisewarning attribute as set on the root element.
origincodeThe sales transaction origin.
Read-only attribute.
originreferencestring(36)The sales transaction origin reference (id). Provided in form of Guid.
Sample: f386393c-e4ba-439a-add4-3b366535d7bf.
Read-only attribute.
modificationdatestringThe date/time on which the sales transaction was modified the last time.
Read-only attribute.
userstringThe user who created the sales transaction.
Read-only attribute.
inputdatestringThe date/time on which the transaction was created.
Read-only attribute.
duedatedateDue date.
invoicenumberstring(40)Invoice number.
Optionally, it is possible to suppress warnings about 'double invoice numbers' by adding the raisewarning attribute and set its value to false. This overwrites the value of the raisewarning attribute as set on the root element.
paymentreferencestring(50)Payment reference of the transaction.
If payment reference is not specified, the paymentreference section must be omitted
freetext1textFree text field 1 as entered on the transaction type.
freetext2textFree text field 2 as entered on the transaction type.
freetext3textFree text field 3 as entered on the transaction type.

Sales transaction lines

XML structure
Total line
<line type="total" id="">
<dim1></dim1>
<dim2></dim2>
<debitcredit></debitcredit>
<value></value>
<basevalue></basevalue>
<rate></rate>
<repvalue></repvalue>
<reprate></reprate>
<description></description>
<vattotal></vattotal>
<vatbasetotal></vatbasetotal>
<vatreptotal></vatreptotal>
<freechar></freechar>
<comment></comment>
</line>
Detail line
<line type="detail" id="">
<dim1></dim1>
<dim2></dim2>
<dim3></dim3>
<debitcredit></debitcredit>
<value></value>
<basevalue></basevalue>
<rate></rate>
<repvalue></repvalue>
<reprate></reprate>
<description></description>
<vatcode></vatcode>
<vatbasevalue></vatbasevalue>
<vatrepvalue></vatrepvalue>
<destoffice></destoffice>
<freechar></freechar>
<comment></comment>
</line>
VAT line
<line type="vat" id="">
<dim1></dim1>
<dim2></dim2>
<dim3></dim3>
<debitcredit></debitcredit>
<value></value>
<basevalue></basevalue>
<rate></rate>
<repvalue></repvalue>
<reprate></reprate>
<description></description>
<vatbaseturnover></vatbaseturnover>
<vatturnover></vatturnover>
<vatcode></vatcode>
<vatbasevalue></vatbasevalue>
<vatvalue></vatvalue>
<baseline></baseline>
<freechar></freechar>
<comment></comment>
</line>

Element name: lines

info

The VAT line is not mandatory. If the VAT fields are used, the calculations are validated. If the VAT amounts in the XML file do not match the amounts calculated by Twinfield the transaction will be rejected. Refer also to VAT Calculation for more information.

NameTypeDescription
@typetotal
detail
vat
Line type.
@idintegerLine ID.
dim1string(16)If line type = total the accounts receivable balance account. When dim1 is omitted, by default the general ledger account will be taken as entered at the customer in Twinfield.
If line type = detail the profit and loss account.
If line type = vat the VAT balance account. When an empty dim1 is entered, by default the general ledger account will be taken as entered at the VAT code in Twinfield.
dim2string(16)If line type = total the account receivable.
If line type = detail the cost center or empty.
If line type = vat empty.
dim3string(16)If line type = total empty.
If line type = detail the project or asset or empty.
If line type = vat empty.
dim4string(16)Not in use.
dim5string(16)Not in use.
dim6string(16)Not in use.
debitcreditdebit
credit
If line type = total
In case of a 'normal' sales transaction debit.
In case of a credit sales transaction credit.
If line type = detail or vat
In case of a 'normal' sales transaction credit.
In case of a credit sales transaction debit.
valuemoneyIf line type = total amount including VAT.
If line type = detail amount without VAT.
If line type = vat VAT amount.
basevaluemoneyAmount in the base currency.
ratedecimalThe exchange rate used for the calculation of the base amount.
repvaluemoneyAmount in the reporting currency.
repratedecimalThe exchange rate used for the calculation of the reporting amount.
descriptionstring(40)Description of the transaction line.
vattotalmoneyOnly if line type is total. The total VAT amount in the currency of the sales transaction.
vatbasetotalmoneyOnly if line type is total. The total VAT amount in base currency.
vatreptotalmoneyOnly if line type is total. The total VAT amount in reporting currency.
matchstatusavailable
matched
proposed
notmatchable
Payment status of the sales transaction.
If line type detail or vat always notmatchable.
Read-only attribute.
matchlevelintegerOnly if line type is total. The level of the matchable dimension.
Read-only attribute.
relationintegerOnly if line type is total.
Read-only attribute.
valueopenmoneyOnly if line type is total. The amount still owed in the currency of the sales transaction.
Read-only attribute.
basevalueopenmoneyOnly if line type is total. The amount still owed in base currency.
Read-only attribute.
repvalueopenmoneyOnly if line type is total. The amount still owed in reporting currency.
Read-only attribute.
vatcodecodeOnly if line type is detail or vat. VAT code.
vatvaluemoneyOnly if line type is detail. VAT amount in the currency of the sales transaction.
vatbasevaluemoneyOnly if line type is detail. VAT amount in base currency.
vatrepvaluemoneyOnly if line type is detail. VAT amount in reporting currency.
vatturnovermoneyOnly if line type is vat. Amount on which VAT was calculated in the currency of the sales transaction.
vatbaseturnovermoneyOnly if line type is vat. Amount on which VAT was calculated in base currency.
vatrepturnovermoneyOnly if line type is vat. Amount on which VAT was calculated in reporting currency.
baselineintegerOnly if line type is vat. The value of the baseline tag is a reference to the line ID of the VAT rate.
performancetypeservices
goods
Only if line type is detail or vat. Mandatory in case of an ICT VAT code. The performance type.
performancecountrystring(2)Only if line type is detail or vat. Mandatory in case of an ICT VAT code. The ISO country codes are used. If not added to the request, by default the country code of the customer will be taken.
Note: For Greece use country code 'EL' and for Northern Ireland use 'XI'.
performancevatnumberstring(16)Only if line type is detail or vat. Mandatory in case of an ICT VAT code. If not added to the request, by default the VAT number of the customer will be taken.
performancedatedateOnly if line type is detail or vat. Mandatory in case of an ICT VAT code but only if performancetype is services.
destofficecodeOffice code. Used for inter company transactions – here you define in which company the transaction line should be posted.
currencydatedateNot used in a sales transaction. Use it only in case of bank or cash transactions.
freecharstring(1)Free character field.
If line type is total and filled with N the sales invoice is excluded from direct debit runs done in Twinfield.
commentstring(255)Comment set on the transaction line.
matchesnodeContains matching information. Is only available in case the sales transaction is (partly) matched.
Read-only attribute.

Matches

XML structure

Not allowed in the XML request.

Element name: matches

NameDescription
setContains information of the match set.

Set

Element name: set

NameTypeDescription
@statustemporary
final
Status of the transaction. temporary if the transaction is posted provisional. final if the transaction is posted final.
matchdatedateMatch date.
matchvaluemoneyMatch value.
linesnodeContains the financial transactions that will be matched.

Transaction lines

Element name: lines

NameTypeDescription
linenodeContains one single line of a financial transaction.

Transaction line

Element name: line

NameTypeDescription
codecodeDaybook code.
numberintegerTransaction number.
lineintegerTransaction line number.
methodpaymentFixed value.
matchvaluemoneyMatch value.

XML Example

<transaction destiny="temporary" raisewarning="false">
<header>
<code>VRK</code>
<currency>EUR</currency>
<date>20210502</date>
<period>2021/05</period>
<invoicenumber>20210-6000</invoicenumber>
<paymentreference>+++100/0160/01495+++</paymentreference>
<office>001</office>
<duedate>20210506</duedate>
</header>
<lines>
<line type="total" id="1">
<dim1>1300</dim1>
<dim2>1000</dim2>
<value>121.00</value>
<debitcredit>debit</debitcredit>
<description />
</line>
<line type="detail" id="2">
<dim1>8020</dim1>
<value>100.00</value>
<debitcredit>credit</debitcredit>
<description>Outfit</description>
<vatcode>VH</vatcode>
</line>
</lines>
</transaction>

Post

Web service type: XML Web Services

XML

This example posts the sales transaction of transaction type VRK and transaction number 202100001.

info

Only sales transactions with status provisional can be posted.

info

The used transaction type, in the example below VRK depends on the administration.

<transaction action="post">
<office>001</office>
<code>VRK</code>
<number>202100001</number>
</transaction>

If the sales transaction does not exist a transaction element is returned containing an error.

Delete

Web service type: XML Web Services

XML

This example deletes the sales transaction of transaction type VRK and transaction number 202100001.

info

Only sales transactions with status provisional can be deleted.

info

The used transaction type, in the example below VRK depends on the administration.

<transaction action="delete" reason="Test sales transaction, can be deleted.">
<office>001</office>
<code>VRK</code>
<number>202100001</number>
</transaction>

If the sales transaction does not exist a transaction element is returned containing an error.

Change pay status

Web service type: XML Web Services

XML

In Twinfield it is possible to exclude or include sales transactions from the collect process. In case a sales transaction is excluded it can be included by using the following example. This example includes sales transaction of transaction type VRK and transaction number 202100001.

info

The used transaction type, in the example below VRK depends on the administration.

<transaction action="changepaystatus">
<office>001</office>
<code>VRK</code>
<number>202100001</number>
</transaction>

If the sales transaction does not exist a transaction element is returned containing an error.

In case a sales transaction is included, it can be excluded by using the following example.

<transaction action="changepaystatus">
<office>001</office>
<code>VRK</code>
<number>202100001</number>
<paystatus>N</paystatus>
</transaction>