月結各模組關閉情況查詢SQL

Iven_lin發表於2024-03-19

-----庫存模組
select oap.status 關閉狀態,
oap.period_name 所屬期間,
oap.organization_id 組織id,
(select name
from hr_organization_units x
where x.organization_id = oap.organization_id) 組織名稱,
oap.last_update_date 執行關閉日期,
(select hre.full_name
from hr_employees_all_v hre, fnd_user fu
where hre.employee_id = fu.employee_id
and fu.user_id = oap.last_updated_by) 執行關閉人,
oap.created_by,
oap.period_number
from org_acct_periods_v oap
where oap.period_number = 6 --月份
and oap.period_year = 2022 -- 年份
and oap.organization_id <> 0
order by oap.organization_id, oap.period_name desc, oap.status desc
-----------------------------------------------------------------其他模組------------------------------------------------------------
select gps.period_name 所屬期間,
(select faa.application_name
from fnd_application_all_view faa
where faa.application_id = gps.application_id) 模組名稱,
gps.ledger_id 分類賬套,
gps.show_status 期間狀態,
(select hre.full_name
from hr_employees_all_v hre, fnd_user fu
where hre.employee_id = fu.employee_id
and fu.user_id = gps.last_updated_by) 執行關閉人,
gps.last_update_date 最後次操作時間
from gl_period_statuses_v gps
where --gps.application_id = 101
--and
gps.ledger_id = 2021
and gps.closing_status != 'N'
and (gps.ledger_id = 2021)
order by gps.application_id, gps.period_name desc;

相關文章