Вы находитесь на странице: 1из 2

ALL Customers running this script should be advised of the following:

a.
This is a data fix and as all systems are different it is possible that
it may have an adverse affect on your system. Support has researched
your data and feel that this is the best course of action. However, it
is strongly recommended that this first be done on a copy of production
to be sure it has the desired affect and does not cause other issues.
b.

This datafix was provided by support to resolve a specific issue support

has identified. This script should not be used or re-used without specific
instructions from support.
c.
Do not run any of the following accounting processes until the datafix i
s complete:
Do not run the Payables Accounting Process
Do not run the Payables Transfer to General Ledger
Do not use the Create Online Accounting function
d.
If this datafix deletes or updates accounting lines from AP that have be
en transferred
and posted in GL, a manual JE will need to be created in GL to account for this.
Also, drilldown from GL to AP will no longer work for these entries.
e.
All backup tables created by the scripts below should be retained at lea
st
through the next closing cycle, until AP and GL are fully reconciled.
********** IMPORTANT **********
1. Backup the check row we are going to update
create table SR_39632646571_aca as
select *
from ap_checks_all
where check_id in (
select e.source_id + 1
from ap_accounting_events_all e
where e.event_type_code = 'PAYMENT'
and e.event_status_code in ('CREATED', 'INCOMPLETE')
and not exists (
select c.check_id
from ap_checks_all c
where c.check_id = e.source_id)
and exists (
select p.check_id
from ap_invoice_payments_all p
where p.accounting_event_id = e.accounting_event_id)
and exists (
select c1.check_id
from ap_checks_all c1
where c1.check_id = e.source_id + 1
and status_lookup_code in ('NEGOTIABLE','ISSUED'))
and not exists (
select p1.check_id
from ap_invoice_payments_all p1
where p1.check_id = e.source_id + 1));

create table SR_39632646571_AAEA


as select * from ap_accounting_events_all
where source_id in (select check_id from SR_39632646571_aca)
and event_type_code = 'PAYMENT CLEARING';
create table SR_39632646571_APHA
as select * from ap_payment_history_all
where check_id in (select check_id from SR_39632646571_aca);
2. Verify the number of rows in each table
select count(*) from SR_39632646571_aca;
select count(*) from SR_39632646571_AAEA;
select count(*) from SR_39632646571_APHA;
Please note that it is acceptable for one of the above queries to return 0 rows.
Return of 0 rows means the associated updates below will not effect any rows.
3. Update the check_id
update ap_checks_all c
set check_id = check_id - 1
, c.amount = (select sum(p.amount)
from ap_invoice_payments_all p
where p.check_id = c.check_id - 1
and p.REVERSAL_INV_PMT_ID is null
group by p.check_id)
where check_id in (
select a.check_id
from SR_39632646571_aca a);
-- this should update the same number of rows as the first query in step 2
update ap_accounting_events_all
set source_id = source_id - 1
where accounting_event_id in (
select a.accounting_event_id
from SR_39632646571_AAEA a);
-- this should update the same number of rows as the second query in step 2
update ap_payment_history_all
set check_id = check_id - 1
where check_id in (
select a.check_id
from SR_39632646571_APHA a);
-- this should update the same number of rows as the third query in step 2
4. Save your work
commit;

Вам также может понравиться