no
This commit is contained in:
@@ -1,162 +0,0 @@
|
||||
// last execution: Sun Dec 18 2022 17:14:39 GMT+0100 (Midden-Europese standaardtijd)
|
||||
|
||||
$par_nascholingsjaar=2021;
|
||||
$par_open_lid_in_nieuwe_tab=true;
|
||||
$par_aantal_rijen_op_een_pagina=21;
|
||||
|
||||
$p_page_len = $par_aantal_rijen_op_een_pagina;
|
||||
|
||||
logAdd(log);
|
||||
|
||||
html = '';
|
||||
$h = '';
|
||||
|
||||
logAdd(log, "Controle op dubbel geregistreerde nascholingsvereisten voor jaar ", $par_nascholingsjaar);
|
||||
$leden = Record\FetchManyHash('Contact',
|
||||
'id, firstName, middleName, lastName, name, regiocode, dispensatie, lidnummer, datumRegistratie',
|
||||
'lastName', 'asc'
|
||||
);
|
||||
|
||||
strAdd($h, '<div class="nvkhresult">');
|
||||
$table = table\new('Voornaam', 10,
|
||||
'Achternaam', 20, 'asc',
|
||||
'Lidnummer', 10, 'center',
|
||||
'Regiocode', 10, 'center',
|
||||
'Nascholingen van lid', 20, 'center',
|
||||
'Dubbel geregistreerd', 30
|
||||
);
|
||||
|
||||
table\rowsPerPage($table, $p_page_len);
|
||||
table\filename($table, string\concatenate($par_nascholingsjaar, ' - leden met te weinig nascholing'));
|
||||
|
||||
$i = 0;
|
||||
$n = array\length($leden);
|
||||
|
||||
logAdd(log, 'leden:', $n);
|
||||
$n_onvoldoende = 0;
|
||||
$cnt_dubbelingen = 0;
|
||||
|
||||
while($i < $n,
|
||||
$lid = array\at($leden, $i);
|
||||
$r_code = string\substring(hash\get($lid, 'regiocode'), 0, 2) + 0;
|
||||
|
||||
ifThen($r_code < 30 && $r_code != 8,
|
||||
$rapport = true;
|
||||
$contact_id = hash\get($lid, 'id');
|
||||
$dispensatie = hash\get($lid, 'dispensatie');
|
||||
$lidnummer = hash\get($lid, 'lidnummer');
|
||||
$naam = hash\get($lid, 'name');
|
||||
$middlename = hash\get($lid, 'middleName');
|
||||
$firstname = hash\get($lid, 'firstName');
|
||||
$lastname = string\concatenate($middlename, ' ', hash\get($lid, 'lastName'));
|
||||
$regdat = hash\get($lid, 'datumRegistratie');
|
||||
$reg_jaar = datetime\year($regdat);
|
||||
|
||||
$contact = Entity\Get('Contact', $contact_id);
|
||||
$nascholingstotalen = Entity\GetRelated($contact, 'nascholingstotalen', 10, 'jaar', 'asc', 'jaar=', $par_nascholingsjaar);
|
||||
$m = array\length($nascholingstotalen);
|
||||
|
||||
ifThenElse($m == 0, $heeft_nt = 'nee', ifThenElse($m > 1, $heeft_nt = 'teveel', $heeft_nt = 'ja'));
|
||||
ifThen($m > 0, $nascholingstotals = array\at($nascholingstotalen, 0);$nascholingstotalen_id = attr($nascholingstotals, 'id'));
|
||||
ifThen($m == 0 && $par_nascholingsjaar < $reg_jaar, $rapport = false; $reden = 'gevraagde jaar ligt voor registratie jaar');
|
||||
ifThen($m == 0, ifThen($rapport, $reden = 'voor het gevraagde jaar geen nascholingstotaal aanwezig!'));
|
||||
ifThenElse($rapport, $opnemen = 'opnemen in rapport', $opnemen = 'niet opnemen');
|
||||
|
||||
// Nu checken of er überhaupt dubbele nascholingsrecords zijn.
|
||||
|
||||
ifThen($heeft_nt == 'ja',
|
||||
$cnt_dubbel = 0;
|
||||
$nascholingen = Entity\GetRelated($nascholingstotals, 'nascholingen1', 1000, 'name', 'asc');
|
||||
$m = array\length($nascholingen);
|
||||
//logAdd(log, 'info', $m, ' nascholingen gevonden');
|
||||
$j = 0;
|
||||
$ns_hash = Hash\New();
|
||||
while($j < $m,
|
||||
$ns = array\at($nascholingen, $j);
|
||||
$j = $j + 1;
|
||||
|
||||
$ns_id = attr($ns, 'accNascholingId');
|
||||
$ns_soort = attr($ns, 'soort');
|
||||
$ns_name = attr($ns, 'name');
|
||||
$ns_status = attr($ns, 'status');
|
||||
//logAdd(log, 'info', 'ns_id = ', $ns_id, ' - name=', attr($ns, 'name'), ' - soort=', $ns_soort, ' - status=', $ns_status);
|
||||
|
||||
ifThenElse($ns_soort != 'Vooraf aangevraagd met formulier',
|
||||
$check_dubbel = true;
|
||||
ifThen($ns_status == 'afgekeurd', $check_dubbel = false)
|
||||
,
|
||||
$check_dubbel = false
|
||||
);
|
||||
|
||||
ifThen($check_dubbel,
|
||||
$dubbel = false;
|
||||
|
||||
//logAdd(log, 'info', 'isset ', $ns_id, ' = ', hash\isset($ns_hash, $ns_id));
|
||||
ifThenElse(hash\isset($ns_hash, $ns_id),
|
||||
$cnt = hash\get($ns_hash, $ns_id) + 1
|
||||
,
|
||||
$cnt = 1
|
||||
);
|
||||
//logAdd(log, 'info', 'cnt = ', $cnt);
|
||||
$ns_hash = hash\set($ns_hash, $ns_id, $cnt);
|
||||
|
||||
ifThen($cnt == 2, $dubbel = true);
|
||||
//logAdd(log, 'info', 'ns_id - cnt = ', $cnt);
|
||||
|
||||
ifThen($dubbel,
|
||||
$ln_ns = table\link(string\concatenate('/#Nascholingstotaal/view/', $nascholingstotalen_id), 'Nascholingen');
|
||||
table\add($table,
|
||||
table\link(string\concatenate('/#Contact/view/', $contact_id), $firstname),
|
||||
table\link(string\concatenate('/#Contact/view/', $contact_id), $lastname),
|
||||
string\concatenate(' ', $lidnummer),
|
||||
string\concatenate(' ', $regiocode),
|
||||
$ln_ns,
|
||||
table\link(string\concatenate('/#Nascholing/view/', $ns_id), $ns_name)
|
||||
);
|
||||
$cnt_dubbel = $cnt_dubbel + 1;
|
||||
);
|
||||
);
|
||||
);
|
||||
|
||||
ifThenElse($cnt_dubbel > 0,
|
||||
logAdd(log, 'warning', 'lid: ', $naam, ', lidnummer: ', $lidnummer, ', nascholingen: ', $m, ' - heeft dubbel opgevoerde nascholingsrecords');
|
||||
$cnt_dubbelingen = $cnt_dubbelingen + 1;
|
||||
,
|
||||
logAdd(log, 'info', 'lid: ', $naam, ', lidnummer: ', $lidnummer, ', nascholingen: ', $m, ' - heeft geen dubbel opgevoerde nascholingsrecords');
|
||||
);
|
||||
);
|
||||
|
||||
ifThen($heeft_nt == 'nee',
|
||||
logAdd(log, 'info', 'lid: ', $naam, ', lidnummer: ', $lidnummer, ' - heeft geen nascholingsjaar ', $par_nascholingsjaar);
|
||||
);
|
||||
|
||||
ifThen($heeft_nt == 'teveel',
|
||||
logAdd(log, 'warning', 'lid: ', $naam, ', lidnummer: ', $lidnummer, ' - heeft teveel nascholingsjaar ', $par_nascholingsjaar, ' records');
|
||||
table\add($table,
|
||||
table\link(string\concatenate('/#Contact/view/', $contact_id), $firstname),
|
||||
table\link(string\concatenate('/#Contact/view/', $contact_id), $lastname),
|
||||
string\concatenate(' ', $lidnummer),
|
||||
string\concatenate(' ', $regiocode),
|
||||
'meerdere nascholingstotalen voor zelfde jaar',
|
||||
''
|
||||
);
|
||||
);
|
||||
);
|
||||
|
||||
$i = $i + 1
|
||||
);
|
||||
|
||||
$table_html = table\toHtml($table);
|
||||
//$table_html = string\replace($table_html, 'title="%RED%', 'title="');
|
||||
//$table_html = string\replace($table_html, '%END"', '"');
|
||||
//$table_html = string\replace(string\replace($table_html, '%RED%', '<span style="color:red;">'), '%END%', '</span>');
|
||||
|
||||
strAdd($h, '<h1>', 'Leden met <b>dubbele</b> nascholingsboekingen voor jaar ', toString($par_nascholingsjaar), '</h1>');
|
||||
$msg = string\concatenate('In totaal ', $cnt_dubbelingen, ' leden met dubbel opgevoerde nascholingen gevonden.');
|
||||
strAdd($h, $msg);
|
||||
ifThen($cnt_dubbelingen > 0, strAdd($h, $table_html));
|
||||
strAdd($h, '</div>');
|
||||
|
||||
html=$h;
|
||||
|
||||
logAdd(log, 'warning', $msg);
|
||||
Reference in New Issue
Block a user