Monday 3 October 2016

Approved Cost Budget Detail Query

/* Formatted on 10/3/2016 7:59:52 PM (QP5 v5.114.809.3010) */
SELECT   po.project_id,
         bv.version_name,
         pt.name AS plan_type_name,
         bv.description,
         po.fin_plan_preference_code,
         bv.budget_version_id,
         bv.record_version_number,
         bv.budget_status_code,
         bv.raw_cost Row_Cost_Total
  FROM   pa_proj_fp_options po,
         pa_fin_plan_types_vl pt,
         pa_budget_versions bv
 WHERE   bv.project_id = :p_project_id
         AND bv.budget_version_id =
               (SELECT   budget_version_id
                  FROM   pa_budget_versions
                 WHERE   project_id = :p_project_id
                         AND fin_plan_type_id =
                               (SELECT   fin_plan_type_id
                                  FROM   pa_fin_plan_types_vl
                                 WHERE   migrated_frm_bdgt_typ_code = 'AC'
                                         AND UPPER (NAME) =
                                               UPPER ('Approved Cost Budget'))
                         AND budget_status_code = 'B'
                         AND CURRENT_FLAG = 'Y')
         AND bv.budget_version_id = po.fin_plan_version_id
         AND bv.ci_id IS NULL
         AND po.fin_plan_option_level_code = 'PLAN_VERSION'
         AND po.fin_plan_type_id = pt.fin_plan_type_id
         AND pt.fin_plan_type_id =
               (SELECT   fin_plan_type_id
                  FROM   pa_fin_plan_types_vl
                 WHERE   migrated_frm_bdgt_typ_code = 'AC'
                         AND UPPER (name) = UPPER ('Approved Cost Budget'));

No comments:

Post a Comment