总账追朔各模块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

时间: 2024-10-05 03:19:00

总账追朔各模块SQL的相关文章

Windows下也可以使用osw追朔系统历史性能

1.Windows系统历史性能分析困难背景 在Linux/Unix上,要追朔历史性能,一般采用部署nmon进行性能监控采集与存储的方式实现,但是却没有在Windows上的版本. Windows系统如果要分析历史性能,一直是个老大难. 其实,ORACLE有一个监控工具叫OSWatcher的工具,不仅可以在Linux/Unix上使用,还可以在Windows上使用,叫OS Watcher For Windows (OSWFW),解决了Windows系统上历史性能不可查的问题. 2.OSWFW支持的Wi

Windows下也能够使用osw追朔系统历史性能

1.Windows系统历史性能分析困难背景 在Linux/Unix上.要追朔历史性能,一般採用部署nmon进行性能监控採集与存储的方式实现.可是却没有在Windows上的版本号. Windows系统假设要分析历史性能,一直是个老大难. 事实上.ORACLE有一个监控工具叫OSWatcher的工具,不仅能够在Linux/Unix上使用,还能够在Windows上使用.叫OS Watcher For Windows (OSWFW),攻克了Windows系统上历史性能不可查的问题. 2.OSWFW支持的

Navicat工具、pymysql模块 sql注入

cls超 Navicat工具.pymysql模块 阅读目录 一 IDE工具介绍 二 pymysql模块 一 IDE工具介绍(Navicat) 生产环境还是推荐使用mysql命令行,但为了方便我们测试,可以使用IDE工具,我们使用Navicat工具,这个工具本质上就是一个socket客户端,可视化的连接mysql服务端的一个工具,并且他是图形界面版的.我们使用它和直接使用命令行的区别就类似linux和windows系统操作起来的一个区别. 下载链接:https://pan.baidu.com/s/

031医疗项目-模块三:药品供应商目录模块——sql补充知识

这个补充知识有一个点很有必要,视屏上的老师提出一点: 内链接关联查询: 如果表A和表B有一个外键关联 ,可以通过外键进行内链接查询 select dictinfo.*, dicttype.typename from dictinfo, dicttype where dictinfo.typecode = dicttype.typecode --不通过外键,通过groupid查询用户类型的代码结果集,只能查询出一条记录,可以使用内链接 select sysuser.*, dictinfo.info

PHPCMS v9.6.0 wap模块 SQL注入

调试这个漏洞的时候踩了个坑,影响的版本是php5.4以后. 由于漏洞是由parse_str()函数引起的,但是这个函数在gpc开启的时候(也就是php5.4以下)会对单引号进行过滤\'  . 看这里:https://github.com/80vul/pasc2at 漏洞来源:https://www.seebug.org/vuldb/ssvid-92929 分析:这个漏洞要三步的过程,直接进入第三步. 根据给的poc:   /phpv9.6.0/index.php?m=content&c=down

用友财务总账(GL)模块的BI数据ETL分析

业务需求如下: 某公司目前用了用友的总账BI分析案例. /* Sql Server2012使用作业设置定时任务,来保证一天执行一次 */ /* 一定要注意temp1表里一定要保证要有记录,否则以temp1 来 left join就出现为空的情况. */ /* Step 1: 把所有的数据库列表都插入到BI数据库的DBLIST表里 */ USE BI; /* drop table BI.DBO.TEMP1; drop table BI.DBO.TEMP2; drop table BI.DBO.TE

关于SQL的几道小题详解

关于SQL的几道小题详解 当我们拿到题目的时候,并不是急于作答,那样会得不偿失的,而是分析思路,采用什么方法,达到什么目的,还要思考有没有简单的方法或者通用的方法等等,这样才会达到以一当十的效果,这样的惯性思维其实早在我们度高中的时候就被领教了,所谓“万变不离其宗”吧.以下各题来自日常所见,或QQ群,或面试题,或博客园. 题目一:如下表所示,现需要按照收款员统计收款和退款合计金额. 实现结果需如下显示: 分析:想要的结果(记为表B)和源数据(记为表A)相比,有共同的列(收款员),不同的是表A的金

关于几道SQL经典题详解

当我们拿到题目的时候,并不是急于作答,那样会得不偿失的,而是分析思路,采用什么方法,达到什么目的,还要思考有没有简单的方法或者通用的方法等等,这样才会达到以一当十的效果,这样的惯性思维其实早在我们度高中的时候就被领教了,所谓"万变不离其宗"吧.以下各题来自日常所见,或QQ群,或面试题,或博客园. 题目一:如下表所示,现需要按照收款员统计收款和退款合计金额. 实现结果需如下显示: 分析:想要的结果(记为表B)和源数据(记为表A)相比,有共同的列(收款员),不同的是表A的金额根据标记和收款

SQL On Hadoop 设计的一个基本原则是:将计算任务移动到数据所在的节点而不是反过来

3.1 数据本地化 SQL On Hadoop 设计的一个基本原则是:将计算任务移动到数据所在的节点而不是反过来.这主要出于网络优化的目的,因为数据分布在不同的节点,如果移动数据那么将会产生大量的低效的网络数据传输.数据本地化一般分为三种:节点局部性 (Node Locality), 机架局部性 (Rack Locality) 和全局局部性 (Global Locality).节点局部性是指将计算任务分配到数据所在的节点上,此时无需任何数据传输,效率最佳.机架局部性是指将计算任务移动到数据所在的