DBA Data[Home] [Help]

APPS.CN_PAYMENT_WORKSHEET_PVT dependencies on CN_PAYMENT_TRANSACTIONS

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

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

Line 243: UPDATE cn_payment_transactions ptrx

239: BEGIN
240: IF p_incentive_type = 'ALL'
241: OR p_incentive_type IS NULL
242: THEN
243: UPDATE cn_payment_transactions ptrx
244: SET payrun_id = NULL,
245: last_update_date = SYSDATE,
246: last_updated_by = fnd_global.user_id,
247: last_update_login = fnd_global.login_id

Line 256: UPDATE cn_payment_transactions ptrx

252: FROM cn_quotas_all q
253: WHERE q.quota_id = ptrx.quota_id
254: AND q.payment_group_code = p_payment_group_code);
255: ELSE
256: UPDATE cn_payment_transactions ptrx
257: SET payrun_id = NULL,
258: last_update_date = SYSDATE,
259: last_updated_by = fnd_global.user_id,
260: last_update_login = fnd_global.login_id

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

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

Line 504: FROM cn_payment_transactions cnpt,

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

Line 554: FROM cn_payment_transactions cnpt,

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

Line 607: FROM cn_payment_transactions cnpt

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

Line 624: FROM cn_payment_transactions cnpt

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

Line 639: FROM cn_payment_transactions cnpt

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

Line 654: FROM cn_payment_transactions cnpt

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

Line 671: FROM cn_payment_transactions cnpt

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

Line 689: FROM cn_payment_transactions cnpt

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

Line 904: FROM cn_payment_transactions cnpt,

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

Line 1434: FROM cn_payment_transactions pmt

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

Line 1456: FROM cn_payment_transactions_all pmt

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

Line 1482: FROM cn_payment_transactions pmt

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

Line 1939: FROM cn_payment_transactions

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

Line 1953: FROM cn_payment_transactions

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

Line 2539: UPDATE cn_payment_transactions cnpt

