Time & Expenses totals per week (651_1)
Browse code 651_1 (BrowseCode::TimeAndExpensesTotalsPerWeek, “Uren en onkosten (Totalen per week)”): the hours, expenses and quantities of Time & Expenses summed per week, with the same criteria as 650_1.
Twinfield documentation: Browse data.
teq.trs.head.yearandteq.trs.head.weekas columns give one row per week; adduserorproject1to split them further.betweenDates('teq.trs.head.date', $from, $to): the date is a criterion only. So isteq.trs.head.yearweek(2026/12).teq.trs.line.timevalueextis the external value of the hours,timevalueintthe internal value.- Time & Expenses is a separate module of Twinfield: a company without it gives no rows.
Criteria: year/week, date, user, cost centre of the user, hour code, authoriser, customer, project, cost centre of the project, activity and status. See browse-definitions/651_1.xml and the browse data guide.
Fields
Section titled “Fields”All fields of the browse definition (browse-definitions/651_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.week |
Week | long | yes | |
teq.trs.head.yearweek |
Jaar/week (JJJJ/WW) | 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::TimeAndExpensesTotalsPerWeek) ->columns( 'teq.trs.head.year', 'teq.trs.head.week', '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 week %d, %s, project %s: %s h, %s, expenses %s', $index + 1, count($result), $row->int('teq.trs.head.year'), $row->int('teq.trs.head.week'), $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;}php examples/browse-data/651_1-time-and-expenses-totals-per-week/example.php # the last yearAdd TWINFIELD_DEBUG=1 to see the SOAP requests and responses.
2 row(s) from 2026-01-01 to 2026-12-31[1/2] 2026 week 10, EXAMPLE, project P0001: 32 h, 3040.00, expenses 45.00[2/2] 2026 week 11, EXAMPLE, project P0001: 24.5 h, 2327.50, expenses 0.00What 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.
Compose the browse request and send it
Section titled “Compose the browse request and send it”Twinfield documentation: Browse data: Compose the browse request and send it.
$twinfield->browse(BrowseCode::TimeAndExpensesTotalsPerWeek) ->columns( 'teq.trs.head.year', 'teq.trs.head.week', '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="651_1" optimize="true"> <column> <field>teq.trs.head.year</field> <visible>true</visible> </column> <column> <field>teq.trs.head.week</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.week</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>10</td> <td>EXAMPLE</td> <td>P0001</td> <td>32</td> <td>3040.00</td> <td>45.00</td> <key> <office>1000</office> </key> </tr> <tr> <td>2026</td> <td>11</td> <td>EXAMPLE</td> <td>P0001</td> <td>24.5</td> <td>2327.50</td> <td>0.00</td> <key> <office>1000</office> </key> </tr></browse>Source
Section titled “Source”View examples/browse-data/651_1-time-and-expenses-totals-per-week/example.php on GitHub.
Twinfield and Wolters Kluwer are trademarks of Wolters Kluwer. Their names and logos are used only to refer to their products.