<?xml version="1.0" encoding="ISO-8859-15"?>
<VUE name="RH000109" 
	label="RH Expert. Contrôles" 
	title="= 'Contrôles Expert' +  ' par ' +  SELECT.GROUPBY_LABEL + ' (' + SELECT.PERIODE_LABEL + ' à ' + SELECT.TOPERIODE_LABEL + ')'" 
	database="iCTI" 
	swf="*CTI_view1" 
	softCode="iCTI_rh" 
	softOption="iCTI_expert" 
	globals="RH_globals.XML" 
	componentsFile="RH_components.XML" 
	dboptimizer="RH_dboptimizer.XML" 
    helpFile="iCTI_RH_RH000109.HTML"
    helpDokuWIkiDir="rh:qualite:expert" 
    helpDokuWIkiFile="rh000109" 
>
	<VIEWPROPERTIES componentName="PROPERTIES_GROUPBY" />
	<VIEWPROPERTIES>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
	</VIEWPROPERTIES>
	
	<SELECTIONS label="Paramètres de l'analyse">
		<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="2009-01-01" globalListProvider="PERIODE_DEBUT"  />
			<FIELD name="TOPERIODE" label="à" UI="combo" tree="true" width="200" default="2009-12-31" globalListProvider="PERIODE_FIN"  />
		</GROUP>
		<GROUP label="Regroupements">
			<FIELD name="GROUPBY" width="220" label="Regroupements" UI="combo" default="EXC" tree="true">
				<OPTION label="Controle Expert" data="EXC" treeLevel="1" />
				<OPTION dataLink="EXC_CLASSES" treeLevelField="lvl" dataField="COD" labelField="txt" />
				<OPTION label="Entreprise" data="ENT" treeLevel="1" globalListProvider="ENTREPRISE_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"/>
			</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" width="220" label="" UI="combo" default="-1" tree="true">
				<OPTION label="Pas de second niveau" data="-1" treeLevel="1" />
				<OPTION label="Controle Expert" data="EXC"  treeLevel="1" />
				<OPTION dataLink="EXC_CLASSES" treeLevelField="lvl" dataField="COD" labelField="txt" />
				<OPTION label="Entreprise" data="ENT" treeLevel="1" globalListProvider="ENTREPRISE_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"/>
			</FIELD>
		</GROUP>
		
		
	</SELECTIONS>
	<SELECTIONS componentName="FILTRES_EXPERT_SELECTIONS" />
	<QUERIES>
		<QUERY label="">
		
			<SQL optimizer="V_ALL_X">
				<select><![CDATA[	
														
					CTISELECT_TREE
						WORKTABLE{RH000109}
						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(DISTINCT CASE WHEN expert_controle_gravite_id = 0 THEN contrat_mois_id ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN expert_controle_gravite_id BETWEEN 1 AND 5 THEN contrat_mois_id ELSE NULL END),,
						COUNT(DISTINCT CASE WHEN expert_controle_gravite_id BETWEEN 6 AND 9 THEN contrat_mois_id ELSE NULL END)
					}
					FROM rh.v_expert_controle_1 
					WHERE date_fin_activite >= '[PERIODE]' AND date_debut_activite <= '[TOPERIODE]'
						[VIEW.EXPERT_CONTROLE_SELECT]	
				]]></select>
				<FIELDS>
					<INSERT name="CTISELECT_TREE_FIELDS"/>
					<FIELD name="NB_CNT_I"/>
					<FIELD name="NB_CNT_A"/>
					<FIELD name="NB_CNT_E"/>
				</FIELDS>
			</SQL>
		</QUERY>
		
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
			
		</QUERY>
	</QUERIES>
	
	<PRESENTATION>
		<VIEWLINKS>
			<VIEWLINK label="Justificatif par Contrat" shortLabel="Justificatif Contrat" view="RH000110.XML" 
					visible="= SELECT.GROUPBY != 'CONTRAT' || SELECT.GROUPBY_2 != 'CONTRAT' || SELECT.GROUPBY_2 != '-1'"
					enabled="= (SELECT.GROUPBY != 'CONTRAT' &amp;&amp; ROW.OID2 &lt; 0) || (SELECT.GROUPBY_2 != 'CONTRAT' &amp;&amp; ROW.OID2 &gt;= 0)" 
					componentName="RH_VIEWLINK" >
					<ARG name="EXPERT_CONTROLE_GRAVITE" 
						value="if (COLUMN.NAME == 'NB_CNT_I') {return 'DT0'}
							if (COLUMN.NAME == 'NB_CNT_A') {return 'DT5'}
							if (COLUMN.NAME == 'NB_CNT_E') {return 'DT9'}
							return SELECT.EXPERT_CONTROLE_GRAVITE"/>
			</VIEWLINK>
			<VIEWLINK label="Détail Contrat" shortLabel="Détail Contrat" view="RH000009.XML"
				visible="= SELECT.GROUPBY == 'CONTRAT' || SELECT.GROUPBY_2 == 'CONTRAT'"
				enabled="= (SELECT.GROUPBY == 'CONTRAT' &amp;&amp; ROW.OID2 &lt; 0) || (SELECT.GROUPBY_2 == 'CONTRAT' &amp;&amp; ROW.OID2 &gt;= 0)">
				<ARG name="CONTRAT" value="ROW.COD" />
			</VIEWLINK>
		</VIEWLINKS>
		<ONGLET excelLabel="Controle" label="Controle" 
			multiTab="true" multiTabBreakField="TABD" multiTabBreakLabelField="TABDL" multiTabBreakLonglabelField="TABDLL">
			
			<DATAGRID title="" total="true" showOthers="true" headerHeight="48" 
				sortable="= SELECT.GROUPBY_2 == '-1' || SELECT.GROUPBY_TAB == 'TAB'"
				selectRowInRows="= ROW.OID == '-9999997'" 
				otherRowInRows="= ROW.OID == '-9999998'" 
				totalRowInRows="= ROW.OID == '-9999999'">
				<INSERT name="DATAGRID_MULTITAB_STYLES"/>

				<COLUMN dataField="OID" width="60" type="Char" visible="false" headerText="Oid">
				</COLUMN>
				<COLUMN dataField="COD" width="200" type="Char" visible="true" headerText="Code" textAlign="left" otherFunction="text" totalFunction="text">
					<INSERT name="COLUMN_COD_MULTITAB_STYLES"/>
				</COLUMN>
				<COLUMN dataField="TXT" type="Char" minWidth="150" headerText="SELECT.GROUPBY_LABEL" headerTextCalc="true" textAlign="left" totalFunction="text" totalComplement="TOTAL" otherFunction="text" otherComplement="Autres">
				</COLUMN>
				<COLUMN dataField="NB_CNT_I" type="Number" width="110" outputFormat="#" textAlign="right"
					selectable="true"
					visibleCondition="SELECT.EXPERT_CONTROLE_GRAVITE == '-1' || SELECT.EXPERT_CONTROLE_GRAVITE == 'DT0'" 
					headerText="Informations" totalFunction="text" otherFunction="text" otherComplement="">
					<CELLSTYLE name="color" value="0x75a0eb" />
					<CELLSTYLE name="fontWeight" value="bold" />
				</COLUMN>
				<COLUMN dataField="NB_CNT_A" type="Number" width="110" outputFormat="#" textAlign="right"
					selectable="true"
					visibleCondition="(SELECT.EXPERT_CONTROLE_GRAVITE == '-1' || SELECT.EXPERT_CONTROLE_GRAVITE == 'DT5' || SELECT.EXPERT_CONTROLE_GRAVITE == 'LI59')" 
					headerText="Avertissements" totalFunction="text" otherFunction="text" otherComplement="">
					<CELLSTYLE name="color" value="0xFFA500" />
					<CELLSTYLE name="fontWeight" value="bold" />
				</COLUMN>
				<COLUMN dataField="NB_CNT_E" type="Number" width="110" outputFormat="#" textAlign="right"
					selectable="true"
					visibleCondition="(SELECT.EXPERT_CONTROLE_GRAVITE == '-1' || SELECT.EXPERT_CONTROLE_GRAVITE == 'DT9' || SELECT.EXPERT_CONTROLE_GRAVITE == 'LI59')" 
					headerText="Erreurs" totalFunction="text" otherFunction="text" otherComplement="">
					<CELLSTYLE name="color" value="0xD63E00" />
					<CELLSTYLE name="fontWeight" value="bold" />
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
