// last execution: Fri Apr 25 2025 10:06:42 GMT+0200 (Midden-Europese zomertijd)
$par_Regels_per_pagina=18;
$par_Alleen_buitenlandse=false;
$par_Excel_Bestandsnaam_voorzien_van_datum=true;
$par_Excel_Bestandsnaam='CZ Kwartaallijst';
$p_filename = $par_Excel_Bestandsnaam;
ifThen($par_Excel_Bestandsnaam_voorzien_van_datum,
$now = datetime\today();
$fmt = datetime\format($now, 'Europe/Amsterdam', 'DD-MM-YYYY');
$p_filename = string\concatenate($p_filename, ' ', $fmt);
);
$p_page_len = $par_Regels_per_pagina;
ifThen($p_page_len < 1, $p_page_len = 10;);
$p_no_nl = $par_Alleen_buitenlandse;
html = '';
logAdd(log);
$rows = record\fetchManyHash('Contact',
'id, agbcode, initialsName, middleName, lastName, addressStreet, addressPostalCode, addressCity, addressCountry, regiocode',
'lastName', 'asc');
$n = array\length($rows);
logAdd(log, 'Contacts read: ', $n);
$h = '';
strAdd($h, '
');
$table = table\new('Persoonlijk AGB',
'VolledigeNaam',
'Adres',
'Postcode',
'Woonplaats', 'asc',
'Land'
);
table\rowsPerPage($table, $p_page_len);
table\filename($table, $p_filename);
logAdd(log, 'Rows Per Page: ', $p_page_len);
logAdd(log, 'Filename: ', $p_filename);
$i = 0;
while($i < $n,
$e = array\at($rows, $i);
$regiocode = hash\get($e, 'regiocode');
$agbcode = hash\get($e, 'agbcode');
ifThenElse($agbcode == null, $agbcode = '';, $agbcode = string\trim($agbcode););
$regiocode = $regiocode + 0;
$meenemen = $regiocode < 30 && $agbcode != '';
ifThen($meenemen,
$initials = hash\get($e, 'initialsName');
$voorvoegsel = hash\get($e, 'middleName');
$naam = hash\get($e, 'lastName');
$adres = hash\get($e, 'addressStreet');
$postcode = hash\get($e, 'addressPostalCode');
$plaats = hash\get($e, 'addressCity');
$country = hash\get($e, 'addressCountry');
ifThen($country == null || $country == '', $country = 'Nederland');
$report = true;
ifThen($country == 'Nederland' && $p_no_nl, $report = false;);
ifThen($voorvoegsel, $voorvoegsel = string\concatenate($voorvoegsel, ' '););
$fullname = string\concatenate($initials, ' ', $voorvoegsel, $naam);
$agbcode = string\replace($agbcode, '/', '');
ifThen($report,
table\add($table,
$agbcode, $fullname, $adres, $postcode, $plaats, $country
);
);
);
$i = $i + 1;
);
strAdd($h, table\toHtml($table));
strAdd($h, '
');
html=$h;