EVAL]]]> EVAL]]]> 0 or v_rh_view_1.heures_payees > 0 then v_rh_view_1.salarie_id else null end'); break; case 'NBETP': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.etp_paye'); break; case 'NBETPCDI': $tmp1 = sprintf($sumDistinctCaseWhenETPCDI, 'v_rh_view_1.etp_paye'); break; case 'NBETPCDD': $tmp1 = sprintf($sumDistinctCaseWhenETPCDD, 'v_rh_view_1.etp_paye'); break; case 'NBETPT': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.etp_travaille'); break; case 'NBETPTCDI': $tmp1 = sprintf($sumDistinctCaseWhenETPCDI, 'v_rh_view_1.etp_travaille'); break; case 'NBETPTCDD': $tmp1 = sprintf($sumDistinctCaseWhenETPCDD, 'v_rh_view_1.etp_travaille'); break; case 'NBETPC': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.etp_contrat'); break; case 'NBETPCCDI': $tmp1 = sprintf($sumDistinctCaseWhenETPCDI, 'v_rh_view_1.etp_contrat'); break; case 'NBETPCCDD': $tmp1 = sprintf($sumDistinctCaseWhenETPCDD, 'v_rh_view_1.etp_contrat'); break; case 'NBHC': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.heures_contrat'); break; case 'NBHP': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.heures_payees'); break; case 'NBHT': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.heures_travaillees'); break; case 'MTMASSE': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_masse_salariale'); break; case 'MTHORMOYCHAR': $tmp1 = 'base.cti_division('.sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_masse_salariale').', '.sprintf($sumDistinctCaseWhen, 'v_rh_view_1.heures_payees').')'; break; case 'MTMASSEMOY': $tmp1 = ' base.cti_division('. sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_masse_salariale').','. sprintf($sumDistinctCaseWhen, 'v_rh_view_1.etp_paye').' ) '; break; case 'MTMASSEPCT': $tmp1 = ' base.cti_division( base.cti_division('. sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_net_a_payer_salarie').','. sprintf($sumDistinctCaseWhen, 'v_rh_view_1.etp_paye').' ), base.cti_division('. sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_masse_salariale').','. sprintf($sumDistinctCaseWhen, 'v_rh_view_1.etp_paye').' ) ) * 100 '; break; case 'MTNETAPAYERMOY' : $tmp1 = 'base.cti_division('.sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_net_a_payer_salarie').', '.sprintf($sumDistinctCaseWhen, 'v_rh_view_1.etp_paye').')'; break; case 'MTBRUT': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_brut'); break; case 'MTBRUTMOY': $tmp1 = 'base.cti_division('.sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_brut').','.sprintf($sumDistinctCaseWhen, 'v_rh_view_1.etp_paye').')'; break; case 'MTBRUTAVANTAGE': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_brut + v_rh_view_1.montant_avantage_nature'); break; case 'MTAVANTAGE': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_avantage_nature'); break; case 'MTFRAISIMPOS': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_frais_imposables'); break; case 'MTODNETSALARIE': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_od_net_salarie'); break; case 'MTODNETPATRONALE': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_od_net_patronale'); break; case 'MTCOTSALARIE': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_cotisation_salarie'); break; case 'MTCOTPATRONALE': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_cotisation_patronale'); break; case 'MTNETIMPOSABLE': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_net_imposable_salarie'); break; case 'MTNETAPAYER': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_net_a_payer_salarie'); break; case 'BASE': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.base'); break; case 'NOMBRE': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.nombre'); break; case 'NBPROVISIONS': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.nombre_provisions'); break; case 'MTPROVISIONS': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_provisions'); break; case 'MTMASSEPROV': $tmp1 = sprintf($sumDistinctCaseWhen, 'v_rh_view_1.montant_masse_salariale_provisionnee'); break; default : $tmp1 = 'null'; } $return = str_replace(array('@date_debut@', '@date_fin@'), array($periodeDebut, $periodeFin), $tmp1) . ',' . str_replace(array('@date_debut@', '@date_fin@'), array($periodePrecDebut, $periodePrecFin), $tmp1); } else { $ctiDivision = "base.cti_division(%s, %s)"; $countDistinctCaseWhen = "count(DISTINCT CASE WHEN v_rh_view_1.date_fin_activite BETWEEN @date_debut@ AND @date_fin@ %s THEN %s ELSE null END)"; $periodeDebut = '\'[PERIODE]\'::date'; $periodeFin = '\'[TOPERIODE]\'::date'; $periodePrecDebut = '\'[VIEW.PERIODE_D]\'::date'; $periodePrecFin = '\'[VIEW.TOPERIODE_D]\'::date'; switch ($data) { case 'NSALPJ': $tmp0 = "AND present_debut_mois = 1 AND to_char(date_debut_activite, 'YYYYMM') = to_char(@date_debut@, 'YYYYMM')"; $tmp1 = sprintf($countDistinctCaseWhen, $tmp0, 'salarie_id'); break; case 'NSALH': $tmp0 = 'AND sexe_code = \'M\''; $tmp1 = sprintf($countDistinctCaseWhen, $tmp0, 'salarie_id'); break; case 'NCDI': $tmp0 = 'AND type_contrat_section_code[9] = \'CDI\''; $tmp1 = sprintf($countDistinctCaseWhen, $tmp0, 'contrat_id'); break; case 'NCDD': $tmp0 = 'AND type_contrat_section_code[9] = \'CDD\''; $tmp1 = sprintf($countDistinctCaseWhen, $tmp0, 'contrat_id'); break; case 'NSALF': $tmp0 = 'AND sexe_code = \'F\''; $tmp1 = sprintf($countDistinctCaseWhen, $tmp0, 'salarie_id'); break; case 'AGEMOYDJ': $tmp1 = 'base.cti_avg_distinct_on( DISTINCT (CASE WHEN 1=1 AND v_rh_view_1.date_fin_activite BETWEEN @date_debut@ AND @date_fin@ THEN ARRAY[salarie_id::numeric, age_id::numeric] ELSE null END) ) '; break; case 'NSALDJ': $tmp0 = "AND present_fin_mois = 1 AND to_char(date_fin_activite, 'YYYYMM') = to_char(@date_fin@, 'YYYYMM')"; $tmp1 = sprintf($countDistinctCaseWhen, $tmp0, 'salarie_id'); break; case 'NSALPJ': $tmp0 = "AND present_debut_mois = 1 AND to_char(date_debut_activite, 'YYYYMM') = to_char(@date_fin@, 'YYYYMM')"; $tmp1 = sprintf($countDistinctCaseWhen, $tmp0, 'salarie_id'); break; default : $tmp1 = 'null'; } $toReplace = array( '@date_debut@', '@date_fin@', '@date_debut_efp@' ); $curPeriod = array( $periodeDebut, $periodeFin, "[PERIODE]" ); $prevPeriod = array( $periodePrecDebut, $periodePrecFin, "[VIEW.PERIODE_D]" ); $return = str_replace($toReplace, $curPeriod, $tmp1) . ',' . str_replace($toReplace, $prevPeriod, $tmp1); } return $return; } // ?> EVAL]]]> EVAL]]]> 0) { return "DEFAULT"; } else { return "indicateurs[1]"; } EVAL]]]>