DBA Data[Home] [Help]

APPS.CN_PAYMENT_WORKSHEET_PVT dependencies on CN_PAYMENT_TRANSACTIONS

Line 225: -- cn_payment_transactions for PMTPLN_REC, COMMISSION and BONUS

221:
222: -- ===========================================================================
223: -- Procedure : reset_payrun_id
224: -- Description : This procedure is used to Reset payrun_id to NULL in
225: -- cn_payment_transactions for PMTPLN_REC, COMMISSION and BONUS
226: -- to be included in the next payrun.
227: -- Added for bug 2776847 by jjhuang.
228: -- Calls :
229: -- ===========================================================================

Line 241: UPDATE cn_payment_transactions ptrx

237: BEGIN
238: IF p_incentive_type = 'ALL'
239: OR p_incentive_type IS NULL
240: THEN
241: UPDATE cn_payment_transactions ptrx
242: SET payrun_id = NULL,
243: last_update_date = SYSDATE,
244: last_updated_by = g_last_updated_by,
245: last_update_login = g_last_update_login

Line 254: UPDATE cn_payment_transactions ptrx

250: FROM cn_quotas_all q
251: WHERE q.quota_id = ptrx.quota_id
252: AND q.payment_group_code = p_payment_group_code);
253: ELSE
254: UPDATE cn_payment_transactions ptrx
255: SET payrun_id = NULL,
256: last_update_date = SYSDATE,
257: last_updated_by = g_last_updated_by,
258: last_update_login = g_last_update_login

Line 491: -- 2/7/03 AC Bug 2792037 get list of PE from cn_payment_transactions

487: x_calc_rec_tbl IN OUT NOCOPY calc_rec_tbl_type,
488: --R12
489: p_org_id IN cn_payruns.org_id%TYPE
490: ) IS
491: -- 2/7/03 AC Bug 2792037 get list of PE from cn_payment_transactions
492: -- 2/12/03 AC Bug 2800968 union all to old cursor(against cn_srp_periods)
493: -- to take care srp with no transaction but want to apply pmt plan
494: -- Bug 3140343 : Payee Design.
495: -- Bug 3198445 by jjhuang: Added payment_group_code for cursor get_srp_pe

Line 502: FROM cn_payment_transactions cnpt,