2535: -- The following change was made by Sundar for bug fix 2772834
2536: -- This will handle scenarios where a salesrep has multiple role assignments
2537: -- during the same period, with an overlapping quota assignment
2538: -- changes records that have changed and not held
2539: UPDATE cn_payment_transactions cnpt
2540: SET ( amount, payment_amount) = (SELECT SUM(balance2_bbd - balance2_bbc + balance2_dtd - balance2_ctd),
2541: SUM(balance2_bbd - balance2_bbc + balance2_dtd - balance2_ctd)
2542: FROM cn_srp_periods csp
2543: WHERE csp.period_id = wksht_rec.pay_period_id

Line 2575: UPDATE cn_payment_transactions cnpt

2571: --R12
2572: AND cnpt.org_id = wksht_rec.org_id;
2573:
2574: -- for those records that have changed, dont update the payment amount
2575: UPDATE cn_payment_transactions cnpt
2576: SET amount = (SELECT SUM(balance2_bbd - balance2_bbc + balance2_dtd - balance2_ctd)
2577: FROM cn_srp_periods csp
2578: WHERE csp.period_id = wksht_rec.pay_period_id
2579: AND csp.salesrep_id = cnpt.credited_salesrep_id

Line 2611: INSERT INTO cn_payment_transactions

2607:
2608: -- Bug 2868584 :Add SUM and Group By clause
2609: -- handle scenarios where a salesrep has multiple role assignments
2610: -- during the same period, with an overlapping quota assignment
2611: INSERT INTO cn_payment_transactions
2612: (payment_transaction_id,
2613: posting_batch_id,
2614: incentive_type_code,
2615: credit_type_id,

Line 2631: SELECT cn_payment_transactions_s.NEXTVAL,

2627: created_by,
2628: creation_date,
2629: --R12
2630: org_id)
2631: SELECT cn_payment_transactions_s.NEXTVAL,
2632: l_posting_batch_id,
2633: v1.incentive_type_code,
2634: v1.credit_type_id,
2635: v1.period_id,

Line 2685: FROM cn_payment_transactions_all cnpt

2681: AND srp.org_id = s.org_id
2682: AND srp.org_id = r.org_id
2683: AND srp.org_id = wksht_rec.org_id
2684: AND NOT EXISTS (SELECT 'X'
2685: FROM cn_payment_transactions_all cnpt
2686: WHERE cnpt.payrun_id = wksht_rec.payrun_id
2687: AND cnpt.credited_salesrep_id = wksht_rec.salesrep_id
2688: AND cnpt.quota_id = q.quota_id
2689: AND cnpt.incentive_type_code IN ('COMMISSION', 'BONUS')

Line 2727: INSERT INTO cn_payment_transactions

2723: SELECT cn_posting_batches_s.NEXTVAL
2724: INTO carryover_posting_batch_id
2725: FROM dual;
2726:
2727: INSERT INTO cn_payment_transactions
2728: (payment_transaction_id,
2729: posting_batch_id,
2730: incentive_type_code,
2731: credit_type_id,

Line 2747: SELECT cn_payment_transactions_s.NEXTVAL,

2743: created_by,
2744: creation_date,
2745: --R12
2746: org_id)
2747: SELECT cn_payment_transactions_s.NEXTVAL,
2748: carryover_posting_batch_id,
2749: 'COMMISSION',
2750: srp.credit_type_id,
2751: srp.period_id,

Line 2784: FROM cn_payment_transactions cnpt

2780: AND srp.org_id = s.org_id
2781: AND srp.org_id = r.org_id
2782: AND srp.org_id = wksht_rec.org_id
2783: AND NOT EXISTS (SELECT 'X'
2784: FROM cn_payment_transactions cnpt
2785: WHERE cnpt.payrun_id = wksht_rec.payrun_id
2786: AND cnpt.credited_salesrep_id = wksht_rec.salesrep_id
2787: AND cnpt.quota_id = -1000
2788: -- 07/18/03 check exist only for commission/bonus

Line 2811: UPDATE cn_payment_transactions cnpt

2807: p_org_id => wksht_rec.org_id);
2808: END IF;
2809:
2810: -- 01/03/03 gasriniv added hold flag check for bug 2710066
2811: UPDATE cn_payment_transactions cnpt
2812: SET ( amount, payment_amount) = (SELECT cnpt.amount - SUM(cnptheld.amount),
2813: cnpt.payment_amount - SUM(cnptheld.amount)
2814: FROM cn_payment_transactions cnptheld
2815: WHERE cnptheld.payrun_id = wksht_rec.payrun_id

Line 2814: FROM cn_payment_transactions cnptheld

2810: -- 01/03/03 gasriniv added hold flag check for bug 2710066
2811: UPDATE cn_payment_transactions cnpt
2812: SET ( amount, payment_amount) = (SELECT cnpt.amount - SUM(cnptheld.amount),
2813: cnpt.payment_amount - SUM(cnptheld.amount)
2814: FROM cn_payment_transactions cnptheld
2815: WHERE cnptheld.payrun_id = wksht_rec.payrun_id
2816: AND cnptheld.credited_salesrep_id = wksht_rec.salesrep_id
2817: AND cnptheld.quota_id = cnpt.quota_id
2818: AND cnptheld.hold_flag = 'Y'

Line 2833: FROM cn_payment_transactions cnptchk

2829: AND incentive_type_code IN ('COMMISSION', 'BONUS')
2830: --R12
2831: AND cnpt.org_id = wksht_rec.org_id
2832: AND EXISTS (SELECT 'X'
2833: FROM cn_payment_transactions cnptchk
2834: WHERE cnptchk.payrun_id = wksht_rec.payrun_id
2835: AND cnptchk.credited_salesrep_id = wksht_rec.salesrep_id
2836: AND cnptchk.quota_id = cnpt.quota_id
2837: AND cnptchk.hold_flag = 'Y'

Line 2848: INSERT INTO cn_payment_transactions

2844: IF l_ispayee <> 1
2845: THEN
2846: -- IF PBT, then create all unposted lines
2847: -- Create new payment transactions for unposted payment transactions
2848: INSERT INTO cn_payment_transactions
2849: (payment_transaction_id,
2850: posting_batch_id,
2851: trx_type,
2852: payee_salesrep_id,

Line 2886: cn_payment_transactions_s.NEXTVAL,

2882: org_id,
2883: object_version_number,
2884: processed_date)
2885: SELECT
2886: cn_payment_transactions_s.NEXTVAL,
2887: l_posting_batch_id,
2888: cl.trx_type,
2889: cl.credited_salesrep_id,
2890: cl.role_id,

Line 2947: INSERT INTO cn_payment_transactions

2943: AND cl.org_id = wksht_rec.org_id;
2944:
2945: ELSE
2946: -- refresh record for Payee. Get unposted trx from comm_lines
2947: INSERT INTO cn_payment_transactions
2948: (payment_transaction_id,
2949: posting_batch_id,
2950: trx_type,
2951: payee_salesrep_id,

Line 2985: cn_payment_transactions_s.NEXTVAL,

2981: org_id,
2982: object_version_number,
2983: processed_date)
2984: SELECT
2985: cn_payment_transactions_s.NEXTVAL,
2986: l_posting_batch_id,
2987: cl.trx_type,
2988: spayee.payee_id,
2989: cl.role_id,

Line 3052: UPDATE cn_payment_transactions cnpt

3048: END IF;
3049: -- end IF l_ispayee <> 1 THEN
3050:
3051: -- update payrun id on all payment transactions
3052: UPDATE cn_payment_transactions cnpt
3053: SET payrun_id = wksht_rec.payrun_id,
3054: pay_element_type_id = (SELECT decode(l_payroll_flag, 'Y', p.pay_element_type_id, NULL) pay_element_type_id
3055: FROM cn_quota_pay_elements p
3056: WHERE p.quota_id = cnpt.quota_id

Line 3072: UPDATE cn_payment_transactions cnpt

3068: AND payrun_id IS NULL
3069: AND processed_date <= wksht_rec.pay_date;
3070:
3071: -- update pay_element_type_id
3072: UPDATE cn_payment_transactions cnpt
3073: SET pay_element_type_id = (SELECT decode(l_payroll_flag, 'Y', p.pay_element_type_id, NULL) pay_element_type_id
3074: FROM cn_quota_pay_elements p
3075: WHERE p.quota_id = decode(cnpt.incentive_type_code, 'PMTPLN_REC', -1001, cnpt.quota_id)
3076: AND wksht_rec.pay_date BETWEEN p.start_date AND p.end_date

Line 3107: UPDATE cn_payment_transactions cnpt

3103: THEN
3104: IF l_calc_rec_tbl(i).pmt_amount_adj_rec <> 0
3105: OR l_calc_rec_tbl(i).pmt_amount_adj_nrec <> 0
3106: THEN
3107: UPDATE cn_payment_transactions cnpt
3108: SET amount = l_calc_rec_tbl(i).pmt_amount_adj_rec + l_calc_rec_tbl(i).pmt_amount_adj_nrec,
3109: payment_amount = l_calc_rec_tbl(i).pmt_amount_adj_rec + l_calc_rec_tbl(i).pmt_amount_adj_nrec,
3110: pay_element_type_id = (SELECT decode(r.payroll_flag, NULL, NULL, 'N', NULL, 'Y', p.pay_element_type_id, NULL) pay_element_type_id
3111: FROM cn_quota_pay_elements p,

Line 3181: UPDATE cn_payment_transactions cnpt

3177: -- Create the Payment Plan Record
3178: cn_pmt_trans_pkg.insert_record(p_tran_rec => l_pmt_trans_rec);
3179: END IF;
3180: ELSE
3181: UPDATE cn_payment_transactions cnpt
3182: SET amount = 0,
3183: payment_amount = 0,
3184: pay_element_type_id = (SELECT decode(r.payroll_flag, NULL, NULL, 'N', NULL, 'Y', p.pay_element_type_id, NULL) pay_element_type_id
3185: FROM cn_quota_pay_elements p,

Line 3291: FROM cn_payment_transactions

3287: WHERE posting_status <> 'POSTED'
3288: AND status = 'CALC'
3289: AND srp_payee_assign_id IS NULL
3290: AND commission_line_id IN (SELECT commission_line_id
3291: FROM cn_payment_transactions
3292: WHERE posting_batch_id = l_posting_batch_id);
3293:
3294: ELSE
3295: -- payee

Line 3305: FROM cn_payment_transactions

3301: WHERE posting_status <> 'POSTED'
3302: AND status = 'CALC'
3303: AND srp_payee_assign_id IS NOT NULL
3304: AND commission_line_id IN (SELECT commission_line_id
3305: FROM cn_payment_transactions
3306: WHERE posting_batch_id = l_posting_batch_id);
3307: END IF;
3308: ELSE
3309:

Line 3631: UPDATE cn_payment_transactions

3627:
3628: --R12
3629: EXIT WHEN l_validation_only = 'Y';
3630:
3631: UPDATE cn_payment_transactions
3632: SET payrun_id = NULL,
3633: waive_flag = 'N',
3634: last_update_date = SYSDATE,
3635: last_updated_by = fnd_global.user_id,

Line 3642: DELETE FROM cn_payment_transactions

3638: AND credited_salesrep_id = wksht.salesrep_id
3639: AND incentive_type_code = 'PMTPLN_REC';
3640:
3641: -- Bug 2760379 : Do not reset cn_commission_lines
3642: DELETE FROM cn_payment_transactions
3643: WHERE incentive_type_code IN ('PMTPLN', 'MANUAL_PAY_ADJ')
3644: AND payrun_id = wksht.payrun_id
3645: AND credited_salesrep_id = wksht.salesrep_id;
3646:

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

3646:
3647: -- Bug 2715543
3648: IF wksht.payrun_mode = 'Y'
3649: THEN
3650: -- Bug 2760379 : Do not delete from cn_payment_transactions,
3651: -- just set the payrun_id to null
3652: -- 3. Set payrun_id to null for remaining tr
3653: -- Bug 2795606 : reset paymnet_amount when delete wkshtx
3654: UPDATE cn_payment_transactions

Line 3654: UPDATE cn_payment_transactions

3650: -- Bug 2760379 : Do not delete from cn_payment_transactions,
3651: -- just set the payrun_id to null
3652: -- 3. Set payrun_id to null for remaining tr
3653: -- Bug 2795606 : reset paymnet_amount when delete wkshtx
3654: UPDATE cn_payment_transactions
3655: SET payrun_id = NULL,
3656: payment_amount = amount,
3657: last_update_date = SYSDATE,
3658: last_updated_by = fnd_global.user_id,

Line 3664: -- Delete cn_payment_transactions for Pay by Summary

3660: WHERE payrun_id = wksht.payrun_id
3661: AND credited_salesrep_id = wksht.salesrep_id
3662: AND commission_line_id IS NOT NULL;
3663: ELSE
3664: -- Delete cn_payment_transactions for Pay by Summary
3665: DELETE FROM cn_payment_transactions
3666: WHERE payrun_id = wksht.payrun_id
3667: AND credited_salesrep_id = wksht.salesrep_id
3668: AND nvl(hold_flag, 'N') = 'N';

Line 3665: DELETE FROM cn_payment_transactions

3661: AND credited_salesrep_id = wksht.salesrep_id
3662: AND commission_line_id IS NOT NULL;
3663: ELSE
3664: -- Delete cn_payment_transactions for Pay by Summary
3665: DELETE FROM cn_payment_transactions
3666: WHERE payrun_id = wksht.payrun_id
3667: AND credited_salesrep_id = wksht.salesrep_id
3668: AND nvl(hold_flag, 'N') = 'N';
3669:

Line 3670: UPDATE cn_payment_transactions

3666: WHERE payrun_id = wksht.payrun_id
3667: AND credited_salesrep_id = wksht.salesrep_id
3668: AND nvl(hold_flag, 'N') = 'N';
3669:
3670: UPDATE cn_payment_transactions
3671: SET payrun_id = '',
3672: last_update_date = SYSDATE,
3673: last_updated_by = fnd_global.user_id,
3674: last_update_login = fnd_global.login_id

Line 3683: FROM cn_payment_transactions cnpd

3679:
3680: -- Delete the Posting Batches
3681: DELETE FROM cn_posting_batches cnpb
3682: WHERE cnpb.posting_batch_id IN (SELECT cnpd.posting_batch_id
3683: FROM cn_payment_transactions cnpd
3684: WHERE cnpd.payrun_id = wksht.payrun_id
3685: AND cnpd.credited_salesrep_id = wksht.salesrep_id
3686: AND nvl(cnpd.hold_flag, 'N') = 'N');
3687:

Line 3874: FROM cn_payment_transactions cnpt

3870: -- commented the code for Bug Fix 2849715
3871: /* BEGIN
3872: SELECT SUM(nvl(amount,0))
3873: INTO l_held_amount_prior
3874: FROM cn_payment_transactions cnpt
3875: WHERE cnpt.quota_id IS NOT NULL
3876: AND cnpt.credited_salesrep_id = l_wksht_rec.salesrep_id
3877: AND cnpt.pay_period_id < l_wksht_rec.pay_period_id
3878: AND cnpt.credit_type_id = G_credit_type_id