Monday, 21 March 2016

Project Accounting - Check funds queries at Task, Top Task and Project Level

FOR TASK

  SELECT project_id,
    (SUM(budget) - SUM(actuals)) "funds"
  FROM PA_TASK_FC_RESULTS_V
  WHERE project_id     =<p_project_id>
  AND start_date       > '31-MAR-15'
  AND end_date         < '1-APR-16'
  AND budget_version_id=
    (SELECT MAX(budget_version_id)
    FROM PA_TASK_FC_RESULTS_V
    WHERE project_id=<p_project_id>
    )
  and TASK_ID=<P_TASK_ID>
  GROUP BY project_id;
  
FOR TOP TASK 

  SELECT project_id,
    (SUM(budget) - SUM(actuals)) "funds"
  FROM PA_TOP_TASK_FC_RESULTS_V
  WHERE project_id     =<p_project_id>
  AND start_date       > '31-MAR-15'
  AND end_date         < '1-APR-16'
  AND budget_version_id=
    (SELECT MAX(budget_version_id)
    FROM PA_TOP_TASK_FC_RESULTS_V
    WHERE project_id=<p_project_id>
    )
  and TOP_TASK_ID=<P_TOP_TASK_ID>
  GROUP BY project_id;
  
FOR PROJECT 

  SELECT project_id,
    (SUM(budget) - SUM(actuals)) "funds"
  FROM PA_PRJ_FC_RESULTS_V
  WHERE project_id     =<p_project_id>
  AND start_date       > '31-MAR-15'
  AND end_date         < '1-APR-16'
  AND budget_version_id=
    (SELECT MAX(budget_version_id)
    FROM PA_PRJ_FC_RESULTS_V
    WHERE project_id=<p_project_id>
    )
  GROUP BY PROJECT_ID;

No comments:

Post a Comment