498: SELECT DISTINCT v.quota_id,
499: v.payment_group_code
500: FROM (SELECT cnpt.quota_id,
501: cq.payment_group_code
502: FROM cn_payment_transactions cnpt,
503: cn_quotas_all cq
504: WHERE cnpt.credit_type_id = g_credit_type_id
505: AND cnpt.credited_salesrep_id = p_salesrep_id
506: AND cnpt.payrun_id = p_payrun_id

Line 552: FROM cn_payment_transactions cnpt,

548: CURSOR get_pgc_count IS
549: SELECT COUNT(DISTINCT v.payment_group_code) pgc_count
550: FROM (SELECT cnpt.quota_id,
551: cq.payment_group_code
552: FROM cn_payment_transactions cnpt,
553: cn_quotas_all cq
554: WHERE cnpt.credit_type_id = g_credit_type_id
555: AND cnpt.credited_salesrep_id = p_salesrep_id
556: AND cnpt.payrun_id = p_payrun_id

Line 605: FROM cn_payment_transactions cnpt

601: cnpt.quota_id quota_id,
602: 0 pmt_amount_recovery,
603: 0 pmt_amount_adj,
604: 0 held_amount
605: FROM cn_payment_transactions cnpt
606: WHERE cnpt.credited_salesrep_id = p_salesrep_id
607: AND cnpt.incentive_type_code = nvl(p_incentive_type, cnpt.incentive_type_code)
608: AND cnpt.incentive_type_code IN ('COMMISSION', 'BONUS')
609: AND cnpt.payrun_id = p_payrun_id

Line 622: FROM cn_payment_transactions cnpt

618: cnpt.quota_id quota_id,
619: nvl(SUM(nvl(cnpt.amount, 0)), 0) pmt_amount_recovery,
620: 0 pmt_amount_adj,
621: 0 held_amount
622: FROM cn_payment_transactions cnpt
623: WHERE cnpt.credited_salesrep_id = p_salesrep_id
624: AND cnpt.incentive_type_code = 'PMTPLN_REC'
625: AND cnpt.payrun_id = p_payrun_id
626: AND nvl(cnpt.quota_id, -9990) = nvl(p_quota_id, -9990)

Line 637: FROM cn_payment_transactions cnpt

633: cnpt.quota_id quota_id,
634: 0 pmt_amount_recovery,
635: nvl(SUM(nvl(cnpt.amount, 0)), 0) pmt_amount_adj,
636: 0 held_amount
637: FROM cn_payment_transactions cnpt
638: WHERE cnpt.credited_salesrep_id = p_salesrep_id
639: AND cnpt.incentive_type_code IN ('MANUAL_PAY_ADJ')
640: AND cnpt.payrun_id = p_payrun_id
641: AND nvl(cnpt.quota_id, -9990) = nvl(p_quota_id, -9990)

Line 652: FROM cn_payment_transactions cnpt

648: cnpt.quota_id quota_id,
649: 0 pmt_amount_recovery,
650: nvl(SUM(nvl(cnpt.payment_amount, 0)), 0) - nvl(SUM(nvl(cnpt.amount, 0)), 0) pmt_amount_adj,
651: 0 held_amount
652: FROM cn_payment_transactions cnpt
653: WHERE cnpt.credited_salesrep_id = p_salesrep_id
654: AND cnpt.incentive_type_code = nvl(p_incentive_type, cnpt.incentive_type_code)
655: AND cnpt.incentive_type_code IN ('COMMISSION', 'BONUS')
656: AND nvl(cnpt.hold_flag, 'N') = 'N'

Line 669: FROM cn_payment_transactions cnpt

665: cnpt.quota_id quota_id,
666: 0 pmt_amount_recovery,
667: 0 pmt_amount_adj,
668: nvl(SUM(nvl(cnpt.payment_amount, 0)), 0) held_amount
669: FROM cn_payment_transactions cnpt
670: WHERE cnpt.credited_salesrep_id = p_salesrep_id
671: AND cnpt.incentive_type_code = nvl(p_incentive_type, cnpt.incentive_type_code)
672: AND cnpt.incentive_type_code IN ('COMMISSION', 'BONUS')
673: AND nvl(cnpt.hold_flag, 'N') = 'Y'

Line 687: FROM cn_payment_transactions cnpt

683: cnpt.quota_id quota_id,
684: 0 pmt_amount_recovery,
685: -nvl(SUM(nvl(cnpt.amount, 0)), 0) pmt_amount_adj,
686: 0 held_amount
687: FROM cn_payment_transactions cnpt
688: WHERE cnpt.credited_salesrep_id = p_salesrep_id
689: AND cnpt.incentive_type_code = 'PMTPLN_REC'
690: AND nvl(cnpt.waive_flag, 'N') = 'Y'
691: AND cnpt.payrun_id = p_payrun_id

Line 902: FROM cn_payment_transactions cnpt,

898: p_org_id IN cn_payruns.org_id%TYPE
899: ) IS
900: CURSOR get_earnings_total(p_payment_group_code VARCHAR2) IS
901: SELECT SUM(cnpt.payment_amount) payment_amount
902: FROM cn_payment_transactions cnpt,
903: cn_quotas_all cnq
904: WHERE cnpt.credited_salesrep_id = p_salesrep_id
905: AND cnpt.payrun_id = p_payrun_id
906: AND cnpt.quota_id = cnq.quota_id

Line 1432: FROM cn_payment_transactions pmt

1428: AND org_id = p_worksheet_rec.org_id;
1429:
1430: CURSOR get_pmt_total(p_period_id NUMBER) IS
1431: SELECT nvl(SUM(nvl(amount, 0)), 0)
1432: FROM cn_payment_transactions pmt
1433: WHERE pmt.pay_period_id <= p_period_id
1434: AND pmt.credited_salesrep_id = p_worksheet_rec.salesrep_id
1435: AND pmt.credit_type_id = g_credit_type_id
1436: AND pmt.incentive_type_code IN ('COMMISSION', 'BONUS')

Line 1454: FROM cn_payment_transactions_all pmt

1450: AND posting_status = 'UNPOSTED'
1451: AND srp_payee_assign_id IS NULL
1452: -- posting_status not set to posted yet
1453: AND NOT EXISTS (SELECT NULL
1454: FROM cn_payment_transactions_all pmt
1455: WHERE pmt.credited_salesrep_id = ccl.credited_salesrep_id
1456: AND pmt.commission_line_id = ccl.commission_line_id
1457: AND pmt.credit_type_id = ccl.credit_type_id
1458: AND pmt.incentive_type_code IN ('COMMISSION', 'BONUS')

Line 1480: FROM cn_payment_transactions pmt

1476: AND cl.credit_type_id = g_credit_type_id
1477: AND cl.posting_status = 'UNPOSTED'
1478: AND cl.org_id = spayee.org_id
1479: AND cl.commission_line_id NOT IN (SELECT pmt.commission_line_id
1480: FROM cn_payment_transactions pmt
1481: WHERE pmt.credited_salesrep_id = p_worksheet_rec.salesrep_id
1482: AND pmt.credit_type_id = g_credit_type_id
1483: AND pmt.incentive_type_code IN ('COMMISSION', 'BONUS')
1484: AND pmt.payrun_id = p_worksheet_rec.payrun_id)

Line 1937: FROM cn_payment_transactions

1933: WHERE posting_status <> 'POSTED'
1934: AND status = 'CALC'
1935: AND srp_payee_assign_id IS NULL
1936: AND commission_line_id IN (SELECT commission_line_id
1937: FROM cn_payment_transactions
1938: WHERE posting_batch_id = cls_posting_batch_id
1939: AND commission_line_id IS NOT NULL);
1940: ELSE
1941: --payee

Line 1951: FROM cn_payment_transactions

1947: WHERE posting_status <> 'POSTED'
1948: AND status = 'CALC'
1949: AND srp_payee_assign_id IS NOT NULL
1950: AND commission_line_id IN (SELECT commission_line_id
1951: FROM cn_payment_transactions
1952: WHERE posting_batch_id = cls_posting_batch_id
1953: AND commission_line_id IS NOT NULL);
1954: END IF;
1955:

Line 2493: UPDATE cn_payment_transactions cnpt

2489: -- The following change was made by Sundar for bug fix 2772834
2490: -- This will handle scenarios where a salesrep has multiple role assignments
2491: -- during the same period, with an overlapping quota assignment
2492: -- changes records that have changed and not held
2493: UPDATE cn_payment_transactions cnpt
2494: SET ( amount, payment_amount) = (SELECT SUM(balance2_bbd - balance2_bbc + balance2_dtd - balance2_ctd),
2495: SUM(balance2_bbd - balance2_bbc + balance2_dtd - balance2_ctd)
2496: FROM cn_srp_periods csp
2497: WHERE csp.period_id = wksht_rec.pay_period_id

Line 2529: UPDATE cn_payment_transactions cnpt

2525: --R12
2526: AND cnpt.org_id = wksht_rec.org_id;
2527:
2528: -- for those records that have changed, dont update the payment amount
2529: UPDATE cn_payment_transactions cnpt
2530: SET amount = (SELECT SUM(balance2_bbd - balance2_bbc + balance2_dtd - balance2_ctd)
2531: FROM cn_srp_periods csp
2532: WHERE csp.period_id = wksht_rec.pay_period_id
2533: AND csp.salesrep_id = cnpt.credited_salesrep_id

Line 2565: INSERT INTO cn_payment_transactions

2561:
2562: -- Bug 2868584 :Add SUM and Group By clause
2563: -- handle scenarios where a salesrep has multiple role assignments
2564: -- during the same period, with an overlapping quota assignment
2565: INSERT INTO cn_payment_transactions
2566: (payment_transaction_id,
2567: posting_batch_id,
2568: incentive_type_code,
2569: credit_type_id,

Line 2585: SELECT cn_payment_transactions_s.NEXTVAL,

2581: created_by,
2582: creation_date,
2583: --R12
2584: org_id)
2585: SELECT cn_payment_transactions_s.NEXTVAL,
2586: l_posting_batch_id,
2587: v1.incentive_type_code,
2588: v1.credit_type_id,
2589: v1.period_id,

Line 2639: FROM cn_payment_transactions_all cnpt

2635: AND srp.org_id = s.org_id
2636: AND srp.org_id = r.org_id
2637: AND srp.org_id = wksht_rec.org_id
2638: AND NOT EXISTS (SELECT 'X'
2639: FROM cn_payment_transactions_all cnpt
2640: WHERE cnpt.payrun_id = wksht_rec.payrun_id
2641: AND cnpt.credited_salesrep_id = wksht_rec.salesrep_id
2642: AND cnpt.quota_id = q.quota_id
2643: AND cnpt.incentive_type_code IN ('COMMISSION', 'BONUS')

Line 2681: INSERT INTO cn_payment_transactions

2677: SELECT cn_posting_batches_s.NEXTVAL
2678: INTO carryover_posting_batch_id
2679: FROM dual;
2680:
2681: INSERT INTO cn_payment_transactions
2682: (payment_transaction_id,
2683: posting_batch_id,
2684: incentive_type_code,
2685: credit_type_id,

Line 2701: SELECT cn_payment_transactions_s.NEXTVAL,

2697: created_by,
2698: creation_date,
2699: --R12
2700: org_id)
2701: SELECT cn_payment_transactions_s.NEXTVAL,
2702: carryover_posting_batch_id,
2703: 'COMMISSION',
2704: srp.credit_type_id,
2705: srp.period_id,

Line 2738: FROM cn_payment_transactions cnpt

2734: AND srp.org_id = s.org_id
2735: AND srp.org_id = r.org_id
2736: AND srp.org_id = wksht_rec.org_id
2737: AND NOT EXISTS (SELECT 'X'
2738: FROM cn_payment_transactions cnpt
2739: WHERE cnpt.payrun_id = wksht_rec.payrun_id
2740: AND cnpt.credited_salesrep_id = wksht_rec.salesrep_id
2741: AND cnpt.quota_id = -1000
2742: -- 07/18/03 check exist only for commission/bonus

Line 2765: UPDATE cn_payment_transactions cnpt

2761: p_org_id => wksht_rec.org_id);
2762: END IF;
2763:
2764: -- 01/03/03 gasriniv added hold flag check for bug 2710066
2765: UPDATE cn_payment_transactions cnpt
2766: SET ( amount, payment_amount) = (SELECT cnpt.amount - SUM(cnptheld.amount),
2767: cnpt.payment_amount - SUM(cnptheld.amount)
2768: FROM cn_payment_transactions cnptheld
2769: WHERE cnptheld.payrun_id = wksht_rec.payrun_id

Line 2768: FROM cn_payment_transactions cnptheld

2764: -- 01/03/03 gasriniv added hold flag check for bug 2710066
2765: UPDATE cn_payment_transactions cnpt
2766: SET ( amount, payment_amount) = (SELECT cnpt.amount - SUM(cnptheld.amount),
2767: cnpt.payment_amount - SUM(cnptheld.amount)
2768: FROM cn_payment_transactions cnptheld
2769: WHERE cnptheld.payrun_id = wksht_rec.payrun_id
2770: AND cnptheld.credited_salesrep_id = wksht_rec.salesrep_id
2771: AND cnptheld.quota_id = cnpt.quota_id
2772: AND cnptheld.hold_flag = 'Y'

Line 2787: FROM cn_payment_transactions cnptchk

2783: AND incentive_type_code IN ('COMMISSION', 'BONUS')
2784: --R12
2785: AND cnpt.org_id = wksht_rec.org_id
2786: AND EXISTS (SELECT 'X'
2787: FROM cn_payment_transactions cnptchk
2788: WHERE cnptchk.payrun_id = wksht_rec.payrun_id
2789: AND cnptchk.credited_salesrep_id = wksht_rec.salesrep_id
2790: AND cnptchk.quota_id = cnpt.quota_id
2791: AND cnptchk.hold_flag = 'Y'

Line 2802: INSERT INTO cn_payment_transactions

2798: IF l_ispayee <> 1
2799: THEN
2800: -- IF PBT, then create all unposted lines
2801: -- Create new payment transactions for unposted payment transactions
2802: INSERT INTO cn_payment_transactions
2803: (payment_transaction_id,
2804: posting_batch_id,
2805: trx_type,
2806: payee_salesrep_id,

Line 2840: cn_payment_transactions_s.NEXTVAL,

2836: org_id,
2837: object_version_number,
2838: processed_date)
2839: SELECT
2840: cn_payment_transactions_s.NEXTVAL,
2841: l_posting_batch_id,
2842: cl.trx_type,
2843: cl.credited_salesrep_id,
2844: cl.role_id,

Line 2901: INSERT INTO cn_payment_transactions

2897: AND cl.org_id = wksht_rec.org_id;
2898:
2899: ELSE
2900: -- refresh record for Payee. Get unposted trx from comm_lines
2901: INSERT INTO cn_payment_transactions
2902: (payment_transaction_id,
2903: posting_batch_id,
2904: trx_type,
2905: payee_salesrep_id,

Line 2939: cn_payment_transactions_s.NEXTVAL,

2935: org_id,
2936: object_version_number,
2937: processed_date)
2938: SELECT
2939: cn_payment_transactions_s.NEXTVAL,
2940: l_posting_batch_id,
2941: cl.trx_type,
2942: spayee.payee_id,
2943: cl.role_id,

Line 3006: UPDATE cn_payment_transactions cnpt

3002: END IF;
3003: -- end IF l_ispayee <> 1 THEN
3004:
3005: -- update payrun id on all payment transactions
3006: UPDATE cn_payment_transactions cnpt
3007: SET payrun_id = wksht_rec.payrun_id,
3008: pay_element_type_id = (SELECT decode(l_payroll_flag, 'Y', p.pay_element_type_id, NULL) pay_element_type_id
3009: FROM cn_quota_pay_elements p
3010: WHERE p.quota_id = cnpt.quota_id

Line 3026: UPDATE cn_payment_transactions cnpt

3022: AND payrun_id IS NULL
3023: AND processed_date <= wksht_rec.pay_date;
3024:
3025: -- update pay_element_type_id
3026: UPDATE cn_payment_transactions cnpt
3027: SET pay_element_type_id = (SELECT decode(l_payroll_flag, 'Y', p.pay_element_type_id, NULL) pay_element_type_id
3028: FROM cn_quota_pay_elements p
3029: WHERE p.quota_id = decode(cnpt.incentive_type_code, 'PMTPLN_REC', -1001, cnpt.quota_id)
3030: AND wksht_rec.pay_date BETWEEN p.start_date AND p.end_date

Line 3061: UPDATE cn_payment_transactions cnpt

3057: THEN
3058: IF l_calc_rec_tbl(i).pmt_amount_adj_rec <> 0
3059: OR l_calc_rec_tbl(i).pmt_amount_adj_nrec <> 0
3060: THEN
3061: UPDATE cn_payment_transactions cnpt
3062: SET amount = l_calc_rec_tbl(i).pmt_amount_adj_rec + l_calc_rec_tbl(i).pmt_amount_adj_nrec,
3063: payment_amount = l_calc_rec_tbl(i).pmt_amount_adj_rec + l_calc_rec_tbl(i).pmt_amount_adj_nrec,
3064: pay_element_type_id = (SELECT decode(r.payroll_flag, NULL, NULL, 'N', NULL, 'Y', p.pay_element_type_id, NULL) pay_element_type_id
3065: FROM cn_quota_pay_elements p,

Line 3135: UPDATE cn_payment_transactions cnpt

3131: -- Create the Payment Plan Record
3132: cn_pmt_trans_pkg.insert_record(p_tran_rec => l_pmt_trans_rec);
3133: END IF;
3134: ELSE
3135: UPDATE cn_payment_transactions cnpt
3136: SET amount = 0,
3137: payment_amount = 0,
3138: pay_element_type_id = (SELECT decode(r.payroll_flag, NULL, NULL, 'N', NULL, 'Y', p.pay_element_type_id, NULL) pay_element_type_id
3139: FROM cn_quota_pay_elements p,

Line 3245: FROM cn_payment_transactions

3241: WHERE posting_status <> 'POSTED'
3242: AND status = 'CALC'
3243: AND srp_payee_assign_id IS NULL
3244: AND commission_line_id IN (SELECT commission_line_id
3245: FROM cn_payment_transactions
3246: WHERE posting_batch_id = l_posting_batch_id);
3247:
3248: ELSE
3249: -- payee

Line 3259: FROM cn_payment_transactions

3255: WHERE posting_status <> 'POSTED'
3256: AND status = 'CALC'
3257: AND srp_payee_assign_id IS NOT NULL
3258: AND commission_line_id IN (SELECT commission_line_id
3259: FROM cn_payment_transactions
3260: WHERE posting_batch_id = l_posting_batch_id);
3261: END IF;
3262: ELSE
3263:

Line 3585: UPDATE cn_payment_transactions

3581:
3582: --R12
3583: EXIT WHEN l_validation_only = 'Y';
3584:
3585: UPDATE cn_payment_transactions
3586: SET payrun_id = NULL,
3587: waive_flag = 'N',
3588: last_update_date = SYSDATE,
3589: last_updated_by = g_last_updated_by,

Line 3596: DELETE FROM cn_payment_transactions

3592: AND credited_salesrep_id = wksht.salesrep_id
3593: AND incentive_type_code = 'PMTPLN_REC';
3594:
3595: -- Bug 2760379 : Do not reset cn_commission_lines
3596: DELETE FROM cn_payment_transactions
3597: WHERE incentive_type_code IN ('PMTPLN', 'MANUAL_PAY_ADJ')
3598: AND payrun_id = wksht.payrun_id
3599: AND credited_salesrep_id = wksht.salesrep_id;
3600:

Line 3604: -- Bug 2760379 : Do not delete from cn_payment_transactions,

3600:
3601: -- Bug 2715543
3602: IF wksht.payrun_mode = 'Y'
3603: THEN
3604: -- Bug 2760379 : Do not delete from cn_payment_transactions,
3605: -- just set the payrun_id to null
3606: -- 3. Set payrun_id to null for remaining tr
3607: -- Bug 2795606 : reset paymnet_amount when delete wkshtx
3608: UPDATE cn_payment_transactions

Line 3608: UPDATE cn_payment_transactions

3604: -- Bug 2760379 : Do not delete from cn_payment_transactions,
3605: -- just set the payrun_id to null
3606: -- 3. Set payrun_id to null for remaining tr
3607: -- Bug 2795606 : reset paymnet_amount when delete wkshtx
3608: UPDATE cn_payment_transactions
3609: SET payrun_id = NULL,
3610: payment_amount = amount,
3611: last_update_date = SYSDATE,
3612: last_updated_by = g_last_updated_by,

Line 3618: -- Delete cn_payment_transactions for Pay by Summary

3614: WHERE payrun_id = wksht.payrun_id
3615: AND credited_salesrep_id = wksht.salesrep_id
3616: AND commission_line_id IS NOT NULL;
3617: ELSE
3618: -- Delete cn_payment_transactions for Pay by Summary
3619: DELETE FROM cn_payment_transactions
3620: WHERE payrun_id = wksht.payrun_id
3621: AND credited_salesrep_id = wksht.salesrep_id
3622: AND nvl(hold_flag, 'N') = 'N';

Line 3619: DELETE FROM cn_payment_transactions

3615: AND credited_salesrep_id = wksht.salesrep_id
3616: AND commission_line_id IS NOT NULL;
3617: ELSE
3618: -- Delete cn_payment_transactions for Pay by Summary
3619: DELETE FROM cn_payment_transactions
3620: WHERE payrun_id = wksht.payrun_id
3621: AND credited_salesrep_id = wksht.salesrep_id
3622: AND nvl(hold_flag, 'N') = 'N';
3623:

Line 3624: UPDATE cn_payment_transactions

3620: WHERE payrun_id = wksht.payrun_id
3621: AND credited_salesrep_id = wksht.salesrep_id
3622: AND nvl(hold_flag, 'N') = 'N';
3623:
3624: UPDATE cn_payment_transactions
3625: SET payrun_id = '',
3626: last_update_date = SYSDATE,
3627: last_updated_by = g_last_updated_by,
3628: last_update_login = g_last_update_login

Line 3637: FROM cn_payment_transactions cnpd

3633:
3634: -- Delete the Posting Batches
3635: DELETE FROM cn_posting_batches cnpb
3636: WHERE cnpb.posting_batch_id IN (SELECT cnpd.posting_batch_id
3637: FROM cn_payment_transactions cnpd
3638: WHERE cnpd.payrun_id = wksht.payrun_id
3639: AND cnpd.credited_salesrep_id = wksht.salesrep_id
3640: AND nvl(cnpd.hold_flag, 'N') = 'N');
3641:

Line 3828: FROM cn_payment_transactions cnpt

3824: -- commented the code for Bug Fix 2849715
3825: /* BEGIN
3826: SELECT SUM(nvl(amount,0))
3827: INTO l_held_amount_prior
3828: FROM cn_payment_transactions cnpt
3829: WHERE cnpt.quota_id IS NOT NULL
3830: AND cnpt.credited_salesrep_id = l_wksht_rec.salesrep_id
3831: AND cnpt.pay_period_id < l_wksht_rec.pay_period_id
3832: AND cnpt.credit_type_id = G_credit_type_id