1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
| Dim num_agent as integer=0
Dim num_formation as integer=0
DIM NB_UV_DETENU as integer=0
DIM NB_UV_A_DETENIR as integer=0
'### cette requête permet d'extraire chaque agent. permet de balayer les '###agents
dim sSql as string = "select cle_pers from dbo.POMP_FHISTO group by cle_pers order by cle_pers"
'### cette requête permet d'extraire toutes les formations. permet de balayer chaque formation possible
dim sSql2 as string = "select CP_FM from ForP_UVparFM group by CP_FM order by CP_FM"
'### cette requête permet de compter le nombre dUV détenu par lagent
'### Pour la formation balayée dans le second next for
dim sSql3 as string = "select count (cp_typestage) from pomp_fhisto where cle_pers=num_agent and typeStage in (select cp_uv from forp_uvparfm where cp_fm=num_formation)"
'### cette requête permet de compter le nombre dUV que doit détenir lagent pour avoir la formation balayée dans le second next for
dim sSql4 as string = "select count(*) from forp_uvparfm
where cp_fm=num_formation order by code_formation"
dim DT as DataTable = GLOBAL.RecupDatas("ODS",OBJ.Environnement(),sSql)
dim DT2 as DataTable = GLOBAL.RecupDatas("ODS",OBJ.Environnement(),sSql2)
dim DT3 as DataTable = GLOBAL.RecupDatas("ODS",OBJ.Environnement(),sSql3)
dim DT4 as DataTable = GLOBAL.RecupDatas("ODS",OBJ.Environnement(),sSql4)
FOR i as integer =0 to DT.rows.count - 1
code_agent = DT.rows(i).item(CLE_PERS)
FOR j as integer =0 to DT2.rows.count 1
code_formation= DT2.rows(j).item(0)
NB_UV_DETENU = cint(DT3.rows(0).item(0))
NB_UV_A_DETENIR = cint(DT4.rows(0).item(0))
IF NB_UV_A_DETENIR=NB_UV_DETENU then
Insert into agent_formation
(code_agent, code_formation)
Values
(code_agent, code_formation)
End IF
NEXT
NEXT |
Partager