Skip to content

Customer transactions (100)

Browse code 100 (BrowseCode::CustomerTransactions, “Debiteurenkaart”): the transaction lines of customers, with the invoice number, due date, open amount and match status. Here: the open items, the invoices and payments that are not (fully) matched yet.

Twinfield documentation: Browse data.

  • fin.trs.line.dim2 is the customer code, fin.trs.line.dim2name its name.
  • equal('fin.trs.line.matchstatus', 'available'): lines that are not matched yet. Use matched for paid invoices, with fin.trs.line.matchdate (the payment date) and fin.trs.line.matchnumber.
  • fin.trs.line.openbasevaluesigned: what is still open in the base currency; negative for a credit note or an unallocated payment.
  • between('fin.trs.line.dim2', $customer, $customer): one customer.
  • nullableDate('fin.trs.line.datedue'): the due date can be empty, e.g. for a payment.

Criteria: period, day book, number, status, customer, amount, invoice number, match status, payment date and change date (fin.trs.line.modified). See browse-definitions/100.xml and the browse data guide. The open invoices are also available with the Finder: salesTransactions()->openInvoices().

All fields of the browse definition (browse-definitions/100.xml), with the label for a Dutch user, the data type and the values of a field with a fixed list (browsefields.xml). A field that is not visible is meant as criterion: asking for it as column can give a server error. Twinfield does not apply the proposed values: send every criterion you need.

Field Label Type Visible Criterion
fin.trs.head.yearperiod Periode string yes between (proposed $DEFAULT$ … $DEFAULT$)
fin.trs.head.code Dagboek string yes equal
fin.trs.head.shortname Naam string yes
fin.trs.head.number Boekst.nr. decimal yes between
fin.trs.head.status Status special: draft, temporary, final, inuse, normal yes equal (proposed normal)
fin.trs.head.date Boekdatum date yes
fin.trs.line.dim2 Debiteur string yes between
fin.trs.line.dim2name Naam string yes
fin.trs.head.curcode Valuta string no
fin.trs.line.valuesigned Bedrag value no
fin.trs.line.basevaluesigned Euro value yes between
fin.trs.line.repvaluesigned – value no
fin.trs.line.openbasevaluesigned Openstaand bedrag value yes
fin.trs.line.invnumber Factuurnr. string yes equal
fin.trs.line.datedue Vervaldatum date yes
fin.trs.line.matchstatus Betaalstatus special: notmatchable, available, proposed, matched yes equal
fin.trs.line.matchnumber Betaalnr. string yes
fin.trs.line.matchdate Betaaldatum date yes between
fin.trs.line.openvaluesigned Openstaand bedrag transactievaluta value no
fin.trs.line.availableforpayruns Beschikbaar voor betaalrun special: false, true no
fin.trs.line.modified Wijzigingsdatum datetime yes between
$twinfield = Example::twinfield();
$customer = $argv[1] ?? null;
$year = Example::lastYear($twinfield);
// Open items: invoices and payments that are not (fully) matched yet.
$query = $twinfield->browse(BrowseCode::CustomerTransactions)
->columns(
'fin.trs.line.dim2',
'fin.trs.line.dim2name',
'fin.trs.head.code',
'fin.trs.head.number',
'fin.trs.line.invnumber',
'fin.trs.head.date',
'fin.trs.line.datedue',
'fin.trs.line.basevaluesigned',
'fin.trs.line.openbasevaluesigned',
)
->between('fin.trs.head.yearperiod', '2000/00', sprintf('%d/55', $year))
->equal('fin.trs.head.status', 'normal')
->equal('fin.trs.line.matchstatus', 'available');
if ($customer !== null) {
$query = $query->between('fin.trs.line.dim2', $customer, $customer);
}
$result = $query->get();
echo count($result), ' open item(s)', $customer === null ? '' : ' of customer ' . $customer, PHP_EOL;
$open = Amount::zero();
foreach ($result as $index => $row) {
$due = $row->nullableDate('fin.trs.line.datedue');
$open = $open->plus($row->amount('fin.trs.line.openbasevaluesigned'));
echo sprintf(
'[%d/%d] %s %s, %s %d invoice %s of %s, due %s: %s, open %s',
$index + 1,
count($result),
$row->string('fin.trs.line.dim2'),
$row->nullableString('fin.trs.line.dim2name') ?? '',
$row->string('fin.trs.head.code'),
$row->int('fin.trs.head.number'),
$row->nullableString('fin.trs.line.invnumber') ?? '-',
$row->date('fin.trs.head.date')->format('Y-m-d'),
$due === null ? '-' : $due->format('Y-m-d'),
$row->amount('fin.trs.line.basevaluesigned'),
$row->amount('fin.trs.line.openbasevaluesigned'),
), PHP_EOL;
}
echo 'Total open: ', $open, PHP_EOL;
Terminal window
php examples/browse-data/100-customer-transactions/example.php # all customers
php examples/browse-data/100-customer-transactions/example.php 1000 # customer 1000

