scripts in de database
This commit is contained in:
@@ -0,0 +1 @@
|
||||
Testscript voor EspoCRM Upgrades (voor systeembeheer)
|
||||
@@ -0,0 +1 @@
|
||||
66ed76ba5e58baf04
|
||||
@@ -0,0 +1,464 @@
|
||||
// last execution: Tue Oct 01 2024 15:18:51 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
$par_hooked_formula_test=true;
|
||||
$par_test_pdf_and_mail=true;
|
||||
$par_espocrm_version=list('8', '-', '6', '7');
|
||||
$par_tabel_rijen_per_pagina=20;
|
||||
|
||||
$espocrm_ver = array\at($par_espocrm_version, 0);
|
||||
$aantal_rijen_op_een_pagina = $par_tabel_rijen_per_pagina;
|
||||
|
||||
// Constanten
|
||||
|
||||
$h_col = "#b3ccff";
|
||||
$hh_col = "#b3ffb3";
|
||||
$t_col = "#ffff99";
|
||||
$test_email = 'hans@dijkewijk.nl';
|
||||
|
||||
|
||||
// Test script
|
||||
|
||||
log('warning', '00 Testscript Upgrade');
|
||||
logAdd(log);
|
||||
logAdd(log, $hh_col, '00 Testscript Upgrade');
|
||||
|
||||
ifThenElse($espocrm_ver == '-',
|
||||
logAdd(log, 'info', 'Log cleared, run script with other version than "-"');
|
||||
html = '';
|
||||
logAdd(log, 'info', 'HTML Report cleared');
|
||||
,
|
||||
|
||||
// Hooked formula tests
|
||||
|
||||
ifThen($par_hooked_formula_test,
|
||||
logAdd(log, $hh_col, 'Testing Hooked Formulas');
|
||||
|
||||
// Record\FetchManyHash
|
||||
|
||||
logAdd(log, $h_col, 'Record\FetchManyHash');
|
||||
|
||||
$rows = record\FetchManyHash('Contact', 'id, lidnummer, name, regiocode, datumRegistratie', 'name', 'asc');
|
||||
$n = array\length($rows);
|
||||
logAdd(log, 'info', 'FetchManyHash: ', $n);
|
||||
|
||||
$rows = record\FetchManyHash('Contact', 'id, lidnummer, name', 'name', 'asc', 'lidnummer=', 1935);
|
||||
$n = array\length($rows);
|
||||
logAdd(log, 'info', 'FetchManyHash: ', $n);
|
||||
|
||||
$contact = array\at($rows, 0);
|
||||
$contact_id = hash\get($contact, 'id');
|
||||
logAdd(log, 'info', 'id = ', hash\get($contact, 'id'));
|
||||
logAdd(log, 'info', 'contact name: ', hash\get($contact, 'name'), ' nummer: ', hash\get($contact, 'lidnummer'), ', id = ', $contact_id);
|
||||
|
||||
// Record\FindMany
|
||||
|
||||
logAdd(log, 'warning', 'Record\FindMany, While, Entity\Get, Attr');
|
||||
|
||||
$rows = record\FindMany('Contact', 'name', 'asc', 'lidnummer>=', 1930, 'lidnummer<=', 1940);
|
||||
$n = array\length($rows);
|
||||
logAdd(log, 'info', 'FetchManyHash: ', $n);
|
||||
|
||||
$i = 0;
|
||||
while($i < $n,
|
||||
$c = Entity\Get('Contact', array\at($rows, $i));
|
||||
logAdd(log, 'info', '--contact: ', attr($c, 'name'), ', nummer: ', attr($c, 'lidnummer'));
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
// EntityGroup
|
||||
logAdd(log, $h_col, 'EntityGroup');
|
||||
// Entity Functions
|
||||
logAdd(log, $t_col, 'Entity\GetMany, SetAttr');
|
||||
$entities = Entity\GetMany('Contact', 10, 'lidnummer', 'asc', 'lidnummer=', 1935);
|
||||
$c = array\at($entities, 0);
|
||||
$id = attr($c, 'id');
|
||||
logAdd(log, 'info', 'contact c: id = ', $id);
|
||||
logAdd(log, $t_col, 'Entity\Get');
|
||||
$c_orig = Entity\Get('Contact', $id);
|
||||
logAdd(log, 'info', '$c_orig: ', attr($c_orig, 'lidnummer'));
|
||||
logAdd(log, 'info', '--fetched entity:', attr($c, 'lidnummer'), ' opmerking: ', attr($c, 'description'));
|
||||
$s = string\concatenate('opmerking nieuw: ', datetime\now());
|
||||
setAttr($c, 'description', $s);
|
||||
logAdd(log, $t_col, 'Entity\Save');
|
||||
logAdd(log, 'info', '--updated entity:', attr($c, 'lidnummer'), ' opmerking: ', attr($c, 'description'));
|
||||
entity\save($c);
|
||||
logAdd(log, 'info', 'entity saved');
|
||||
logAdd(log, $t_col, 'Entity\GetRelated');
|
||||
$rel = Entity\GetRelated($c, 'dossierdocumenten', 1000, 'name', 'asc');
|
||||
$i = 0;
|
||||
while($i < array\length($rel),
|
||||
$account = array\at($rel, $i);
|
||||
logAdd(log, 'info', $i, ': ', attr($account, 'name'));
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
logAdd(log, $t_col, 'Entity\This');
|
||||
$e = entity\this();
|
||||
logAdd(log, 'info', '--Entity\This->name = ', attr($e, 'name'));
|
||||
|
||||
// Config
|
||||
logAdd(log, $h_col, 'Config');
|
||||
logAdd(log, 'Config functions - clearing cache');
|
||||
ConfigClearCache();
|
||||
logAdd(log, 'config_exists hoi: ', ConfigExists('hoi'));
|
||||
logAdd(log, 'config_exists visitatie-geldigheid-in-jaren: ', ConfigExists('visitatie-geldigheid-in-jaren'));
|
||||
ConfigInc('visitatie-geldigheid-in-jaren');
|
||||
logAdd(log, 'config_get visitatie-geldigheid-in-jaren: ', ConfigGet('visitatie-geldigheid-in-jaren'));
|
||||
ConfigSet('visitatie-geldigheid-in-jaren', 5);
|
||||
logAdd(log, 'config_get visitatie-geldigheid-in-jaren: ', ConfigGet('visitatie-geldigheid-in-jaren'));
|
||||
|
||||
// StrAdd
|
||||
logAdd(log, $h_col, 'StrAdd functions');
|
||||
$str = "Hoi";
|
||||
logAdd(log, $str);
|
||||
strAdd($str, ' Hans');
|
||||
logAdd(log, 'warning', $str);
|
||||
|
||||
// exec
|
||||
logAdd(log, $h_col, 'Exec functions');
|
||||
$script = '$i = $i +1;logAdd(log, "increasing value to ", $i)';
|
||||
$i = 0;
|
||||
Exec($script);
|
||||
Exec($script);
|
||||
|
||||
// Conversion
|
||||
logAdd(log, $h_col, 'Conversion');
|
||||
$a = '20';
|
||||
logAdd(log, '(int) $a = ', toInt($a));
|
||||
logAdd(log, '(double) $a = ', toDouble($a));
|
||||
$b = toDouble($a);
|
||||
$b = $b + 0.1;
|
||||
logAdd(log, '(string) $b = ', toString($b));
|
||||
|
||||
// To Json file
|
||||
logAdd(log, $h_col, 'ToJsonFile');
|
||||
logAdd(log, 'toJsonFile: ', toJsonFile('000_upgrade_test.json', $c));
|
||||
|
||||
// Diff
|
||||
logAdd(log, 'warning', 'Diff');
|
||||
logAdd(log, 'diff: ', Diff($c_orig, $c));
|
||||
|
||||
// ArrayGroup
|
||||
logAdd(log, $h_col, 'ArrayGroup');
|
||||
logAdd(log, $t_col, 'Array\Set');
|
||||
$a = list(10, 20, 30);
|
||||
logAdd(log, 'info', '$a[1] = ', array\at($a, 1));
|
||||
$a1 = array\at($a, 1) * 2.3;
|
||||
logAdd(log, 'info', '$a1 = ', $a1);
|
||||
$a = array\set($a, 1, $a1);
|
||||
logAdd(log, 'info', '$a[1] = ', array\at($a, 1));
|
||||
|
||||
// ExtGroup
|
||||
logAdd(log, $h_col, 'ExtGroup');
|
||||
logAdd(log, $t_col, 'Ext\Htmlize');
|
||||
$body = '<html><head></head><body>Beste {{name}},<br><br>Dit is een test voor {{today}}.</body></html>';
|
||||
logAdd(log, 'info', $body);
|
||||
$body = ext\htmlize($body, 'Contact', attr($c, 'id'));
|
||||
logAdd(log, 'info', $body);
|
||||
|
||||
logAdd(log, $t_col, 'Ext\Begin, Ext\Commit');
|
||||
Ext\Begin();
|
||||
Entity\Save($c);
|
||||
Entity\Save($c);
|
||||
Ext\Commit();
|
||||
|
||||
logAdd(log, $t_col, 'Ext\CopyFile');
|
||||
$icons = Entity\GetMany('StandaardIcon', 1, 'name', 'asc');
|
||||
$icon_doc = array\at($icons, 0);
|
||||
$file_id = attr($icon_doc, 'iconId');
|
||||
logAdd(log, 'info', 'Standaard Icon = ', attr($icon_doc, 'name '), ', File Id = ', $file_id);
|
||||
|
||||
$file_id_copy = Ext\CopyFile($file_id, Entity\This());
|
||||
logAdd(log, 'info', 'Copied Attachement = ', $file_id_copy);
|
||||
|
||||
logAdd(log, 'info', 'Deleting created attachement');
|
||||
//Record\Delete('Attachment', $file_id_copy); // Vanaf EspoCRM 7.4
|
||||
|
||||
ifThen($par_test_pdf_and_mail,
|
||||
// ExtGroup\PdfGroup
|
||||
logAdd(log, $h_col, 'Ext\PdfGroup');
|
||||
logAdd(log, $t_col, 'Ext\Pdf\PdfFillIn');
|
||||
log('warning', 'Ext\Pdf\PdfFillIn');
|
||||
$visitatie_formulier_id = configGet('visitatie-formulier');
|
||||
$formulier_id = $visitatie_formulier_id;
|
||||
$lid = $c;
|
||||
log('warning', 'Lid: ', attr($lid, 'lidnummer'));
|
||||
$praktijken = Entity\GetRelated($c, 'accounts', 1, 'name', 'asc');
|
||||
log('warning', 'praktijken: ', array\length($praktijken));
|
||||
$pr = array\at($praktijken, 0);
|
||||
$lid_id = attr($c, 'contact_id');
|
||||
$lid_nr = attr($c, 'lidnummer');
|
||||
$lid_name = attr($c, 'name');
|
||||
logAdd(log, 'warning', '$lid_name = ', $lid_name);
|
||||
log('warning', '$lid_name = ', $lid_name);
|
||||
$form_out = string\concatenate('visitatie-vragenlijst-', $lid_nr, '.pdf');
|
||||
$visitatiedatum = '27-08-2024';
|
||||
$two_weeks_before_visitatiedatum = '01-08-2024';
|
||||
$visitatietijdstip = '12:03';
|
||||
$visitatienummer = '12345';
|
||||
$visiteurname = 'Liesbeth Kruyswijk';
|
||||
$nvkh_afzender = 'sysadm@nvkh.nl';
|
||||
$visitatie_wacht_dagen = 10;
|
||||
logAdd(log, 'info', 'visitatie vragenformulier avar document : ', $form_out);
|
||||
|
||||
$attach_id = ext\pdf\fillin('Contact', $lid_id, $formulier_id, $form_out,
|
||||
'naam_homeopaat', attr($lid, 'name'),
|
||||
'naam_gevisiteerde', attr($lid, 'name'),
|
||||
'AVAR_Visitatienummer', $visitatie_nummer,
|
||||
'ondertekening_naam_gevisiteerde', attr($lid, 'name'),
|
||||
'email_homeopaat', $email,
|
||||
'naam_praktijk', attr($pr, 'naam'),
|
||||
'agb_praktijk', attr($pr, 'agbcode'),
|
||||
'rbcz_nummer', attr($lid, 'rbcznummer'),
|
||||
'nvkh_nummer', attr($lid, 'lidnummer'),
|
||||
'adres_praktijk_straat', attr($pr, 'shippingAddressStreet'),
|
||||
'adres_praktijk_postcode', attr($pr, 'shippingAddressPostalCode'),
|
||||
'adres_praktijk_plaats', attr($pr, 'shippingAddressCity'),
|
||||
'agb_persoonlijk', attr($lid, 'agbcode'),
|
||||
'datum_mbk_of_big', $mbkdatum,
|
||||
'datum_vog', $vogdatum,
|
||||
'email_retouradres', $retouradres,
|
||||
'tel_prive', attr($lid, 'phoneNumber'),
|
||||
'tel_praktijk', attr($pr, 'phoneNumber'),
|
||||
'websites', attr($pr, 'website'),
|
||||
'datum_diploma_vakopleiding', $diplomadatum,
|
||||
'bijscholingsdagen_laatste_jaren', $bijscholing,
|
||||
'datum_nascholing_big', 'Nvt',
|
||||
'datum_visitatie', $visitatiedatum,
|
||||
'tijdstip_visitatie', $visitatietijdstip,
|
||||
'AVAR_Visitatienummer', $visitatienummer
|
||||
);
|
||||
logAdd(log, 'info', 'attachment id :', $attach_id);
|
||||
|
||||
$body = configGet('visitatie-informatie-email');
|
||||
$scr_fnln = configGet('script-to-firstname-lastname');
|
||||
|
||||
$param_name = $lid_name;
|
||||
logAdd(log, 'info', 'lid: ', $param_name);
|
||||
exec($scr_fnln);
|
||||
$lid_name = $val_fn_ln;
|
||||
logAdd(log, 'info', 'lid_name: ', $lid_name);
|
||||
|
||||
$param_name = $visiteur_name;
|
||||
exec($scr_fnln);
|
||||
$visiteur_name = $val_fn_ln;
|
||||
|
||||
$emailadres = $test_email;
|
||||
$secretariaat_email = 'secretariaat@nvkh.nl';
|
||||
|
||||
$visitatie_dt = datetime\format(datetime\now(), 'Europe/Amsterdam', 'DD/MM/YYYY');
|
||||
logAdd(log, 'repl1');log('warning', 'repl1');
|
||||
$body = string\replace($body, '{{visitatie-datum}}', $visitatie_dt);
|
||||
logAdd(log, 'repl2');log('warning', 'repl2');
|
||||
$body = string\replace($body, '{{visitatie-tijdstip}}', $visitatietijdstip);
|
||||
logAdd(log, 'repl3');log('warning', 'repl3');
|
||||
$body = string\replace($body, '{{visitatie-nummer}}', $visitatienummer);
|
||||
logAdd(log, 'repl4');log('warning', 'repl4');
|
||||
$body = string\replace($body, '{{nvkh-afzender}}', $nvkh_afzender);
|
||||
logAdd(log, 'repl5');log('warning', 'repl5');
|
||||
$body = string\replace($body, '{{visiteur}}', $visiteur_name);
|
||||
logAdd(log, 'repl6');log('warning', 'repl6');
|
||||
$body = string\replace($body, '{{wacht-dagen}}', string\concatenate('', $visitatie_wacht_dagen));
|
||||
logAdd(log, 'repl7');log('warning', 'repl7');
|
||||
$body = string\replace($body, '{{retourdatum}}', $two_weeks_before_visitatiedatum);
|
||||
logAdd(log, 'repl8');log('warning', 'repl8');
|
||||
$body = string\replace($body, '{{secretariaat-adres}}', $secretariaat_email);
|
||||
logAdd(log, 'repl9');log('warning', 'repl9');
|
||||
$body = string\replace($body, '{{lid-naam}}', $lid_name);
|
||||
logAdd(log, 'replA');log('warning', 'replA');
|
||||
$body = ext\htmlize($body, 'Contact', attr($lid, 'id'));
|
||||
|
||||
$userId = env\userAttribute('id');
|
||||
|
||||
$subject = 'Upgrade Test PdfFillIn {{datum}}';
|
||||
$subject = string\replace($subject, '{{datum}}', $visitatiedatum);
|
||||
|
||||
$emailId = record\create('Email',
|
||||
'subject', $subject,
|
||||
'body', $body,
|
||||
'to', $emailadres,
|
||||
'attachmentsIds', list($attach_id),
|
||||
'assignedUser', $userId,
|
||||
'isUser', true,
|
||||
'parentType', 'Contact',
|
||||
'parentId', $lid_id
|
||||
);
|
||||
ext\email\send($emailId);
|
||||
);
|
||||
|
||||
// GlobalGroup
|
||||
|
||||
$key = 'upgrade-test-script-global-key';
|
||||
logAdd(log, 'info', 'ConfigGet for key "', $key, '"');
|
||||
$cg = ConfigGet($key);
|
||||
ifThenElse($cg != 0,
|
||||
Global\Set($key, $cg),
|
||||
Global\UnSet($key)
|
||||
);
|
||||
logAdd(log, $h_col, 'GlobalGroup');
|
||||
logAdd(log, $t_col, 'Global\IsSet');
|
||||
$is = Global\IsSet($key);
|
||||
ifThenElse($is, $is = 'yes', $is = 'no');
|
||||
logAdd(log, 'info', $key, ' iset = ', $is);
|
||||
ifThenElse($is == 'yes',
|
||||
logAdd(log, $t_col, 'Global\Get');
|
||||
$v = Global\Get($key);
|
||||
$v = $v + 1;
|
||||
logAdd(log, $t_col, 'Global\Set');
|
||||
Global\Set($key, $v);
|
||||
,
|
||||
logAdd(log, 'info', 'initializing ', $key, ' to 1');
|
||||
$v = 1;
|
||||
logAdd(log, $t_col, 'Global\Set');
|
||||
Global\Set($key, $v);
|
||||
);
|
||||
logAdd(log, 'info', 'Key value: ', $key, ' = ', Global\Get($key));
|
||||
ifThen($v > 3,
|
||||
logAdd(log, 'info', 'clearing ', $key);
|
||||
logAdd(log, $t_col, 'Global\UnSet');
|
||||
Global\UnSet($key);
|
||||
);
|
||||
ifThenElse(Global\IsSet($key),
|
||||
logAdd(log, 'info', $key, ' is still set');
|
||||
ConfigSet($key, $v);
|
||||
logAdd(log, 'warning', 'Run this test another time!');
|
||||
,
|
||||
logAdd(log, 'info', $key, ' is not set anymore');
|
||||
ConfigSet($key, 0);
|
||||
logAdd(log, 'info', 'This test is now completed.');
|
||||
);
|
||||
|
||||
// HashGroup
|
||||
logAdd(log, $h_col, 'HashGroup');
|
||||
logAdd(log, $t_col, 'Hash\New');
|
||||
$hash_1 = Hash\New();
|
||||
logAdd(log, $t_col, 'Hash\Set');
|
||||
$hash_1 = Hash\Set($hash_1, 'key', 122213);
|
||||
logAdd(log, $t_col, 'Hash\Get');
|
||||
$v = Hash\Get($hash_1, 'key');
|
||||
logAdd(log, 'info', 'Value for "key" = ', $v);
|
||||
$hash_1 = Hash\Set($hash_1, 'key2', 'HIHI');
|
||||
log('warning', 'getting keys');
|
||||
$keys = Hash\Keys($hash_1);
|
||||
logAdd(log, $t_col, 'Hash\Keys');
|
||||
$i = 0;
|
||||
$n = array\length($keys);
|
||||
logAdd(log, 'info', 'Number of keys: ', $n);
|
||||
log('warning', 'Number of Keys: ', $n);
|
||||
while($i < array\length($keys),
|
||||
$key_i = array\at($keys, $i);
|
||||
logAdd(log, 'info', 'key ', $i, ' = \"', $key_i, '\", value = ', hash\get($hash_1, $key_i));
|
||||
$i = $i + 1;
|
||||
);
|
||||
logAdd(log, $t_col, 'Hash\IsSet');
|
||||
logAdd(log, 'info', 'hash\isset key2: ', Hash\IsSet($hash_1, 'key2'));
|
||||
|
||||
ifThen($espocrm_ver != '6',
|
||||
logAdd(log, $t_col, 'Hash\Copy');
|
||||
$hash_2 = Hash\Copy($hash_1);
|
||||
);
|
||||
|
||||
logAdd(log, $t_col, 'Hash\UnSet');
|
||||
$hash_1 = Hash\UnSet($hash_1, 'key2');
|
||||
logAdd(log, 'info', 'hash\isset($hash_1, "key2"): ', Hash\IsSet($hash_1, 'key2'));
|
||||
|
||||
ifThen($espocrm_ver != '6',
|
||||
logAdd(log, 'info', 'hash\isset($hash_2, "key2"): ', Hash\IsSet($hash_2, 'key2'));
|
||||
);
|
||||
|
||||
// RecordGroup
|
||||
logAdd(log, $h_col, 'RecordGroup');
|
||||
logAdd(log, 'info', 'Using Contact Id ', $contact_id);
|
||||
logAdd(log, $t_col, 'Record\CountRel');
|
||||
$count = Record\CountRel('Contact', $contact_id, 'accounts');
|
||||
logAdd(log, 'info', 'Record\CountRel = ', $count);
|
||||
logAdd(log, $t_col, 'Record\FetchManyHash - ALREADY TESTED');
|
||||
logAdd(log, $t_col, 'Record\FindMany - ALREADY TESTED');
|
||||
logAdd(log, $t_col, 'Record\Create - ALREADY TESTED');
|
||||
|
||||
logAdd(log, $t_col, 'Record\FetchMany');
|
||||
$rows = Record\FetchMany('Contact', 'id, lidnummer', 'lidnummer', 'desc', 'lidnummer>', 1934, 'lidnummer<', 1939);
|
||||
logAdd(log, 'info', 'Fetched ', array\length($rows), ' rows');
|
||||
$i = 0;
|
||||
while($i < array\length($rows),
|
||||
$row = array\at($rows, $i);
|
||||
logAdd(log, 'info', $i, ' - id = ', array\at($row, 0), ', lidnummer = ', array\at($row, 1));
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
logAdd(log, $t_col, 'Record\FetchRelatedMany');
|
||||
$rows = Record\FetchRelatedMany('Contact', $contact_id, 'nascholingstotalen', 'id, jaar', 'jaar', 'desc', 'jaar>=', 2022);
|
||||
logAdd(log, 'info', 'Fetched ', array\length($rows), ' rows');
|
||||
$i = 0;
|
||||
while($i < array\length($rows),
|
||||
$row = array\at($rows, $i);
|
||||
logAdd(log, 'info', $i, ' - id = ', array\at($row, 0), ', jaar = ', array\at($row, 1));
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
logAdd(log, $t_col, 'Record\FetchRelatedManyHash');
|
||||
$rows = Record\FetchRelatedManyHash('Contact', $contact_id, 'nascholingstotalen', 'id, jaar', 'jaar', 'desc', 'jaar>=', 2022);
|
||||
logAdd(log, 'info', 'Fetched ', array\length($rows), ' rows');
|
||||
$i = 0;
|
||||
while($i < array\length($rows),
|
||||
$row = array\at($rows, $i);
|
||||
logAdd(log, 'info', $i, ' - id = ', hash\get($row, 'id'), ', jaar = ', hash\get($row, 'jaar'));
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
logAdd(log, $t_col, 'Record\Recalculate');
|
||||
Record\Recalculate('Contact', 'id=', $contact_id);
|
||||
logAdd(log, 'warning', 'Check the EspoCRM Logs for this one');
|
||||
|
||||
logAdd(log, $h_col, 'StringGroup');
|
||||
logAdd(log, $t_col, 'String\Tobase64');
|
||||
$b64 = String\Tobase64($contact_id);
|
||||
logAdd(log, 'info', 'id = ', $contact_id, ', - b64: ', $b64);
|
||||
|
||||
|
||||
logAdd(log, $h_col, 'TableGroup');
|
||||
html = '';
|
||||
|
||||
$p_page_len = $aantal_rijen_op_een_pagina;
|
||||
|
||||
$h = '';
|
||||
strAdd($h, '<div class="nvkhresult">');
|
||||
$table = table\new('Naam', 75,
|
||||
'Lidnummer', 5, 'right',
|
||||
'registratiejaar', 20, 'center'
|
||||
);
|
||||
|
||||
table\rowsPerPage($table, $p_page_len);
|
||||
table\filename($table, 'upgrade_test_tabel');
|
||||
|
||||
$rows = record\FetchManyHash('Contact', 'id, lidnummer, name, datumRegistratie, lastName', 'lastName', 'desc', 'lidnummer>', 1934, 'lidnummer<', 1980);
|
||||
$n = array\length($rows);
|
||||
$i = 0;
|
||||
while($i < $n,
|
||||
$row = array\at($rows, $i);
|
||||
|
||||
$contact_id = hash\get($row, 'id');
|
||||
$name = hash\get($row, 'name');
|
||||
$reg_dat = hash\get($row, 'datumRegistratie');
|
||||
$reg_jaar = datetime\year($reg_dat);
|
||||
$lidnummer = hash\get($row, 'lidnummer');
|
||||
logAdd(log, 'info', $i, ' - id = ', $contact_id, ', name = ', $name, ', reg_jaar = ', $reg_jaar, ', lidnummer = ', $lidnummer);
|
||||
table\add($table,
|
||||
table\link(string\concatenate('/#Contact/view/', $contact_id), $name),
|
||||
string\concatenate(' ', $lidnummer),
|
||||
toString($reg_jaar)
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
$table_html = table\toHtml($table);
|
||||
strAdd($h, $table_html);
|
||||
strAdd($h, '</div>');
|
||||
|
||||
html = string\concatenate('<h1>Upgrade Testscript Report</h1>', $h);
|
||||
|
||||
logAdd(log, $t_col, 'Table\New, Table\Add, Table\RowsPerPage, Table\Filename, Table\toHtml, Table\Link');
|
||||
logAdd(log, 'info', 'Testresult: see Report');
|
||||
logAdd(log, 'warning', 'Table\Style is not tested');
|
||||
);
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
#<sql-null>
|
||||
@@ -0,0 +1 @@
|
||||
66ed7ad21b4740be1
|
||||
@@ -0,0 +1,5 @@
|
||||
// last execution: 2026-08-28 10:17:02
|
||||
$cfg = ConfigGet('job-test');
|
||||
log('warning', 'JobTest: Current value for config job-test:', $cfg);
|
||||
$cfg = datetime\now();
|
||||
ConfigSet('job-test', $cfg);
|
||||
@@ -0,0 +1 @@
|
||||
Berekent alle nascholingstotalen opnieuw, voor alle jaren. Dat zijn er dan erg veel.
|
||||
@@ -0,0 +1 @@
|
||||
5fa55e9426ec82119
|
||||
@@ -0,0 +1,76 @@
|
||||
// last execution: 2026-08-28 03:30:01
|
||||
$script_alle_totalen = configGet('script-bereken-nascholingstotalen');
|
||||
$script_calc_totaal_voor_jaar = configGet('script-bereken-nascholingstotaal-voor-jaar');
|
||||
|
||||
log('warning', 'Fetching Maximum nascholingstotaal');
|
||||
$rows= Record\FetchManyHash('Nascholingstotaal', 'jaar', 'jaar', 'desc', 'limit by', 1);
|
||||
$n_rows = array\length($rows);
|
||||
|
||||
log('warning', 'n_rows=', $n_rows);
|
||||
|
||||
logAdd(log);
|
||||
logAdd(log, 'info', 'n_rows = ', $n_rows);
|
||||
|
||||
ifThenElse($n_rows == 0,
|
||||
logAdd(log, 'info', '0 nascholingstotalen');
|
||||
,
|
||||
logAdd(log, 'info', $n_rows, ' nascholingstotalen');
|
||||
$row = array\at($rows, 0);
|
||||
$max_jaar = hash\get($row, 'jaar');
|
||||
logAdd(log, 'info', 'Maximum jaar met nascholingstotalen = ', $max_jaar);
|
||||
|
||||
logAdd(log, 'info', 'Herberekenen van alle nascholingstotalen.');
|
||||
|
||||
//global\set('nascholingstotalen-niet-herberekenen', true);
|
||||
//record\recalculate('Nascholingstotaal');
|
||||
//global\unset('nascholingstotalen-niet-herberekenen');
|
||||
|
||||
logAdd(log, 'info', 'Voor alle contacten met regiocode < 30, nascholingstotaal herberekenen en dan ook totaliseren');
|
||||
|
||||
$rows = Record\FetchManyHash('Contact', 'id, lidnummer, lastName, regiocode',
|
||||
'lastName', 'asc');
|
||||
$n_rows = array\length($rows);
|
||||
$i = 0;
|
||||
|
||||
log('warning', 'i=', $i, ', n_rows=', $n_rows);
|
||||
|
||||
while($i < $n_rows,
|
||||
$row = array\at($rows, $i);
|
||||
$contact_id = hash\get($row, 'id');
|
||||
$regiocode = 0 + hash\get($row, 'regiocode');
|
||||
ifThen($regiocode < 30,
|
||||
$lidnummer = hash\get($row, 'lidnummer');
|
||||
$lastname = hash\get($row, 'lastName');
|
||||
logAdd(log, 'info', 'regiocode: ', $regiocode, ', lid: ', $lidnummer, ' - ', $lastname, ' - herberekenen...');
|
||||
log('warning', 'Herberekenen alle totalen voor lid ', $lidnummer, ', id = ', $contact_id);
|
||||
|
||||
$tot_rows = Record\FetchManyHash('Nascholingstotaal', 'id, jaar',
|
||||
'jaar', 'asc', 'contactId=', $contact_id);
|
||||
$n_tot_rows = array\length($tot_rows);
|
||||
|
||||
ifThenElse($n_tot_rows == 0,
|
||||
logAdd(log, 'info', 'Geen nascholingstotalen voor dit lid');
|
||||
,
|
||||
$t_row = 0;
|
||||
while($t_row < $n_tot_rows,
|
||||
$tot_row = array\at($tot_rows, $t_row);
|
||||
$jaar = hash\get($tot_row, 'jaar');
|
||||
$t_id = hash\get($tot_row, 'id');
|
||||
|
||||
logAdd(log, 'info', 'Berekenen jaar voor lid ', $lidnummer, ', jaar:', $jaar);
|
||||
|
||||
$no_db_update == false;
|
||||
$year = $jaar;
|
||||
Exec($script_calc_totaal_voor_jaar);
|
||||
|
||||
$t_row = $t_row + 1;
|
||||
);
|
||||
|
||||
// bereken de hele zaak
|
||||
$year = $jaar;
|
||||
Exec($script_alle_totalen);
|
||||
);
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
Berekent de nascholingstotalen voor één lid
|
||||
@@ -0,0 +1 @@
|
||||
620ae9091bdb2322c
|
||||
@@ -0,0 +1,44 @@
|
||||
// last execution: Fri Aug 28 2026 11:05:10 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
$me = Entity\This();
|
||||
|
||||
logAdd(log);
|
||||
|
||||
logAdd(log, 'info', 'Ophalen naberekeningsscript voor één jaar');
|
||||
$jaar_calc_script = configGet('script-bereken-nascholingstotaal-voor-jaar');
|
||||
|
||||
logAdd(log, 'info', 'Ophalen naberekeningsscript voor de jaren');
|
||||
$jaren_calc_script = configGet('script-bereken-nascholingstotalen');
|
||||
|
||||
logAdd(log, 'info', 'Leden ophalen bij dit script');
|
||||
$contacts = Entity\GetRelated($me, 'contacts', 1000, 'lidnummer', 'asc');
|
||||
$n = Array\Length($contacts);
|
||||
logAdd(log, 'info', $n, ' Leden');
|
||||
|
||||
$i = 0;
|
||||
while($i < $n,
|
||||
$contact = array\at($contacts, $i);
|
||||
$contact_id = Attr($contact, 'id');
|
||||
|
||||
logAdd(log, 'warning', 'Lid: ', Attr($contact, 'lidnummer'), ' - ', Attr($contact, 'name'));
|
||||
|
||||
logAdd(log, 'Ophalen nascholingstotalen');
|
||||
$nascholingstotalen = Entity\GetRelated($contact, 'nascholingstotalen', 1000, 'jaar', 'asc');
|
||||
logAdd(log, 'opgehaald');
|
||||
|
||||
$m = array\length($nascholingstotalen);
|
||||
logAdd(log, 'info', ' #nascholingstotalen: ', $m);
|
||||
$j = 0;
|
||||
while($j < $m,
|
||||
$nascholingstotaal = array\at($nascholingstotalen, $j);
|
||||
$year = Attr($nascholingstotaal, 'jaar');
|
||||
logAdd(log, 'info', ' Herberekenen jaar: ', $year);
|
||||
Exec($jaar_calc_script);
|
||||
$j = $j + 1;
|
||||
);
|
||||
|
||||
logAdd(log, 'info', 'Totalen herberekenen');
|
||||
Exec($jaren_calc_script);
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
@@ -0,0 +1,3 @@
|
||||
Voert de laatste stand van de gegevens uit voor CZ.
|
||||
|
||||
Alle leden met regiocode < 30 worden uitgevoerd.
|
||||
@@ -0,0 +1 @@
|
||||
5ed765f5bd8a8b9bc
|
||||
@@ -0,0 +1,88 @@
|
||||
// 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, '<div class="nvkhresult">');
|
||||
|
||||
$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, '</div>');
|
||||
|
||||
html=$h;
|
||||
@@ -0,0 +1,3 @@
|
||||
Checkt of leden met een regiocode < 30 een AGB voor hun praktijk hebben.
|
||||
Checkt daarnaast of er een lege persoonlijke AGB code voor die leden.
|
||||
En checkt of de AGB code aan het format voldoet: nn/nnnnnn.
|
||||
@@ -0,0 +1 @@
|
||||
5ed794a47a7f6b2b3
|
||||
@@ -0,0 +1,123 @@
|
||||
// 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;
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Updaten van alle nascholingstotaal records van <=2018, waarbij dagen medisch op 0 wordt gezet. Hierbij wordt niet per contact het totaal aan nascholingstotalen herberekend, maar worden alleen de individuele nascholingstotalen herberekend. Dit wordt gedaan door de globale variabele 'nascholingstotalen-niet-herberekenen' te zetten.
|
||||
@@ -0,0 +1 @@
|
||||
5f05d49d9948e27c7
|
||||
@@ -0,0 +1,21 @@
|
||||
// last execution: Tue Jul 14 2020 09:06:56 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
global\set('nascholingstotalen-niet-herberekenen', true);
|
||||
|
||||
logAdd(log);
|
||||
$rows = record\fetchManyHash('Nascholingstotaal', 'id, jaar, dagenMedisch', 'name', 'asc', 'jaar<=', '2018');
|
||||
logAdd(log, 'Aantal rijen:', array\length($rows));
|
||||
|
||||
$i = 0;
|
||||
$n = array\length($rows);
|
||||
|
||||
while($i < $n,
|
||||
$row = array\at($rows, $i);
|
||||
$id = hash\get($row, 'id');
|
||||
$jaar = hash\get($row, 'jaar');
|
||||
record\update('Nascholingstotaal', $id, 'dagenMedisch', 0);
|
||||
logAdd(log, 'Updating: ', $i, ' - ', $jaar);
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
global\unset('nascholingstotalen-niet-herberekenen');
|
||||
@@ -0,0 +1 @@
|
||||
Triggert de herberekening van alle individuele nascholingsrecords.
|
||||
@@ -0,0 +1 @@
|
||||
5f0c8b06e797b2dc0
|
||||
@@ -0,0 +1,5 @@
|
||||
// last execution: Tue Jul 14 2020 08:58:56 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
global\set('nascholingstotalen-niet-herberekenen', true);
|
||||
record\recalculate('Nascholingstotaal');
|
||||
global\unset('nascholingstotalen-niet-herberekenen');
|
||||
@@ -0,0 +1 @@
|
||||
Triggert de contacten om de nascholingstotalen te herberekenen
|
||||
@@ -0,0 +1 @@
|
||||
5efa6f935ef17c59a
|
||||
@@ -0,0 +1,32 @@
|
||||
// last execution: Tue Jul 14 2020 13:08:34 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
logAdd(log);
|
||||
|
||||
$leden = Record\FetchManyHash('Contact', 'id, name, regiocode', 'name', 'asc');
|
||||
|
||||
$i = 0;
|
||||
$n = array\length($leden);
|
||||
logAdd(log, 'info', '#leden om te processen: ', $n);
|
||||
|
||||
while($i < $n,
|
||||
$lid = array\at($leden, $i);
|
||||
|
||||
$regiocode = hash\get($lid, 'regiocode');
|
||||
$r_code = string\substring($regiocode, 0, 2) + 0;
|
||||
|
||||
ifThenElse($r_code >= 30,
|
||||
logAdd(log, 'info', $i, ': lid: ', hash\get($lid, 'name'), ' - regiocode >= 30');
|
||||
,
|
||||
logAdd(log, 'info', $i, ': lid: ', hash\get($lid, 'name'), ' - herberekenen nascholingstotalen');
|
||||
|
||||
$lid_id = hash\get($lid, 'id');
|
||||
|
||||
// Trigger recalculate van één van de nascholingen
|
||||
$na_id = record\findRelatedOne('Contact', $lid_id, 'nascholingstotalen', 'createdAt', 'desc');
|
||||
ifThen($na_id, record\recalculate('Nascholingstotaal', 'id=', $na_id); );
|
||||
);
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
logAdd(log, 'info', 'Klaar.');
|
||||
@@ -0,0 +1 @@
|
||||
Maakt de doellijst met homeopaten resp. werkt deze bij
|
||||
@@ -0,0 +1 @@
|
||||
5f16fdf4c0b3bc6b8
|
||||
@@ -0,0 +1,66 @@
|
||||
// last execution: 2026-08-28 03:00:01
|
||||
logAdd(log);
|
||||
|
||||
$entities = Entity\GetMany('TargetList', 1, 'name', 'asc', 'name=', 'Homeopaten');
|
||||
$n = array\length($entities);
|
||||
|
||||
ifThenElse($n == 0,
|
||||
logAdd(log, 'warning', 'Geen "Homeopaten" doellijst, maak deze eerst aan!');
|
||||
,
|
||||
logAdd(log, 'info', 'Homeopaten doellijst aanwezig, leden worden vervangen...');
|
||||
|
||||
$doellijst = array\at($entities, 0);
|
||||
$id = attr($doellijst, 'id');
|
||||
|
||||
logAdd(log, 'info', 'Verwijderen leden met regiocode >=30');
|
||||
$rows = record\fetchRelatedManyHash('TargetList', $id,
|
||||
'contacts', 'id, lastName, regiocode',
|
||||
'lastName', 'asc'
|
||||
);
|
||||
$n = array\length($rows);
|
||||
logAdd(log, 'info', 'Aantal gerelateerde leden: ', $n);
|
||||
$i = 0;
|
||||
$rcnt = 0;
|
||||
while($i < $n,
|
||||
$row = array\at($rows, $i);
|
||||
$code = hash\get($row, 'regiocode') + 0;
|
||||
ifThen($code >= 30,
|
||||
$lastname = hash\get($row, 'lastName');
|
||||
$contact_id = hash\get($row, 'id');
|
||||
logAdd(log, 'info', 'Verwijderen: ', $lastname, '; regiocode=', $code);
|
||||
record\unrelate('TargetList', $id, 'contacts', $contact_id);
|
||||
$rcnt = $rcnt + 1;
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
logAdd(log, 'info', 'Relateren leden met regiocode <30');
|
||||
$rows = record\fetchManyHash('Contact', 'id, lastName, regiocode', 'lastName', 'asc');
|
||||
$n = array\length($rows);
|
||||
logAdd(log, 'info', 'Aantal leden om te beoordelen: ', $n);
|
||||
$i = 0;
|
||||
$cnt = 0;
|
||||
$hom_cnt = 0;
|
||||
while($i < $n,
|
||||
$row = array\at($rows, $i);
|
||||
$code = hash\get($row, 'regiocode') + 0;
|
||||
ifThen($code < 30,
|
||||
$hom_cnt = $hom_cnt + 1;
|
||||
$contact_id = hash\get($row, 'id');
|
||||
$r_id = record\findRelatedMany('TargetList', $id,
|
||||
'contacts', 1, 'createdAt', 'desc',
|
||||
'id=', $contact_id
|
||||
);
|
||||
ifThen(!$r_id,
|
||||
$lastname = hash\get($row, 'lastName');
|
||||
logAdd(log, 'info', 'Toevoegen lid: ', $lastname);
|
||||
record\relate('TargetList', $id, 'contacts', $contact_id);
|
||||
$cnt = $cnt + 1;
|
||||
);
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
logAdd(log, 'info', $cnt, ' leden toegevoegd');
|
||||
logAdd(log, 'info', $rcnt, ' leden verwijderd');
|
||||
logAdd(log, 'info', $hom_cnt, ' leden in de lijst');
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
Koppelt de geïmporteerde nascholingstotalen aan de betreffende leden.
|
||||
@@ -0,0 +1 @@
|
||||
5ef9d2ba1e3e500f5
|
||||
@@ -0,0 +1,44 @@
|
||||
// last execution: Mon Jun 29 2020 15:53:33 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
$par_Nu_uitvoeren=1;
|
||||
|
||||
logAdd(log);
|
||||
|
||||
ifThenElse($par_Nu_uitvoeren == 0,
|
||||
logAdd(log, 'info', "Zet 'Nu uitvoeren' op 1 om deze taak uit te voeren.");
|
||||
,
|
||||
$nascholingen = entity\getMany('Nascholingstotaal', 10000, 'jaar', '');
|
||||
|
||||
$i = 0;
|
||||
$n = array\length($nascholingen);
|
||||
|
||||
logAdd(log, 'info', 'Aantal nascholingsrecords: ', $n);
|
||||
|
||||
while($i < $n,
|
||||
|
||||
$nascholing = array\at($nascholingen, $i);
|
||||
|
||||
$lidnr = attr($nascholing, 'lidnummer');
|
||||
$jaar = attr($nascholing, 'jaar');
|
||||
|
||||
$contacts = entity\getMany('Contact', 1, 'name', '', 'lidnummer=', $lidnr);
|
||||
|
||||
log('error', $i, ': nascholingsjaar: ', $jaar, 'lidnummer: ', $lidnr);
|
||||
|
||||
ifThenElse(array\length($contacts) > 0,
|
||||
$contact = array\at($contacts, 0);
|
||||
$name = attr($contact, 'name');
|
||||
|
||||
setAttr($nascholing, 'contactId', attr($contact, 'id'));
|
||||
|
||||
entity\save($nascholing);
|
||||
|
||||
logAdd(log, 'info', $i, ': nascholingsjaar: ', $jaar, ', lidnummer: ', $lidnr, ' naam: ', $name);
|
||||
,
|
||||
logAdd(log, 'warning', $i, ': lidnummer: ', $lidnr, ' niet aanwezig in het systeem');
|
||||
);
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Koppelt de geïmporteerde visitaties aan de betreffende leden
|
||||
@@ -0,0 +1 @@
|
||||
5ed18abfb4cefb71d
|
||||
@@ -0,0 +1,36 @@
|
||||
// last execution: Tue Jun 09 2020 13:51:55 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
$par_import=0;
|
||||
|
||||
logAdd(log);
|
||||
ifThenElse($par_import == 1,
|
||||
logAdd(log, 'Bezig de visitaties te koppelen aan de leden');
|
||||
|
||||
$records = record\fetchMany('Visitatie', 'id, lidnummer, name', 'lidnummer', 'asc');
|
||||
$n = array\length($records);
|
||||
logAdd(log, $n, ' visitaties ingelezen');
|
||||
|
||||
$i = 0;
|
||||
while($i < $n,
|
||||
$row = array\at($records, $i);
|
||||
$lidnummer = array\at($row, 1);
|
||||
$visitatie_id = array\at($row, 0);
|
||||
$datum = array\at($row, 2);
|
||||
$contact_id = record\findOne('Contact', 'createdAt', 'asc', 'lidnummer=', $lidnummer);
|
||||
ifThenElse($contact_id,
|
||||
$success = record\relate('Visitatie', $visitatie_id, 'lid', $contact_id);
|
||||
ifThenElse($success,
|
||||
logAdd(log, 'relateren contact_id = ', $contact_id, ' voor ', $lidnummer, ' gelukt, met datum ', $datum);
|
||||
,
|
||||
logAdd(log, 'error',
|
||||
'relateren contact_id = ', $contact_id, ' voor ', $lidnummer, ' met datum ', $datum, 'niet gelukt'
|
||||
);
|
||||
);
|
||||
,
|
||||
logAdd(log, 'error', 'lidnummer "', $lidnummer, '" niet gevonden');
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
,
|
||||
logAdd(log, 'Zet import op 1 om de visitatie nabewerking uit te voeren');
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
Bewerkt de import na, als de parameter gelijk is aan 1
|
||||
@@ -0,0 +1 @@
|
||||
5ed0fa67cb3ab01e7
|
||||
@@ -0,0 +1,72 @@
|
||||
// last execution: Tue Jun 09 2020 13:51:49 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
$par_import=0;
|
||||
|
||||
logAdd(log);
|
||||
|
||||
IfThenElse($par_import,
|
||||
$records = record\fetchMany('Account', 'id, name, lidnummers', 'name', 'asc', 'lidnummers!=', '');
|
||||
|
||||
$i = 0;
|
||||
$n = array\length($records);
|
||||
logAdd(log, 'Nabewerken: ', $n, ' praktijken');
|
||||
|
||||
while($i < $n,
|
||||
$row = array\at($records, $i);
|
||||
$account_id = array\at($row, 0);
|
||||
$account_name = array\at($row, 1);
|
||||
$lidnummers = array\at($row, 2);
|
||||
logAdd(log, $account_id, ' - ', $lidnummers);
|
||||
$i = $i + 1;
|
||||
|
||||
$lid_nummers = string\matchAll($lidnummers, '/[0-9]+/');
|
||||
|
||||
$j = 0;
|
||||
$m = array\length($lid_nummers);
|
||||
|
||||
while($j < $m,
|
||||
$lidnummer = array\at($lid_nummers, $j);
|
||||
$contact_id = record\findOne('Contact', 'createdAt', 'asc', 'lidnummer=', $lidnummer);
|
||||
ifThenElse($contact_id,
|
||||
$success = record\relate('Account', $account_id, 'contacts', $contact_id);
|
||||
ifThenElse($success,
|
||||
logAdd(log, 'relateren contact_id = ', $contact_id, ' voor ', $lidnummer, ' gelukt');
|
||||
,
|
||||
logAdd(log, 'error', 'relateren contact_id = ', $contact_id, ' voor ', $lidnummer, ' niet gelukt');
|
||||
);
|
||||
,
|
||||
logAdd(log, 'error', 'lidnummer "', $lidnummer, '" niet gevonden');
|
||||
);
|
||||
$j = $j + 1;
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
/*
|
||||
$lid_nummers =
|
||||
|
||||
logAdd(log, 'lid_nummers = ', $lid_nummers);
|
||||
logAdd(log, 'length = ', array\length($lid_nummers));
|
||||
|
||||
$i = 0;
|
||||
$n = array\length($lid_nummers);
|
||||
log('error', 'Praktijk:', 'n=', $n);
|
||||
|
||||
while(
|
||||
$i < $n,
|
||||
$lidnummer = array\at($lid_nummers, $i);
|
||||
$lidnummer = $lidnummer + 0;
|
||||
$contact_id = record\findOne('Contact', 'createdAt', 'asc', 'lidnummer=', $lidnummer);
|
||||
ifThenElse($contact_id,
|
||||
logAdd(log, 'Contact: linking contact_id = ', $contact_id);
|
||||
record\relate('Account', $accountId, 'contacts', $contact_id),
|
||||
logAdd(log, 'lidnummer ', $lidnummer, ' niet gevonden');
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
*/
|
||||
,
|
||||
|
||||
logAdd(log, 'par_import = 0, de import nabewerking wordt niet uitgevoerd nu.');
|
||||
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
Importeert CSV bestanden met lidnummer, #consulten (of leeg als er geen consulten waren; of niet ingevuld.)
|
||||
@@ -0,0 +1 @@
|
||||
60192aded6ee3632b
|
||||
@@ -0,0 +1,116 @@
|
||||
// last execution: Thu Feb 04 2021 11:28:51 GMT+0100 (Midden-Europese standaardtijd)
|
||||
|
||||
$csvfile_par_consultgegevens_als_csv='Lid Nummer,consulten 2019,\n1846,,\n1780,,\n1856,150,\n0045,,\n0878,200,\n1509,v,\n1697,,\n0325,,\n1316,v,\n1255,300,\n1871,,\n0600,362,\n1749,400,\n1938,,\n1055,,\n0949,,\n1885,v,\n1148,v,\n1258,65,\n1352,50,\n0982,100,\n1431,v,\n1924,v,\n0349,v,\n1849,,\n1761,155,\n1830,,\n1821,,\n0489,219,\n1940,,\n1682,v,\n1030,,\n1219,422,\n1675,93,\n1459,,\n0769,,\n0847,555,\n0871,v,\n0157,,\n1433,,\n1536,250,\n1158,,\n1621,,\n1820,112,\n1926,,\n0395,61,\n1436,,\n1880,,\n1896,18,\n1716,617,\n1799,,\n0220,584,\n1883,,\n1640,,\n1628,191,\n0723,,\n1242,,\n1914,168,\n0038,,\n1003,400,\n1762,,\n1256,,\n1718,304,\n1487,v,\n1259,,\n0049,212,\n1362,150,\n1706,352,\n1784,37,\n1274,v,\n1579,v,\n1547,,\n1565,,\n1001,200,\n1500,v, \n1790,33,\n1357,177,\n1727,,\n0751,520,\n1892,,\n0293,,\n1239,,\n0191,459,\n0257,v, \n1329,,\n1512,v,\n0853,,\n1842,62,\n1143,651,\n1935,40,\n1387,,\n1585,,\n0985,,\n1002,104,\n0265,760,\n0669,900,\n1872,24,\n1569,201,\n0743,,\n0577,185,\n1495,65,\n1643,90,\n1794,v,\n1750,208,\n1841,,\n1932,,\n0729,188,\n1658,,\n1571,,\n1796,,\n1713,252,\n1507,560,\n0205,900,\n0189,720,\n0956,90,\n0336,,\n1541,201,\n1933,,\n1278,262,\n0080,400,\n1690,,\n1824,25,\n1620,280,\n1584,815,\n0396,,\n0757,v,\n1736,178,\n0812,361,\n1533,,\n1063,71,\n1380,300,\n1358,380,\n1445,,\n1894,,\n1863,35,\n1681,194,\n1741,v,\n0963,,\n0778,1000,\n1205,350,\n1759,24,\n0726,,\n1293,250,\n1524,v,\n0421,,\n1203,3550,\n1878,,\n1865,,\n0111,550,\n1696,,\n1253,1000,\n1210,250,\n1288,,\n1666,v,\n1455,,\n1691,,\n0271,473,\n1787,,\n1859,728,\n0924,180,\n1811,,\n1079,90,\n1848,,\n1499,v,\n1260,445,\n0456,250,\n1826,18,\n1048,,\n1605,v,\n0961,1100,\n0451,,\n1457,,\n0685,500,\n0042,,\n1911,v,\n0957,180,\n1623,v,\n0084,,\n1828,50,\n1680,1000,\n1350,,\n1610,v,\n1684,,\n1720,190,\n0843,135,\n1869,v,\n1614,355,\n1418,190,\n1598,,\n1954,,\n1563,300,\n1919,77,\n0266,,\n1613,,\n1325,,\n1466,170,\n1747,4,\n0301,,\n0919,176,\n1729,,\n1589,v,\n1395,,\n1897,v,\n1669,,\n1171,v,\n1725,,\n1712,250,\n0286,557,\n0076,v,\n1920,,\n1693,v,\n0179,,\n1513,,\n0887,1100,\n1700,v,\n1622,v,\n0893,1219,\n0848,,\n0954,,\n1945,,\n1575,v,\n1936,,\n1917,200,\n1629,158,\n1321,310,\n0631,247,\n1895,,\n0180,,\n1860,,\n0230,,\n1853,,\n1532,253,\n1254,,\n0085,500,\n0606,500,\n1633,100,\n0398,300,\n1649,300,\n1709,160,\n1798,,\n1699,193,\n1816,35,\n1218,v,\n1868,27,\n1597,250,\n1804,,\n0799,84,\n1788,358,\n1934,40,\n0660,161,\n1810,,\n1854,,\n1428,173,\n1814,,\n1299,,\n0063,,\n0633,225,\n1939,,\n0807,450,\n0485,,\n1570,750,\n1634,280,\n1801,731,\n1889,,\n1578,,\n1554,v,\n1722,v,\n1627,230,\n1701,,\n1943,,\n0433,610,\n1652,,\n1730,285,\n1866,,\n1777,221,\n0190,496,\n1805,,\n0137,,\n1150,300,\n0525,107,\n1838,110,\n1803,96,\n1639,371,\n0140,227,\n1923,47,\n1827,,\n0866,213,\n1161,v,\n0355,39,\n1674,,\n0872,500,\n1737,180,\n1005,24,\n0155,220,\n0003,,\n1529,525,\n1040,,\n1359,250,\n0516,,\n0154,,\n1266,,\n0209,185,\n1858,,\n0185,v,\n1615,v,\n0004,125,\n1948,,\n1683,95,\n1086,v,\n0926,230,\n1899,,\n0756,60,\n1893,,\n1823,504,\n1141,,\n1808,,\n0287,,\n1464,150,\n1746,280,\n1916,,\n0967,340,\n0876,,\n1534,450,\n0861,1200,\n1949,,\n0363,204,\n0932,251,\n0953,500,\n1745,148,\n1929,,\n1653,v,\n1175,220,\n1740,54,\n1435,250,\n0226,124,\n0938,490,\n1432,400,\n1549,720,\n0047,299,\n1779,v,\n1035,431,\n1728,11,\n1797,,\n0788,v,\n1545,,\n0569,,\n0228,,\n0316,,\n1498,50,\n0461,,\n1711,108,\n0927,,\n0413,380,\n1600,,\n1887,,\n1733,v,\n1467,85,\n1641,,\n1813,,\n1425,,\n1724,900,\n1638,v,\n0869,,\n1096,710,\n0714,501,\n1781,v,\n0034,,\n1809,,\n0171,215,\n0935,360,\n0720,240,\n1510,222,\n1213,362,\n1648,833,\n1195,v,\n0203,143,\n1667,v,\n0533,v,\n1874,624,\n1556,206,\n1692,400,\n1857,,\n1465,400,\n1732,v,\n0721,,\n0899,,\n1873,,\n1891,,\n1942,15,\n1937,,\n0643,,\n0245,,\n0322,,\n1877,,\n1815,,\n0727,v,\n0292,,\n1062,,\n0112,,\n0113,502,\n0551,320,\n1562,670,\n1763,825,\n1383,,\n0984,,\n0114,,\n1468,,\n0648,1450,\n1179,,\n1703,v,\n0821,v,\n1785,,\n1886,,\n1791,290,\n0811,25,\n1572,,\n1698,108,\n1772,517,\n1471,203,\n1752,,\n0885,,\n1363,,\n1850,230,\n1178,325,\n1407,450,\n1812,,\n1773,738,\n1665,140,\n0388,217,\n1317,,\n0564,,\n0696,v,\n0875,v,\n0570,107,\n1625,,\n1941,,\n1283,,\n1084,173,\n1912,,\n1739,550,\n1612,61,\n1953,,\n1807,v,\n1422,540,\n1837,,\n0273,,\n1276,,\n1123,65,\n0580,,\n1778,110,\n1100,150,\n1843,,\n1267,,\n1930,,\n1867,,\n0022,,\n0664,,\n1659,,\n0628,,\n1663,436,\n1011,284,\n0820,482,\n0178,,\n0928,v,\n1888,,\n0342,,\n1156,,\n1308,270,\n0921,,\n';
|
||||
$par_Testrun_geen_consultgegevens_maken=false;
|
||||
$par_jaar=2019;
|
||||
|
||||
logAdd(log);
|
||||
|
||||
$csv = $csvfile_par_consultgegevens_als_csv;
|
||||
$testrun = $par_Testrun_geen_consultgegevens_maken;
|
||||
$jaar = $par_jaar;
|
||||
|
||||
ifThenElse($csv == '',
|
||||
logAdd(log, 'error', 'Geen CSV bestand ingelezen, kies er één.');
|
||||
,
|
||||
logAdd(log, 'warning', 'CSV Bestand ingelezen, uitvoeren inlezen consultgegevens.');
|
||||
|
||||
$idx1 = string\pos($csv, ',');
|
||||
$idx2 = string\pos($csv, ';');
|
||||
|
||||
$comma="@$@#@@";
|
||||
ifThenElse($idx1,
|
||||
ifThenElse($idx2,
|
||||
ifThenElse($idx1 < $idx2, $comma=',', $comma=';');
|
||||
,
|
||||
$comma=',';
|
||||
);
|
||||
,
|
||||
ifThen($idx2,
|
||||
$comma=';';
|
||||
);
|
||||
);
|
||||
|
||||
$re_entries = string\concatenate('/["][^"]*["]|[^', $comma, ']+/');
|
||||
|
||||
$user_id = env\userAttribute('id');
|
||||
logAdd(log, 'info', 'User id: ', $user_id);
|
||||
|
||||
logAdd(log, 'info', "Gevonden comma-separator: '", $comma, "' - positie ','=", $idx1, ", positie ';'=", $idx2 );
|
||||
|
||||
ifThenElse($testrun,
|
||||
logAdd(log, 'warning', 'Testrun - er worden geen consultgegevens aangemaakt.');
|
||||
,
|
||||
logAdd(log, 'warning', 'Er worden consultgegevens aangemaakt');
|
||||
);
|
||||
|
||||
// Split in lines
|
||||
|
||||
$rows=list();
|
||||
$line='';
|
||||
$csv = string\concatenate(string\trim($csv), '\n');
|
||||
$idx = string\pos($csv, '\n');
|
||||
$data = list();
|
||||
$n_data = 2;
|
||||
$heading = true;
|
||||
|
||||
while($idx,
|
||||
$line = string\substring($csv, 0, $idx);
|
||||
$csv = string\substring($csv, $idx + 1);
|
||||
|
||||
$entries = string\matchAll($line, $re_entries);
|
||||
|
||||
$k = array\length($entries);
|
||||
ifThen($k < $n_data, $entries = array\push($entries, ''));
|
||||
$k = array\length($entries);
|
||||
ifThenElse($k < $n_data,
|
||||
logAdd(log, 'error', 'Minder dan ', $n_data, ' cellen op deze rij, niet te herkennen');
|
||||
logAdd(log, 'error', $line);
|
||||
,
|
||||
$row = list();
|
||||
$j = 0;
|
||||
while($j < $k,
|
||||
$entry = array\at($entries, $j);
|
||||
$row = array\push($row, $entry);
|
||||
$j = $j + 1;
|
||||
);
|
||||
ifThenElse($heading,
|
||||
$heading = false;
|
||||
,
|
||||
$rows = array\push($rows, $row);
|
||||
);
|
||||
);
|
||||
|
||||
$idx = string\pos($csv, '\n');
|
||||
);
|
||||
|
||||
$n = array\length($rows);
|
||||
logAdd(log, 'warning', $n, ' - rijen ingelezen');
|
||||
|
||||
|
||||
$i = 0;
|
||||
while($i < $n,
|
||||
$row = array\at($rows, $i);
|
||||
$lidnummer = toString(array\at($row, 0));
|
||||
$consulten = string\trim(array\at($row, 1));
|
||||
ifThen($consulten == 'v', $consulten = "");
|
||||
ifThenElse($consulten != "",
|
||||
$consulten_int = toInt($consulten);
|
||||
$id = record\findOne('Contact', 'name', 'asc', 'lidnummer=', $lidnummer);
|
||||
ifThenElse($id,
|
||||
ifThenElse($testrun,
|
||||
logAdd(log, 'info', 'Testrun, er worden geen consultgegevens opgevoerd');
|
||||
,
|
||||
$rec_id = record\create('ConsultGegevens', 'contactId', $id, 'jaar', $jaar, 'aantal', $consulten_int, 'assignedUserId', $used_id);
|
||||
record\relate('Contact', $id, 'consultGegevens', $rec_id);
|
||||
);
|
||||
logAdd(log, 'info', 'lidnummer: ', $lidnummer, ' - ', $consulten_int, ' consulten opgegeven (', $consulten, '), voor id: ', $id);
|
||||
,
|
||||
logAdd(log, 'warning', 'lidnummer: ', $lidnummer, ' - geen id gevonden!');
|
||||
);
|
||||
,
|
||||
logAdd(log, 'info', 'lidnummer: ', $lidnummer, ' - geen consulten opgegeven');
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
Rapporteer leden die in een bepaald nascholingsjaar nascholingen meer dan 1 keer geregistreerd hebben. Te checken voor leden die moeten nascholen, d.w.z. leden met regiocode < 30 en ongelijk 8 (verloskundige).
|
||||
@@ -0,0 +1 @@
|
||||
639e03f4e8f686f7a
|
||||
@@ -0,0 +1,162 @@
|
||||
// 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);
|
||||
@@ -0,0 +1 @@
|
||||
Geeft een lijst met alle niet ex-leden met hun praktijken (p1, p2 en p3)
|
||||
@@ -0,0 +1 @@
|
||||
602e70cccdb6eccbb
|
||||
@@ -0,0 +1,228 @@
|
||||
//exec last execution: Fri Jun 12 2026 11:17:40 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
$par_Regels_per_pagina=18;
|
||||
$par_Excel_Bestandsnaam_voorzien_van_datum=true;
|
||||
$par_Excel_Bestandsnaam='ledenlijst';
|
||||
|
||||
$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;);
|
||||
|
||||
html = '';
|
||||
logAdd(log);
|
||||
|
||||
$fields = string\concatenate(
|
||||
'id, salutationName, initialsName, firstName, middleName, lastName, ',
|
||||
'geboortedatum, geslacht, ',
|
||||
'addressStreet, addressPostalCode, addressCity, addressCountry, ',
|
||||
'emailAddress, phoneNumber, website, ',
|
||||
'regiocode, lidnummer, ',
|
||||
'balens, quasier, ',
|
||||
'dispensatie, ',
|
||||
'agbcode, rbcznummer, mCode, ',
|
||||
'datumRegistratie, vakopleidingDatumDiploma, mBKDatum, datumVOG, ',
|
||||
'geplandeAfstudeerdatum, einddatum ',
|
||||
''
|
||||
);
|
||||
|
||||
$rows = record\fetchManyHash('Contact', $fields, 'lastName', 'asc');
|
||||
|
||||
$n = array\length($rows);
|
||||
logAdd(log, 'Contacts read: ', $n);
|
||||
$h = '';
|
||||
|
||||
strAdd($h, '<div class="nvkhresult">');
|
||||
|
||||
$table = table\new('Aanhef', 'Initialen', 'Voornaam', 'Voorzetsel', 'Achternaam',
|
||||
'Geboortedatum',
|
||||
'Straat', 'Postcode', 'Plaats', 'Land',
|
||||
'eMail', 'Telefoon',
|
||||
'Regiocode', 'Lidnummer',
|
||||
'Agbcode',
|
||||
'Registratie',
|
||||
'Praktijken Agbcode',
|
||||
'Praktijken tel.',
|
||||
'P1 Naam', 'P1 Straat', 'P1 Postcode', 'P1 Plaats', 'P1 Website',
|
||||
'P2 Naam', 'P2 Straat', 'P2 Postcode', 'P2 Plaats', 'P2 Website',
|
||||
'P3 Naam', 'P3 Straat', 'P3 Postcode', 'P3 Plaats', 'P3 Website'
|
||||
);
|
||||
table\rowsPerPage($table, $p_page_len);
|
||||
table\filename($table, $p_filename);
|
||||
|
||||
$i = 0;
|
||||
while($i < $n,
|
||||
$e = array\at($rows, $i);
|
||||
|
||||
$regiocode = hash\get($e, 'regiocode');
|
||||
$regiocode = $regiocode + 0;
|
||||
$meenemen = $regiocode < 30;
|
||||
$lastname = hash\get($e, 'lastName');
|
||||
|
||||
logAdd(log, 'info', 'regiocode=', $regiocode, ' lastName=', $lastname);
|
||||
|
||||
ifThen($meenemen,
|
||||
$contact_id = hash\get($e, 'id');
|
||||
$salutation = hash\get($e, 'salutationName');
|
||||
$initials = hash\get($e, 'initialsName');
|
||||
$firstname = hash\get($e, 'firstName');
|
||||
$voorvoegsel = hash\get($e, 'middleName');
|
||||
$street = hash\get($e, 'addressStreet');
|
||||
$postalcode = hash\get($e, 'addressPostalCode');
|
||||
$city = hash\get($e, 'addressCity');
|
||||
$country = hash\get($e, 'addressCountry');
|
||||
ifThen($country == null || $country == '', $country = 'Nederland');
|
||||
$email = hash\get($e, 'emailAddress');
|
||||
ifThen($email, $email = table\link(string\concatenate('mailto:', $email), $email));
|
||||
$phone = hash\get($e, 'phoneNumber');
|
||||
ifThen($website, $website = table\link(string\concatenate('http://', $website), $website, '_blank'));
|
||||
$birth = hash\get($e, 'geboortedatum');
|
||||
$gender = hash\get($e, 'geslacht');
|
||||
$lidnr = hash\get($e, 'lidnummer');
|
||||
$balens = hash\get($e, 'balens');
|
||||
$quasir = hash\get($e, 'quasier');
|
||||
$dispensatie = hash\get($e, 'dispensatie');
|
||||
$agbcode = hash\get($e, 'agbcode');
|
||||
$mcode = hash\get($e, 'mCode');
|
||||
$rbcznr = hash\get($e, 'rbcznummer');
|
||||
$registratie = hash\get($e, 'datumRegistratie');
|
||||
$vakopleiding = hash\get($e, 'vakopleidingDatumDiploma');
|
||||
$mbk = hash\get($e, 'mBKDatum');
|
||||
$vog = hash\get($e, 'datumVOG');
|
||||
$afstuderen = hash\get($e, 'geplandeAfstudeerdatum')
|
||||
$einddatum = hash\get($e, 'einddatum');
|
||||
|
||||
$contact = entity\get('Contact', $contact_id);
|
||||
$p1s = entity\getRelated($contact, 'accounts', 1, 'name', 'asc', 'type=', 'P1');
|
||||
ifThenElse(array\length($p1s) == 1, $p1 = array\at($p1s, 0), $p1 = null);
|
||||
$p2s = entity\getRelated($contact, 'accounts', 1, 'name', 'asc', 'type=', 'P2');
|
||||
ifThenElse(array\length($p2s) == 1, $p2 = array\at($p2s, 0), $p2 = null);
|
||||
$p3s = entity\getRelated($contact, 'accounts', 1, 'name', 'asc', 'type=', 'P3');
|
||||
ifThenElse(array\length($p3s) == 1, $p3 = array\at($p3s, 0), $p3 = null);
|
||||
|
||||
$report = true;
|
||||
ifThenElse($p1,
|
||||
$p1_name = attr($p1, 'naam');
|
||||
$p1_straat = attr($p1, 'shippingAddressStreet');
|
||||
$p1_postcode = attr($p1, 'shippingAddressPostalCode');
|
||||
$p1_plaats = attr($p1, 'shippingAddressCity');
|
||||
$p1_land = attr($p1, 'shippngAddressCountry');
|
||||
$p1_email = attr($p1, 'emailAddress');
|
||||
$p1_phone = attr($p1, 'phoneNumber');
|
||||
$p1_website = attr($p1, 'website');
|
||||
$p1_op_internet = attr($p1, 'opInternet');
|
||||
$p1_agbcode = attr($p1, 'agbcode');
|
||||
,
|
||||
$p1_name = '';
|
||||
$p1_straat = '';
|
||||
$p1_postcode = '';
|
||||
$p1_plaats = '';
|
||||
$p1_land = '';
|
||||
$p1_email = '';
|
||||
$p1_phone = '';
|
||||
$p1_website = '';
|
||||
$p1_op_internet = '';
|
||||
$p1_agbcode = '';
|
||||
);
|
||||
|
||||
ifThenElse($p2,
|
||||
$p2_name = attr($p2, 'naam');
|
||||
$p2_straat = attr($p2, 'shippingAddressStreet');
|
||||
$p2_postcode = attr($p2, 'shippingAddressPostalCode');
|
||||
$p2_plaats = attr($p2, 'shippingAddressCity');
|
||||
$p2_land = attr($p2, 'shippngAddressCountry');
|
||||
$p2_email = attr($p2, 'emailAddress');
|
||||
$p2_phone = attr($p2, 'phoneNumber');
|
||||
$p2_website = attr($p2, 'website');
|
||||
$p2_op_internet = attr($p2, 'opInternet');
|
||||
$p2_agbcode = attr($p2, 'agbcode');
|
||||
,
|
||||
$p2_name = '';
|
||||
$p2_straat = '';
|
||||
$p2_postcode = '';
|
||||
$p2_plaats = '';
|
||||
$p2_land = '';
|
||||
$p2_email = '';
|
||||
$p2_phone = '';
|
||||
$p2_website = '';
|
||||
$p2_op_internet = '';
|
||||
$p2_agbcode = '';
|
||||
);
|
||||
|
||||
ifThenElse($p3,
|
||||
$p3_name = attr($p3, 'naam');
|
||||
$p3_straat = attr($p3, 'shippingAddressStreet');
|
||||
$p3_postcode = attr($p3, 'shippingAddressPostalCode');
|
||||
$p3_plaats = attr($p3, 'shippingAddressCity');
|
||||
$p3_land = attr($p3, 'shippngAddressCountry');
|
||||
$p3_email = attr($p3, 'emailAddress');
|
||||
$p3_phone = attr($p3, 'phoneNumber');
|
||||
$p3_website = attr($p3, 'website');
|
||||
$p3_op_internet = attr($p3, 'opInternet');
|
||||
$p3_agbcode = attr($p3, 'agbcode');
|
||||
,
|
||||
$p3_name = '';
|
||||
$p3_straat = '';
|
||||
$p3_postcode = '';
|
||||
$p3_plaats = '';
|
||||
$p3_land = '';
|
||||
$p3_email = '';
|
||||
$p3_phone = '';
|
||||
$p3_website = '';
|
||||
$p3_op_internet = '';
|
||||
$p3_agbcode = '';
|
||||
);
|
||||
|
||||
$p_agbcode = '';
|
||||
ifThenElse($p1_agbcode,
|
||||
$p_agbcode = $p1_agbcode;
|
||||
,
|
||||
ifThenElse($p2_agbcode,
|
||||
$p_agbcode = $p2_agbcode;
|
||||
,
|
||||
ifThen($p3_agbcode, $p_agbcode = $p3_agbcode;);
|
||||
);
|
||||
);
|
||||
$p_phone = '';
|
||||
ifThenElse($p1_phone,
|
||||
$p_phone = $p1_phone;
|
||||
,
|
||||
ifThenElse($p2_phone,
|
||||
$p_phone = $p2_phone;
|
||||
,
|
||||
ifThen($p3_phone, $p_phone = $p3_phone;);
|
||||
);
|
||||
);
|
||||
|
||||
|
||||
ifThen($report,
|
||||
table\add($table,
|
||||
$salutation, $initials, $firstname, $voorvoegsel, $lastname,
|
||||
$birth,
|
||||
$street, $postalcode, $city, $country,
|
||||
$email, $phone,
|
||||
$regiocode, $lidnr,
|
||||
$agbcode,
|
||||
$registratie,
|
||||
$p_agbcode,
|
||||
$p_phone,
|
||||
$p1_name, $p1_straat, $p1_postcode, $p1_plaats, $p1_website,
|
||||
$p2_name, $p2_straat, $p2_postcode, $p2_plaats, $p2_website,
|
||||
$p3_name, $p3_straat, $p3_postcode, $p3_plaats, $p3_website
|
||||
);
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
strAdd($h, table\toHtml($table));
|
||||
|
||||
strAdd($h, '</div>');
|
||||
|
||||
html=$h;
|
||||
@@ -0,0 +1 @@
|
||||
Geeft een lijst met alle niet ex-leden met hun praktijken (p1, p2 en p3)
|
||||
@@ -0,0 +1 @@
|
||||
5fca5c9b4b0997868
|
||||
@@ -0,0 +1,220 @@
|
||||
//exec last execution: Fri Jun 12 2026 11:18:17 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
$par_Regels_per_pagina=18;
|
||||
$par_Excel_Bestandsnaam_voorzien_van_datum=true;
|
||||
$par_Excel_Bestandsnaam='ledenlijst';
|
||||
|
||||
$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;);
|
||||
|
||||
html = '';
|
||||
logAdd(log);
|
||||
|
||||
$fields = string\concatenate(
|
||||
'id, salutationName, initialsName, firstName, middleName, lastName, ',
|
||||
'geboortedatum, geslacht, ',
|
||||
'addressStreet, addressPostalCode, addressCity, addressCountry, ',
|
||||
'emailAddress, phoneNumber, website, ',
|
||||
'regiocode, lidnummer, ',
|
||||
'balens, quasier, ',
|
||||
'dispensatie, ',
|
||||
'agbcode, rbcznummer, mCode, ',
|
||||
'datumRegistratie, vakopleidingDatumDiploma, mBKDatum, datumVOG, ',
|
||||
'geplandeAfstudeerdatum, einddatum ',
|
||||
''
|
||||
);
|
||||
|
||||
$rows = record\fetchManyHash('Contact', $fields, 'lastName', 'asc');
|
||||
|
||||
$n = array\length($rows);
|
||||
logAdd(log, 'Contacts read: ', $n);
|
||||
$h = '';
|
||||
|
||||
strAdd($h, '<div class="nvkhresult">');
|
||||
|
||||
$table = table\new('Aanhef', 'Initialen', 'Voornaam', 'Voorzetsel', 'Achternaam',
|
||||
'Geboortedatum', 'Geslacht',
|
||||
'Straat', 'Postcode', 'Plaats', 'Land',
|
||||
'eMail', 'Telefoon', 'Website',
|
||||
'Regiocode', 'Lidnummer',
|
||||
'Balens', 'Quasier',
|
||||
'Dispensatie',
|
||||
'Agbcode', 'RBCZnr', 'MCode',
|
||||
'Registratie', 'Vakopleiding', 'MBK', 'VOG', 'Afstuderen', 'Beeindiging',
|
||||
'P1 Naam', 'P1 Straat', 'P1 Postcode', 'P1 Plaats', 'P1 Land',
|
||||
'P1 eMail', 'P1 Telefoon', 'P1 Website', 'P1 Op Internet',
|
||||
'P1 Agbcode',
|
||||
'P2 Naam', 'P2 Straat', 'P2 Postcode', 'P2 Plaats', 'P2 Land',
|
||||
'P2 eMail', 'P2 Telefoon', 'P2 Website', 'P2 Op Internet',
|
||||
'P2 Agbcode',
|
||||
'P3 Naam', 'P3 Straat', 'P3 Postcode', 'P3 Plaats', 'P3 Land',
|
||||
'P3 eMail', 'P3 Telefoon', 'P3 Website', 'P3 Op Internet',
|
||||
'P3 Agbcode'
|
||||
);
|
||||
table\rowsPerPage($table, $p_page_len);
|
||||
table\filename($table, $p_filename);
|
||||
|
||||
$i = 0;
|
||||
while($i < $n,
|
||||
$e = array\at($rows, $i);
|
||||
|
||||
$regiocode = hash\get($e, 'regiocode');
|
||||
$regiocode = $regiocode + 0;
|
||||
$meenemen = $regiocode < 30;
|
||||
$lastname = hash\get($e, 'lastName');
|
||||
|
||||
logAdd(log, 'info', 'regiocode=', $regiocode, ' lastName=', $lastname);
|
||||
|
||||
ifThen($meenemen,
|
||||
$contact_id = hash\get($e, 'id');
|
||||
$salutation = hash\get($e, 'salutationName');
|
||||
$initials = hash\get($e, 'initialsName');
|
||||
$firstname = hash\get($e, 'firstName');
|
||||
$voorvoegsel = hash\get($e, 'middleName');
|
||||
$street = hash\get($e, 'addressStreet');
|
||||
$postalcode = hash\get($e, 'addressPostalCode');
|
||||
$city = hash\get($e, 'addressCity');
|
||||
$country = hash\get($e, 'addressCountry');
|
||||
ifThen($country == null || $country == '', $country = 'Nederland');
|
||||
$email = hash\get($e, 'emailAddress');
|
||||
ifThen($email, $email = table\link(string\concatenate('mailto:', $email), $email));
|
||||
$phone = hash\get($e, 'phoneNumber');
|
||||
$website = hash\get($e, 'website');
|
||||
ifThen($website, $website = table\link(string\concatenate('http://', $website), $website, '_blank'));
|
||||
$birth = hash\get($e, 'geboortedatum');
|
||||
$gender = hash\get($e, 'geslacht');
|
||||
$lidnr = hash\get($e, 'lidnummer');
|
||||
$balens = hash\get($e, 'balens');
|
||||
$quasir = hash\get($e, 'quasier');
|
||||
$dispensatie = hash\get($e, 'dispensatie');
|
||||
$agbcode = hash\get($e, 'agbcode');
|
||||
$mcode = hash\get($e, 'mCode');
|
||||
$rbcznr = hash\get($e, 'rbcznummer');
|
||||
$registratie = hash\get($e, 'datumRegistratie');
|
||||
$vakopleiding = hash\get($e, 'vakopleidingDatumDiploma');
|
||||
$mbk = hash\get($e, 'mBKDatum');
|
||||
$vog = hash\get($e, 'datumVOG');
|
||||
$afstuderen = hash\get($e, 'geplandeAfstudeerdatum')
|
||||
$einddatum = hash\get($e, 'einddatum');
|
||||
|
||||
$contact = entity\get('Contact', $contact_id);
|
||||
$p1s = entity\getRelated($contact, 'accounts', 1, 'name', 'asc', 'type=', 'P1');
|
||||
ifThenElse(array\length($p1s) == 1, $p1 = array\at($p1s, 0), $p1 = null);
|
||||
$p2s = entity\getRelated($contact, 'accounts', 1, 'name', 'asc', 'type=', 'P2');
|
||||
ifThenElse(array\length($p2s) == 1, $p2 = array\at($p2s, 0), $p2 = null);
|
||||
$p3s = entity\getRelated($contact, 'accounts', 1, 'name', 'asc', 'type=', 'P3');
|
||||
ifThenElse(array\length($p3s) == 1, $p3 = array\at($p3s, 0), $p3 = null);
|
||||
|
||||
$report = true;
|
||||
ifThenElse($p1,
|
||||
$p1_name = attr($p1, 'naam');
|
||||
$p1_straat = attr($p1, 'shippingAddressStreet');
|
||||
$p1_postcode = attr($p1, 'shippingAddressPostalCode');
|
||||
$p1_plaats = attr($p1, 'shippingAddressCity');
|
||||
$p1_land = attr($p1, 'shippngAddressCountry');
|
||||
$p1_email = attr($p1, 'emailAddress');
|
||||
$p1_phone = attr($p1, 'phoneNumber');
|
||||
$p1_website = attr($p1, 'website');
|
||||
$p1_op_internet = attr($p1, 'opInternet');
|
||||
$p1_agbcode = attr($p1, 'agbcode');
|
||||
,
|
||||
$p1_name = '';
|
||||
$p1_straat = '';
|
||||
$p1_postcode = '';
|
||||
$p1_plaats = '';
|
||||
$p1_land = '';
|
||||
$p1_email = '';
|
||||
$p1_phone = '';
|
||||
$p1_website = '';
|
||||
$p1_op_internet = '';
|
||||
$p1_agbcode = '';
|
||||
);
|
||||
|
||||
ifThenElse($p2,
|
||||
$p2_name = attr($p2, 'naam');
|
||||
$p2_straat = attr($p2, 'shippingAddressStreet');
|
||||
$p2_postcode = attr($p2, 'shippingAddressPostalCode');
|
||||
$p2_plaats = attr($p2, 'shippingAddressCity');
|
||||
$p2_land = attr($p2, 'shippngAddressCountry');
|
||||
$p2_email = attr($p2, 'emailAddress');
|
||||
$p2_phone = attr($p2, 'phoneNumber');
|
||||
$p2_website = attr($p2, 'website');
|
||||
$p2_op_internet = attr($p2, 'opInternet');
|
||||
$p2_agbcode = attr($p2, 'agbcode');
|
||||
,
|
||||
$p2_name = '';
|
||||
$p2_straat = '';
|
||||
$p2_postcode = '';
|
||||
$p2_plaats = '';
|
||||
$p2_land = '';
|
||||
$p2_email = '';
|
||||
$p2_phone = '';
|
||||
$p2_website = '';
|
||||
$p2_op_internet = '';
|
||||
$p2_agbcode = '';
|
||||
);
|
||||
|
||||
ifThenElse($p3,
|
||||
$p3_name = attr($p3, 'naam');
|
||||
$p3_straat = attr($p3, 'shippingAddressStreet');
|
||||
$p3_postcode = attr($p3, 'shippingAddressPostalCode');
|
||||
$p3_plaats = attr($p3, 'shippingAddressCity');
|
||||
$p3_land = attr($p3, 'shippngAddressCountry');
|
||||
$p3_email = attr($p3, 'emailAddress');
|
||||
$p3_phone = attr($p3, 'phoneNumber');
|
||||
$p3_website = attr($p3, 'website');
|
||||
$p3_op_internet = attr($p3, 'opInternet');
|
||||
$p3_agbcode = attr($p3, 'agbcode');
|
||||
,
|
||||
$p3_name = '';
|
||||
$p3_straat = '';
|
||||
$p3_postcode = '';
|
||||
$p3_plaats = '';
|
||||
$p3_land = '';
|
||||
$p3_email = '';
|
||||
$p3_phone = '';
|
||||
$p3_website = '';
|
||||
$p3_op_internet = '';
|
||||
$p3_agbcode = '';
|
||||
);
|
||||
|
||||
ifThen($report,
|
||||
table\add($table,
|
||||
$salutation, $initials, $firstname, $voorvoegsel, $lastname,
|
||||
$birth, $gender,
|
||||
$street, $postalcode, $city, $country,
|
||||
$email, $phone, $website,
|
||||
$regiocode, $lidnr,
|
||||
$balens, $quasir,
|
||||
$dispensatie,
|
||||
$agbcode, $rbcznr, $mcode,
|
||||
$registratie, $vakopleiding, $mbk, $vog, $afstuderen, $einddatum,
|
||||
$p1_name, $p1_straat, $p1_postcode, $p1_plaats, $p1_land,
|
||||
$p1_email, $p1_phone, $p1_website, $p1_op_internet,
|
||||
$p1_agbcode,
|
||||
$p2_name, $p2_straat, $p2_postcode, $p2_plaats, $p2_land,
|
||||
$p2_email, $p2_phone, $p2_website, $p2_op_internet,
|
||||
$p2_agbcode,
|
||||
$p3_name, $p3_straat, $p3_postcode, $p3_plaats, $p3_land,
|
||||
$p3_email, $p3_phone, $p3_website, $p3_op_internet,
|
||||
$p3_agbcode
|
||||
|
||||
);
|
||||
);
|
||||
|
||||
);
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
strAdd($h, table\toHtml($table));
|
||||
|
||||
strAdd($h, '</div>');
|
||||
|
||||
html=$h;
|
||||
@@ -0,0 +1 @@
|
||||
Leden met nascholingstotalen die liggen voor hun registratiejaar.
|
||||
@@ -0,0 +1 @@
|
||||
63caa2bdc445ed778
|
||||
@@ -0,0 +1,70 @@
|
||||
// last execution: Thu Mar 30 2023 12:27:14 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
$par_aantal_rijen_op_een_pagina=21;
|
||||
|
||||
$p_page_len = $par_aantal_rijen_op_een_pagina;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Script start
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
log('warning', 'Executing ', name);
|
||||
logAdd(log);
|
||||
|
||||
$h = '';
|
||||
strAdd($h, '<div class="nvkhresult">');
|
||||
$table = table\new('Naam', 40,
|
||||
'Lidnummer', 10, 'center',
|
||||
'registratiejaar', 20, 'center',
|
||||
'#nascholingstotalen < r-jaar', 20, 'center'
|
||||
);
|
||||
|
||||
table\rowsPerPage($table, $p_page_len);
|
||||
table\filename($table, 'leden met nascholingstotalen voor het registratiejaar');
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Kijk of er nascholingsjaren zijn die liggen voor de registratiedatum
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$rows = record\FetchManyHash('Contact', 'id, lidnummer, name, regiocode, datumRegistratie', 'name', 'asc');
|
||||
$n = array\length($rows);
|
||||
$i = 0;
|
||||
$aantal = 0;
|
||||
$aantal_met = 0;
|
||||
|
||||
while($i < $n,
|
||||
$row = array\at($rows, $i);
|
||||
$regiocode = hash\get($row, 'regiocode') + 0;
|
||||
ifThen($regiocode < 30,
|
||||
$aantal = $aantal + 1;
|
||||
|
||||
$contact_id = hash\get($row, 'id');
|
||||
$name = hash\get($row, 'name');
|
||||
$reg_dat = hash\get($row, 'datumRegistratie');
|
||||
$reg_jaar = datetime\year($reg_dat);
|
||||
$lidnummer = hash\get($row, 'lidnummer');
|
||||
|
||||
$cnt = record\count('Nascholingstotaal', 'jaar<', $reg_jaar, 'contactId=', $contact_id);
|
||||
|
||||
ifThen($cnt > 0,
|
||||
logAdd(log, 'info', 'Contact: ', $name, ' lidnummer: ', $lidnummer, ', registratiejaar: ', $reg_jaar, ' #nascholingstotalen vóór registratiedatum: ', $cnt);
|
||||
table\add($table,
|
||||
table\link(string\concatenate('/#Contact/view/', $contact_id), $name),
|
||||
string\concatenate(' ', $lidnummer),
|
||||
toString($reg_jaar),
|
||||
toString($cnt)
|
||||
);
|
||||
$aantal_met = $aantal_met + 1;
|
||||
);
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
$table_html = table\toHtml($table);
|
||||
strAdd($h, $table_html);
|
||||
strAdd($h, '</div>');
|
||||
|
||||
html = $h;
|
||||
|
||||
logAdd(log, 'info', '#Aantal leden met regiocode < 30: ', $aantal);
|
||||
logAdd(log, 'info', '#Aantal leden met regiocode < 30 met nascholingstotalen vóór het registratiejaar : ', $aantal_met);
|
||||
@@ -0,0 +1 @@
|
||||
Kijkt welke leden niet aan de nascholingsvereisten voldoen, inclusief verloskundigen.
|
||||
@@ -0,0 +1 @@
|
||||
5efa765f5a951f599
|
||||
@@ -0,0 +1,125 @@
|
||||
// last execution: Tue Jul 14 2026 08:49:16 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
$par_nascholingsjaar=2025;
|
||||
$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 nascholingsvereisten voor jaar ", $par_nascholingsjaar);
|
||||
$leden = Record\FetchManyHash('Contact',
|
||||
'id, firstName, middleName, lastName, name, emailAddress, regiocode, dispensatie, lidnummer, datumRegistratie',
|
||||
'lastName', 'asc'
|
||||
);
|
||||
|
||||
strAdd($h, '<div class="nvkhresult">');
|
||||
$table = table\new('Voornaam', 26,
|
||||
'Achternaam', 26, 'asc',
|
||||
'email', 26,
|
||||
'Lidnummer', 7, 'center',
|
||||
'Dispensatie', 7, 'center',
|
||||
'Regiocode', 8, 'center'
|
||||
);
|
||||
|
||||
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 en ex-leden: ', $n);
|
||||
$n_onvoldoende = 0;
|
||||
|
||||
while($i < $n,
|
||||
$lid = array\at($leden, $i);
|
||||
$r_code = toInt(string\substring(hash\get($lid, 'regiocode'), 0, 2));
|
||||
|
||||
//ifThen($r_code < 30 && $r_code != 8,
|
||||
ifThen($r_code < 30,
|
||||
$rapport = true;
|
||||
$contact_id = hash\get($lid, 'id');
|
||||
$email = hash\get($lid, 'emailAddress');
|
||||
$dispensatie = hash\get($lid, 'dispensatie');
|
||||
$lidnummer = hash\get($lid, 'lidnummer');
|
||||
$naam = hash\get($lid, 'name');
|
||||
$regdat = hash\get($lid, 'datumRegistratie');
|
||||
$reg_jaar = datetime\year($regdat);
|
||||
|
||||
$contact = Entity\Get('Contact', $contact_id);
|
||||
$nascholingstotalen = Entity\GetRelated($contact, 'nascholingstotalen', 1, '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, $nascholingstotalen = array\at($nascholingstotalen, 0));
|
||||
ifThen($m == 0 && $par_nascholingsjaar < $reg_jaar, $rapport = false; $reden = 'gevraagde jaar ligt voor registratie jaar');
|
||||
|
||||
ifThenElse($m == 0,
|
||||
$hom_surplus = 'nvt';
|
||||
$med_surplus = 'nvt';
|
||||
$surplus = 'nvt';
|
||||
$hom_lt = false;
|
||||
$med_lt = false;
|
||||
$lt = false;
|
||||
$onvoldoende = true;
|
||||
ifThen($rapport, $reden = 'voor het gevraagde jaar geen nascholingstotaal aanwezig!');
|
||||
,
|
||||
$status = attr($nascholingstotalen, 'status');
|
||||
|
||||
ifThenElse($status == 'voldoet-niet' || $status == 'voldoet-niet-na-saldering', $onvoldoende = true, $onvoldoende = false);
|
||||
ifThenElse($onvoldoende, $reden = 'onvoldoende nascholing', $reden = 'voldoende nascholing');
|
||||
);
|
||||
|
||||
ifThenElse($rapport && $onvoldoende, $opnemen = 'opnemen in rapport', $opnemen = 'niet opnemen');
|
||||
|
||||
ifThenElse($rapport && $onvoldoende,
|
||||
logAdd(log, 'warning', $opnemen, ' - lid: ', $naam, ' email: ', $email, ' registratiejaar: ', $reg_jaar, ' - ', $reden);
|
||||
,
|
||||
logAdd(log, 'info', $opnemen, ' - lid: ', $naam, ' email: ', $email, ' registratiejaar: ', $reg_jaar, ' - ', $reden);
|
||||
);
|
||||
|
||||
ifThen($rapport,
|
||||
ifThen($onvoldoende,
|
||||
$n_onvoldoende = $n_onvoldoende + 1;
|
||||
$naam = hash\get($lid, 'name');
|
||||
$lastname = hash\get($lid, 'lastName');
|
||||
$middlename = hash\get($lid, 'middleName');
|
||||
$firstname = hash\get($lid, 'firstName');
|
||||
$lastname = string\concatenate($lastname, ', ', $middlename);
|
||||
$regiocode = hash\get($lid, 'regiocode');
|
||||
ifThenElse($dispensatie, $dispensatie = 'Ja', $dispensatie = '-');
|
||||
|
||||
strAdd($h, '<tr>');
|
||||
$td = '<td>';
|
||||
ifThenElse($par_open_lid_in_nieuwe_tab, $target = 'target="_blank"', $target = "");
|
||||
|
||||
table\add($table,
|
||||
table\link(string\concatenate('/#Contact/view/', $contact_id), $firstname),
|
||||
table\link(string\concatenate('/#Contact/view/', $contact_id), $lastname),
|
||||
table\link(string\concatenate('mailto:', $email), $email),
|
||||
string\concatenate(' ', $lidnummer),
|
||||
$dispensatie,
|
||||
string\concatenate(' ', $regiocode)
|
||||
);
|
||||
); // $onvoldoende
|
||||
); // $rapport
|
||||
);
|
||||
$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>onvoldoende</b> nascholing voor jaar ', toString($par_nascholingsjaar), ': ', $n_onvoldoende, '</h1>');
|
||||
strAdd($h, $table_html);
|
||||
strAdd($h, '</div>');
|
||||
|
||||
logAdd(log, 'info', 'leden met onvoldoende nascholing voor jaar ', $par_nascholingsjaar, ': ', $n_onvoldoende);
|
||||
|
||||
html=$h;
|
||||
@@ -0,0 +1 @@
|
||||
Publiceert iedere nacht automatisch de ledenmails die nog in concept staan en zet ze in de juiste categorie. Als er een nieuw jaar moet worden aangemaakt, dan gebeurt dat.
|
||||
@@ -0,0 +1 @@
|
||||
6002046fe26fbfbfd
|
||||
@@ -0,0 +1,46 @@
|
||||
// last execution: 2026-08-28 05:19:02
|
||||
logAdd(log);
|
||||
logAdd(log, 'info', 'Ophalen Ledeninformatie van type "ledenmail" en status <> "gepubliceerd"');
|
||||
|
||||
$rows = record\fetchManyHash('KnowledgeBaseArticle', 'id, publishDate,name', 'name', 'asc', 'status!=', 'Published', 'type=', 'ledenmail');
|
||||
logAdd(log, 'info', array\length($rows));
|
||||
|
||||
$i = 0;
|
||||
$n = array\length($rows);
|
||||
|
||||
//$ledenmails_cat_ids = record\fetchManyHash('KnowledgeBaseCategory', 'id', 'name', 'asc', 'id=', '5eb3e7d4bec32f0d7');
|
||||
//$ledenmails_cat_id = hash\get(array\at($ledenmails_cat_ids, 0), 'id');
|
||||
$ledenmails_cat_id = '5eb3e7d4bec32f0d7';
|
||||
|
||||
logAdd(log, 'info', 'ledenmails categorie id: ', $ledenmails_cat_id);
|
||||
|
||||
while($i < $n,
|
||||
$row = array\at($rows, $i);
|
||||
$name = hash\Get($row, 'name');
|
||||
$datum = hash\Get($row, 'publishDate');
|
||||
$id = hash\Get($row, 'id');
|
||||
logAdd(log, 'info', 'publiceren: ', $name, ' - datum: ', $datum);
|
||||
|
||||
$year = datetime\year($datum);
|
||||
logAdd(log, 'info', 'in categorie: ', $year);
|
||||
|
||||
// Vind de de id voor de gegeven categorie, of maak er één aan
|
||||
$cat_ids = record\fetchManyHash('KnowledgeBaseCategory', 'id', 'name', 'asc', 'name=', $year, 'parentId=', $ledenmails_cat_id);
|
||||
$cat_ids_n = array\length($cat_ids);
|
||||
logAdd(log, 'info', 'categorie: ', $year, ' gevonden: ', $cat_ids_n);
|
||||
ifThenElse($cat_ids_n == 0,
|
||||
$cat_id = record\create('KnowledgeBaseCategory', 'name', $year, 'parentId', $ledenmails_cat_id,
|
||||
'order', -$year);
|
||||
,
|
||||
$cat_id = hash\Get(array\at($cat_ids, 0), 'id');
|
||||
);
|
||||
|
||||
// Zet het record in de juiste categorie
|
||||
record\relate('KnowledgeBaseArticle', $id, 'categories', $cat_id);
|
||||
record\relate('KnowledgeBaseArticle', $id, 'categories', $ledenmails_cat_id);
|
||||
|
||||
// Publiceer het.
|
||||
record\update('KnowledgeBaseArticle', $id, 'status', 'Published', 'type');
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
Mail de verslagen van de jobs.
|
||||
@@ -0,0 +1 @@
|
||||
5f17f1d332c9cb538
|
||||
@@ -0,0 +1,45 @@
|
||||
// last execution: 2026-08-28 08:00:01
|
||||
$jobs = entity\getMany('Script', 100, 'name', 'asc', 'type=', 'job');
|
||||
|
||||
logAdd(log);
|
||||
html = '';
|
||||
|
||||
logAdd(log, 'info', 'Mailen laatste taken logs');
|
||||
|
||||
$html = "";
|
||||
|
||||
$i = 0;
|
||||
$n = array\length($jobs);
|
||||
while($i < $n,
|
||||
$job = array\at($jobs, $i);
|
||||
$log = attr($job, 'log');
|
||||
|
||||
$name = attr($job, 'name');
|
||||
$last_exec = datetime\format(attr($job, 'lastexec'), 'Europe/Amsterdam', 'DD/MM/YYYY HH:mm:ss');
|
||||
|
||||
strAdd($html, '<h3>', $name, '</h3>');
|
||||
strAdd($html, '<p>', 'Laatste uitvoering: ', $last_exec, '</p>');
|
||||
|
||||
$html = string\concatenate($html, '<table><tbody>', $log, '</tbody></table>');
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
$body = emailTemplate;
|
||||
$body = string\replace($body, '{{log}}', $html);
|
||||
$dt = datetime\format(datetime\now(), 'Europe/Amsterdam', 'DD/MM/YYYY');
|
||||
$subject = string\concatenate('NVKH Crm - Job Verslag - ', $dt);
|
||||
$userId = env\userAttribute('id');
|
||||
$mailadr = configGet('job-report-mail-address');
|
||||
|
||||
$emailId = record\create('Email', 'subject', $subject,
|
||||
'body', $body,
|
||||
'to', $mailadr,
|
||||
'assignedUser', $userId,
|
||||
'isUser', true,
|
||||
'parentType', 'Script',
|
||||
'parentId', id
|
||||
);
|
||||
ext\email\send($emailId);
|
||||
|
||||
logAdd(log, 'info', 'Mail gestuurd naar ', $mailadr);
|
||||
@@ -0,0 +1,9 @@
|
||||
Maakt een distributielijst voor degenen van de homeopaten die in een op te geven jaar nog geen nascholingen hebben opgegeven en ook niet in dat jaar zijn afgestudeerd. Op te nemen:
|
||||
|
||||
* aantal overige dagen = 0 &
|
||||
* aantal dagen homeopathie = 0 &
|
||||
* aantal dagen medisch = 0 &
|
||||
* niet aangevinkt: geen nascholingen gevolgd &
|
||||
* jaar van registratie >= opgegeven jaar &
|
||||
* regiocode < 30 &
|
||||
* geen verloskundige
|
||||
@@ -0,0 +1 @@
|
||||
5fa3deb12801abd47
|
||||
@@ -0,0 +1,107 @@
|
||||
// last execution: Fri Feb 06 2026 09:50:10 GMT+0100 (Midden-Europese standaardtijd)
|
||||
|
||||
$par_nascholings_jaar=2025;
|
||||
|
||||
logAdd(log);
|
||||
|
||||
$year = $par_nascholings_jaar;
|
||||
$list_name = string\concatenate('Na te scholen - ', $year);
|
||||
|
||||
$entities = Entity\GetMany('TargetList', 1, 'name', 'asc', 'name=', $list_name);
|
||||
$n = array\length($entities);
|
||||
|
||||
ifThenElse($n == 0,
|
||||
logAdd(log, 'warning', 'Geen distributielijst met naam: "', $list_name, '", maak deze eerst aan!');
|
||||
,
|
||||
logAdd(log, 'info', 'Distributielijst 'Na te scholen' aanwezig, leden worden vervangen...');
|
||||
|
||||
$doellijst = array\at($entities, 0);
|
||||
$id = attr($doellijst, 'id');
|
||||
|
||||
logAdd(log, 'info', 'Leegmaken distributielijst...');
|
||||
$rows = record\fetchRelatedManyHash('TargetList', $id,
|
||||
'contacts', 'id, lastName, regiocode',
|
||||
'lastName', 'asc'
|
||||
);
|
||||
$n = array\length($rows);
|
||||
logAdd(log, 'info', 'Aantal gerelateerde leden: ', $n);
|
||||
$i = 0;
|
||||
$rcnt = 0;
|
||||
while($i < $n,
|
||||
$row = array\at($rows, $i);
|
||||
$contact_id = hash\get($row, 'id');
|
||||
record\unrelate('TargetList', $id, 'contacts', $contact_id);
|
||||
$rcnt = $rcnt + 1;
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
logAdd(log, 'info', 'Relateren leden met regiocode < 30 en nascholingen = 0 en niet dispensatie en niet geregistreerd in het opgegeven jaar');
|
||||
$rows = record\fetchManyHash('Contact', 'id, lidnummer, lastName, regiocode, dispensatie, datumRegistratie', 'lastName', 'asc');
|
||||
$n = array\length($rows);
|
||||
logAdd(log, 'info', 'Aantal leden om te beoordelen: ', $n);
|
||||
$i = 0;
|
||||
$cnt = 0;
|
||||
$hom_cnt = 0;
|
||||
while($i < $n,
|
||||
$row = array\at($rows, $i);
|
||||
$code = hash\get($row, 'regiocode') + 0;
|
||||
ifThen($code < 8 || $code == 10,
|
||||
$datum_registratie = hash\get($row, 'datumRegistratie');
|
||||
$jaar_reg = datetime\year($datum_registratie);
|
||||
$dispensatie = hash\get($row, 'dispensatie');
|
||||
$lastname = hash\get($row, 'lastName');
|
||||
$lidnummer = hash\get($row, 'lidnummer');
|
||||
|
||||
$niet = ($jaar_reg >= $year) || $dispensatie;
|
||||
logAdd(log, 'info', 'lid ', $lidnummer, ' (', $lastname, '): jaar_reg=', $datum_registratie, ', dispensatie = ', $dispensatie, ' registratiejaar = ', $jaar_reg);
|
||||
|
||||
ifThenElse($niet,
|
||||
logAdd(log, 'info', 'lid ', $lastname, ': dispensatie = ', $dispensatie, ' registratiejaar = ', $jaar_reg);
|
||||
,
|
||||
$hom_cnt = $hom_cnt + 1;
|
||||
$contact_id = hash\get($row, 'id');
|
||||
|
||||
// Opvoeren lid als deze voor de nascholingstotalen op 0 zit en
|
||||
// niet is aangegeven dat hij/zij geen nascholingen heeft gevolgd
|
||||
|
||||
$t_rows = record\fetchManyHash('Nascholingstotaal',
|
||||
'contactId, dagenHomeopathie, dagenMedisch, dagen, geenNascholingGevolgd',
|
||||
'jaar', 'asc',
|
||||
'jaar=', $year,
|
||||
'contactId=', $contact_id
|
||||
);
|
||||
$t_rows_n = array\length($t_rows);
|
||||
|
||||
ifThenElse($t_rows_n == 0,
|
||||
logAdd(log, 'error', 'Geen nascholingstotaal voor contact ', $lastname);
|
||||
,
|
||||
ifThenElse($t_rows_n > 1,
|
||||
logAdd(log, 'error', 'Onverwacht! aantal records nascholingstotaal > 1 voor ', $lastname);
|
||||
,
|
||||
$t_row = array\at($t_rows, 0);
|
||||
$dagenHomeopathie = hash\get($t_row, 'dagenHomeopathie');
|
||||
$dagenMedisch = hash\get($t_row, 'dagenMedisch');
|
||||
$dagenOverig = hash\get($t_row, 'dagen');
|
||||
$geen = hash\get($t_row, 'geenNascholingGevolgd');
|
||||
ifThenElse($geen, $geen=1;, $geen=0);
|
||||
$tot = $dagenHomeopathie + $dagenMedisch + $dagenOverig + $geen;
|
||||
|
||||
ifThenElse($geen == 0, $nv = "niet aangevinkt", $nv = "wel aangevinkt");
|
||||
|
||||
logAdd(log, 'info', $lidnummer, ': homeopathie=', $dagenHomeopathie, ', medisch=', $dagenMedisch,
|
||||
', overig=', $dagenOverig, ', niet gevolgd=', $nv, ', tot=', $tot);
|
||||
|
||||
ifThen($tot <= 0,
|
||||
$cnt = $cnt + 1;
|
||||
logAdd(log, 'warning', 'Toevoegen lid: ',$cnt, ' - lidnummer:', $lidnummer, ', naam:', $lastname);
|
||||
record\relate('TargetList', $id, 'contacts', $contact_id);
|
||||
);
|
||||
)
|
||||
|
||||
);
|
||||
)
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
logAdd(log, 'info', $cnt, ' leden op de lijst');
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
Door de veranderde structuur. Geaccrediteerde nascholingen bij leden omzetten naar handmatige nascholingen gekoppeld aan het jaar van nascholing.
|
||||
@@ -0,0 +1 @@
|
||||
5fca2bdbde7c729ff
|
||||
@@ -0,0 +1,47 @@
|
||||
// last execution: Fri Dec 04 2020 14:28:53 GMT+0100 (Midden-Europese standaardtijd)
|
||||
|
||||
logAdd(log);
|
||||
|
||||
$contacts = Entity\GetRelated(Entity\This(), 'contacts', 1000);
|
||||
|
||||
$n = array\length($contacts);
|
||||
$i = 0;
|
||||
|
||||
while($i < $n,
|
||||
$contact = array\at($contacts, $i);
|
||||
$contact_id = attr($contact, 'id');
|
||||
logAdd(log, 'info', 'Contact: ', attr($contact, 'lastName'));
|
||||
|
||||
$nascholingen = Entity\GetRelated($contact, 'nascholingen', 1000);
|
||||
$j = 0;
|
||||
$m = array\length($nascholingen);
|
||||
|
||||
ifThen($m > 0,
|
||||
$totaal_2020s = Entity\GetRelated($contact, 'nascholingstotalen', 1000, 'jaar', 'asc', 'jaar=', 2020);
|
||||
$totaal_2020 = array\at($totaal_2020s, 0);
|
||||
$totaal_2020_id = attr($totaal_2020, 'id');
|
||||
|
||||
while($j < $m,
|
||||
$nascholing = array\at($nascholingen, $j);
|
||||
$nasch_id = attr($nascholing, 'id');
|
||||
logAdd(log, 'info', 'Nascholing: ', attr($nascholing, 'code'), ' - ', $nasch_id);
|
||||
$rec_id = record\create('HandmatigeNascholing', 'accNascholingId', $nasch_id,
|
||||
'contactId', $contact_id, 'status', 'presentielijst'
|
||||
);
|
||||
record\relate('Nascholingstotaal', $totaal_2020_id, 'nascholingen', $rec_id);
|
||||
$j = $j + 1;
|
||||
);
|
||||
|
||||
$j = 0;
|
||||
while ($j < $m,
|
||||
$nascholing = array\at($nascholingen, $j);
|
||||
$nasch_id = attr($nascholing, 'id');
|
||||
record\unrelate('Contact', $contact_id, 'nascholingen', $nasch_id);
|
||||
$j = $j + 1;
|
||||
);
|
||||
);
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Maakt nascholingsdata aan bij een opgevoerde geaccrediteerde nascholing
|
||||
@@ -0,0 +1 @@
|
||||
60030cfe09affc218
|
||||
@@ -0,0 +1,51 @@
|
||||
// last execution: Sat Jan 16 2021 17:25:13 GMT+0100 (Midden-Europese standaardtijd)
|
||||
|
||||
logAdd(log);
|
||||
|
||||
$nascholingen = record\fetchManyHash('Nascholing', 'id, name, dateStart, dateEnd', 'name', 'asc');
|
||||
|
||||
$i = 0;
|
||||
$n = array\length($nascholingen);
|
||||
logAdd(log, 'info', '#Nasscholingen: ', $n);
|
||||
//$n = 1;
|
||||
|
||||
$userid = env\userAttribute('id');
|
||||
|
||||
while($i < $n,
|
||||
$row = array\at($nascholingen, $i);
|
||||
$name = hash\Get($row, 'name');
|
||||
$id = hash\Get($row, 'id');
|
||||
|
||||
$dateStart = hash\Get($row, 'dateStart');
|
||||
$dateEnd = hash\Get($row, 'dateEnd');
|
||||
|
||||
$data = record\fetchRelatedManyHash('Nascholing', $id, 'nascholingsDatums', 'id', 'name', 'asc');
|
||||
$ndata = array\length($data);
|
||||
|
||||
$info = 'info';
|
||||
ifThen($ndata > 1, $info = 'warning');
|
||||
logAdd(log, $info, 'Nascholing: ', $name, ' - ', $ndata, ' datums geregistreerd');
|
||||
|
||||
ifThen($ndata == 0,
|
||||
$days = datetime\diff($dateEnd, $dateStart, 'days') + 1;
|
||||
$info = 'info';
|
||||
ifThen($days > 1, $info='warning');
|
||||
logAdd(log, $info, 'Aantal dagen: ', $days);
|
||||
|
||||
$endtime = datetime\format($dateEnd, 'UTC', 'HH:mm:ss');
|
||||
|
||||
logAdd(log, $info, 'einde dag:', $endtime);
|
||||
|
||||
$dt = $dateStart;
|
||||
$dte = string\concatenate(datetime\format($dt, 'europe/amsterdam', 'YYYY-MM-DD'), ' ', $endtime);
|
||||
|
||||
$id = record\create('NascholingsDatum',
|
||||
'dagStart', $dt, 'dagEinde', $dte,
|
||||
'nascholingId', $id,
|
||||
'assignedUserId', $userid
|
||||
);
|
||||
);
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Maakt nascholingsnormen aan van jaar tot jaar
|
||||
@@ -0,0 +1 @@
|
||||
6003147ebce563769
|
||||
@@ -0,0 +1,22 @@
|
||||
// last execution: Sat Jan 16 2021 17:33:26 GMT+0100 (Midden-Europese standaardtijd)
|
||||
|
||||
$userid = env\userAttribute('id');
|
||||
|
||||
$regiocode = '08';
|
||||
|
||||
$jaar_begin = 2025;
|
||||
$jaar_einde = 2030;
|
||||
$dagen = 2;
|
||||
$hom = 2;
|
||||
$med = 0;
|
||||
$jaar = $jaar_begin;
|
||||
while($jaar < $jaar_einde,
|
||||
record\create(
|
||||
'Nascholingsnorm',
|
||||
'jaar', $jaar,
|
||||
'dagen', $dagen, 'dagenHomeopathie', $hom, 'dagenMedisch', $med,
|
||||
'regiocode', $regiocode,
|
||||
'assignedUserId', $userid
|
||||
);
|
||||
$jaar = $jaar + 1;
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
Maakt indien nodig het nascholingstotaal - jaar record van het huidige jaar aan voor alle geldige contacten, d.w.z. met regiocode <30. Wordt als Job uitgevoerd, dus hoeft niet handmatig te worden uitgevoerd.
|
||||
@@ -0,0 +1 @@
|
||||
5f0c64eef3607a14b
|
||||
@@ -0,0 +1,66 @@
|
||||
// last execution: 2026-08-27 23:00:01
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Script start
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
log('warning', 'Executing ', name);
|
||||
logAdd(log);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Nascholingsnorm inlezen
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
ifThen(!global\isset('nascholingsnorm-hash'),
|
||||
$na_script = configGet('script-lees-nascholingsnorm-hash');
|
||||
Exec($na_script);
|
||||
);
|
||||
$na_norm = global\get('nascholingsnorm-hash');
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Bepalen jaar en nascholingsnorm en creeren records bij leden die dat nodig hebben
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$jaar = datetime\year(datetime\now());
|
||||
//$jaar=2018;
|
||||
|
||||
ifThenElse(!hash\isSet($na_norm, $jaar),
|
||||
logAdd(log, 'error', 'Er is geen normering vastgelegd voor jaar ', $jaar, '!');
|
||||
,
|
||||
$norm_id = hash\get(hash\get($na_norm, $jaar), 'id');
|
||||
|
||||
logAdd(log, 'info', 'Jaar: ', $jaar);
|
||||
logAdd(log, 'info', 'Nascholingsnorm id:', $norm_id);
|
||||
logAdd(log, 'info', 'Nascholingsnorm jaar: ', hash\get(hash\get($na_norm, $jaar), 'jaar'));
|
||||
|
||||
$rows = record\FetchManyHash('Contact', 'id, name, regiocode', 'name', 'asc');
|
||||
$n = array\length($rows);
|
||||
$i = 0;
|
||||
$aantal = 0;
|
||||
$aantal_zonder = 0;
|
||||
|
||||
while($i < $n,
|
||||
$row = array\at($rows, $i);
|
||||
$regiocode = hash\get($row, 'regiocode') + 0;
|
||||
ifThen($regiocode < 30,
|
||||
$aantal = $aantal + 1;
|
||||
$contact_id = hash\get($row, 'id');
|
||||
$cnt = record\count('Nascholingstotaal', 'jaar=', $jaar, 'contactId=', $contact_id);
|
||||
ifThen($cnt == 0,
|
||||
$name = hash\get($row, 'name');
|
||||
//logAdd(log, 'info', 'Contact: ', $name, ' #Nascholingstotaaal voor ', $jaar, ': ', $cnt);
|
||||
$aantal_zonder = $aantal_zonder + 1;
|
||||
record\create('Nascholingstotaal', 'jaar', $jaar,
|
||||
'contactId', $contact_id,
|
||||
'nascholingsnormId', $norm_id,
|
||||
'handmatig', false
|
||||
);
|
||||
);
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
);
|
||||
|
||||
logAdd(log, 'info', 'jaar: ', $jaar);
|
||||
logAdd(log, 'info', '#Aantal leden met regiocode < 30: ', $aantal);
|
||||
logAdd(log, 'info', '#Aantal leden met regiocode < 30 zonder nascholingstotaal voor gegeven jaar : ', $aantal_zonder);
|
||||
logAdd(log, 'info', $aantal_zonder, ' aangemaakte nascholingstotalen.');
|
||||
@@ -0,0 +1 @@
|
||||
Hiermee kan voor een gegeven contact de berekening van de nascholingstotalen worden gestart.
|
||||
@@ -0,0 +1 @@
|
||||
63c1c37ad36bde87e
|
||||
@@ -0,0 +1,70 @@
|
||||
// last execution: Mon Aug 10 2026 14:14:13 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
// last execution: 2023-01-13 03:30:02
|
||||
$script_alle_totalen = configGet('script-bereken-nascholingstotalen');
|
||||
$script_calc_totaal_voor_jaar = configGet('script-bereken-nascholingstotaal-voor-jaar');
|
||||
|
||||
log('warning', 'Fetching Maximum nascholingstotaal');
|
||||
$rows= Record\FetchManyHash('Nascholingstotaal', 'jaar', 'jaar', 'desc', 'limit by', 1);
|
||||
$n_rows = array\length($rows);
|
||||
|
||||
log('warning', 'n_rows=', $n_rows);
|
||||
|
||||
logAdd(log);
|
||||
logAdd(log, 'info', 'n_rows = ', $n_rows);
|
||||
|
||||
ifThenElse($n_rows == 0,
|
||||
logAdd(log, 'info', '0 nascholingstotalen');
|
||||
,
|
||||
logAdd(log, 'info', $n_rows, ' nascholingstotalen');
|
||||
$row = array\at($rows, 0);
|
||||
$max_jaar = hash\get($row, 'jaar');
|
||||
logAdd(log, 'info', 'Maximum jaar met nascholingstotalen = ', $max_jaar);
|
||||
|
||||
logAdd(log, 'info', 'Herberekenen van alle nascholingstotalen.');
|
||||
|
||||
logAdd(log, 'info', 'Voor alle contacten gerelateerd aan dit script.');
|
||||
|
||||
$rows = record\fetchRelatedManyHash('Script', id, 'contacts', 'id, lidnummer, name', 'name', 'asc');
|
||||
$n_rows = array\length($rows);
|
||||
$i = 0;
|
||||
|
||||
log('warning', 'i=', $i, ', n_rows=', $n_rows);
|
||||
|
||||
while($i < $n_rows,
|
||||
$row = array\at($rows, $i);
|
||||
$contact_id = hash\get($row, 'id');
|
||||
$lidnummer = hash\get($row, 'lidnummer');
|
||||
$lastname = hash\get($row, 'name');
|
||||
logAdd(log, 'info', 'lid: ', $lidnummer, ' - ', $lastname, ' - herberekenen...');
|
||||
log('warning', 'Herberekenen alle totalen voor lid ', $lidnummer, ', id = ', $contact_id);
|
||||
|
||||
$tot_rows = Record\FetchManyHash('Nascholingstotaal', 'id, jaar',
|
||||
'jaar', 'asc', 'contactId=', $contact_id);
|
||||
$n_tot_rows = array\length($tot_rows);
|
||||
|
||||
ifThenElse($n_tot_rows == 0,
|
||||
logAdd(log, 'info', 'Geen nascholingstotalen voor dit lid');
|
||||
,
|
||||
$t_row = 0;
|
||||
while($t_row < $n_tot_rows,
|
||||
$tot_row = array\at($tot_rows, $t_row);
|
||||
$jaar = hash\get($tot_row, 'jaar');
|
||||
$t_id = hash\get($tot_row, 'id');
|
||||
|
||||
logAdd(log, 'info', 'Berekenen jaar voor lid ', $lidnummer, ', jaar:', $jaar);
|
||||
|
||||
$no_db_update == false;
|
||||
$year = $jaar;
|
||||
Exec($script_calc_totaal_voor_jaar);
|
||||
|
||||
$t_row = $t_row + 1;
|
||||
);
|
||||
|
||||
// bereken de hele zaak
|
||||
$year = $jaar;
|
||||
Exec($script_alle_totalen);
|
||||
);
|
||||
$i = $i + 1;
|
||||
);
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
Relateert de nascholingstotalen aan het juiste norm record
|
||||
@@ -0,0 +1 @@
|
||||
5f0c7cd0681a3e480
|
||||
@@ -0,0 +1,28 @@
|
||||
// last execution: Mon Jul 13 2020 17:56:15 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
logAdd(log);
|
||||
|
||||
$script = configGet('script-lees-nascholingsnorm-hash');
|
||||
Exec($script);
|
||||
$norm_hash = global\get('nascholingsnorm-hash');
|
||||
|
||||
$jaar = 2020;
|
||||
while($jaar <= 2020,
|
||||
$rows = record\fetchManyHash('Nascholingstotaal', 'id', 'createdAt', 'asc', 'jaar=', $jaar);
|
||||
$i = 0;
|
||||
$n = array\length($rows);
|
||||
|
||||
$norm_jaar = hash\get($norm_hash, $jaar);
|
||||
$norm_id = hash\get($norm_jaar, 'id');
|
||||
|
||||
|
||||
while($i < $n,
|
||||
$row = array\at($rows, $i);
|
||||
$id = hash\get($row, 'id');
|
||||
record\relate('Nascholingstotaal', $id, 'nascholingsnorm', $norm_id);
|
||||
$i = $i + 1;
|
||||
);
|
||||
logAdd(log, 'info', $n, ' nascholingstotalen behandeld voor jaar ', $jaar);
|
||||
$jaar = $jaar + 1;
|
||||
);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Schoont alle updates door leden die ouder zijn dan 'Aantal dagen oud' dagen op. Minimum: 3 dagen. Maximum: 120 dagen.
|
||||
@@ -0,0 +1 @@
|
||||
5f0ff18c1d0f01475
|
||||
@@ -0,0 +1,47 @@
|
||||
// last execution: 2026-08-28 02:00:01
|
||||
$par_Aantal_dagen_oud=120;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Script start
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
log('warning', 'Executing ', name);
|
||||
logAdd(log);
|
||||
|
||||
$p_days = $par_Aantal_dagen_oud;
|
||||
logAdd(log, 'info', '#Dagen als parameter: ', $p_days);
|
||||
|
||||
ifThenElse($p_days,
|
||||
ifThenElse($p_days < 3,
|
||||
$p_days = 3;
|
||||
,
|
||||
ifThen($p_days > 120,
|
||||
$p_days = 120;
|
||||
);
|
||||
);
|
||||
,
|
||||
$p_days = 90;
|
||||
);
|
||||
|
||||
logAdd(log, 'info', '#Dagen na correctie: ', $p_days);
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Opschonen ledenupdates
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
$cleanup_date = datetime\addDays(datetime\now(), -1 * $p_days);
|
||||
|
||||
$ids = record\findMany('Ledenupdates', 'createdAt', 'desc', 'createdAt<', $cleanup_date);
|
||||
$cnt = array\length($ids);
|
||||
|
||||
logAdd(log, 'info', '#Ledenupdates om te verwijderen: ', $cnt);
|
||||
|
||||
$i = 0;
|
||||
$n = $cnt;
|
||||
while($i < $n,
|
||||
$id = array\at($ids, $i);
|
||||
record\update('Ledenupdates', $id, 'deleted', true);
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
logAdd(log, 'info', 'Voor ', $cnt, ' records deleted = true gezet');
|
||||
@@ -0,0 +1 @@
|
||||
Koppelt per Portaal Account, de praktijken behorend bij het contact van het portaal account aan het Portaal account, zodat de juiste relaties er liggen.
|
||||
@@ -0,0 +1 @@
|
||||
5fd37dda13bc6dbcf
|
||||
@@ -0,0 +1,24 @@
|
||||
// last execution: 2026-03-28 01:00:01
|
||||
logAdd(log);
|
||||
|
||||
$portal_users = record\fetchManyHash('User', 'id, userName, contactId', 'userName', 'asc', 'type=', 'portal');
|
||||
$script_praktijken_koppelen = configGet('script-praktijken-koppelen-aan-portal-user');
|
||||
|
||||
$n = array\length($portal_users);
|
||||
$i = 0;
|
||||
|
||||
logAdd(log, 'info', $n, ' portal users');
|
||||
|
||||
while($i < $n,
|
||||
$u = array\at($portal_users, $i);
|
||||
$username = hash\get($u, 'userName');
|
||||
|
||||
$user_id = hash\get($u, 'id');
|
||||
$contact_id = hash\get($u, 'contactId');
|
||||
|
||||
logAdd(log, 'info', 'user:', $username, ' id:', $user_id);
|
||||
|
||||
exec($script_praktijken_koppelen);
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
@@ -0,0 +1 @@
|
||||
Maakt één of meerdere presentielijsten van alle homeopaten, afhankelijk van de gekozen geaccrediteerde nascholing.
|
||||
@@ -0,0 +1 @@
|
||||
5fd31282705796983
|
||||
@@ -0,0 +1,215 @@
|
||||
// last execution: Tue Jul 07 2026 10:09:08 GMT+0200 (Midden-Europese zomertijd)
|
||||
|
||||
//ex last execution: Sat Jan 16 2021 16:45:52 GMT+0100 (Midden-Europese standaardtijd)
|
||||
|
||||
logAdd(log);
|
||||
logAdd(log, 'info', 'Aanmaken Excel Exports');
|
||||
|
||||
$leden = record\fetchManyHash('Contact', 'name, lidnummer', 'lastName', 'asc', 'regiocode<=', '10');
|
||||
|
||||
$js_leden = '';
|
||||
$n = array\length($leden);
|
||||
$i = 0;
|
||||
|
||||
while($i < $n,
|
||||
$obj = array\at($leden, $i);
|
||||
$naam = hash\get($obj, 'name');
|
||||
$lidnr = hash\get($obj, 'lidnummer');
|
||||
|
||||
$naam = string\replace($naam, "'", "\'");
|
||||
ifThen($i > 0, strAdd($js_leden, ', '));
|
||||
strAdd($js_leden, "['", $naam, "', '", $lidnr, "']");
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
logAdd(log, 'info', $n, ' leden');
|
||||
|
||||
$func_name = "exportFiles_";
|
||||
|
||||
$func_name = string\concatenate($func_name, number\randomInt());
|
||||
|
||||
$h = "";
|
||||
strAdd($h, '<script nonce="7tgetfwru8">', "\n");
|
||||
strAdd($h, 'function ',$func_name, '() { ', "\n");
|
||||
strAdd($h, "console.log('exporteren presentielijsten');");
|
||||
strAdd($h, 'var leden = [', $js_leden, '];', "\n");
|
||||
|
||||
$nascholingen = entity\getRelated(Entity\this(), 'nascholingen', 1000, 'name', 'asc');
|
||||
$n = array\length($nascholingen);
|
||||
$aantal_nascholingen = $n;
|
||||
$i = 0;
|
||||
while($i < $n,
|
||||
$nascholing = array\at($nascholingen, $i);
|
||||
$nascholing_id = attr($nascholing, 'id');
|
||||
$code = attr($nascholing, 'code');
|
||||
$naam = attr($nascholing, 'name');
|
||||
$datum = attr($nascholing, 'datum');
|
||||
$einde = attr($nascholing, 'eindDatum');
|
||||
$fn_name = string\replace($naam, " ", "_");
|
||||
$fn_name = string\replace($fn_name, ".", "_");
|
||||
$fn_name = string\replace($fn_name, "(", "_");
|
||||
$fn_name = string\replace($fn_name, ")", "_");
|
||||
|
||||
$datum_rows = record\fetchRelatedManyHash('Nascholing', $nascholing_id, 'nascholingsDatums', 'datum', 'datum', 'asc');
|
||||
$datums = list();
|
||||
|
||||
$k = 0;
|
||||
$days = array\length($datum_rows);
|
||||
|
||||
logAdd(log, 'info', 'datum: ', $datum, ', eind datum: ', $einde, ', dagen: ', $days);
|
||||
|
||||
while ($k < $days,
|
||||
$datum_row = array\at($datum_rows, $k);
|
||||
$dat = hash\Get($datum_row, 'datum');
|
||||
$datums = array\push($datums, $dat);
|
||||
$k = $k + 1;
|
||||
);
|
||||
|
||||
$k = 0;
|
||||
$dates = '';
|
||||
$comma = '';
|
||||
while($k < $days,
|
||||
$dt = array\at($datums, $k);
|
||||
strAdd($dates, $comma, "new Date('", $dt, "')");
|
||||
$k = $k + 1;
|
||||
$comma = ',';
|
||||
);
|
||||
logAdd(log, 'info', 'dates: ', $dates);
|
||||
|
||||
strAdd($h, "{", "\n");
|
||||
|
||||
// Data
|
||||
strAdd($h, ' var data = leden.map(function(x) { return x; });', "\n");
|
||||
strAdd($h, " data.unshift(['Naam', 'Lidnummer', ",$dates, "]);");
|
||||
strAdd($h, ' data.unshift([]);', "\n");
|
||||
strAdd($h, " data.unshift(['Gebruik een X om aan te kruizen of een lid aanwezig is, vul anders niets in.']);");
|
||||
strAdd($h, ' data.unshift([]);', "\n");
|
||||
strAdd($h, " data.unshift(['Nascholing', '", $code, "', '", $naam, "']);", "\n");
|
||||
strAdd($h, " data.unshift(['Presentielijst', 'Nascholingsdatum:', new Date('", $datum, "'), 't/m', new Date('",$einde, "')]);", "\n");
|
||||
strAdd($h, " var ws_name = 'Presentielijst';", "\n");
|
||||
strAdd($h, " var filename = 'Presentielijst-", $datum, "-", $fn_name, ".xlsx';", "\n");
|
||||
strAdd($h, " var wb = new ExcelJS.Workbook();", "\n");
|
||||
strAdd($h, " var ws = wb.addWorksheet(ws_name);", "\n");
|
||||
strAdd($h, " ws.getColumn(1).width = 40;", "\n");
|
||||
strAdd($h, " ws.getColumn(2).width = 18;", "\n");
|
||||
strAdd($h, " ws.getColumn(3).width = 12;", "\n");
|
||||
strAdd($h, " ws.getColumn(4).width = 12;", "\n");
|
||||
strAdd($h, " ws.getColumn(5).width = 12;", "\n");
|
||||
$k = 0;
|
||||
while($k < $days,
|
||||
strAdd($h, " ws.getColumn(3 + ", $k, ").width = 12;", "\n");
|
||||
$k = $k + 1;
|
||||
);
|
||||
strAdd($h, " var i;", "\n");
|
||||
strAdd($h, " for(i = 0; i < data.length; i++) {", "\n");
|
||||
strAdd($h, " var row = ws.getRow(i + 1);", "\n");
|
||||
strAdd($h, " var j;", "\n");
|
||||
strAdd($h, " var r = data[i];", "\n");
|
||||
strAdd($h, " for(j = 0; j < r.length; j++) {", "\n");
|
||||
strAdd($h, " row.getCell(j + 1).value = r[j];", "\n");
|
||||
strAdd($h, " }", "\n");
|
||||
strAdd($h, " }", "\n");
|
||||
|
||||
// Formatting
|
||||
strAdd($h, " ws.getCell('C1').alignment = { horizontal:'left' };", "\n");
|
||||
strAdd($h, " ws.getCell('A1').font = { name: 'Arial', size:14, bold:true };", "\n");
|
||||
strAdd($h, " ws.getCell('A2').font = { name: 'Arial', bold:true };", "\n");
|
||||
strAdd($h, " ws.getCell('D1').alignment = { horizontal:'center' };", "\n");
|
||||
strAdd($h, " ws.getCell('A6').font = { name: 'Arial', bold: true };", "\n");
|
||||
strAdd($h, " ws.getCell('B6').font = { name: 'Arial', bold: true };", "\n");
|
||||
$k = 0;
|
||||
while($k < $days,
|
||||
strAdd($h, " ws.getCell(String.fromCharCode(67 + ",$k,") + '6').font = { name: 'Arial', bold: true };", "\n");
|
||||
$k = $k + 1;
|
||||
);
|
||||
strAdd($h, " for(i = 0; i < leden.length; i++) {", "\n");
|
||||
strAdd($h, " ws.getCell('B' + (i + 6)).alignment = { horizontal:'center' };", "\n");
|
||||
$k = 0;
|
||||
while($k < $days,
|
||||
strAdd($h, " ws.getCell(String.fromCharCode(67 + ", $k, ") + (i + 6)).alignment = { horizontal:'center' };", "\n");
|
||||
$k = $k + 1;
|
||||
);
|
||||
//strAdd($h, " ws.getCell('C' + (i + 6)).alignment = { horizontal:'center' };", "\n");
|
||||
strAdd($h, " }","\n");
|
||||
|
||||
// Conditional formatting
|
||||
$formulae = "'OR('";
|
||||
$k = 0;
|
||||
$comma = '';
|
||||
while($k < $days,
|
||||
strAdd($formulae, "+'", $comma, "$' + String.fromCharCode(67 + ", $k, ") + '7=\"X\"'");
|
||||
$comma = ';';
|
||||
strAdd($formulae, "+'", $comma, "$' + String.fromCharCode(67 + ", $k, ") + '7=\"x\"'");
|
||||
$k = $k + 1;
|
||||
);
|
||||
strAdd($formulae, "+')'");
|
||||
|
||||
$k = 0;
|
||||
while($k < $days,
|
||||
$formulae = string\concatenate("'$' + String.fromCharCode(67 + ", $k, ") + '7=\"X\"'");
|
||||
strAdd($h, " ws.addConditionalFormatting({", "\n");
|
||||
strAdd($h, " ref: 'A7:' + String.fromCharCode(67 + ", $days - 1, ") + (leden.length + 7), ", "\n");
|
||||
strAdd($h, " rules: [ { type: 'expression', formulae: [", $formulae, "], ", "\n");
|
||||
strAdd($h, " style: {fill: {type: 'pattern', pattern: 'solid', bgColor: {argb: 'FF82F59F'}}}", "\n");
|
||||
strAdd($h, " }]", "\n");
|
||||
strAdd($h, " });", "\n");
|
||||
$k = $k + 1;
|
||||
);
|
||||
|
||||
// Output to file
|
||||
strAdd($h, " var wrt = function(fn, wb) {", "\n");
|
||||
strAdd($h, " wb.xlsx.writeBuffer().then(function(data) {", "\n");
|
||||
strAdd($h, " const blob = new Blob([data], ", "\n");
|
||||
strAdd($h, " { type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' });", "\n");
|
||||
strAdd($h, " const url = window.URL.createObjectURL(blob);", "\n");
|
||||
strAdd($h, " const anchor = document.createElement('a');", "\n");
|
||||
//strAdd($h, " anchor.style.display='none';", "\n");
|
||||
strAdd($h, " document.body.appendChild(anchor);", "\n");
|
||||
strAdd($h, " anchor.href = url;", "\n");
|
||||
strAdd($h, " anchor.download = fn;", "\n");
|
||||
strAdd($h, " console.log(fn);", "\n");
|
||||
strAdd($h, " anchor.click();", "\n");
|
||||
//strAdd($h, " window.URL.revokeObjectURL(url);", "\n");
|
||||
strAdd($h, " });", "\n");
|
||||
strAdd($h, " };", "\n");
|
||||
strAdd($h, "wrt(filename, wb);", "\n");
|
||||
|
||||
// End
|
||||
strAdd($h, "console.log(filename);");
|
||||
strAdd($h, "}", "\n");
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
strAdd($h, "}", "\n");
|
||||
strAdd($h, "</script>", "\n");
|
||||
|
||||
logAdd(log, 'info', 'Export button');
|
||||
|
||||
ifThenElse($aantal_nascholingen == 0,
|
||||
strAdd($h, "<h1>Presentielijsten maken</h1>");
|
||||
strAdd($h, "Selecteer 1 of meer geaccrediteerde nascholingen om lijsten voor te maken.");
|
||||
,
|
||||
strAdd($h, "<h1>Presentielijsten maken</h1>");
|
||||
$pl = "presentielijsten";
|
||||
ifThen($aantal_nascholingen == 1, $pl = "presentielijst");
|
||||
$button_id = "jdkerehnsmrletjkrk%34js";
|
||||
strAdd($h, '<button id="', $button_id, '">');
|
||||
strAdd($h, " Download ", $aantal_nascholingen, " ", $pl);
|
||||
strAdd($h, "</button>");
|
||||
strAdd($h, '<script nonce="7tgetfwru8">', "\n");
|
||||
strAdd($h, ' { let button_el = document.getElementById(\'', $button_id, '\');', "\n");
|
||||
strAdd($h, ' console.log(button_el);', "\n");
|
||||
strAdd($h, ' $(button_el).on(\'click\', ', $func_name, ');', "\n");
|
||||
strAdd($h, ' }', "\n");
|
||||
|
||||
//strAdd($h, ' $("#" + \'', $button_id, '\').on(\'click\', ', $func_name, ');', "\n");
|
||||
strAdd($h, '</script>', "\n");
|
||||
);
|
||||
|
||||
logAdd(log, 'info', 'setting html');
|
||||
|
||||
html = $h;
|
||||
|
||||
logAdd(log, 'info', 'done');
|
||||
@@ -0,0 +1,22 @@
|
||||
Dit is voor een geaccrediteerde nascholing met één of meer datums voor dagen waarop de presentie kan worden bijgehouden.
|
||||
Leest een eerder gemaakte presentielijst in (zie aanmaken presentielijsten). Deze moet eerst worden opgeslagen als CSV formaat in Excel of Libreoffice. Vervolgens kan deze worden ingelezen.
|
||||
|
||||
Per lid waarbij 1 of meer kruisjes staan wordt bepaald aan de hand van het aantal datums wat de presentiefactor is. Deze is >0 en <= 1. Indien bijvoorbeeld 5 data mogelijk zijn en een lid is er 4 van de vijf, dan is presentiefactor 0.8.
|
||||
|
||||
Bij het lid wordt een nascholingsrecord opgevoerd. Als deze er al is en op basis van een presentielijst is opgevoerd, wordt deze **overschreven** door de import. Daarbij wordt bij het administreren van het aantal dagen de presentiefactor opgeslagen en gebruikt om het aantal gevolgde dagen te berekenen.
|
||||
|
||||
Bij het verwijderen worden alleen nascholingsrecords die op basis van een presentielijst zijn opgevoerd verwijderd.
|
||||
|
||||
**NB: Dit script werkt zolang alleen het aantal dagen presentie geteld wordt en de datum van presentie voor het tellen niet van belang is!**
|
||||
|
||||
Het format moet voldoen aan het volgende:
|
||||
|
||||
1e rij:
|
||||
Nascholing, <code>,,
|
||||
2e rij:
|
||||
<leeg>
|
||||
3e rij:
|
||||
Naam, Regiocode, Lidnummer, <datum1>, <datum2>, ...
|
||||
4e rij en verder:
|
||||
<naam>,<Lidnummer>,<X of leeg>, <X of leeg>, <X of leeg>, ...
|
||||
...
|
||||
@@ -0,0 +1 @@
|
||||
5fcaa72a37b8b7e43
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
|
||||
Zet de relaties naar handmatige nascholingen om van many-to-many naar one-to-many
|
||||
@@ -0,0 +1 @@
|
||||
5fca3fa0a7857aa07
|
||||
@@ -0,0 +1,34 @@
|
||||
// last execution: Fri Dec 04 2020 15:16:08 GMT+0100 (Midden-Europese standaardtijd)
|
||||
|
||||
logAdd(log);
|
||||
|
||||
$ids = Record\FindMany('HandmatigeNascholing', 'name', 'asc');
|
||||
|
||||
$n = array\length($ids);
|
||||
logAdd(log, 'info', '#handmatige nascholingen=', $n);
|
||||
|
||||
logAdd(log, 'info', 'ja');
|
||||
|
||||
$i = 0;
|
||||
while($i < $n,
|
||||
$id = array\at($ids, $i);
|
||||
$nascholing = entity\get('HandmatigeNascholing', $id);
|
||||
$nascholingstotalen = Entity\GetRelated($nascholing, 'nascholingstotaalen', 1000);
|
||||
|
||||
$m = array\length($nascholingstotalen);
|
||||
$j = 0;
|
||||
while($j < $m,
|
||||
$totaal = array\at($nascholingstotalen, $j);
|
||||
$totaal_id = attr($totaal, 'id');
|
||||
$contact_id = attr($totaal, 'contactId');
|
||||
$contact = entity\get('Contact', $contact_id);
|
||||
logAdd(log, 'info', 'gerelateerd aan:', $id, ' - ', attr($totaal, 'jaar'), ' van ', attr($contact, 'name'));
|
||||
|
||||
record\relate('Nascholingstotaal', $totaal_id, 'nascholingen1', $id);
|
||||
|
||||
$j = $j + 1;
|
||||
);
|
||||
|
||||
$i = $i + 1;
|
||||
);
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Werkt de doellijst voor studentleden bij.
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user