Skip to content

Cost centers (900)

Browse code 900 (BrowseCode::CostCenters, “Kostenplaatsen”): the transaction lines booked on cost centres (dimension 2), with the general ledger account.

Twinfield documentation: Browse data.

  • fin.trs.line.dim2 is the cost centre and dim1 the general ledger account.
  • between('fin.trs.line.dim2', $from, $to): a range of cost centres.
  • equal('fin.trs.head.browseregime', $regime): the regime. The status is not a criterion in 900: you get all transactions, also drafts (number -1).

Criteria: period, general ledger account, cost centre, day book, number and regime. See browse-definitions/900.xml and the browse data guide.

All fields of the browse definition (browse-definitions/900.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.line.dim1 Grootboek string yes between
fin.trs.line.dim1name Naam string yes
fin.trs.line.dim2 Kostenplaats string yes between
fin.trs.line.dim2name Naam string yes
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.curcode Valuta string no
fin.trs.line.valuesigned Bedrag value no
fin.trs.line.basevaluesigned Euro value yes
fin.trs.line.repvaluesigned – value no
fin.trs.head.status Status special: draft, temporary, final, inuse, normal no
fin.trs.head.browseregime Regime special: Generic, Commercial, Economic, Fiscal yes equal
$twinfield = Example::twinfield();
$year = (int) ($argv[1] ?? Example::lastYear($twinfield));
$query = $twinfield->browse(BrowseCode::CostCenters)
->columns(
'fin.trs.line.dim2',
'fin.trs.line.dim2name',
'fin.trs.line.dim1',
'fin.trs.line.dim1name',
'fin.trs.head.code',
'fin.trs.head.number',
'fin.trs.line.basevaluesigned',
)
->between('fin.trs.head.yearperiod', sprintf('%d/00', $year), sprintf('%d/55', $year));
$result = $query->get();
echo count($result), ' cost centre line(s) in ', $year, PHP_EOL;
$totals = [];
foreach ($result as $index => $row) {
$costCenter = $row->string('fin.trs.line.dim2');
$value = $row->amount('fin.trs.line.basevaluesigned');
$totals[$costCenter] = ($totals[$costCenter] ?? Amount::zero())->plus($value);
echo sprintf(
'[%d/%d] %s %s: %s %s, %s %d %s',
$index + 1,
count($result),
$costCenter,
$row->nullableString('fin.trs.line.dim2name') ?? '',
$row->string('fin.trs.line.dim1'),
$row->nullableString('fin.trs.line.dim1name') ?? '',
$row->string('fin.trs.head.code'),
$row->int('fin.trs.head.number'),
$value,
), PHP_EOL;
}
foreach ($totals as $costCenter => $total) {
echo 'Total ', $costCenter, ': ', $total, PHP_EOL;
}
Terminal window
php examples/browse-data/900-cost-centers/example.php # the last year

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

2 cost centre line(s) in 2026
[1/2] 00100 Algemeen: 4500 Kantoorkosten, INK 202600003 50.00
[2/2] 00200 Verkoop: 4600 Reclamekosten, INK 202600006 120.00
Total 00100: 50.00
Total 00200: 120.00

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::CostCenters)
->columns(
'fin.trs.line.dim2',
'fin.trs.line.dim2name',
'fin.trs.line.dim1',
'fin.trs.line.dim1name',
'fin.trs.head.code',
'fin.trs.head.number',
'fin.trs.line.basevaluesigned',
)
->between('fin.trs.head.yearperiod', '2026/00', '2026/55')
->get();

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

<columns code="900" 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.line.dim1</field>
<visible>true</visible>
</column>
<column>
<field>fin.trs.line.dim1name</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.basevaluesigned</field>
<visible>true</visible>
</column>
<column>
<field>fin.trs.head.yearperiod</field>
<operator>between</operator>
<from>2026/00</from>
<to>2026/55</to>
</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.line.dim1</td>
<td label="" hideforuser="false" type="String">fin.trs.line.dim1name</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="Value">fin.trs.line.basevaluesigned</td>
</th>
<tr>
<td>00100</td>
<td>Algemeen</td>
<td>4500</td>
<td>Kantoorkosten</td>
<td>INK</td>
<td>202600003</td>
<td>50.00</td>
<key>
<office>1000</office>
<code>INK</code>
<number>202600003</number>
<line>2</line>
</key>
</tr>
<tr>
<td>00200</td>
<td>Verkoop</td>
<td>4600</td>
<td>Reclamekosten</td>
<td>INK</td>
<td>202600006</td>
<td>120.00</td>
<key>
<office>1000</office>
<code>INK</code>
<number>202600006</number>
<line>2</line>
</key>
</tr>
</browse>

View examples/browse-data/900-cost-centers/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.