首页 > 其他分享 >库存MTA

库存MTA

时间:2023-01-19 13:57:29浏览次数:38  
标签:MTA mta period transaction 库存 je gl id

-- 库存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 || '%'

标签:MTA,mta,period,transaction,库存,je,gl,id
From: https://www.cnblogs.com/ivenlin/p/17061371.html

相关文章