<?xml version="1.0" encoding="ISO-8859-1"?>
<VUE name="RH000012" label="RH. Détail rubriques de paie" title="= 'Détail rubriques de paie n° ' + VIEW.SALARIE_CODE + ' (' + VIEW.LNK_MOIS_PAIE + ')'" database="iCTI" swf="*CTI_view1" softCode="iCTI_rh" >
	<CACHE cachable="false" />
	<VIEWPROPERTIES>
		<PROPERTY dataLink="VIEWPROPERTIES" nameField="name" valueField="value"/>
		<PROPERTY name="CONTRAT_MOIS_ID">
			<value><![CDATA[[EVAL 
						return '[CONTRAT_MOIS_ID]' + 0;
					EVAL]]]></value>
		</PROPERTY>
		<PROPERTY name="LNK_MOIS_PAIE">
			<value><![CDATA[[EVAL 
						return '[LNK_MOIS_PAIE]' + 0;
					EVAL]]]></value>
		</PROPERTY>
		<PROPERTY name="SALARIE_ID">
			<value><![CDATA[[EVAL 
						return '[SALARIE_ID]' + 0;
					EVAL]]]></value>
		</PROPERTY>
	</VIEWPROPERTIES>
	<SELECTIONS label="Identifiant">
		<GROUP>
			<FIELD name="CONTRAT_MOIS_ID" label="id contrat mois" UI="number" default="0" enabled="true" visible="true"/>
			<FIELD name="LNK_MOIS_PAIE" label="mois paie" UI="number" default="0" enabled="true" visible="true"/>
			<FIELD name="SALARIE_ID" label="salarie id" UI="number" default="0" enabled="true" visible="true"/>
		</GROUP>
	</SELECTIONS>
	<QUERIES>
		<QUERY label="Paie">
			<SQL optimizer=""> 
				<select><![CDATA[		
					SELECT 
						rubrique_id,
						rubrique_code || ' ' || rubrique_texte,
						SUM(base),
						SUM(nombre),
						MAX(taux_cotisation_salarie),
						SUM(heures_payees),
						SUM(heures_travaillees),
						SUM(montant_brut),
						SUM(montant_net_imposable_salarie),
						SUM(montant_net_a_payer_salarie),
						SUM(montant_avantage_nature),
						SUM(montant_frais_imposables),
						0 - SUM(montant_cotisation_salarie),
						0 - SUM(montant_od_net_salarie),
						SUM(montant_od_net_patronale),
						MAX(taux_cotisation_patronale),
						SUM(montant_cotisation_patronale)
					FROM rh.v_historique_paie_1
					WHERE 1=1
						AND mois_paie_id = [VIEW.LNK_MOIS_PAIE]
						AND salarie_id = [VIEW.SALARIE_ID]
						AND (
							heures_payees <> 0 OR
							montant_brut <> 0 OR
							montant_net_imposable_salarie <> 0 OR
							montant_net_a_payer_salarie <> 0 OR
							montant_avantage_nature <> 0 OR
							montant_frais_imposables <> 0 OR
							montant_cotisation_salarie <> 0 OR
							montant_od_net_salarie <> 0 OR
							montant_od_net_patronale <> 0 OR
							montant_cotisation_patronale <> 0
						)
					GROUP BY 2,1,rubrique_rang_edition
					ORDER BY rubrique_rang_edition
				]]></select>
				<FIELDS>
					<FIELD name="OID"/>
					<FIELD name="RUB"/>
					<FIELD name="BASE"/>
					<FIELD name="NOMBRE"/>
					<FIELD name="TCOS" />
					<FIELD name="HPAY" />
					<FIELD name="HTRA" />
					<FIELD name="MBRU" />
					<FIELD name="MNETIMPOSABLE" />
					<FIELD name="MNETSALARIE" />
					<FIELD name="MANA" />
					<FIELD name="MFIM" />
					<FIELD name="MCOS" />
					<FIELD name="MODS" />
					<FIELD name="MODP" />
					<FIELD name="TCOP" />
					<FIELD name="MCOP" />
				</FIELDS>
			</SQL>
			<SQL optimizer=""> 
				<select><![CDATA[		
					SELECT 
						-9999999,
						'Total BRUT',
						SUM(heures_payees),
						SUM(heures_travaillees),
						SUM(v_historique_paie_1.montant_brut),
						SUM(v_historique_paie_1.montant_avantage_nature),
						SUM(v_historique_paie_1.montant_frais_imposables)
					FROM rh.v_historique_paie_1
					WHERE 1=1
						AND mois_paie_id = [VIEW.LNK_MOIS_PAIE]
						AND salarie_id = [VIEW.SALARIE_ID]
				]]></select>
				<FIELDS>
					<FIELD name="OID"/>
					<FIELD name="RUB"/>
					<FIELD name="HPAY" />
					<FIELD name="HTRA" />
					<FIELD name="MBRU" />
					<FIELD name="MANA" />
					<FIELD name="MFIM" />
				</FIELDS>
			</SQL>
			<SQL optimizer=""> 
				<select><![CDATA[		
					(
					SELECT 
						-9999998,
						'Total COTISATIONS',
						0 - SUM(v_historique_paie_1.montant_cotisation_salarie),
						0 - SUM(v_historique_paie_1.montant_od_net_salarie),
						SUM(v_historique_paie_1.montant_od_net_patronale),
						SUM(v_historique_paie_1.montant_cotisation_patronale)
					FROM rh.v_historique_paie_1
					WHERE 1=1
						AND mois_paie_id = [VIEW.LNK_MOIS_PAIE]
						AND salarie_id = [VIEW.SALARIE_ID]
					)
				]]></select>
				<FIELDS>
					<FIELD name="OID"/>
					<FIELD name="RUB"/>
					<FIELD name="MCOS" />
					<FIELD name="MODS" />
					<FIELD name="MODP" />
					<FIELD name="MCOP" />
				</FIELDS>
			</SQL>
			<SQL optimizer=""> 
				<select><![CDATA[		
					SELECT 
						-9999997,
						'Total NET IMPOSABLE',
						SUM(v_historique_paie_1.montant_net_imposable_salarie)
					FROM rh.v_historique_paie_1
					WHERE 1=1
						AND mois_paie_id = [VIEW.LNK_MOIS_PAIE]
						AND salarie_id = [VIEW.SALARIE_ID]
				]]></select>
				<FIELDS>
					<FIELD name="OID"/>
					<FIELD name="RUB"/>
					<FIELD name="MNETIMPOSABLE" />
				</FIELDS>
			</SQL>			
			<SQL optimizer=""> 
				<select><![CDATA[		
					SELECT 
						-9999996,
						'Total NET A PAYER',
						SUM(v_historique_paie_1.montant_net_a_payer_salarie)
					FROM rh.v_historique_paie_1
					WHERE 1=1
						AND mois_paie_id = [VIEW.LNK_MOIS_PAIE]
						AND salarie_id = [VIEW.SALARIE_ID]
				]]></select>
				<FIELDS>
					<FIELD name="OID"/>
					<FIELD name="RUB"/>
					<FIELD name="MNETIMPOSABLE" />
				</FIELDS>
			</SQL>
		</QUERY>
		<QUERY type="propertiesLink" name="VIEWPROPERTIES" forSelections="false">
			<SQL select="SELECT 'SALARIE_CODE', matricule FROM rh.p_salaries WHERE oid = [VIEW.SALARIE_ID]">
				<FIELDS>
					<FIELD name="name"/>
					<FIELD name="value"/>
				</FIELDS>
			</SQL>
		</QUERY>
	</QUERIES>
	<PRESENTATION>
		<ONGLET label="Bulletin"  newPage="true">
			<DATAGRID title="" headerHeight="36" total="true" totalRowInRows="= Number(ROW.OID) &lt; 0">
				<COLUMN dataField="OID"
					type="Number"
					visible="false" />
				<COLUMN dataField="RUB" 
					type="Char" 
					visible="true" 
					headerText="Rubrique" 
					minWidth="80" />
				<COLUMN dataField="NOMBRE" 
					type="Number" 
					width="80"
					outputFormat="#,00"
					headerText="Nombre" 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="BASE" 
					type="Number" 
					width="80"
					outputFormat="#,00"
					headerText="Base" 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="HPAY" 
					type="Number" 
					width="60"
					outputFormat="#,00"
					headerText="Heures Payées" 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="HTRA" 
					type="Number" 
					width="60"
					outputFormat="#,00"
					headerText="Heures Travaillées" 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="MBRU" 
					type="Number" 
					width="80"
					outputFormat="#,00"
					headerText="Brut" 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="TCOS" 
					type="Number" 
					width="80"
					outputFormat="#,00"
					headerText="PU ou Taux"
					description="Dans le cas d'une rubrique de cotisation, il s'agit du taux de cotisation salariale."
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="MCOS" 
					type="Number" 
					width="85"
					outputFormat="#,00"
					headerText="Mnt. Cot. Sal." 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="TCOP" 
					type="Number" 
					width="80"
					outputFormat="#,00"
					headerText="Tx. Cot. Pat." 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="MCOP" 
					type="Number" 
					width="85"
					outputFormat="#,00"
					headerText="Mnt. Cot. Pat." 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />	
				<COLUMN dataField="MNETIMPOSABLE" 
					type="Number" 
					width="80"
					outputFormat="#,00"
					headerText="Net imposable" 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="MNETSALARIE" 
					type="Number" 
					width="80"
					outputFormat="#,00"
					headerText="Net à payer" 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="MANA" 
					type="Number" 
					width="80"
					outputFormat="#,00"
					headerText="Avant. nat." 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="MFIM" 
					type="Number" 
					width="80"
					outputFormat="#,00"
					headerText="Frais impos." 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="MODS" 
					type="Number" 
					width="80"
					outputFormat="#,00"
					headerText="OD/net Sal." 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
				<COLUMN dataField="MODP" 
					type="Number" 
					width="80"
					outputFormat="#,00"
					headerText="OD/net Pat." 
					textAlign="right"
					fixed="false"
					totalComplement="*ROW" />
			</DATAGRID>
		</ONGLET>
	</PRESENTATION>
</VUE>
