Viraax

Untitled

May 5th, 2020
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
SQL 2.72 KB | None | 0 0
  1. $prestations = "select * from (
  2.        select
  3.            'DP' as type_demande,
  4.             dem.description,
  5.             dem.demande_prestation_id as id,
  6.             to_date(dem.creation_date,'DD/MM/YYYY') as dates,
  7.             dem.creation_date as sort_date,
  8.             to_char(dem.creation_date, 'YYYYMMDD') as date_tri,
  9.             per.person_id as id_personne,
  10.             per.full_name as personne,
  11.             typ_prest.libelle as objet,
  12.             gcc.concatenated_segments as ccf,
  13.             sta.meaning as statut,
  14.             decode(lieu_prest.precision_lieu, NULL,lieu_prest.lieu, lieu_prest.lieu||' : '||lieu_prest.precision_lieu ) as ville,
  15.             dem.code_urgence_client as urgence,
  16.             dem.commentaire as commentaire,
  17.             dem.statut_code,
  18.             dem.beneficiaire_id,
  19.             dem.created_by,
  20.             dem.prest_refusee_lue,
  21.             dem.target_business_group_id,
  22.             dem.business_group_id,
  23.             dem.target_business_group_id as BDD_EXE_ID,
  24.             dem.business_group_id as BDD_PROV_ID
  25.             " . ($_GET['dataset'] == 'to_evaluate' ? ', ev.evaluation_prest_id' : '') . "
  26.        from
  27.            xxmi.xxmi_demande_prest dem,
  28.            xxmi_all_people_f per,
  29.            gl_code_combinations_kfv gcc,
  30.            fnd_lookup_values sta,
  31.            xxmi_type_prestation typ_prest,
  32.            xxmi_lieux_presta lieu_prest
  33.            " . ($_GET['dataset'] == 'to_evaluate' ? ', xxmi_evaluation_prest ev' : '') . "
  34.        where
  35.             per.person_id = dem.beneficiaire_id
  36.             and per.current_employee_flag='Y'
  37.             and dem.type_id = typ_prest.type_prestation_id
  38.             and dem.lieu_prestation_code = lieu_prest.lieux_presta_id (+)
  39.             and dem.code_combination_id = gcc.code_combination_id
  40.             and sta.lookup_type = 'XXMI_STATUT'
  41.             and sta.language = 'F'
  42.             and dem.statut_code = sta.lookup_code
  43.             and dem.creation_date >= add_months(trunc(sysdate, 'month'), - 6)
  44.             " . (COUNT($statuses) > 0 ? "and dem.statut_code IN (" . implode(", ", $statuses) . ")" : "") . "
  45.             " . ($_GET['dataset'] == 'to_approve' ? ' and dem.approbateur_id = ' . intval($sData->get_value('user_id')) : '') . "
  46.             " . ($_GET['dataset'] == 'to_evaluate' ? ' and ev.demande_prestation_id = dem.demande_prestation_id ' : '') . "
  47.             and (dem.prest_refusee_lue is null
  48.             or dem.prest_refusee_lue = 'N')
  49.             and dem.beneficiaire_id = ". intval($sData->get_value('person_id'))."
  50.             and dem.created_by = " .intval($sData->get_value('user_id')). "
  51.        order by date_tri asc
  52.    ) WHERE ROWNUM <= " . $nb_max_lignes;
Add Comment
Please, Sign In to add comment