287: * decode(nvl(ps.amount_adjusted_pending,0), 0, 1,
288: decode(v_bucket_category,
289: 'PENDADJ_ONLY', 0, 'DISPUTE_PENDADJ', 0,
290: 1))) b6
291: from ra_cust_trx_types,
292: ar_payment_schedules ps
293: where ps.gl_date <= p_as_of_date
294: and ps.cust_trx_type_id = ra_cust_trx_types.cust_trx_type_id
295: and ps.gl_date_closed > p_as_of_date
290: 1))) b6
291: from ra_cust_trx_types,
292: ar_payment_schedules ps
293: where ps.gl_date <= p_as_of_date
294: and ps.cust_trx_type_id = ra_cust_trx_types.cust_trx_type_id
295: and ps.gl_date_closed > p_as_of_date
296: and ps.customer_id = p_customer_id
297: and decode(p_customer_site_use_id,
298: NULL, ps.customer_site_use_id,
306: and decode(upper(p_credit_option),
307: 'AGE', 'dummy',
308: 'PMT') <> ps.class
309: and decode(p_invoice_type_low,
310: NULL, ra_cust_trx_types.name,
311: p_invoice_type_low) <= ra_cust_trx_types.name
312: and decode(p_invoice_type_high,
313: NULL, ra_cust_trx_types.name,
314: p_invoice_type_high) >= ra_cust_trx_types.name
307: 'AGE', 'dummy',
308: 'PMT') <> ps.class
309: and decode(p_invoice_type_low,
310: NULL, ra_cust_trx_types.name,
311: p_invoice_type_low) <= ra_cust_trx_types.name
312: and decode(p_invoice_type_high,
313: NULL, ra_cust_trx_types.name,
314: p_invoice_type_high) >= ra_cust_trx_types.name
315: UNION ALL
309: and decode(p_invoice_type_low,
310: NULL, ra_cust_trx_types.name,
311: p_invoice_type_low) <= ra_cust_trx_types.name
312: and decode(p_invoice_type_high,
313: NULL, ra_cust_trx_types.name,
314: p_invoice_type_high) >= ra_cust_trx_types.name
315: UNION ALL
316: select -sum(decode(p_currency_code, NULL, app.acctd_amount_applied_from,
317: app.amount_applied)),
310: NULL, ra_cust_trx_types.name,
311: p_invoice_type_low) <= ra_cust_trx_types.name
312: and decode(p_invoice_type_high,
313: NULL, ra_cust_trx_types.name,
314: p_invoice_type_high) >= ra_cust_trx_types.name
315: UNION ALL
316: select -sum(decode(p_currency_code, NULL, app.acctd_amount_applied_from,
317: app.amount_applied)),
318: decode(v_bucket_line_type_0,