<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE 
	name="RH000079" 
	label="RH. Justificatif formations" 
	title="= 'Justificatif des formations par ' +  SELECT.GROUPBY_LABEL + ' de ' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL " 
	database="iCTI" 
	swf="*CTI_view1" 
	globals="RH_globals.XML" 
	componentsFile="RH_components.XML" 
	softCode="iCTI_rh"
	dboptimizer="RH_dboptimizer.XML"
	helpDokuWIkiDir="rh:vues:formations" helpDokuWIkiFile="rh000079"  helpFile="">
	<VIEWPROPERTIES componentName="PROPERTIES_FORMATION"/>
	<VIEWPROPERTIES componentName="PROPERTIES_GROUPBY"/>
	<VIEWPROPERTIES>
		<PROPERTY name="FORMATION_DATE">
			<value><![CDATA[[EVAL 
			
			// <?php
			$r = "";
			
			// CheckBox 'Formations planifiées' cochée --> on prend même les formations sans dates
			if('[UNDONE_FORMATIONS]' == 'Y'){
				$r = "AND ((v_rh_view_1.formation_date BETWEEN '[PERIODE]' AND '[TOPERIODE]') OR v_rh_view_1.formation_date > '2099-01-01')";
			}else{
				$r = "AND v_rh_view_1.formation_date BETWEEN '[PERIODE]' AND '[TOPERIODE]'";
			}
			
			return $r;
			
			// ?>
					
			EVAL]]]></value>
		</PROPERTY>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
	</VIEWPROPERTIES>
	<SELECTIONS label="Paramètres de l'analyse" displayText="">
		<GROUP label="Période">
			<FIELD name="ALIAS_PERIODE" label="" UI="combo" width="220" default="CUM_LAST_MONTH" tree="true" globalListProvider="ALIAS_PERIODE" />
			<FIELD name="PERIODE" label="" UI="combo" tree="true" width="200" default="2010-01-01" globalListProvider="PERIODE_DEBUT" />
			<FIELD name="TOPERIODE" label="au" UI="combo" tree="true" width="200" default="2010-01-31" globalListProvider="PERIODE_FIN" />
		</GROUP>
		<GROUP label="Regroupement">
			<FIELD name="GROUPBY" label="" UI="combo" width="200" default="FOR" tree="true" >
				<OPTION label="Formation" data="FOR" treeLevel="1" globalListProvider="FORMATION_GROUPBY"/>
				<OPTION label="[DICT.RH.SALARIE#1]" data="SAL" treeLevel="1" globalListProvider="SALARIE_GROUPBY"/>
				<OPTION label="[DICT.RH.CONTRAT#1]" data="CNT" treeLevel="1" globalListProvider="CONTRAT_GROUPBY"/>
				<OPTION label="Temporel" data="MOIACT" treeLevel="1" globalListProvider="TEMPOREL_GROUPBY"/>
				<OPTION label="Référentiel SAE" data="REFERENTIEL_SAE" treeLevel="1" globalListProvider="REFERENTIEL_SAE_GROUPBY"/>
			</FIELD>
			<FIELD name="GROUPBY_TAB" width="100" label="Présentation" UI="combo" default="AUTO" visible="= SELECT.GROUPBY_2 != '-1' ">
				<OPTION label="Automatique" data="AUTO"/>
				<OPTION label="Arbre" data="TREE"/>
				<OPTION label="Onglet" data="TAB"/>
			</FIELD>
		</GROUP>
		<GROUP label="Niveau de détail" visible="false">
			<FIELD name="GROUPBY_2" label="" width="200" UI="combo" default="SAL" tree="true">
				<OPTION label="Formation" data="FORM" />
				<OPTION label="[DICT.RH.SALARIE]" data="SAL" />
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_FORMATIONS_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_SALARIES_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_CONTRATS_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_REFERENTIEL_SAE_SELECTIONS"/>
	<QUERIES>
		<QUERY label=""> 
			<SQL optimizer="V_FOR_X" optimizer2="V_ALL_X">
				<select><![CDATA[		

					CTISELECT_TREE
						GROUPBY1{[VIEW.GROUPBY_OID_FIELD],, [VIEW.GROUPBY_COD_FIELD],, [VIEW.GROUPBY_TXT_FIELD]}
						GROUPBY1MODE{[GROUPBY_TAB]}
						GROUPBY2{[VIEW.GROUPBY_2_OID_FIELD],, [VIEW.GROUPBY_2_COD_FIELD],, [VIEW.GROUPBY_2_TXT_FIELD]}
						INDICATORS{
							count(v_rh_view_1.formation_id),,
						}
						INDICATORS_2_TEXT{
							max(v_rh_view_1.salarie_id)::text,,
							max(liste_formation_texte)::text,,
							max(CASE WHEN v_rh_view_1.formation_date = '2099-12-31' THEN ''
								ELSE v_rh_view_1.formation_date::text
								END
								),,
							max(v_rh_view_1.nb_heures)::text,,
							max(CASE WHEN v_rh_view_1.organisateur = '' THEN '* N/R *'
								ELSE v_rh_view_1.organisateur::text
								END),,
							count(v_rh_view_1.formation_date)::text,,
						}						
					FROM #V_FOR_X##V_ALL_X#
					WHERE 1=1
						[VIEW.FORMATION_DATE]
						[VIEW.SALARIES_SELECT]
						[VIEW.CONTRATS_SELECT]
						[VIEW.REFERENTIEL_SAE_SELECT]
						[VIEW.FORMATIONS_SELECT]
						
				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="NBF" />
					
					<FIELD name="ISAL" />
					<FIELD name="TFOR" />
					<FIELD name="DFOR" />
					<FIELD name="NBHR" />
					<FIELD name="NORG" />
					<FIELD name="NBFR" />
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK
				label="Détail [DICT.RH.SALARIE#2]" 
				shortLabel="Détail [DICT.RH.SALARIE#2]" 
				view="RH000009.XML" 
				componentName="" 
			>
				<ARGS name="ALL" >
					<value><![CDATA[
					
					{LINKVARIABLES['SALARIE_ID'] = ROW.ISAL}
					{LINKVARIABLES['MATRICULE'] = ''}
					
					return 'OK';
			
					]]></value>
				</ARGS>
			</VIEWLINK>
		</VIEWLINKS>		
		<ONGLET label="Onglet" multiTab="true" >

			<DATAGRID 	title="" 
						total="true" 
						headerHeight="40" 
						selectRowInRows="= ROW.OID == '-9999997'" 
						otherRowInRows="= ROW.OID == '-9999998'" 
						totalRowInRows="= ROW.OID == '-9999999'"
						variableRowHeight="true" 
						sortable="= SELECT.GROUPBY == '-1' || SELECT.GROUPBY_2 == '-1' || SELECT.GROUPBY_TAB == 'TAB'"> 
				
				<INSERT name="DATAGRID_MULTITAB_STYLES"/>
				
				<COLUMN dataField="OID"
					type="Number"
					visible="false" />
				<COLUMN dataField="ISAL"
					type="Number"
					visible="false" />
				<COLUMN dataField="COD" 
					type="Char" 
					width="90"
					outputFormat="#"
					headerText="Matricule" 
					textAlign="left" 
					totalComplement="*ROW">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES"/>
				</COLUMN>
				<COLUMN dataField="TXT" 
					type="Char" 
					width="250"
					headerText="Nom" 
					textAlign="left" 
					totalComplement="*ROW"/>
				<COLUMN dataField="TFOR" 
					type="Char" 
					width="350"
					headerText="Nom Formation" 
					totalComplement="*ROW" />
				<COLUMN dataField="DFOR" 
					type="Date" 
					width="100"
					inputFormat="AAAA-MM-JJ"
					outputFormat="DD/MM/YYYY"
					headerText="Date Formation" 
					totalComplement="*ROW" />
				<COLUMN dataField="NBFR" 
					type="Char" 
					width="80"
					headerText="Nbre séances suivies" 
					visibleCondition="SELECT.GROUPBY_2 == 'SAL'"
					totalComplement="*ROW" />
				<COLUMN dataField="NBHR" 
					type="Number" 
					width="80"
					headerText="Nombre d'heures" 
					textAlign="left" 
					totalComplement="*ROW"/>
				<COLUMN dataField="NORG" 
					type="Char" 
					width="150"
					headerText="Organisateur" 
					textAlign="left" 
					totalComplement="*ROW"/>				
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>