Search offices
Searches offices (companies) by name, and counts how many of them are not in a tax group.
offices()->search() uses the Twinfield Finder and returns OfficeSummary objects, like list(). Every method returns a new search, so a base search can be reused:
search('10*'): the pattern;*matches anything,?one character.inCode(),inName()orinCodeAndName()(default): where the pattern must match.withoutTaxGroup(): only offices that are not in a fiscal unity (tax group), are no template and have no VAT declaration in progress. These are the offices that can join a fiscal unity.limit()andoffset()for paging,get()for one page,all()for all results andcount()for the number of results.
$twinfield = Example::twinfield();
$pattern = $argv[1] ?? '*B.V.*';
$search = $twinfield->offices()->search($pattern)->inName();
$page = $search->limit(5)->get();
echo $page->totalRows, ' offices with a name like "', $pattern, '", first ', count($page), ':', PHP_EOL;
foreach ($page as $office) { echo $office->code, ' ', $office->name, PHP_EOL;}
// Offices that can join a fiscal unity: not in a tax group, no template, no VAT declaration in progress.echo $search->withoutTaxGroup()->count(), ' of them are not in a tax group.', PHP_EOL;php examples/offices/search-offices/example.phpphp examples/offices/search-offices/example.php '*Holding*'12 offices with a name like "*B.V.*", first 5:1000 Example Holding B.V.1001 Example Retail B.V.1002 Example Services B.V.1005 Example Logistics B.V.1008 Example Consultancy B.V.9 of them are not in a tax group.Source
Section titled “Source”View examples/offices/search-offices/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.