Skip to content

Time & Expenses totals per period (652_1)

Browse code 652_1 (BrowseCode::TimeAndExpensesTotalsPerPeriod, “Uren en onkosten (Totalen per periode)”): the hours, expenses and quantities of Time & Expenses summed per period, with the same criteria as 650_1.

Twinfield documentation: Browse data.

  • teq.trs.head.year and teq.trs.head.period as columns give one row per period; add user or project1 to split them further.
  • betweenDates('teq.trs.head.date', $from, $to): the date is a criterion only. So is teq.trs.head.yearperiod (2026/03).
  • teq.trs.line.timevalueext is the external value of the hours, timevalueint the internal value.
  • Time & Expenses is a separate module of Twinfield: a company without it gives no rows.

Criteria: year/period, date, user, cost centre of the user, hour code, authoriser, customer, project, cost centre of the project, activity and status. See browse-definitions/652_1.xml and the browse data guide.

All fields of the browse definition (browse-definitions/652_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.year Jaar long yes
teq.trs.head.period Periode long yes
teq.trs.head.yearperiod Jaar/periode (JJJJ/PP) string no between
teq.trs.head.date Datum date no between
teq.trs.head.user Gebruiker string yes between
teq.trs.head.username Gebruikersnaam string yes
teq.trs.head.usercostcentre Kostenplaatsgebruiker string yes between
teq.trs.head.usercostcentrename Naam kostenplaatsgebruiker string yes
teq.trs.head.code Urencode string yes between
teq.trs.head.authoriser Autorisator string yes between
teq.trs.head.authorisername Naam autorisator string yes
teq.trs.head.customer Klant string yes between
teq.trs.head.customername Klantnaam string yes
teq.trs.head.project1 Project string yes between
teq.trs.head.project1name Projectnaam string yes
teq.trs.head.project1costcentre Projectkostenplaats string yes between
teq.trs.head.project1costcentrename Project kostenplaatsnaam string yes
teq.trs.head.project2 Activiteit string yes between
teq.trs.head.project2name Activiteitsnaam string yes
teq.trs.head.status Urenstatus special: entered, proposed, authorised, rejected, inuse, journalised yes equal
teq.trs.head.curcode Valuta string yes
teq.trs.line.time Uren decimal yes
teq.trs.line.timevalueint Uren intern value yes
teq.trs.line.timevalueext Uren extern value yes
teq.trs.line.time_nb Uren niet facturabel decimal yes
teq.trs.line.timevalueint_nb Uren intern niet facturabel value yes
teq.trs.line.timevalueext_nb Uren extern niet facturabel value yes
teq.trs.line.expense Onkosten value yes
teq.trs.line.expense_nb Onkosten niet facturabel value yes
teq.trs.line.quantity Aantallen decimal yes
teq.trs.line.qtyvalueint Aantallen intern value yes
teq.trs.line.qtyvalueext Aantallen extern value yes
teq.trs.line.quantity_nb Aantallen niet facturabel decimal yes
teq.trs.line.qtyvalueint_nb Aantallen intern niet facturabel value yes
teq.trs.line.qtyvalueext_nb Aantallen extern niet facturabel 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::TimeAndExpensesTotalsPerPeriod)
->columns(
'teq.trs.head.year',
'teq.trs.head.period',
'teq.trs.head.user',
'teq.trs.head.project1',
'teq.trs.line.time',
'teq.trs.line.timevalueext',
'teq.trs.line.expense',
)
->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] %d period %d, %s, project %s: %s h, %s, expenses %s',
$index + 1,
count($result),
$row->int('teq.trs.head.year'),
$row->int('teq.trs.head.period'),
$row->string('teq.trs.head.user'),
$row->string('teq.trs.head.project1'),
$row->nullableDecimal('teq.trs.line.time') ?? '0',
$row->amount('teq.trs.line.timevalueext'),
$row->amount('teq.trs.line.expense'),
), PHP_EOL;
}
Terminal window
php examples/browse-data/652_1-time-and-expenses-totals-per-period/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] 2026 period 2, EXAMPLE, project P0001: 120 h, 11400.00, expenses 90.00
[2/2] 2026 period 3, EXAMPLE, project P0001: 96.5 h, 9167.50, expenses 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::TimeAndExpensesTotalsPerPeriod)
->columns(
'teq.trs.head.year',
'teq.trs.head.period',
'teq.trs.head.user',
'teq.trs.head.project1',
'teq.trs.line.time',
'teq.trs.line.timevalueext',
'teq.trs.line.expense',
)
->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="652_1" optimize="true">
<column>
<field>teq.trs.head.year</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.head.period</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.head.user</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.head.project1</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.line.time</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.line.timevalueext</field>
<visible>true</visible>
</column>
<column>
<field>teq.trs.line.expense</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="Number">teq.trs.head.year</td>
<td label="" hideforuser="false" type="Number">teq.trs.head.period</td>
<td label="" hideforuser="false" type="String">teq.trs.head.user</td>
<td label="" hideforuser="false" type="String">teq.trs.head.project1</td>
<td label="" hideforuser="false" type="Decimal">teq.trs.line.time</td>
<td label="" hideforuser="false" type="Value">teq.trs.line.timevalueext</td>
<td label="" hideforuser="false" type="Value">teq.trs.line.expense</td>
</th>
<tr>
<td>2026</td>
<td>2</td>
<td>EXAMPLE</td>
<td>P0001</td>
<td>120</td>
<td>11400.00</td>
<td>90.00</td>
<key>
<office>1000</office>
</key>
</tr>
<tr>
<td>2026</td>
<td>3</td>
<td>EXAMPLE</td>
<td>P0001</td>
<td>96.5</td>
<td>9167.50</td>
<td>45.00</td>
<key>
<office>1000</office>
</key>
</tr>
</browse>

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