库存MTA
-- 库存MTA
SELECT c.code_combination_id,
c.segment1,
c.segment2,
c.segment3,
c.segment4,
c.segment5,
h.currency_code,
h.period_name,
to_number(to_char(h.default_effective_date, 'YYYY')) AS je_year,
to_number(to_char(h.default_effective_date, 'MM')) AS je_month,
to_number(to_char(h.default_effective_date, 'DD')) AS je_day,
to_char(h.doc_sequence_value) AS voucher,
'TRANSACTION_ID:' || to_char(mta.transaction_id) AS explanation,
b.NAME AS batch,
h.NAME AS account_name,
'库存' AS origin,
sign(l.entered_dr) * abs(mta.base_transaction_value) AS entered_dr,
sign(l.entered_cr) * abs(mta.base_transaction_value) AS entered_cr,
sign(l.entered_dr) * abs(mta.base_transaction_value) AS accounted_dr,
sign(l.entered_cr) * abs(mta.base_transaction_value) AS accounted_cr,
mta.currency_conversion_rate AS rate,
mta.transaction_id AS je_line_num
FROM gl.gl_code_combinations c,
gl.gl_je_headers h,
gl.gl_je_lines l,
gl.gl_je_batches b,
gl.gl_import_references i,
inv.mtl_transaction_accounts mta
WHERE i.je_batch_id = b.je_batch_id
AND i.je_header_id = h.je_header_id
AND i.je_line_num = l.je_line_num
AND h.je_header_id = l.je_header_id
AND h.je_batch_id = b.je_batch_id
AND h.je_source = 'Inventory'
AND l.code_combination_id = c.code_combination_id
AND l.period_name = rec_period.period_name
AND l.status = 'P'
AND i.gl_sl_link_table = 'MTA'
AND i.gl_sl_link_id = mta.gl_sl_link_id
AND mta.organization_id = p_organization_id
AND h.set_of_books_id = p_set_of_books_id
AND h.period_name = rec_period.period_name
AND mta.transaction_date >= rec_period.start_date
AND c.segment1 = nvl(p_segment1, c.segment1)
AND c.segment2 = nvl(p_segment2, c.segment2)
AND to_char(h.doc_sequence_value) LIKE p_segment1 || '%'
本文来自博客园,作者:Iven_lin,转载请注明原文链接:https://www.cnblogs.com/ivenlin/p/17061371.html
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库