<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="RH000001" 
	label="RH. Intégrité de la base de données" 
	title="Intégrité de la base de données" 
	database="iCTI" 
	swf="*CTI_view1" 
	softCode="iCTI_rh"
	dboptimizer="RH_dboptimizer.XML"
	helpDokuWIkiDir="rh:vues:controles" helpDokuWIkiFile="rh000001"  helpFile=""
	>
	<CACHE cachable="false" />
	<QUERIES>
		<QUERY label=""> 
			<SQL>
				<select><![CDATA[
				SELECT 1, '[DICT.RH.SALARIE#3]', 'Vue v_salaries_1', subviewp.count, subviewv.count
				FROM
					(SELECT count(*) AS count FROM rh.p_salaries) subviewp,
					(SELECT count(*) AS count FROM rh.v_salaries_1) subviewv
				]]></select>
				<FIELDS>
					<FIELD name="NUM" />
					<FIELD name="TAB" />
					<FIELD name="VIEW" />
					<FIELD name="NB_P" />
					<FIELD name="NB_V" />
				</FIELDS>
			</SQL>
			<SQL optimizer="V_CNT_X" optimizer2="V_ALL_X">
				<select><![CDATA[
                SELECT 2, '[DICT.RH.CONTRAT#3]', 'Vue v_contrats_1', subviewp.count, subviewv.count
                FROM
                    (SELECT count(*) AS count FROM rh.p_contrats) subviewp,
                    (SELECT count(DISTINCT contrat_id) AS count FROM rh.v_contrats_1) subviewv
                ]]></select>
                <FIELDS>
                    <FIELD name="NUM" />
                    <FIELD name="TAB" />
                    <FIELD name="VIEW" />
                    <FIELD name="NB_P" />
                    <FIELD name="NB_V" />
                </FIELDS>
            </SQL>
            <SQL optimizer="V_CNT_X" optimizer2="V_ALL_X">
                <select><![CDATA[
				SELECT 2, '[DICT.RH.CONTRAT#3]' as dboptimizer_trigger_all, 'Vue v_contrats_mois_1', subviewp.count, subviewv.count
				FROM
					(SELECT count(*) AS count FROM rh.p_contrats_mois) subviewp,
					(SELECT count(DISTINCT contrat_mois_id) AS count FROM #V_CNT_X##V_ALL_X#) subviewv
				]]></select>
				<FIELDS>
					<FIELD name="NUM" />
					<FIELD name="TAB" />
					<FIELD name="VIEW" />
					<FIELD name="NB_P" />
					<FIELD name="NB_V" />
				</FIELDS>
			</SQL>
			<SQL optimizer="V_HP_X" optimizer2="V_ALL_X">
				<select><![CDATA[
					SELECT 3, 'Historique paie' as dboptimizer_trigger_all, 'Vue v_historique_paie_1', subviewp.count, subviewv.count
					FROM
						(SELECT count(*) AS count FROM rh.p_historique_paie) subviewp,
						(SELECT count(DISTINCT CTID) AS count FROM #V_HP_X##V_ALL_X#) AS subviewv
				]]></select>
				<FIELDS>
					<FIELD name="NUM" />
					<FIELD name="TAB" />
					<FIELD name="VIEW" />
					<FIELD name="NB_P" />
					<FIELD name="NB_V" />
				</FIELDS>
			</SQL>
			<SQL optimizer="V_AT_X" optimizer2="V_ALL_X">
				<select><![CDATA[
				SELECT 4, 'Arrets travail' as dboptimizer_trigger_all, 'Vue v_arrets_travail_mois_1', subviewp.count, subviewv.count
				FROM
					(SELECT count(*) AS count FROM rh.p_arrets_travail_mois) subviewp,
					(SELECT count(*) AS count FROM (SELECT contrat_mois_id, arret_travail_id FROM #V_AT_X##V_ALL_X# GROUP BY 1,2) AS sbq) AS subviewv
				]]></select>
				<FIELDS>
					<FIELD name="NUM" />
					<FIELD name="TAB" />
					<FIELD name="VIEW" />
					<FIELD name="NB_P" />
					<FIELD name="NB_V" />
				</FIELDS>
			</SQL>
			<SQL optimizer="V_ACC_X" optimizer2="V_ALL_X">
				<select><![CDATA[
				SELECT 5, 'Accidents travail' as dboptimizer_trigger_all, 'Vue v_accident_travail_1', subviewp.count, subviewv.count
				FROM
					(SELECT count(*) AS count FROM rh.p_accident_travail) subviewp,
					(SELECT count(*) AS count FROM (SELECT contrat_mois_id, accident_travail_id FROM #V_ACC_X##V_ALL_X# GROUP BY 1,2) AS sbq) AS subviewv
				]]></select>
				<FIELDS>
					<FIELD name="NUM" />
					<FIELD name="TAB" />
					<FIELD name="VIEW" />
					<FIELD name="NB_P" />
					<FIELD name="NB_V" />
				</FIELDS>
			</SQL>
			<SQL optimizer="V_FOR_X" optimizer2="V_ALL_X">
				<select><![CDATA[
				SELECT 6, 'Formations' as dboptimizer_trigger_all, 'Vue v_formations_1', subviewp.count, subviewv.count
				FROM
					(SELECT count(*) AS count FROM rh.p_formations) subviewp,
					(SELECT count(DISTINCT formation_id) AS count FROM #V_FOR_X##V_ALL_X#) subviewv
				]]></select>
				<FIELDS>
					<FIELD name="NUM" />
					<FIELD name="TAB" />
					<FIELD name="VIEW" />
					<FIELD name="NB_P" />
					<FIELD name="NB_V" />
				</FIELDS>
			</SQL>
			<SQL optimizer="V_VIS_X" optimizer2="V_ALL_X">
				<select><![CDATA[
				SELECT 7, 'Visites médicales' as dboptimizer_trigger_all, 'Vue v_visites_medicales_1', subviewp.count, subviewv.count
				FROM
					(SELECT count(*) AS count FROM rh.p_visites_medicales) subviewp,
					(SELECT count(DISTINCT visite_id) AS count FROM #V_VIS_X##V_ALL_X#) subviewv
				]]></select>
				<FIELDS>
					<FIELD name="NUM" />
					<FIELD name="TAB" />
					<FIELD name="VIEW" />
					<FIELD name="NB_P" />
					<FIELD name="NB_V" />
				</FIELDS>
			</SQL>
			<SQL>
				<select><![CDATA[
				SELECT 8, 'Handicaps', 'Vue v_handicap_1', subviewp.count, subviewv.count
				FROM
					(SELECT count(*) AS count FROM rh.p_handicap) subviewp,
					(SELECT count(*) AS count FROM rh.v_handicap_1) subviewv
				]]></select>
				<FIELDS>
					<FIELD name="NUM" />
					<FIELD name="TAB" />
					<FIELD name="VIEW" />
					<FIELD name="NB_P" />
					<FIELD name="NB_V" />
				</FIELDS>
			</SQL>
			<SQL optimizer="V_PLA_X" optimizer2="V_ALL_X">
				<select><![CDATA[
				SELECT 9, 'Planning' as dboptimizer_trigger_all, 'Vue v_planning_mouvement_1', subviewp.count, subviewv.count
				FROM
					(SELECT count(*) AS count FROM rh.p_planning_mouvement) subviewp,
                    (SELECT count(DISTINCT CTID) AS count FROM #V_PLA_X##V_ALL_X#) AS subviewv
				]]></select>
				<FIELDS>
					<FIELD name="NUM" />
					<FIELD name="TAB" />
					<FIELD name="VIEW" />
					<FIELD name="NB_P" />
					<FIELD name="NB_V" />
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<ONGLET>
			<DATAGRID title="" total="false" key="NUM" sortable="false" headerHeight="40" >
				<ROWSTYLE name="fontSize" value="12" />
				<COLUMN dataField="NUM"
					width="60"
					type="Number"
					outputFormat="#"
					visible="false"
					headerText="N°" 
					textAlign="left" >
				</COLUMN>
				<COLUMN dataField="TAB"
					minWidth="100"
					type="Char"
					visible="true"
					headerText="Table" 
					textAlign="left">
				</COLUMN>
				<COLUMN dataField="VIEW"
					minWidth="200"
					type="Char"
					visible="true"
					headerText="Vue" 
					textAlign="left">
				</COLUMN>
				<COLUMN dataField="NB_P"
					width="100"
					type="Number"
					visible="true"
					headerText="Taille table" 
					outputFormat="0"
					fixed="false"
					textAlign="right">
				</COLUMN>
				<COLUMN dataField="NB_V"
					width="100"
					type="Number"
					visible="true"
					headerText="Taille vue" 
					outputFormat="0"
					fixed="false"
					textAlign="right">
					<CELLSTYLE name="cellIndicator" value="circle, 5, left top, 0xFF0000" 
							condition="ROW.NB_V != ROW.NB_P" />
					<CELLSTYLE name="cellIndicator" value="circle, 5, left top, 0x00FF33" 
							condition="ROW.NB_V == ROW.NB_P" />
				</COLUMN>
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
