-- =============================================================================================
-- Trx_Number || Customer_trx_id | Payment_Schedule_id | Receivable_application_id | Type |
-- =============================================================================================
-- 747693(A) || 2615786 | 1618821 | 2512596 | CM |
-- 747719(B) || 2615899 | 1618822 | 2512597 | CM |
-- 747584(B) || 2615657 | 1618397 | | INV |
-- 747561(A) || 2615629 | 1618365 | | INV |
-- =============================================================================================
-- Step1: Datafix AR invoice line
update ar.ra_customer_trx_lines_all
set extended_amount=-1010.26,
revenue_amount=-1010.26
where customer_trx_id=2615899
and line_type='LINE';
update ar.ra_customer_trx_lines_all
set extended_amount=-4117.95,
revenue_amount=-4117.95
where customer_trx_id=2615786
and line_type='LINE';
-- Step2: Datafix AR invoice distribution line
alter trigger RA_CUST_TRX_LINE_GL_DIST_BRI disable;
update ar.ra_cust_trx_line_gl_dist_all
set amount=-4818,
acctd_amount=-4818
where cust_trx_line_gl_dist_id=8149393
update ar.ra_cust_trx_line_gl_dist_all
set amount=-4117.95,
acctd_amount=-4117.95
where cust_trx_line_gl_dist_id=8149395
update ar.ra_cust_trx_line_gl_dist_all
set amount=-1182,
acctd_amount=-1182
where cust_trx_line_gl_dist_id=8149709
update ar.ra_cust_trx_line_gl_dist_all
set amount=-1010.26,
acctd_amount=-1010.26
where cust_trx_line_gl_dist_id=8149711
alter trigger RA_CUST_TRX_LINE_GL_DIST_BRI enable;
-- Step3: Datafix AR Balance
update ar.ar_payment_schedules_all
set amount_credited=amount_credited+700.05,
amount_due_remaining=amount_due_remaining+700.05
where customer_trx_id=2615629
update ar.ar_payment_schedules_all
set amount_credited=amount_credited+171.74,
amount_due_remaining=amount_due_remaining+171.74
where customer_trx_id=2615657
update ar.ar_payment_schedules_all
set amount_due_original=amount_due_original+700.05,
amount_line_items_original=amount_line_items_original+700.05,
amount_applied=amount_applied+700.05
where customer_trx_id=2615786
and payment_schedule_id =1618821
update ar.ar_payment_schedules_all
set amount_due_original=amount_due_original+171.74,
amount_line_items_original=amount_line_items_original+171.74,
amount_applied=amount_applied+171.74
where customer_trx_id=2615899
and payment_schedule_id =1618822
-- Step4: Datafix AR Application
update ar.ar_receivable_applications_all
set ammount_applied=ammount_applied-700.05,
line_applied=line_applied-700.05,
acctd_amount_applied_from=acctd_amount_applied_from-700.05,
acctd_amount_applied_to=acctd_amount_applied_to-700.05
where receivable_application_id=2512596
and customer_trx_id=2615786
update ar.ar_receivable_applications_all
set ammount_applied=ammount_applied-700.05,
line_applied=line_applied-171.74,
acctd_amount_applied_from=acctd_amount_applied_from-171.74,
acctd_amount_applied_to=acctd_amount_applied_to-171.74
where receivable_application_id=2512597
and customer_trx_id=2615899
-- Step5: to adjust the difference posted between receivable account and revenue account
DR
81.CN.000.13110.0000 700.05
CR
81.GZ.501.51599.P024 700.05
DR
81.CN.000.13110.0000 171.74
CR
81.GZ.501.51599.P024 171.74
阅读(1386) | 评论(0) | 转发(0) |