scripts in de database
This commit is contained in:
@@ -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);
|
||||
Reference in New Issue
Block a user