Files
2026-08-28 12:28:39 +02:00

124 lines
3.9 KiB
JavaScript

// last execution: Fri Dec 04 2020 19:25:55 GMT+0100 (Midden-Europese standaardtijd)
$par_Rapporteer_alleen_de_lege_Praktijk_AGBs=true;
$par_Maximum_aantal_rijen_per_pagina=12;
$par_Valide_AGB_Prefixen='84,90';
html = '';
logAdd(log);
$p_agb_report = $par_Rapporteer_alleen_de_lege_Praktijk_AGBs;
$p_page_len = $par_Maximum_aantal_rijen_per_pagina;
ifThen($p_page_len < 1,
$p_page_len = 10;
);
$agb_prefixes=string\replace($par_Valide_AGB_Prefixen, ',', '|');
$re_agb = string\concatenate('/^(', $agb_prefixes, ')[\/][0-9]{6,6}$/');
$rows = record\fetchManyHash('Contact',
'id, agbcode, firstName, middleName, lastName, emailAddress, regiocode',
'lastName', 'asc');
$n = array\length($rows);
logAdd(log, 'Contacts read: ', $n);
$h = '';
$table = table\new('AGB Persoonlijk', 10,
'AGB Praktijk', 10,
'Voornaam', 10, 'ellipsis',
'Achternaam', 20, 'asc', 'ellipsis',
'Praktijknaam', 25, 'ellipsis',
'Regiocode', 5, 'center',
'eMail', 20, 'ellipsis'
);
table\rowsPerPage($table, $p_page_len);
$i = 0;
while($i < $n,
$e = array\at($rows, $i);
$regiocode = hash\get($e, 'regiocode');
$r_code = $regiocode + 0;
$meenemen = $r_code < 30;
$naam = hash\get($e, 'lastName');
ifThen($meenemen,
$id = hash\get($e, 'id');
$praktijk_id = record\findRelatedOne('Contact', $id, 'accounts', 'type');
ifThenElse($praktijk_id,
$praktijk_rows = record\fetchManyHash('Account', 'naam, agbcode, type', 'type', 'asc', 'id=', $praktijk_id);
$praktijk_row = array\at($praktijk_rows, 0);
$praktijk_naam = hash\get($praktijk_row, 'naam');
$praktijk_agbcode = hash\get($praktijk_row, 'agbcode');
,
$praktijk_naam = '';
$praktijk_agbcode = '';
);
$style = '';
$report = true;
$problem = false;
ifThenElse($praktijk_agbcode != '' && $praktijk_agbcode != null,
$report = !$p_agb_report;
,
$problem = true;
ifThen(!$p_agb_report,
$style = 'background:#f78c81;';
);
);
$agbcode = hash\get($e, 'agbcode');
ifThen($agbcode == '' || $agbcode == null,
$problem = true;
$report = true;
ifThen(!$p_agb_report,
$style = 'background:#f78c81;';
);
);
ifThen(!$problem,
ifThen(string\match($agbcode, $re_agb) == null,
$style = 'background:#faa75f;';
$report = true;
);
ifThen(string\match($praktijk_agbcode, $re_agb) == null,
$style = 'background:#faa75f;';
$report = true;
);
);
ifThen($report,
$voornaam = hash\get($e, 'firstName');
$voorvoegsel = hash\get($e, 'middleName');
$email = hash\get($e, 'emailAddress');
ifThen($voorvoegsel,
$naam = string\concatenate($naam, ', ', $voorvoegsel);
);
table\add($table, $agbcode, $praktijk_agbcode,
$voornaam,
table\link(string\concatenate('/#Contact/view/', $id), $naam),
$praktijk_naam,
$regiocode, $email
);
table\style($table, $style);
);
);
$i = $i + 1;
);
strAdd($h, table\toHtml($table));
strAdd($h, '</div>');
html=$h;