应计帐户在INV设置的时候错误,造成后期问题;由制造费用update为应付账款;update各张表...不知是否有遗漏?
对于该帐户的理解不深、帐户的产生跟cost有何关联么?不解..
----请购单------------------------------------
--查询请购单错误帐户
select prh.segment1 AS 请购单号, prh.creation_date AS 创建日期
from Po_Requisition_Headers_All prh
where prh.requisition_header_id in
(select pr.requisition_header_id
from po_requisition_lines_all pr
where pr.requisition_line_id in
(select p.requisition_line_id
from Po_Req_Distributions_All p
where p.accrual_account_id = 6167));
select * from Po_Req_Distributions_All p
where p.accrual_account_id=6167;
from Po_Requisition_Headers_All prh
where prh.requisition_header_id in
(select pr.requisition_header_id
from po_requisition_lines_all pr
where pr.requisition_line_id in
(select p.requisition_line_id
from Po_Req_Distributions_All p
where p.accrual_account_id = 6167));
select * from Po_Req_Distributions_All p
where p.accrual_account_id=6167;
update Po_Req_Distributions_All p set p.accrual_account_id=2038
where p.accrual_account_id=6167;
where p.accrual_account_id=6167;
----采购单------------------------------
/* 查询采购单帐户错误的*/
(SELECT PHA.SEGMENT1 AS 采购单号,PRA.RELEASE_NUM AS 版本
FROM Po_Distributions_All PD, po_headers_all pha,Po_Releases_All PRA
WHERE PD.PO_HEADER_ID = PHA.PO_HEADER_ID
AND PRA.PO_HEADER_ID=PHA.PO_HEADER_ID
AND PRA.PO_RELEASE_ID=PD.PO_RELEASE_ID
AND PD.ACCRUAL_ACCOUNT_ID = 6167
UNION ALL
SELECT PHA.SEGMENT1 AS 采购单号,NULL AS 版本
FROM Po_Distributions_All PD, po_headers_all pha
WHERE PD.PO_HEADER_ID = PHA.PO_HEADER_ID
AND PD.PO_RELEASE_ID IS NULL
AND PD.ACCRUAL_ACCOUNT_ID = 6167);
(SELECT PHA.SEGMENT1 AS 采购单号,PRA.RELEASE_NUM AS 版本
FROM Po_Distributions_All PD, po_headers_all pha,Po_Releases_All PRA
WHERE PD.PO_HEADER_ID = PHA.PO_HEADER_ID
AND PRA.PO_HEADER_ID=PHA.PO_HEADER_ID
AND PRA.PO_RELEASE_ID=PD.PO_RELEASE_ID
AND PD.ACCRUAL_ACCOUNT_ID = 6167
UNION ALL
SELECT PHA.SEGMENT1 AS 采购单号,NULL AS 版本
FROM Po_Distributions_All PD, po_headers_all pha
WHERE PD.PO_HEADER_ID = PHA.PO_HEADER_ID
AND PD.PO_RELEASE_ID IS NULL
AND PD.ACCRUAL_ACCOUNT_ID = 6167);
SELECT pd.accrual_account_id, pd.code_combination_id
FROM Po_Distributions_All pd
where pd.accrual_account_id = 6167;
FROM Po_Distributions_All pd
where pd.accrual_account_id = 6167;
update Po_Distributions_All pd set pd.accrual_account_id=2038
where pd.accrual_account_id=6167;
-----------------接收入库-------------------------
select rsh.receipt_num AS 接收编号,
poh.segment1 AS 采购单号,
pol.line_num AS 行号,
rsl.item_description AS 物料说明,
rt.quantity AS 数量,
rt.po_unit_price AS 单价,
rt.transaction_id
from RCV_SHIPMENT_HEADERS rsh,
RCV_SHIPMENT_LINES rsl,
RCV_TRANSACTIONS rt,
PO_HEADERS_ALL POH,
PO_LINES_ALL POL,
PO_VENDORS PV
where rsh.shipment_header_id = rsl.shipment_header_id
and rsh.shipment_header_id = rt.shipment_header_id
and rsl.shipment_line_id = rt.shipment_line_id
and poh.po_header_id = rt.po_header_id
and pol.po_line_id = rt.po_line_id
and poh.org_id = pol.org_id
AND PV.VENDOR_ID = RT.VENDOR_ID
and poh.org_id = 81
and rt.transaction_id in
(select p.rcv_transaction_id
from Po.Rcv_Receiving_Sub_Ledger p
where p.code_combination_id = 6167
and p.accounting_line_type = 'Accrual');
------------接收会计分录表:------------------------
select p.rcv_transaction_id, p.code_combination_id
from Po.Rcv_Receiving_Sub_Ledger p
where p.code_combination_id = 6167
and p.accounting_line_type = 'Accrual';
where pd.accrual_account_id=6167;
-----------------接收入库-------------------------
select rsh.receipt_num AS 接收编号,
poh.segment1 AS 采购单号,
pol.line_num AS 行号,
rsl.item_description AS 物料说明,
rt.quantity AS 数量,
rt.po_unit_price AS 单价,
rt.transaction_id
from RCV_SHIPMENT_HEADERS rsh,
RCV_SHIPMENT_LINES rsl,
RCV_TRANSACTIONS rt,
PO_HEADERS_ALL POH,
PO_LINES_ALL POL,
PO_VENDORS PV
where rsh.shipment_header_id = rsl.shipment_header_id
and rsh.shipment_header_id = rt.shipment_header_id
and rsl.shipment_line_id = rt.shipment_line_id
and poh.po_header_id = rt.po_header_id
and pol.po_line_id = rt.po_line_id
and poh.org_id = pol.org_id
AND PV.VENDOR_ID = RT.VENDOR_ID
and poh.org_id = 81
and rt.transaction_id in
(select p.rcv_transaction_id
from Po.Rcv_Receiving_Sub_Ledger p
where p.code_combination_id = 6167
and p.accounting_line_type = 'Accrual');
------------接收会计分录表:------------------------
select p.rcv_transaction_id, p.code_combination_id
from Po.Rcv_Receiving_Sub_Ledger p
where p.code_combination_id = 6167
and p.accounting_line_type = 'Accrual';
update Po.Rcv_Receiving_Sub_Ledger p
set p.code_combination_id = 2038
where p.code_combination_id = 6167
and p.accounting_line_type = 'Accrual';
-----------------AP立账-------------------------
/*查询帐户错误的凭证*/
select aia.doc_sequence_value AS 凭证编号,
aid.dist_code_combination_id AS 帐户ID,
aid.invoice_id AS 发票ID,
aid.line_type_lookup_code AS 类型
from ap_invoices_all aia, AP_INVOICE_DISTRIBUTIONS_ALL aid
where aia.invoice_id = aid.invoice_id
and aid.line_type_lookup_code = 'ACCRUAL'
and aid.dist_code_combination_id = 6167;
---------------------------
select aid.dist_code_combination_id,
aid.invoice_id,
aid.line_type_lookup_code
from AP_INVOICE_DISTRIBUTIONS_ALL aid
where aid.line_type_lookup_code = 'ACCRUAL'
and aid.dist_code_combination_id = 6167;
set p.code_combination_id = 2038
where p.code_combination_id = 6167
and p.accounting_line_type = 'Accrual';
-----------------AP立账-------------------------
/*查询帐户错误的凭证*/
select aia.doc_sequence_value AS 凭证编号,
aid.dist_code_combination_id AS 帐户ID,
aid.invoice_id AS 发票ID,
aid.line_type_lookup_code AS 类型
from ap_invoices_all aia, AP_INVOICE_DISTRIBUTIONS_ALL aid
where aia.invoice_id = aid.invoice_id
and aid.line_type_lookup_code = 'ACCRUAL'
and aid.dist_code_combination_id = 6167;
---------------------------
select aid.dist_code_combination_id,
aid.invoice_id,
aid.line_type_lookup_code
from AP_INVOICE_DISTRIBUTIONS_ALL aid
where aid.line_type_lookup_code = 'ACCRUAL'
and aid.dist_code_combination_id = 6167;
update AP_INVOICE_DISTRIBUTIONS_ALL aid
set aid.dist_code_combination_id = 2038
where aid.line_type_lookup_code = 'ACCRUAL'
and aid.dist_code_combination_id = 6167;
--------------会计分录-------------------
select * from xla_ae_lines xal where
xal.accounting_class_code='ACCRUAL'
and xal.ae_header_id
in (
select xah.ae_header_id
from xla_ae_headers xah
where xah.doc_sequence_value in
(
select aia.doc_sequence_value from Ap_Invoices_All aia where aia.invoice_id
in (
select distinct
aid.invoice_id
from AP_INVOICE_DISTRIBUTIONS_ALL aid
where
aid.line_type_lookup_code = 'ACCRUAL'
and aid.dist_code_combination_id = 6167))
);
xal.accounting_class_code='ACCRUAL'
and xal.ae_header_id
in (
select xah.ae_header_id
from xla_ae_headers xah
where xah.doc_sequence_value in
(
select aia.doc_sequence_value from Ap_Invoices_All aia where aia.invoice_id
in (
select distinct
aid.invoice_id
from AP_INVOICE_DISTRIBUTIONS_ALL aid
where
aid.line_type_lookup_code = 'ACCRUAL'
and aid.dist_code_combination_id = 6167))
);
/*查询会计分录内的错误帐户*/
select xla.ae_header_id,
xla.accounted_dr AS 借方,
xla.accounted_cr AS 贷方,
xla.entered_dr AS 借方,
xla.entered_cr AS 贷方,
xla.description AS 物料说明,
xla.accounting_class_code AS 类型,
xla.party_id AS 供应商ID,
xla.creation_date AS 创建日期,
xla.accounting_date AS 创建会计科目日期
from xla_ae_lines xla
where xla.code_combination_id = 6167
and xla.accounting_class_code = 'ACCRUAL';
-------
select *
from xla_ae_lines xla
where xla.code_combination_id = 6167
and xla.accounting_class_code = 'ACCRUAL';
update xla_ae_lines xla
set xla.code_combination_id = 2038
where xla.code_combination_id = 6167
and xla.accounting_class_code = 'ACCRUAL';
select xla.ae_header_id,
xla.accounted_dr AS 借方,
xla.accounted_cr AS 贷方,
xla.entered_dr AS 借方,
xla.entered_cr AS 贷方,
xla.description AS 物料说明,
xla.accounting_class_code AS 类型,
xla.party_id AS 供应商ID,
xla.creation_date AS 创建日期,
xla.accounting_date AS 创建会计科目日期
from xla_ae_lines xla
where xla.code_combination_id = 6167
and xla.accounting_class_code = 'ACCRUAL';
-------
select *
from xla_ae_lines xla
where xla.code_combination_id = 6167
and xla.accounting_class_code = 'ACCRUAL';
update xla_ae_lines xla
set xla.code_combination_id = 2038
where xla.code_combination_id = 6167
and xla.accounting_class_code = 'ACCRUAL';
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/24899662/viewspace-700951/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/24899662/viewspace-700951/