zoukankan      html  css  js  c++  java
  • 总账追朔各模块SQL

    SELECT gjh.set_of_books_id,
    			 gjl.je_line_num,
    			 mta.organization_id,
    			 ood.organization_code,
    			 ood.organization_name,
    			 mtt.transaction_type_name,
    			 NULL trx_number,
    			 to_char(ooh.order_number) trx_source,
    			 trunc(mmt.transaction_date) transaction_date,
    			 gcc.concatenated_segments account,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									1, nvl(mta.transaction_value, mta.base_transaction_value), 0, 0,
    									NULL)) entered_dr1,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									-1,
    									(-1 * nvl(mta.transaction_value, mta.base_transaction_value)),
    									NULL)) entered_cr1,
    			 SUM(decode(sign(mta.base_transaction_value), 1,
    									mta.base_transaction_value, 0, 0, NULL)) accounted_dr1,
    			 SUM(decode(sign(mta.base_transaction_value), -1,
    									(-1 * mta.base_transaction_value), NULL)) accounted_cr1,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1,
    									nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_cr,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1, mta.base_transaction_value,
    									0)) accounted_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * mta.base_transaction_value, 0)) accounted_cr
    	FROM gl_je_lines                  gjl,
    			 gl_je_headers                gjh,
    			 gl_code_combinations_kfv     gcc,
    			 gl_import_references         gir,
    			 gl_period_statuses           gps,
    			 mtl_transaction_accounts     mta,
    			 mtl_material_transactions    mmt,
    			 mtl_transaction_types        mtt,
    			 org_organization_definitions ood,
    			 oe_order_lines_all           ool,
    			 oe_order_headers_all         ooh
     WHERE gjl.je_header_id = gjh.je_header_id AND
    			 gjl.code_combination_id = gcc.code_combination_id AND
    			 gjl.je_header_id = gir.je_header_id AND
    			 gjl.je_line_num = gir.je_line_num AND
    			 gjh.set_of_books_id = gps.set_of_books_id AND
    			 gjh.period_name = gps.period_name AND gps.application_id = 401 AND
    			 gir.reference_1 = mta.gl_batch_id AND
    			 gjl.code_combination_id = mta.reference_account AND
    			 mta.transaction_date BETWEEN gps.start_date AND gps.end_date AND
    			 mta.transaction_id = mmt.transaction_id AND
    			 mmt.transaction_type_id = mtt.transaction_type_id AND
    			 mmt.organization_id = ood.organization_id AND
    			--
    			 mtt.transaction_type_name = 'Sales Order Pick' AND
    			 ooh.header_id = ool.header_id AND ool.line_id = mmt.trx_source_line_id AND
    			--
    			 gjh.je_source = 'Inventory' AND gjh.je_category = 'MTL' AND
    			--
    			 gjh.period_name = '06-2004' AND gjh.set_of_books_id = 1 AND
    			 gjh.je_header_id = 3148
     GROUP BY gjh.set_of_books_id,
    					mta.organization_id,
    					ood.organization_code,
    					ood.organization_name,
    					gjl.je_line_num,
    					trunc(mmt.transaction_date),
    					ooh.order_number,
    					mtt.transaction_type_name,
    					gcc.concatenated_segments
    UNION ALL
    SELECT gjh.set_of_books_id,
    			 gjl.je_line_num,
    			 mta.organization_id,
    			 ood.organization_code,
    			 ood.organization_name,
    			 mtt.transaction_type_name,
    			 wnd.NAME trx_number,
    			 to_char(ooh.order_number) trx_source,
    			 trunc(mmt.transaction_date) transaction_date,
    			 gcc.concatenated_segments account,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									1, nvl(mta.transaction_value, mta.base_transaction_value), 0, 0,
    									NULL)) entered_dr1,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									-1,
    									(-1 * nvl(mta.transaction_value, mta.base_transaction_value)),
    									NULL)) entered_cr1,
    			 SUM(decode(sign(mta.base_transaction_value), 1,
    									mta.base_transaction_value, 0, 0, NULL)) accounted_dr1,
    			 SUM(decode(sign(mta.base_transaction_value), -1,
    									(-1 * mta.base_transaction_value), NULL)) accounted_cr1,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1,
    									nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_cr,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1, mta.base_transaction_value,
    									0)) accounted_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * mta.base_transaction_value, 0)) accounted_cr
    	FROM gl_je_lines                  gjl,
    			 gl_je_headers                gjh,
    			 gl_code_combinations_kfv     gcc,
    			 gl_import_references         gir,
    			 gl_period_statuses           gps,
    			 mtl_transaction_accounts     mta,
    			 mtl_material_transactions    mmt,
    			 mtl_transaction_types        mtt,
    			 org_organization_definitions ood,
    			 oe_order_lines_all           ool,
    			 wsh_new_deliveries           wnd,
    			 oe_order_headers_all         ooh
     WHERE gjl.je_header_id = gjh.je_header_id AND
    			 gjl.code_combination_id = gcc.code_combination_id AND
    			 gjl.je_header_id = gir.je_header_id AND
    			 gjl.je_line_num = gir.je_line_num AND
    			 gjh.set_of_books_id = gps.set_of_books_id AND
    			 gjh.period_name = gps.period_name AND gps.application_id = 401 AND
    			 gir.reference_1 = mta.gl_batch_id AND
    			 gjl.code_combination_id = mta.reference_account AND
    			 mta.transaction_date BETWEEN gps.start_date AND gps.end_date AND
    			 mta.transaction_id = mmt.transaction_id AND
    			 mmt.transaction_type_id = mtt.transaction_type_id AND
    			 mmt.organization_id = ood.organization_id AND
    			--
    			 mtt.transaction_type_name = 'Sales order issue' AND
    			 mmt.shipment_number = wnd.delivery_id AND ooh.header_id = ool.header_id AND
    			 ool.line_id = mmt.trx_source_line_id AND
    			--
    			 gjh.je_source = 'Inventory' AND gjh.je_category = 'MTL' AND
    			--
    			 gjh.period_name = '06-2004' AND gjh.set_of_books_id = 1 AND
    			 gjh.je_header_id = 3148
     GROUP BY gjh.set_of_books_id,
    					mta.organization_id,
    					ood.organization_code,
    					ood.organization_name,
    					gjl.je_line_num,
    					trunc(mmt.transaction_date),
    					ooh.order_number,
    					wnd.NAME,
    					mtt.transaction_type_name,
    					gcc.concatenated_segments
    UNION ALL
    SELECT gjh.set_of_books_id,
    			 gjl.je_line_num,
    			 mta.organization_id,
    			 ood.organization_code,
    			 ood.organization_name,
    			 mtt.transaction_type_name,
    			 rsh.receipt_num trx_number,
    			 pha.segment1 trx_source,
    			 trunc(mmt.transaction_date) transaction_date,
    			 gcc.concatenated_segments account,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									1, nvl(mta.transaction_value, mta.base_transaction_value), 0, 0,
    									NULL)) entered_dr1,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									-1,
    									(-1 * nvl(mta.transaction_value, mta.base_transaction_value)),
    									NULL)) entered_cr1,
    			 SUM(decode(sign(mta.base_transaction_value), 1,
    									mta.base_transaction_value, 0, 0, NULL)) accounted_dr1,
    			 SUM(decode(sign(mta.base_transaction_value), -1,
    									(-1 * mta.base_transaction_value), NULL)) accounted_cr1,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1,
    									nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_cr,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1, mta.base_transaction_value,
    									0)) accounted_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * mta.base_transaction_value, 0)) accounted_cr
    	FROM gl_je_lines                  gjl,
    			 gl_je_headers                gjh,
    			 gl_code_combinations_kfv     gcc,
    			 gl_import_references         gir,
    			 gl_period_statuses           gps,
    			 mtl_transaction_accounts     mta,
    			 mtl_material_transactions    mmt,
    			 mtl_transaction_types        mtt,
    			 org_organization_definitions ood,
    			 rcv_transactions             rt,
    			 rcv_shipment_headers         rsh,
    			 po_headers_all               pha
     WHERE gjl.je_header_id = gjh.je_header_id AND
    			 gjl.code_combination_id = gcc.code_combination_id AND
    			 gjl.je_header_id = gir.je_header_id AND
    			 gjl.je_line_num = gir.je_line_num AND
    			 gjh.set_of_books_id = gps.set_of_books_id AND
    			 gjh.period_name = gps.period_name AND gps.application_id = 401 AND
    			 gir.reference_1 = mta.gl_batch_id AND
    			 gjl.code_combination_id = mta.reference_account AND
    			 mta.transaction_date BETWEEN gps.start_date AND gps.end_date AND
    			 mta.transaction_id = mmt.transaction_id AND
    			 mmt.transaction_type_id = mtt.transaction_type_id AND
    			 mmt.organization_id = ood.organization_id AND
    			--
    			 mtt.transaction_type_name IN ('PO Receipt', 'PO Rcpt Adjust') AND
    			 rt.transaction_id = mmt.rcv_transaction_id AND
    			 rt.shipment_header_id = rsh.shipment_header_id AND
    			 rt.po_header_id = pha.po_header_id AND
    			--
    			 gjh.je_source = 'Inventory' AND gjh.je_category = 'MTL' AND
    			--
    			 gjh.period_name = '06-2004' AND gjh.set_of_books_id = 1 AND
    			 gjh.je_header_id = 3148
     GROUP BY gjh.set_of_books_id,
    					mta.organization_id,
    					ood.organization_code,
    					ood.organization_name,
    					gjl.je_line_num,
    					trunc(mmt.transaction_date),
    					rsh.receipt_num,
    					pha.segment1,
    					mtt.transaction_type_name,
    					gcc.concatenated_segments
    UNION ALL
    SELECT gjh.set_of_books_id,
    			 gjl.je_line_num,
    			 mta.organization_id,
    			 ood.organization_code,
    			 ood.organization_name,
    			 mtt.transaction_type_name,
    			 to_char(mmt.transaction_set_id) trx_number,
    			 mmt.subinventory_code trx_source,
    			 trunc(mmt.transaction_date) transaction_date,
    			 gcc.concatenated_segments account,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									1, nvl(mta.transaction_value, mta.base_transaction_value), 0, 0,
    									NULL)) entered_dr1,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									-1,
    									(-1 * nvl(mta.transaction_value, mta.base_transaction_value)),
    									NULL)) entered_cr1,
    			 SUM(decode(sign(mta.base_transaction_value), 1,
    									mta.base_transaction_value, 0, 0, NULL)) accounted_dr1,
    			 SUM(decode(sign(mta.base_transaction_value), -1,
    									(-1 * mta.base_transaction_value), NULL)) accounted_cr1,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1,
    									nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_cr,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1, mta.base_transaction_value,
    									0)) accounted_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * mta.base_transaction_value, 0)) accounted_cr
    	FROM gl_je_lines                  gjl,
    			 gl_je_headers                gjh,
    			 gl_code_combinations_kfv     gcc,
    			 gl_import_references         gir,
    			 gl_period_statuses           gps,
    			 mtl_transaction_accounts     mta,
    			 mtl_material_transactions    mmt,
    			 mtl_transaction_types        mtt,
    			 org_organization_definitions ood
     WHERE gjl.je_header_id = gjh.je_header_id AND
    			 gjl.code_combination_id = gcc.code_combination_id AND
    			 gjl.je_header_id = gir.je_header_id AND
    			 gjl.je_line_num = gir.je_line_num AND
    			 gjh.set_of_books_id = gps.set_of_books_id AND
    			 gjh.period_name = gps.period_name AND gps.application_id = 401 AND
    			 gir.reference_1 = mta.gl_batch_id AND
    			 gjl.code_combination_id = mta.reference_account AND
    			 mta.transaction_date BETWEEN gps.start_date AND gps.end_date AND
    			 mta.transaction_id = mmt.transaction_id AND
    			 mmt.transaction_type_id = mtt.transaction_type_id AND
    			 mmt.organization_id = ood.organization_id AND
    			--
    			 mtt.transaction_type_name IN
    			 ('Subinventory Transfer', 'Move Order Transfer', 'Physical Inv Adjust',
    				'富通子库存转移') AND
    			--
    			 gjh.je_source = 'Inventory' AND gjh.je_category = 'MTL' AND
    			--
    			 gjh.period_name = '06-2004' AND gjh.set_of_books_id = 1 AND
    			 gjh.je_header_id = 3148
     GROUP BY gjh.set_of_books_id,
    					mta.organization_id,
    					ood.organization_code,
    					ood.organization_name,
    					gjl.je_line_num,
    					mmt.transaction_set_id,
    					mmt.subinventory_code,
    					trunc(mmt.transaction_date),
    					mtt.transaction_type_name,
    					gcc.concatenated_segments
    UNION ALL
    
    SELECT gjh.set_of_books_id,
    			 gjl.je_line_num,
    			 mta.organization_id,
    			 ood.organization_code,
    			 ood.organization_name,
    			 mtt.transaction_type_name,
    			 NULL trx_number,
    			 mmt.transaction_source_name trx_source,
    			 trunc(mmt.transaction_date) transaction_date,
    			 gcc.concatenated_segments account,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									1, nvl(mta.transaction_value, mta.base_transaction_value), 0, 0,
    									NULL)) entered_dr1,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									-1,
    									(-1 * nvl(mta.transaction_value, mta.base_transaction_value)),
    									NULL)) entered_cr1,
    			 SUM(decode(sign(mta.base_transaction_value), 1,
    									mta.base_transaction_value, 0, 0, NULL)) accounted_dr1,
    			 SUM(decode(sign(mta.base_transaction_value), -1,
    									(-1 * mta.base_transaction_value), NULL)) accounted_cr1,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1,
    									nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_cr,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1, mta.base_transaction_value,
    									0)) accounted_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * mta.base_transaction_value, 0)) accounted_cr
    	FROM gl_je_lines                  gjl,
    			 gl_je_headers                gjh,
    			 gl_code_combinations_kfv     gcc,
    			 gl_import_references         gir,
    			 gl_period_statuses           gps,
    			 mtl_transaction_accounts     mta,
    			 mtl_material_transactions    mmt,
    			 mtl_transaction_types        mtt,
    			 org_organization_definitions ood
     WHERE gjl.je_header_id = gjh.je_header_id AND
    			 gjl.code_combination_id = gcc.code_combination_id AND
    			 gjl.je_header_id = gir.je_header_id AND
    			 gjl.je_line_num = gir.je_line_num AND
    			 gjh.set_of_books_id = gps.set_of_books_id AND
    			 gjh.period_name = gps.period_name AND gps.application_id = 401 AND
    			 gir.reference_1 = mta.gl_batch_id AND
    			 gjl.code_combination_id = mta.reference_account AND
    			 mta.transaction_date BETWEEN gps.start_date AND gps.end_date AND
    			 mta.transaction_id = mmt.transaction_id AND
    			 mmt.transaction_type_id = mtt.transaction_type_id AND
    			 mmt.organization_id = ood.organization_id AND
    			--
    			 mtt.transaction_type_name = 'Average cost update' AND
    			--
    			 gjh.je_source = 'Inventory' AND gjh.je_category = 'MTL' AND
    			--
    			 gjh.period_name = '06-2004' AND gjh.set_of_books_id = 1 AND
    			 gjh.je_header_id = 3148
     GROUP BY gjh.set_of_books_id,
    					mta.organization_id,
    					ood.organization_code,
    					ood.organization_name,
    					gjl.je_line_num,
    					mmt.transaction_source_name,
    					mmt.subinventory_code,
    					trunc(mmt.transaction_date),
    					mtt.transaction_type_name,
    					gcc.concatenated_segments
    UNION ALL
    SELECT gjh.set_of_books_id,
    			 gjl.je_line_num,
    			 mta.organization_id,
    			 ood.organization_code,
    			 ood.organization_name,
    			 mtt.transaction_type_name,
    			 rsh.receipt_num trx_number,
    			 to_char(ooh.order_number) trx_source,
    			 trunc(mmt.transaction_date) transaction_date,
    			 gcc.concatenated_segments account,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									1, nvl(mta.transaction_value, mta.base_transaction_value), 0, 0,
    									NULL)) entered_dr1,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									-1,
    									(-1 * nvl(mta.transaction_value, mta.base_transaction_value)),
    									NULL)) entered_cr1,
    			 SUM(decode(sign(mta.base_transaction_value), 1,
    									mta.base_transaction_value, 0, 0, NULL)) accounted_dr1,
    			 SUM(decode(sign(mta.base_transaction_value), -1,
    									(-1 * mta.base_transaction_value), NULL)) accounted_cr1,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1,
    									nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_cr,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1, mta.base_transaction_value,
    									0)) accounted_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * mta.base_transaction_value, 0)) accounted_cr
    	FROM gl_je_lines                  gjl,
    			 gl_je_headers                gjh,
    			 gl_code_combinations_kfv     gcc,
    			 gl_import_references         gir,
    			 gl_period_statuses           gps,
    			 mtl_transaction_accounts     mta,
    			 mtl_material_transactions    mmt,
    			 mtl_transaction_types        mtt,
    			 rcv_transactions             rt,
    			 rcv_shipment_headers         rsh,
    			 oe_order_headers_all         ooh,
    			 org_organization_definitions ood
     WHERE gjl.je_header_id = gjh.je_header_id AND
    			 gjl.code_combination_id = gcc.code_combination_id AND
    			 gjl.je_header_id = gir.je_header_id AND
    			 gjl.je_line_num = gir.je_line_num AND
    			 gjh.set_of_books_id = gps.set_of_books_id AND
    			 gjh.period_name = gps.period_name AND gps.application_id = 401 AND
    			 gir.reference_1 = mta.gl_batch_id AND
    			 gjl.code_combination_id = mta.reference_account AND
    			 mta.transaction_date BETWEEN gps.start_date AND gps.end_date AND
    			 mta.transaction_id = mmt.transaction_id AND
    			 mmt.transaction_type_id = mtt.transaction_type_id AND
    			 mmt.organization_id = ood.organization_id AND
    			--
    			 mtt.transaction_type_name = 'RMA Receipt' AND
    			 rt.transaction_id = mmt.rcv_transaction_id AND
    			 rt.shipment_header_id = rsh.shipment_header_id AND
    			 rt.oe_order_header_id = ooh.header_id AND
    			--
    			 gjh.je_source = 'Inventory' AND gjh.je_category = 'MTL' AND
    			--
    			 gjh.period_name = '06-2004' AND gjh.set_of_books_id = 1 AND
    			 gjh.je_header_id = 3148
     GROUP BY gjh.set_of_books_id,
    					mta.organization_id,
    					ood.organization_code,
    					ood.organization_name,
    					gjl.je_line_num,
    					rsh.receipt_num,
    					ooh.order_number,
    					mmt.subinventory_code,
    					trunc(mmt.transaction_date),
    					mtt.transaction_type_name,
    					gcc.concatenated_segments
    UNION ALL
    SELECT gjh.set_of_books_id,
    			 gjl.je_line_num,
    			 mta.organization_id,
    			 ood.organization_code,
    			 ood.organization_name,
    			 mtt.transaction_type_name,
    			 to_char(mmt.transaction_set_id) trx_number,
    			 mgd.segment1 trx_source,
    			 trunc(mmt.transaction_date) transaction_date,
    			 gcc.concatenated_segments account,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									1, nvl(mta.transaction_value, mta.base_transaction_value), 0, 0,
    									NULL)) entered_dr1,
    			 SUM(decode(sign(nvl(mta.transaction_value, mta.base_transaction_value)),
    									-1,
    									(-1 * nvl(mta.transaction_value, mta.base_transaction_value)),
    									NULL)) entered_cr1,
    			 SUM(decode(sign(mta.base_transaction_value), 1,
    									mta.base_transaction_value, 0, 0, NULL)) accounted_dr1,
    			 SUM(decode(sign(mta.base_transaction_value), -1,
    									(-1 * mta.base_transaction_value), NULL)) accounted_cr1,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1,
    									nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * nvl(mta.transaction_value, mta.base_transaction_value), 0)) entered_cr,
    			 SUM(decode(sign(nvl(gjl.accounted_dr, 0)), 1, mta.base_transaction_value,
    									0)) accounted_dr,
    			 SUM(decode(sign(nvl(gjl.accounted_cr, 0)), 1,
    									-1 * mta.base_transaction_value, 0)) accounted_cr
    	FROM gl_je_lines                  gjl,
    			 gl_je_headers                gjh,
    			 gl_code_combinations_kfv     gcc,
    			 gl_import_references         gir,
    			 gl_period_statuses           gps,
    			 mtl_transaction_accounts     mta,
    			 mtl_material_transactions    mmt,
    			 mtl_transaction_types        mtt,
    			 org_organization_definitions ood,
    			 MTL_GENERIC_DISPOSITIONS     mgd
     WHERE gjl.je_header_id = gjh.je_header_id AND
    			 gjl.code_combination_id = gcc.code_combination_id AND
    			 gjl.je_header_id = gir.je_header_id AND
    			 gjl.je_line_num = gir.je_line_num AND
    			 gjh.set_of_books_id = gps.set_of_books_id AND
    			 gjh.period_name = gps.period_name AND gps.application_id = 401 AND
    			 gir.reference_1 = mta.gl_batch_id AND
    			 gjl.code_combination_id = mta.reference_account AND
    			 mta.transaction_date BETWEEN gps.start_date AND gps.end_date AND
    			 mta.transaction_id = mmt.transaction_id AND
    			 mmt.transaction_type_id = mtt.transaction_type_id AND
    			 mmt.organization_id = ood.organization_id AND
    			--
    			 mtt.transaction_type_name NOT IN
    			 ('Sales Order Pick', 'Sales order issue', 'PO Receipt', 'PO Rcpt Adjust',
    				'Subinventory Transfer', 'Move Order Transfer', 'Physical Inv Adjust',
    				'富通子库存转移', 'Average cost update', 'RMA Receipt') AND
    			 mmt.transaction_source_id = mgd.disposition_id AND
    			 mgd.organization_id = mmt.organization_id AND
    			--
    			 gjh.je_source = 'Inventory' AND gjh.je_category = 'MTL' AND
    			--
    			 gjh.period_name = '06-2004' AND gjh.set_of_books_id = 1 AND
    			 gjh.je_header_id = 3148
     GROUP BY gjh.set_of_books_id,
    					mta.organization_id,
    					ood.organization_code,
    					ood.organization_name,
    					gjl.je_line_num,
    					mmt.transaction_set_id,
    					mgd.segment1,
    					trunc(mmt.transaction_date),
    					mtt.transaction_type_name,
    					gcc.concatenated_segments
     ORDER BY 2

  • 相关阅读:
    kafka消费者如何才能从头开始消费某个topic的全量数据
    kafka消费者客户端启动之后消费不到消息的原因分析
    JMeter测试工具中的参数化使用[函数助手]
    在IDEA中使用gradle配置打可执行jar包[可执行jar与其所依赖的jar分离]
    一次tomcat配置参数调优Jmeter压力测试记录前后对比
    IntelliJ IDEA 14.1.4导入项目启动报错:Error during artifact deployment.[组件部署期间出错]
    BZOJ2861 : 双向边定向为单向边
    BZOJ4313 : 三维积木
    BZOJ4714 : 旋转排列
    BZOJ1395 : [Baltic2005]Trip
  • 原文地址:https://www.cnblogs.com/wanghang/p/6299131.html
Copyright © 2011-2022 走看看