<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="RH000010" 
	label="RH. Justificatif [DICT.RH.ARRET_TRAVAIL#4]" 
	title="= 'Justificatif des [DICT.RH.ARRET_TRAVAIL#4] 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:arrets_de_travail" helpDokuWIkiFile="rh000010"  helpFile=""
>
	<VIEWPROPERTIES componentName="PROPERTIES_ARRET"/>
	<VIEWPROPERTIES componentName="PROPERTIES_GROUPBY"/>
	<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>
			<FIELD name="TOPERIODE" label="au" UI="combo" tree="true" width="200" default="2010-01-31" globalListProvider="PERIODE_FIN">
			</FIELD>
		</GROUP>
		<GROUP label="Regroupement">
			<FIELD name="GROUPBY" label="" UI="combo" width="200" default="-1" tree="true" >
				<OPTION label="Pas de regroupement" data="-1"/>
				<OPTION label="Entreprise" data="ENT" treeLevel="1" globalListProvider="ENTREPRISE_GROUPBY"/>
				<OPTION label="[DICT.RH.ARRET_TRAVAIL_COURT#1]" data="MOA" treeLevel="1" globalListProvider="ARRET_GROUPBY"/>
				<OPTION label="[DICT.RH.SALARIE#1]" data="SAL" treeLevel="1" globalListProvider="SALARIE_GROUPBY"/>
				<OPTION label="[DICT.RH.ARRET_TRAVAIL_COURT#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">
			<FIELD name="GROUPBY_2" label="" width="200" UI="combo" default="SAL" tree="true">
				<OPTION label="[DICT.RH.SALARIE]" data="SAL" />
				<OPTION label="[DICT.RH.CONTRAT]" data="CNT" />
				<OPTION label="Arrêts" data="ARR" />
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_SALCNT_SOUSSELECTIONS"/>
	<SELECTIONS componentName="FILTRES_ARRETS_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_SALARIES_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_CONTRATS_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_REFERENTIEL_SAE_SELECTIONS"/>
	<QUERIES>
		<QUERY label=""> 
			<SQL optimizer="V_AT_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]}
						SIGNIFDATA{[VIEW.ACTIVITE_SIGNIFICATIVE_DATA],, [ACTIVITE_SIGNIFICATIVE_MODE],, [ACTIVITE_SIGNIFICATIVE_NUMBER]}
						INDICATORS{
							count(DISTINCT CASE WHEN nb_arret = 1 THEN contrat_id ELSE null END),
							count(DISTINCT CASE WHEN nb_arret = 1 THEN salarie_id ELSE null END),
							count(DISTINCT CASE WHEN nb_arret = 1 THEN arret_travail_id ELSE null END),
							SUM(nb_jours_arret),

						}
						INDICATORS_2_TEXT{
							MIN(salarie_id)::text,,
							MIN(date_debut_arret)::text,,
							MAX(CASE WHEN date_fin_arret < '20991231' THEN date_fin_arret ELSE NULL END)::text,,
							(base.cti_last(ARRAY[date_fin_arret::text, (motif_arret_code || ' ' || motif_arret_texte)::text]))[2],,
							(base.cti_last(ARRAY[date_fin_arret::text, (precision_motif_arret_code || ' ' || precision_motif_arret_texte)::text]))[2],,
							MIN(date_entree_ets)::text,,
						}
					FROM #V_AT_X##V_ALL_X#
					WHERE 1=1
						AND date_fin_activite BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.SALARIES_SELECT]
						[VIEW.CONTRATS_SELECT]
						[VIEW.REFERENTIEL_SAE_SELECT]
						[VIEW.ARRETS_SELECT]
					
					AFTER{
						[EVAL 
						if ('[GROUPBY_2]' == 'SAL') {
							return "
								UPDATE w_table 
								SET texte = floor(indicateurs[2]) || ' [DICT.RH.SALARIE#4]'
								WHERE level = 9
							";
						} else if ('[GROUPBY_2]' == 'CNT') {
							return "
								UPDATE w_table 
								SET texte = floor(indicateurs[1]) || ' [DICT.RH.CONTRAT#4]'
								WHERE level = 9
							";
						} else {
							return "
								UPDATE w_table 
								SET texte = floor(indicateurs[3]) || ' arrêts'
								WHERE level = 9
							";
						}
						EVAL]
					}

				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="NCNT" />
					<FIELD name="NSAL" />
					<FIELD name="NARR" />
					<FIELD name="NJOU" />
					
					<FIELD name="ISAL" />
					<FIELD name="DDEB" />
					<FIELD name="DFIN" />
					<FIELD name="MOT" />
					<FIELD name="MOP" />
					<FIELD name="DTENT" />
				</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['CONTRAT_ID'] = ''}
					{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" 
					minWidth="110"
					headerText="Nom" 
					textAlign="left" 
					totalComplement="*ROW"/>
				<COLUMN dataField="DTENT" 
					type="Date" 
					width="80"
					inputFormat="AAAA-MM-JJ"
					outputFormat="DD/MM/YY"
					headerText="Date entrée" 
					totalComplement="*ROW" />
				<COLUMN dataField="DDEB" 
					type="Date" 
					width="80"
					inputFormat="AAAA-MM-JJ"
					outputFormat="DD/MM/YY"
					headerText="Début [DICT.RH.ARRET_TRAVAIL#2]" 
					totalComplement="*ROW" />
				<COLUMN dataField="DFIN" 
					type="Date" 
					width="80"
					inputFormat="AAAA-MM-JJ"
					outputFormat="DD/MM/YY"
					headerText="Fin [DICT.RH.ARRET_TRAVAIL#2]" 
					totalComplement="*ROW" />
				<COLUMN dataField="NJOU" 
					type="Number" 
					width="80"
					outputFormat="#"
					headerText="Nb jours / période" 
					totalComplement="" >
				</COLUMN>
				<COLUMN dataField="MOT" 
					type="Char" 
					minWidth="100"
					headerText="Motif" 
					totalComplement="" >
				</COLUMN>
				<COLUMN dataField="MOP" 
					type="Char" 
					minWidth="100"
					headerText="Précision" 
					totalComplement="" >
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>

			
