return: SETOF activite.p_gmt_valorises lang: plpgsql src: | DECLARE _input_record RECORD; _output_record activite.p_gmt_valorises%ROWTYPE; BEGIN FOR _input_record IN SELECT p_sejours_groupes_smr.no_sejour , p_sejours_groupes_smr.nb_jours_presence , p_sejours_groupes_smr.gme_code , p_sejours_groupes_smr.gmt_code , p_sejours_groupes_smr.date_debut_gmt , p_sejours_groupes_smr.date_fin_gmt , v_tarifs_prive_gmt_hospitalisation_partielle.texte , v_tarifs_prive_gmt_hospitalisation_partielle.dzf , v_tarifs_prive_gmt_hospitalisation_partielle.fzf , v_tarifs_prive_gmt_hospitalisation_partielle.tzb , v_tarifs_prive_gmt_hospitalisation_partielle.tzf1 , v_tarifs_prive_gmt_hospitalisation_partielle.szb , v_tarifs_prive_gmt_hospitalisation_partielle.szh FROM activite.p_sejours_groupes_smr JOIN base.v_tarifs_prive_gmt_hospitalisation_partielle ON p_sejours_groupes_smr.gmt_code = v_tarifs_prive_gmt_hospitalisation_partielle.code AND p_sejours_groupes_smr.date_fin_gmt BETWEEN v_tarifs_prive_gmt_hospitalisation_partielle.date_debut AND v_tarifs_prive_gmt_hospitalisation_partielle.date_fin AND p_sejours_groupes_smr.gme_code = v_tarifs_prive_gmt_hospitalisation_partielle.gme_code WHERE p_sejours_groupes_smr.types_gmt_code = 'hp_hebdomadaire' LOOP _output_record.no_sejour := _input_record.no_sejour; _output_record.gme_code := _input_record.gme_code; _output_record.gmt_code := _input_record.gmt_code; _output_record.gmt_libelle := _input_record.texte; _output_record.date_debut_gmt := _input_record.date_debut_gmt; _output_record.date_fin_gmt := _input_record.date_fin_gmt; _output_record.montant_valorise := _input_record.tzf1 * _input_record.nb_jours_presence; _output_record.montant_valorise_par_jour := _input_record.tzf1; RETURN NEXT _output_record; END LOOP; RETURN; END;