368: l_temp_start := p_start_date;
369: end if;
370:
371: IF p_party_id IS NOT NULL THEN
372: SELECT SUM(arpcurr.functional_amount(
373: ps.amount_due_original,
374: g_base_currency_code,
375: nvl(ps.exchange_rate,1),
376: g_base_precision,
384: AND ps.gl_date BETWEEN l_temp_start AND p_end_date
385: AND ps.customer_id = ca.cust_account_id
386: AND ca.party_id = p_party_id;
387: ELSIF p_cust_account_id IS NOT NULL THEN
388: SELECT SUM(arpcurr.functional_amount(
389: ps.amount_due_original,
390: g_base_currency_code,
391: nvl(ps.exchange_rate,1),
392: g_base_precision,
398: AND ps.payment_schedule_id <> -1
399: AND ps.gl_date BETWEEN l_temp_start AND p_end_date
400: AND ps.customer_id = p_cust_account_id;
401: ELSIF p_customer_site_use_id IS NOT NULL THEN
402: SELECT SUM(arpcurr.functional_amount(
403: ps.amount_due_original,
404: g_base_currency_code,
405: nvl(ps.exchange_rate,1),
406: g_base_precision,