<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="RH000026" 
	label="RH. Indicateurs de planning" 
	title="= 'Indicateurs de planning par ' +  SELECT.GROUPBY_LABEL + ' de ' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL " 
	database="iCTI" 
	swf="*CTI_view1" 
	globals="RH_globals.XML"
	dboptimizer="RH_dboptimizer.XML"
	componentsFile="RH_components.XML" 
	softCode="iCTI_rh">
    <VIEWPROPERTIES>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
	</VIEWPROPERTIES>
	<VIEWPROPERTIES componentName="PROPERTIES_PLANNING"/>
	<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_JOUR">
			</FIELD>
			<FIELD name="TOPERIODE" label="au" UI="combo" tree="true" width="200" default="2010-01-31" globalListProvider="PERIODE_FIN_JOUR">
			</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="Planning" data="MOA" treeLevel="1" globalListProvider="PLANNING_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_PLANNING_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" />
			</FIELD>
		</GROUP>
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_SALCNT_SOUSSELECTIONS"/>
	<SELECTIONS componentName="FILTRES_PLANNING_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_SALARIES_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_CONTRATS_SELECTIONS"/>
	<SELECTIONS componentName="FILTRES_REFERENTIEL_SAE_SELECTIONS"/>
	<QUERIES>
		<QUERY label=""> 
			<SQL optimizer="V_PLA_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 v_rh_view_1.salarie_id),
							SUM(v_rh_view_1.temps_presence),
							SUM(v_rh_view_1.temps_du_initial),
							SUM(v_rh_view_1.temps_du),
							SUM(v_rh_view_1.temps_valide),
							SUM(v_rh_view_1.temps_du) - SUM(v_rh_view_1.temps_valide),
							SUM(v_rh_view_1.temps_absence),
							SUM(v_rh_view_1.temps_du_ajuste),
							SUM(v_rh_view_1.temps_valide_ajuste),
							SUM(v_rh_view_1.temps_du_ajuste) - SUM(v_rh_view_1.temps_valide_ajuste),
							SUM(v_rh_view_1.temps_absence_ajuste),
						}
						INDICATORS_2_TEXT{
							MIN(salarie_id)::text,,
						}
					FROM #V_PLA_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.PLANNING_SELECT]
						[VIEW.PLANNING_ABSENCE_SELECT]
					AFTER{
						[EVAL 
						if ('[GROUPBY_2]' == 'SAL') {
							return "
								UPDATE w_table 
								SET texte = floor(indicateurs[2]) || ' [DICT.RH.SALARIE#4]'
								WHERE level = 9
							";
						}
						EVAL]
					}

				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="NSAL" />
					<FIELD name="TPSPRE" />
					<FIELD name="TPSDUI" />
					<FIELD name="TPSDU" />
					<FIELD name="TPSVA" />
					<FIELD name="TPSEC" />
					<FIELD name="TPSABS" />
                    <FIELD name="TPSDUA" />
					<FIELD name="TPSVAA" />
					<FIELD name="TPSECA" />
					<FIELD name="TPSABSA" />
				</FIELDS>
			</SQL>
		</QUERY>
        
        <QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false" forRows="true">
			<SQL>
				<select><![CDATA[
				
						SELECT 
							'QAJUST',
							COALESCE(CASE WHEN valeur = '1' THEN 'true' ELSE 'false' END,'false')
						FROM rh.t_divers
                        WHERE code = 'OCTIME_TPS_VALIDE_A'
						;
							
				]]></select>
				<FIELDS>
					<FIELD name="name"/>
					<FIELD name="value"/>
				</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'] = ROW.COD}
					
					return 'OK';
			
					]]></value>
				</ARGS>
			</VIEWLINK>
		</VIEWLINKS>		
		<ONGLET label="Onglet" multiTab="true" >
			<DATAGRID 	title="" 
						total="true" 
						headerHeight="60" 
						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="TPSPRE" 
					type="Number" 
					width="85"
					outputFormat="#,00h"
					headerText="Temps Présence@LF@(H)" 
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="TPSDUI" 
					type="Number" 
					width="85"
					outputFormat="#,00h"
					headerText="Temps Du Initial@LF@(H)" 
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="TPSDU" 
					type="Number" 
					width="85"
					outputFormat="#,00h"
					headerText="Temps Du@LF@@LF@(H)" 
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="TPSVA" 
					type="Number" 
					width="85"
					outputFormat="#,00h"
					headerText="Temps Validé@LF@@LF@(H)" 
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="TPSEC" 
					type="Number" 
					width="85"
					outputFormat="#,00h"
					headerText="Ecart (H)" 
					textAlign="right"
					totalComplement="*ROW" />
				<COLUMN dataField="TPSABS" 
					type="Number" 
					width="85"
					outputFormat="#,00h"
					headerText="Temps Absence@LF@@LF@(H)" 
					textAlign="right"
					totalComplement="*ROW" />
                <COLUMNx dataField="TPSDUA" 
					type="Number" 
					width="85"
					outputFormat="#,00h"
                    visibleCondition="VIEW.QAJUST == 'true'"
					headerText="Temps Du@LF@Ajusté@LF@(H)" 
					textAlign="right"
					totalComplement="*ROW" >
                    <HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
                    <CELLSTYLE name="cellIndicator" value="circle, 5, left top, 0xFF6600" condition="ROW.TPSDUA != ROW.TPSDU"/>
                </COLUMNx>
				<COLUMNx dataField="TPSECA" 
					type="Number" 
					width="85"
					outputFormat="#,00h"
                    visibleCondition="VIEW.QAJUST == 'true'"
					headerText="Ecart Ajusté (H)" 
					textAlign="right">
                    <HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
                </COLUMNx>
				<COLUMNx dataField="TPSABSA" 
					type="Number" 
					width="85"
					outputFormat="#,00h"
                    visibleCondition="VIEW.QAJUST == 'true'"
					headerText="Temps Abs.@LF@Ajusté@LF@(H)" 
					textAlign="right"
					totalComplement="*ROW" >
                    <HEADERCELLSTYLE name="backgroundColor" value="0xbccbed"/>
                    <CELLSTYLE name="cellIndicator" value="circle, 5, left top, 0xFF6600" condition="ROW.TPSABSA != ROW.TPSABS"/>
                </COLUMNx>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>

			
