src: |
  SELECT p_rss_lpp.rss_id,
      p_rss_lpp.finess,
      p_rss_lpp.no_rss,
      p_rss_lpp.rang,
      p_rss_lpp.date_lpp,
      p_rss_lpp.lpp_id,
      t_lpp.code AS lpp_code,
      t_lpp.texte_court AS lpp_texte,
      t_lpp.section_id AS lpp_section_id,
      t_lpp.section_code AS lpp_section_code,
      t_lpp.section_texte AS lpp_section_texte,
      t_lpp.code_fg11 AS lpp_code_fg11,
      p_rss_lpp.nombre,
      p_rss_lpp.prix_unitaire,
      p_rss_lpp.montant_facture,
      p_rss_lpp.montant_tr,
      p_rss_lpp.montant_t2a_accorde,
      p_rss_lpp.non_pris_en_compte,
      p_rss_lpp.montant_ecart_indemnisable,
      t_type_lpp.oid AS type_lpp_id,
      t_type_lpp.code AS type_lpp_code,
      t_type_lpp.texte AS type_lpp_texte,
      p_rss_lpp.from_eco,
      p_rss_lpp.montant_consommation
     FROM pmsi.p_rss_lpp
       JOIN pmsi.t_lpp ON p_rss_lpp.lpp_id = t_lpp.oid
       LEFT JOIN base.t_lpp b_lpp ON t_lpp.code::text = b_lpp.code
       JOIN base.t_type_lpp ON COALESCE(p_rss_lpp.type_lpp_id, 1::bigint) = t_type_lpp.oid;