<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="RH000008" 
	label="RH. [DICT.RH.ARRET_TRAVAIL#3]" 
	title="= '[DICT.RH.ARRET_TRAVAIL#3] 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="rh000008"  helpFile=""
>
	<VIEWPROPERTIES componentName="PROPERTIES_ARRET"/>
	<VIEWPROPERTIES componentName="PROPERTIES_GROUPBY"/>
	<VIEWPROPERTIES>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value" />
		<PROPERTY name="ORDERBY">
			<value><![CDATA[[EVAL 
					
				$groupBys = array(
					'[GROUPBY]', 
					'[GROUPBY_2]', 
					'[GROUPBY_3]'
				);
				$exceptions = array('AMCAL', 'ATRIMCAL', 'ACAL', 'MCAL', 'TRIMCAL', 'AMACT', 'ATRIMACT', 'AACT', 'MACT', 'TRIMACT');
				
				$result = array_intersect($groupBys, $exceptions);
				
				if (count($result) > 0) {
					return "DEFAULT";
				} else {
					return "indicateurs[3]";
				}
					
			EVAL]]]></value>
		</PROPERTY>
	</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="SAL" tree="true" >
				<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.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="">
			<FIELD name="GROUPBY_2" label="" width="200" UI="combo" default="-1" tree="true" >
				<OPTION label="Pas de second niveau" 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.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>
		</GROUP>
		<GROUP label="">
			<FIELD name="GROUPBY_3" label="" width="200" UI="combo" default="-1" tree="true" >
				<OPTION label="Pas de troisième niveau" 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.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>
		</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]}
						GROUPBY3{[VIEW.GROUPBY_3_OID_FIELD],, [VIEW.GROUPBY_3_COD_FIELD],, [VIEW.GROUPBY_3_TXT_FIELD]}
						SIGNIFDATA{[VIEW.ACTIVITE_SIGNIFICATIVE_DATA],, [ACTIVITE_SIGNIFICATIVE_MODE],, [ACTIVITE_SIGNIFICATIVE_NUMBER]}
						OPTIONS{NOTZERO=1}
						ORDERBY{[VIEW.ORDERBY],, DESC}
						INDICATORS{
							count(DISTINCT CASE WHEN nb_arret = 1 THEN v_rh_view_1.salarie_id ELSE null END),
							count(DISTINCT CASE WHEN nb_arret = 1 THEN v_rh_view_1.contrat_id ELSE null END),
							count(DISTINCT CASE WHEN nb_arret = 1 THEN v_rh_view_1.arret_travail_id ELSE null END),
							base.cti_sum_distinct_on(DISTINCT ARRAY[(v_rh_view_1.arret_travail_id)::numeric, v_rh_view_1.nb_debut_arret]),
							base.cti_sum_distinct_on(DISTINCT ARRAY[(v_rh_view_1.arret_travail_id)::numeric, v_rh_view_1.nb_fin_arret]),
							base.cti_sum_distinct_on(DISTINCT ARRAY[(v_rh_view_1.arret_travail_id)::numeric, v_rh_view_1.nb_reprise_apres_arret]),
							SUM(nb_jours_arret),
                            SUM(nb_heures_arret),
							count(DISTINCT CASE WHEN nb_arret = 1 AND motif_arret_section_code[9] = 'ACT' THEN arret_travail_id ELSE null END),
							SUM(CASE WHEN motif_arret_section_code[9] = 'ACT' THEN nb_jours_arret ELSE 0 END),
							count(DISTINCT CASE WHEN nb_arret = 1 AND motif_arret_section_code[9] = 'MAL' THEN arret_travail_id ELSE null END),
                            SUM(CASE WHEN motif_arret_section_code[9] = 'MAL' THEN nb_jours_arret ELSE 0 END),
							count(DISTINCT CASE WHEN nb_arret = 1 AND motif_arret_section_code[9] = 'MAT' THEN arret_travail_id ELSE null END),
                            SUM(CASE WHEN motif_arret_section_code[9] = 'MAT' THEN nb_jours_arret ELSE 0 END),
							count(DISTINCT CASE WHEN nb_arret = 1 AND motif_arret_section_code[9] = 'AUT' THEN arret_travail_id ELSE null END),
							SUM(CASE WHEN motif_arret_section_code[9] = 'AUT' THEN nb_jours_arret ELSE 0 END),
						}
						WORKINDICATORS{	
							count(DISTINCT v_rh_view_1.salarie_id),
							count(DISTINCT v_rh_view_1.contrat_id),
							count(DISTINCT v_rh_view_1.arret_travail_id),
						}
					FROM #V_AT_X##V_ALL_X#
					WHERE 1=1
						AND v_rh_view_1.date_fin_activite BETWEEN '[PERIODE]' AND '[TOPERIODE]'
						[VIEW.SALARIES_SELECT]
						[VIEW.CONTRATS_SELECT]
						[VIEW.REFERENTIEL_SAE_SELECT]	
						[VIEW.ARRETS_SELECT]
						
				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="SORT" /><!-- colonne exploitée pour le mécanisme de tri uniquement ORDERBY{indicateur[7]} -->
					<FIELD name="NSAL" />
					<FIELD name="NCNT" />
					<FIELD name="NARR" />
					<FIELD name="NDEB" />
					<FIELD name="NFIN" />
					<FIELD name="NREP" />
					<FIELD name="NJOU" />
					<FIELD name="NHRE" />
					<FIELD name="NACT" />
					<FIELD name="JACT" />
					<FIELD name="NMAL" />
					<FIELD name="JMAL" />
					<FIELD name="NMAT" />
					<FIELD name="JMAT" />
					<FIELD name="NAUT" />
					<FIELD name="JAUT" />
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
			<SQL>
				<select><![CDATA[
						SELECT 'X_PERIODE_D', greatest(('[PERIODE]'::date - '1 year'::interval)::date, (SELECT (min(mois)::text||'01')::date FROM rh.p_chiffrier_production))::text
					UNION ALL
						SELECT 'X_TOPERIODE_D', greatest(('[TOPERIODE]'::date - '1 year'::interval)::date, (SELECT (min(mois)::text||'01')::date FROM rh.p_chiffrier_production))::text
					UNION ALL
						SELECT 'X_PERIODE', greatest(('[PERIODE]'::date - '3 years'::interval)::date, (SELECT (min(mois)::text||'01')::date FROM rh.p_chiffrier_production))::text
				]]></select>
				<FIELDS>
					<FIELD name="name" />
					<FIELD name="value" />
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Comparatif" shortLabel="Comparatif" view="RH000024.XML" enabled="true" rowContext="false" buttonType="COMPARATIF">
				<ARG name="PERIODE_D" value="return VIEW.X_PERIODE_D;" />
				<ARG name="TOPERIODE_D" value="return VIEW.X_TOPERIODE_D;" />
				<ARG name="DATA1" value="'NBARRETSDEBUT'" />
				<ARG name="DATA2" value="'NBSALARIES'" />
				<ARG name="DATA3" value="'NBJOURS'" />
			</VIEWLINK>
			<VIEWLINK label="Evolution" shortLabel="Evolution" view="RH000014.XML" enabled="true" rowContext="false" componentName="PERIODICITE_VIEWLINK" buttonType="EVOLUTION">
				<ARG name="DATA" value="'NBARRETSDEBUT'" />
			</VIEWLINK>
			<VIEWLINK label="Analyse croisée" shortLabel="Analyse croisée" view="RH000101.XML" enabled="true" rowContext="false" buttonType="ANALYSE_CROISEE">
				<ARG name="PERIODE" value="return VIEW.X_PERIODE;" />
				<ARG name="DATA" value="'NDEB'" />
				<ARG name="COLUMNBY" value="'MACT'" />
				<ARG name="GROUPBY" value="'AACT'" />
				<ARG name="GROUPBY_TAB" value="'TAB'" />
				<ARG name="GROUPBY_2" value="return SELECT.GROUPBY;" />
				<ARG name="COLUMNBYCOUNT" value="'12'" />
			</VIEWLINK>
			<VIEWLINK label="Justificatif" shortLabel="Justificatif" view="RH000010.XML" componentName="RH_VIEWLINK" >
				<ARGS name="SPEC" >
					<value><![CDATA[
						LINKVARIABLES['GROUPBY_2'] = 'ARR'
						return 'OK';
					]]></value>
				</ARGS>
			</VIEWLINK>
		</VIEWLINKS>		
		<ONGLET label="Onglet" multiTab="true" >
			<CHART title="" type="group" subType="h" percentHeight="100" maxItems="10">
				<CHART title="Ratio Motifs d'[DICT.RH.ARRET_TRAVAIL_COURT#2] en nombre" type="pieChart" subType="" fromTotal="true" serieIsCategory="true" >
					<CATEGORY field="COD" type="Char" />
					<SERIE field="NACT" displayName="Accident du travail"/>
					<SERIE field="NMAL" displayName="Maladie" />
					<SERIE field="NMAT" displayName="Maternité" />
					<SERIE field="NAUT" displayName="Autres motifs" />
				</CHART>
				<CHART title="Ratio Motifs d'[DICT.RH.ARRET_TRAVAIL_COURT#2] en jours" type="pieChart" subType="" fromTotal="true" serieIsCategory="true" >
					<CATEGORY field="COD" type="Char" />
					<SERIE field="JACT" displayName="Accident du travail"/>
					<SERIE field="JMAL" displayName="Maladie" />
					<SERIE field="JMAT" displayName="Maternité" />
					<SERIE field="JAUT" displayName="Autres motifs" />
				</CHART>
			</CHART>
			<DATAGRID 	title="" 
						total="true" 
						headerHeight="54" 
						selectRowInRows="= ROW.OID == '-9999997'" 
						otherRowInRows="= ROW.OID == '-9999998'" 
						totalRowInRows="= ROW.OID == '-9999999'"
						variableRowHeight="true" 
						sortable="= SELECT.GROUPBY_3 == '-1' &amp;&amp; (SELECT.GROUPBY_2 == '-1' || SELECT.GROUPBY_TAB == 'TAB')"> 
				<INSERT name="DATAGRID_MULTITAB_STYLES"/>
				<COLUMN dataField="OID"
					type="Number"
					visible="false" />
				<COLUMN dataField="COD" 
					type="Char" 
					width="90"
					outputFormat="#"
					headerText="Code" 
					textAlign="left" 
					totalComplement="*ROW">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES"/>
				</COLUMN>
				<COLUMN dataField="TXT" 
					type="Char" 
					minWidth="110"
					headerText="Texte" 
					textAlign="left" 
					totalComplement="*ROW"/>
				<COLUMN dataField="NSAL" 
					type="Number" 
					width="80"
					outputFormat="#"
					headerText="Nb [DICT.RH.SALARIE#3]" 
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="NCNT" 
					visible="false"
					type="Number" 
					width="80"
					outputFormat="#"
					headerText="Nb [DICT.RH.CONTRAT#4]" 
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="NARR" 
					type="Number" 
					width="80"
					outputFormat="#"
					headerText="Nb [DICT.RH.ARRET_TRAVAIL_COURT#4]"
					description="Nombre d'[DICT.RH.ARRET_TRAVAIL_COURT#4] total."
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="NARRMOY" 
					type="Number" 
					width="70"
					outputFormat="#,0"
					headerText="Nb [DICT.RH.ARRET_TRAVAIL_COURT#4] moyen" 
					description="Nombre d'[DICT.RH.ARRET_TRAVAIL_COURT#4] &#247; nombre de [DICT.RH.SALARIE#4] ayant eu au moins un [DICT.RH.ARRET_TRAVAIL_COURT#4]."
					textAlign="right"
					totalComplement="" 
					calc="true">
					<CALC formula="ROW.NARR / ROW.NSAL" />
				</COLUMN>
				<COLUMN dataField="NDEB" 
					type="Number" 
					width="80"
					outputFormat="#"
					headerText="[DICT.RH.ARRET_TRAVAIL_COURT#31]" 
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="NREP" 
					type="Number" 
					width="80"
					outputFormat="#"
					headerText="Reprises" 
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="NJOU" 
					type="Number" 
					width="80"
					outputFormat="#,0"
					headerText="Jours"
					description="Nombre de jours d'[DICT.RH.ARRET_TRAVAIL_COURT#2]."
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="NHRE" 
					type="Number" 
					width="80"
					outputFormat="#,0"
					headerText="Heures"
					description="Nombre d'heures d'[DICT.RH.ARRET_TRAVAIL_COURT#2]."
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="PJOU" 
					type="Number" 
					width="70"
					outputFormat="#,0%"
					headerText="% Jours / Total" 
					textAlign="right"
					totalComplement="" 
					calc="true">
					<CALC formula="ROW.NJOU / TOTALROW.NJOU * 100" />
				</COLUMN>
				<COLUMN dataField="DMOYARR" 
					type="Number" 
					width="70"
					outputFormat="#,0"
					headerText="Durée moyenne [DICT.RH.ARRET_TRAVAIL_COURT#4]" 
					textAlign="right"
					totalComplement="" 
					calc="true">
					<CALC formula="ROW.NJOU / ROW.NARR" />
				</COLUMN>
				<COLUMN dataField="NACT" 
					type="Number" 
					width="80"
					outputFormat="#"
					headerText="Nb accidents du travail" 
					description="Nombre d'[DICT.RH.ARRET_TRAVAIL_COURT#4] suite à un accident du travail."
					textAlign="right"
					totalComplement="*ROW" />	
				<COLUMN dataField="JACT" 
					type="Number" 
					width="80"
					outputFormat="#,0"
					headerText="Jours accident du travail" 
					description="Nombre de jours d'[DICT.RH.ARRET_TRAVAIL_COURT#2] suite à un accident du travail."
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="PACT" 
					type="Number" 
					width="70"
					outputFormat="#,0%"
					headerText="% Jours accident du travail" 
					description="% de jours d'accident du travail sur le nombre de jours d'[DICT.RH.ARRET_TRAVAIL_COURT#2]"
					textAlign="right"
					totalComplement="" 
					calc="true">
					<CALC formula="ROW.JACT / ROW.NJOU * 100" />
				</COLUMN>
				<COLUMN dataField="NMAL" 
					type="Number" 
					width="80"
					outputFormat="#"
					headerText="Nb maladie"
					description="Nombre d'[DICT.RH.ARRET_TRAVAIL_COURT#4] pour maladie."
					textAlign="right"
					totalComplement="*ROW" />	
				<COLUMN dataField="JMAL" 
					type="Number" 
					width="80"
					outputFormat="#,0"
					headerText="Jours maladie"
					description="Nombre de jours d'[DICT.RH.ARRET_TRAVAIL_COURT#2] pour maladie."
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="PMAL" 
					type="Number" 
					width="70"
					outputFormat="#,0%"
					headerText="% Jours maladie" 
					description="% de jours d'[DICT.RH.ARRET_TRAVAIL_COURT#2] maladie sur le nombre de jours d'[DICT.RH.ARRET_TRAVAIL_COURT#2]"
					textAlign="right"
					totalComplement="" 
					calc="true">
					<CALC formula="ROW.JMAL / ROW.NJOU * 100" />
				</COLUMN>
				<COLUMN dataField="NMAT" 
					type="Number" 
					width="80"
					outputFormat="#"
					headerText="Nb maternités"
					description="Nombre d'[DICT.RH.ARRET_TRAVAIL_COURT#4] pour maternité."
					textAlign="right"
					totalComplement="*ROW" />	
				<COLUMN dataField="JMAT" 
					type="Number" 
					width="80"
					outputFormat="#,0"
					headerText="Jours maternités"
					description="Nombre de jours d'[DICT.RH.ARRET_TRAVAIL_COURT#2] pour maternité."
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="PMAT" 
					type="Number" 
					width="70"
					outputFormat="#,0%"
					headerText="% Jours maternité" 
					description="% de jours d'[DICT.RH.ARRET_TRAVAIL_COURT#2] maternité sur le nombre de jours d'[DICT.RH.ARRET_TRAVAIL_COURT#2]"
					textAlign="right"
					totalComplement="" 
					calc="true">
					<CALC formula="ROW.JMAT / ROW.NJOU * 100" />
				</COLUMN>
				<COLUMN dataField="NAUT" 
					type="Number" 
					width="80"
					outputFormat="#"
					headerText="Autre motif"
					description="Nombre d'[DICT.RH.ARRET_TRAVAIL_COURT#4] pour autre motif."
					textAlign="right"
					totalComplement="*ROW" />	
				<COLUMN dataField="JAUT" 
					type="Number" 
					width="80"
					outputFormat="#,0"
					headerText="Jours autre motif"
					description="Nombre de jours d'[DICT.RH.ARRET_TRAVAIL_COURT#2] pour autre motif."
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="PAUT" 
					type="Number" 
					width="70"
					outputFormat="#,0%"
					headerText="% Jours autre motif" 
					description="% de jours d'autre type d'[DICT.RH.ARRET_TRAVAIL_COURT#2] sur le nombre de jours d'[DICT.RH.ARRET_TRAVAIL_COURT#2]"
					textAlign="right"
					totalComplement="" 
					calc="true">
					<CALC formula="ROW.JAUT / ROW.NJOU * 100" />
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
