Skip to content

Time & Expenses totals (610_1)

Browse code 610_1 (BrowseCode::TimeAndExpensesTotals, “Uren en onkosten (Totalen)”): the totals of time, expenses and quantities in Time & Expenses per project, activity, rate and user, with the internal and external amount.

Twinfield documentation: Browse data.

  • betweenDates('teq.trs.head.date', $from, $to): the date is a criterion only.
  • teq.trs.line.type is time, expense or quantity; teq.trs.line.billable is true or false.
  • teq.trs.head.project1 is the project and project2 the activity.
  • Time & Expenses is a separate module of Twinfield: a company without it gives no rows.

Criteria: date, project, activity and user. See browse-definitions/610_1.xml and the browse data guide.

All fields of the browse definition (browse-definitions/610_1.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.office Administratie string yes
fin.trs.head.officename Adm.naam string yes
teq.trs.head.date Datum date no between
teq.trs.line.type Regeltype special: time, expense, quantity yes
teq.trs.head.project1 Project string yes between
teq.trs.head.project1name Projectnaam string yes
teq.trs.head.project2 Activiteit string yes between
teq.trs.head.project2name Activiteitsnaam string yes
teq.trs.line.rate.code Tariefcode string yes
teq.trs.line.rate.name Tariefnaam string yes
teq.trs.head.user Gebruiker string yes between
teq.trs.head.username Gebruikersnaam string yes
teq.trs.line.billable Facturabel special: false, true yes
teq.trs.line.quantity Aantallen decimal yes
teq.trs.line.valueint Bedrag intern value yes
teq.trs.line.valueext Bedrag extern value yes
$twinfield = Example::twinfield();
$year = (int) ($argv[1] ?? Example::lastYear($twinfield));
$from = new DateTimeImmutable($year . '-01-01');
$to = new DateTimeImmutable($year . '-12-31');
$query = $twinfield->browse(BrowseCode::TimeAndExpensesTotals)
->columns(
'teq.trs.head.project1',
'teq.trs.head.project2',
'teq.trs.head.user',
'teq.trs.line.type',
'teq.trs.line.rate.code',
'teq.trs.line.billable',
'teq.trs.line.quantity',
'teq.trs.line.valueint',
'teq.trs.line.valueext',
)
->betweenDates('teq.trs.head.date', $from, $to);
$result = $query->get();
echo count($result), ' row(s) from ', $from->format('Y-m-d'), ' to ', $to->format('Y-m-d'), PHP_EOL;
foreach ($result as $index => $row) {
echo sprintf(
'[%d/%d] project %s activity %s, %s, %s rate %s%s: %s, internal %s, external %s',
$index + 1,
count($result),
$row->string('teq.trs.head.project1'),
$row->nullableString('teq.trs.head.project2') ?? '-',
$row->string('teq.trs.head.user'),
$row->string('teq.trs.line.type'),
$row->nullableString('teq.trs.line.rate.code') ?? '-',
$row->string('teq.trs.line.billable') === 'true' ? ' (billable)' : '',
$row->nullableDecimal('teq.trs.line.quantity') ?? '0',
$row->amount('teq.trs.line.valueint'),
$row->amount('teq.trs.line.valueext'),
), PHP_EOL;
}
Terminal window
php examples/browse-data/610_1-time-and-expenses-totals/example.php # the last year

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

2 row(s) from 2026-01-01 to 2026-12-31
[1/2] project P0001 activity A100, EXAMPLE, time rate SENIOR (billable): 12.5, internal 625.00, external 1187.50
[2/2] project P0001 activity A200, EXAMPLE, expense rate -: 1, internal 45.00, external 45.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::TimeAndExpensesTotals)
->columns(
'teq.trs.head.project1',
'teq.trs.head.project2',
'teq.trs.head.user',
'teq.trs.line.type',
'teq.trs.line.rate.code',
'teq.trs.line.billable',
'teq.trs.line.quantity',
'teq.trs.line.valueint',
'teq.trs.line.valueext',
)
->betweenDates('teq.trs.head.date', new DateTimeImmutable('2026-01-01'), new DateTimeImmutable('2026-03-31'))
->get();

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

<columns code="610_1" optimize="true">
<column>
<field>teq.trs.head.project1</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.head.project2</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.head.user</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.line.type</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.line.rate.code</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.line.billable</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.line.quantity</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.line.valueint</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.line.valueext</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.head.date</field>
<operator>between</operator>
<from>20260101</from>
<to>20260331</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">teq.trs.head.project1</td>
<td label="" hideforuser="false" type="String">teq.trs.head.project2</td>
<td label="" hideforuser="false" type="String">teq.trs.head.user</td>
<td label="" hideforuser="false" type="String">teq.trs.line.type</td>
<td label="" hideforuser="false" type="String">teq.trs.line.rate.code</td>
<td label="" hideforuser="false" type="String">teq.trs.line.billable</td>
<td label="" hideforuser="false" type="Decimal">teq.trs.line.quantity</td>
<td label="" hideforuser="false" type="Value">teq.trs.line.valueint</td>
<td label="" hideforuser="false" type="Value">teq.trs.line.valueext</td>
</th>
<tr>
<td>P0001</td>
<td>A100</td>
<td>EXAMPLE</td>
<td name="Tijd">time</td>
<td>SENIOR</td>
<td name="Ja">true</td>
<td>12.5</td>
<td>625.00</td>
<td>1187.50</td>
<key>
<office>1000</office>
</key>
</tr>
<tr>
<td>P0001</td>
<td>A200</td>
<td>EXAMPLE</td>
<td name="Onkosten">expense</td>
<td/>
<td name="Nee">false</td>
<td>1</td>
<td>45.00</td>
<td>45.00</td>
<key>
<office>1000</office>
</key>
</tr>
</browse>

View examples/browse-data/610_1-time-and-expenses-totals/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.