Add TWINFIELD_DEBUG=1 to see the SOAP requests and responses.

55 open item(s)
[1/55] 1002 Pixel & Co, MEMO 202200003 invoice - of 2022-10-19, due 2022-11-18: -100.00, open -100.00
[2/55] 1004 Familie Jansen, MEMO 202200003 invoice - of 2022-10-19, due 2022-11-18: 100.00, open 100.00
[3/55] 1000 Voorbeeld BV, VRK 201000001 invoice 5 of 2010-12-20, due 2011-01-03: 148.75, open 148.75
[4/55] 1000 Voorbeeld BV, VRK 201000002 invoice 6 of 2010-12-28, due 2011-01-11: 148.75, open 148.75
…
Total open: 36459.13

What the SDK sends to Twinfield and what Twinfield sends back, for a call like the one in this example. The responses come from the tests, with example data.

Twinfield documentation: Browse data: Compose the browse request and send it.

$twinfield->browse(BrowseCode::CustomerTransactions)
->columns(
'fin.trs.line.dim2',
'fin.trs.line.dim2name',
'fin.trs.head.code',
'fin.trs.head.number',
'fin.trs.line.invnumber',
'fin.trs.head.date',
'fin.trs.line.datedue',
'fin.trs.line.basevaluesigned',
'fin.trs.line.openbasevaluesigned',
)
->between('fin.trs.head.yearperiod', '2000/00', '2026/55')
->equal('fin.trs.head.status', 'normal')
->equal('fin.trs.line.matchstatus', 'available')
->get();

The SDK sends this XML as xmlRequest of ProcessXmlString to processxml.asmx:

<columns code="100" optimize="true">
<column>
<field>fin.trs.line.dim2</field>
<visible>true</visible>
</column>
<column>
<field>fin.trs.line.dim2name</field>
<visible>true</visible>
</column>
<column>
<field>fin.trs.head.code</field>
<visible>true</visible>
</column>
<column>
<field>fin.trs.head.number</field>
<visible>true</visible>
</column>
<column>
<field>fin.trs.line.invnumber</field>
<visible>true</visible>
</column>
<column>
<field>fin.trs.head.date</field>
<visible>true</visible>
</column>
<column>
<field>fin.trs.line.datedue</field>
<visible>true</visible>
</column>
<column>
<field>fin.trs.line.basevaluesigned</field>
<visible>true</visible>
</column>
<column>
<field>fin.trs.line.openbasevaluesigned</field>
<visible>true</visible>
</column>
<column>
<field>fin.trs.head.yearperiod</field>
<operator>between</operator>
<from>2000/00</from>
<to>2026/55</to>
</column>
<column>
<field>fin.trs.head.status</field>
<operator>equal</operator>
<from>normal</from>
</column>
<column>
<field>fin.trs.line.matchstatus</field>
<operator>equal</operator>
<from>available</from>
</column>
</columns>

Twinfield answers with this XML in ProcessXmlStringResult:

<browse result="1" first="1" last="2" total="2">
<th>
<td label="" hideforuser="false" type="String">fin.trs.line.dim2</td>
<td label="" hideforuser="false" type="String">fin.trs.line.dim2name</td>
<td label="" hideforuser="false" type="String">fin.trs.head.code</td>
<td label="" hideforuser="false" type="Decimal">fin.trs.head.number</td>
<td label="" hideforuser="false" type="String">fin.trs.line.invnumber</td>
<td label="" hideforuser="false" type="Date">fin.trs.head.date</td>
<td label="" hideforuser="false" type="Date">fin.trs.line.datedue</td>
<td label="" hideforuser="false" type="Value">fin.trs.line.basevaluesigned</td>
<td label="" hideforuser="false" type="Value">fin.trs.line.openbasevaluesigned</td>
</th>
<tr>
<td>1000</td>
<td>Example customer</td>
<td>VRK</td>
<td>202600002</td>
<td>2026-0002</td>
<td name="01/02/2026">20260201</td>
<td name="03/03/2026">20260303</td>
<td>242.00</td>
<td>242.00</td>
<key>
<office>1000</office>
<code>VRK</code>
<number>202600002</number>
<line>1</line>
</key>
</tr>
<tr>
<td>1001</td>
<td>Second customer</td>
<td>VRK</td>
<td>202600005</td>
<td>2026-0005</td>
<td name="10/03/2026">20260310</td>
<td name="09/04/2026">20260409</td>
<td>60.50</td>
<td>30.25</td>
<key>
<office>1000</office>
<code>VRK</code>
<number>202600005</number>
<line>1</line>
</key>
</tr>
</browse>

View examples/browse-data/100-customer-transactions/example.php on GitHub.

Made by SolveBeam

Twinfield and Wolters Kluwer are trademarks of Wolters Kluwer. Their names and logos are used only to refer to their products.