The following lines contain the word 'select', 'insert', 'update' or 'delete':
Select adj.customer_trx_id cust_trx_id,
adj.customer_trx_line_id cust_trx_line_id,
ard.code_combination_id adj_ccid,
adj.amount adj_amount,
adj.type adj_type
From ar_adjustments adj,
ar_distributions ard
Where adj.adjustment_id = g_adjustment_id
and adj.adjustment_id = ard.source_id
and ard.source_table = 'ADJ'
and ard.source_type IN ('ADJ', 'FINCHRG');
Select B.mf_receivables_ccid mf_rec_ccid,
C.mf_adjustment_ccid mf_adj_ccid,
C.prev_mf_adjustment_ccid prev_mf_adj_ccid,
C.prev_cust_trx_line_id prev_cust_trx_line_id
From ra_cust_trx_line_gl_dist A,
psa_mf_trx_dist_all B,
psa_mf_adj_dist_all C
Where C.adjustment_id = g_adjustment_id
And A.customer_trx_id = g_customer_trx_id
And A.CUST_TRX_LINE_GL_DIST_ID = B.CUST_TRX_LINE_GL_DIST_ID
And B.cust_trx_line_gl_dist_id = C.cust_trx_line_gl_dist_id
FOR UPDATE;
DELETE FROM psa_mf_adj_dist_all
WHERE adjustment_id = g_adjustment_id;
psa_utils.debug_other_string(g_state_level,l_full_path, ' DELETE FROM psa_mf_adj_dist_all --> ' || SQL%ROWCOUNT);
PSA_MFAR_UTILS.INSERT_DISTRIBUTIONS_LOG (g_run_id, 'ADJUSTMENT', g_customer_trx_id, g_adjustment_id, l_exception_error);
PSA_MFAR_UTILS.INSERT_DISTRIBUTIONS_LOG (g_run_id, 'ADJUSTMENT', g_customer_trx_id, g_adjustment_id, l_exception_error);
PSA_MFAR_UTILS.INSERT_DISTRIBUTIONS_LOG (g_run_id, 'ADJUSTMENT', g_customer_trx_id, g_adjustment_id, l_exception_error);
Select A.customer_trx_line_id cust_trx_line_id,
A.line_type line_type,
B.cust_trx_line_gl_dist_id cust_trx_line_gl_dist_id,
C.mf_receivables_ccid mf_rec_ccid,
b.code_combination_id code_combination_id,
decode (c_sum_adr,
0, D.amount_due_original,
D.amount_due_remaining) amount_due,
B.percent -- panatara
From ra_customer_trx_lines A,
ra_cust_trx_line_gl_dist B,
psa_mf_trx_dist_all C,
psa_mf_balances_view D
Where A.customer_trx_id = g_customer_trx_id
and A.customer_trx_line_id = B.customer_trx_line_id
and B.account_class <> 'REC'
and B.cust_trx_line_gl_dist_id = C.cust_trx_line_gl_dist_id
and C.cust_trx_line_gl_dist_id = D.cust_trx_line_gl_dist_id
and B.customer_trx_line_id = DECODE(g_adj_type,
'LINE', nvl(l_customer_trx_line_id, B.customer_trx_line_id),
B.customer_trx_line_id);
SELECT gl_account_source
FROM ar_receivables_trx r, ar_adjustments a
WHERE r.receivables_trx_id = a.receivables_trx_id
AND a.adjustment_id = g_adjustment_id;
Select decode (sum(mf_balances.amount_due_remaining), 0, sum(mf_balances.amount_due_original),
sum(mf_balances.amount_due_remaining)) total_amount_due,
sum(mf_balances.amount_due_remaining) sum_amt_due_rem
Into l_total_amount_due, sum_amt_due_rem
From ra_customer_trx_lines trx_lines,
ra_cust_trx_line_gl_dist trx_dist,
psa_mf_balances_view mf_balances
Where trx_lines.customer_trx_id = g_customer_trx_id
And trx_lines.customer_trx_line_id = trx_dist.customer_trx_line_id
And trx_dist.cust_trx_line_gl_dist_id = mf_balances.cust_trx_line_gl_dist_id
And trx_lines.customer_trx_line_id = nvl(g_cust_trx_line_id, trx_dist.customer_trx_line_id)
And trx_lines.line_type = decode(g_adj_type, 'LINE', 'LINE',
'TAX', FIND_TAX_FREIGHT_LINES('TAX', trx_lines.line_type),
'FREIGHT', FIND_TAX_FREIGHT_LINES('FREIGHT', trx_lines.line_type),
'INVOICE', trx_lines.line_type, trx_lines.line_type);
-- Select the customer_trx_line_id if adjustment type is LINE
IF (g_adj_type = 'LINE') THEN
SELECT customer_trx_line_id INTO l_customer_trx_line_id
FROM ar_adjustments
WHERE adjustment_id = g_adjustment_id;
SELECT count(*) INTO l_distr_line_count
FROM ra_customer_trx_lines A,
ra_cust_trx_line_gl_dist B,
psa_mf_trx_dist_all C,
psa_mf_balances_view D
WHERE A.customer_trx_id = g_customer_trx_id
and A.customer_trx_line_id = B.customer_trx_line_id
and B.account_class <> 'REC'
and B.cust_trx_line_gl_dist_id = C.cust_trx_line_gl_dist_id
and C.cust_trx_line_gl_dist_id = D.cust_trx_line_gl_dist_id;
Select DECODE(g_adj_type, 'LINE', 'LINE',
'TAX', FIND_TAX_FREIGHT_LINES('TAX', ccid_info(i).line_type),
'FREIGHT', FIND_TAX_FREIGHT_LINES('FREIGHT', ccid_info(i).line_type),
'INVOICE', ccid_info(i).line_type, ccid_info(i).line_type)
Into l_temp_adj_type From Dual;
-- Insert into psa_mf_adj_dist_all
--
-- ========================= FND LOG ===========================
psa_utils.debug_other_string(g_state_level,l_full_path, ' Calling PSA_MF_ADJ_DIST_ALL_PKG.INSERT_ROW ');
PSA_MF_ADJ_DIST_ALL_PKG.INSERT_ROW
( X_ROWID => l_row_id,
X_ADJUSTMENT_ID => g_adjustment_id,
X_CUST_TRX_LINE_GL_DIST_ID => ccid_info(i).cust_trx_line_gl_dist_id,
X_MF_ADJUSTMENT_CCID => p_ccid,
X_AMOUNT => l_amount,
X_PERCENT => l_percent,
X_PREV_CUST_TRX_LINE_ID => g_cust_trx_line_id,
X_PREV_MF_ADJUSTMENT_CCID => p_ccid,
X_POSTING_CONTROL_ID => -3,
X_MODE => 'R' );
psa_utils.debug_other_string(g_state_level,l_full_path, ' Calling PSA_MF_ADJ_DIST_ALL_PKG.INSERT_ROW --> ' || SQL%ROWCOUNT);
PSA_MFAR_UTILS.INSERT_DISTRIBUTIONS_LOG (g_run_id, 'ADJUSTMENT', g_customer_trx_id, g_adjustment_id, l_exception_error);
PSA_MFAR_UTILS.INSERT_DISTRIBUTIONS_LOG (g_run_id, 'ADJUSTMENT', g_customer_trx_id, g_adjustment_id, l_exception_error);
SELECT line_type
FROM ra_customer_trx_lines
WHERE line_type = p_adjustment_type
AND rownum = 1;