SELECT jh.period_name 期间, jh.default_effective_date 日期, jh.name 凭证名, jh.doc_sequence_value 单据号, jl.je_line_num 凭证行号, gccv.segment1 公司, gccv.segment2 成本中心, gccv.segment3 会计科目, gccv.segment4 明细, gccv.segment5 往来, gccv.segment6 备用1, gccv.segment7 备用2, jl.accounted_dr 借方, jl.accounted_cr 贷方, jl.status FROM gl_je_lines jl, gl_code_combinations_v gccv, gl_je_headers jh WHERE jl.je_header_id = jh.je_header_id AND gccv.code_combination_id = jl.code_combination_id AND jh.doc_sequence_value IN (SELECT jh.doc_sequence_value FROM gl_je_lines jl, gl_code_combinations_v gccv, gl_je_headers jh WHERE jl.je_header_id = jh.je_header_id AND gccv.code_combination_id = jl.code_combination_id AND (jh.default_effective_date BETWEEN to_date('2014-01-01', 'YYYY-MM-DD') AND to_date('2014-01-31', 'YYYY-MM-DD')) --and jl.status='P' AND gccv.segment3 IN (SELECT ffv.flex_value FROM fnd_flex_values ffv, fnd_flex_value_sets ffvs WHERE ffv.flex_value_set_id = ffvs.flex_value_set_id AND ffvs.flex_value_set_name = 'BZ_ACCOUNT' AND ffv.enabled_flag = 'Y' AND ffv.summary_flag = 'N' AND ffv.attribute2 = 'Y')) --现金科目 ORDER BY jh.doc_sequence_value, jl.je_line_num