20: CURSOR get_last_payment_info(p_cust_acct_id NUMBER,
21: p_site_use_id NUMBER,
22: p_currency VARCHAR2) IS
23: SELECT last_payment_date,last_payment_number
24: FROM ar_trx_bal_summary
25: WHERE cust_account_id = p_cust_acct_id
26: AND site_use_id = nvl(p_site_use_id,-9999)
27: AND currency = p_currency
28: FOR UPDATE;
75: debug ('org_id ='||l_org_id);
76: END IF;
77:
78:
79: UPDATE ar_trx_bal_summary
80: set OP_CREDIT_MEMOS_VALUE
81: = nvl(OP_CREDIT_MEMOS_VALUE,0)
82: + DECODE(l_trx_class,'CM',
83: nvl(l_trx_amt,0),0)
124: and currency = l_trx_currency_code
125: and NVL(org_id,'-99') = NVL(l_org_id,-99);
126:
127: IF l_app_type = 'CASH' THEN
128: UPDATE ar_trx_bal_summary
129: set UNRESOLVED_CASH_VALUE = nvl(UNRESOLVED_CASH_VALUE,0)
130: + nvl(l_unresolved_cash_value,0),
131: UNRESOLVED_CASH_COUNT = nvl(UNRESOLVED_CASH_COUNT,0) -
132: nvl(l_unresolved_cash_count,0),
290: --
291: -- l_tot_inv_amt := 0;
292:
293:
294: UPDATE ar_trx_bal_summary
295: set BEST_CURRENT_RECEIVABLES
296: = nvl(BEST_CURRENT_RECEIVABLES,0)
297: +DECODE(sign(rec.due_date - trunc(sysdate)),-1,0,
298: rec.amount_due_original),
352:
353:
354: IF SQL%NOTFOUND THEN
355: /* bug4403146 : Modified the decode for getting OP_DEBIT_MEMOS_COUNT */
356: INSERT INTO ar_trx_bal_summary
357: (CUST_ACCOUNT_ID,
358: SITE_USE_ID,
359: ORG_ID,
360: CURRENCY,
559: debug ('site_use_id ='||l_site_use_id);
560: debug ('currency ='||l_currency_code);
561: debug ('org_id ='||l_org_id);
562: END IF;
563: UPDATE ar_trx_bal_summary
564: set BEST_CURRENT_RECEIVABLES
565: = nvl(BEST_CURRENT_RECEIVABLES,0)
566: + nvl(l_adj_amount,0),
567: OP_CREDIT_MEMOS_VALUE
606: and NVL(org_id,'-99') = NVL(l_org_id,-99);
607:
608: IF sql%NOTFOUND THEN
609:
610: INSERT INTO ar_trx_bal_summary
611: (CUST_ACCOUNT_ID,
612: SITE_USE_ID,
613: ORG_ID,
614: CURRENCY,
816:
817: /*
818: These variables are used to maintain the cumulative totals for the
819: data in application_info cursor, which will be used for updating the
820: ar_trx_bal_summary column.
821: */
822: l_prev_trx_customer_id number;
823: l_prev_trx_site_use_id number;
824: l_prev_trx_currency varchar2(30);
887:
888:
889: FOR i in get_last_payment_info(p_req_id)
890: LOOP
891: UPDATE ar_trx_bal_summary
892: set last_payment_amount = decode(sign(i.last_payment_date-last_payment_date),
893: -1,last_payment_amount,i.last_payment_amount),
894: last_payment_date =decode(sign(i.last_payment_date-last_payment_date),
895: -1,last_payment_date,i.last_payment_date),
903: and NVL(org_id,'-99') = NVL(p_org_id,-99)
904: and currency = i.rcpt_currency;
905:
906: IF sql%notfound then
907: INSERT into ar_trx_bal_summary
908: (cust_account_id,
909: site_use_id,
910: org_id,
911: currency,
1157:
1158: FOR j in 1..l_ps_tab.COUNT
1159: LOOP
1160: --
1161: -- Update the AR_TRX_BAL_SUMMARY table
1162: --
1163: UPDATE ar_trx_bal_summary
1164: set BEST_CURRENT_RECEIVABLES
1165: = nvl(BEST_CURRENT_RECEIVABLES,0)
1159: LOOP
1160: --
1161: -- Update the AR_TRX_BAL_SUMMARY table
1162: --
1163: UPDATE ar_trx_bal_summary
1164: set BEST_CURRENT_RECEIVABLES
1165: = nvl(BEST_CURRENT_RECEIVABLES,0)
1166: +DECODE(sign(l_ps_tab(j).due_date - sysdate),-1,0,
1167: (l_ps_tab(j).amount_due_original
1186: and NVL(org_id,'-99') = NVL(l_org_id,-99);
1187:
1188: IF SQL%NOTFOUND THEN
1189:
1190: INSERT INTO ar_trx_bal_summary
1191: (CUST_ACCOUNT_ID,
1192: SITE_USE_ID,
1193: ORG_ID,
1194: CURRENCY,
1447:
1448: l_tot_inv_amt := 0;
1449:
1450: --
1451: -- Update the AR_TRX_BAL_SUMMARY table
1452: --
1453: UPDATE ar_trx_bal_summary
1454: set BEST_CURRENT_RECEIVABLES
1455: = nvl(BEST_CURRENT_RECEIVABLES,0)
1449:
1450: --
1451: -- Update the AR_TRX_BAL_SUMMARY table
1452: --
1453: UPDATE ar_trx_bal_summary
1454: set BEST_CURRENT_RECEIVABLES
1455: = nvl(BEST_CURRENT_RECEIVABLES,0)
1456: -DECODE(sign(l_history_rec.due_date - sysdate),-1,0,
1457: (l_history_rec.amount_due_original
1730: AND nvl(l_history_rec.amount_in_dispute,0) > 0 THEN
1731: l_inv_dispute_count := -1;
1732: END IF;
1733:
1734: UPDATE ar_trx_bal_summary
1735: set BEST_CURRENT_RECEIVABLES
1736: = nvl(BEST_CURRENT_RECEIVABLES,0)
1737: -DECODE(l_due_date_change,'+',
1738: (l_history_rec.amount_due_original
1959:
1960: --this is a credit memo so only one ps exists
1961:
1962: --
1963: -- Update the AR_TRX_BAL_SUMMARY table
1964: --
1965: UPDATE ar_trx_bal_summary
1966: set BEST_CURRENT_RECEIVABLES
1967: = nvl(BEST_CURRENT_RECEIVABLES,0)
1961:
1962: --
1963: -- Update the AR_TRX_BAL_SUMMARY table
1964: --
1965: UPDATE ar_trx_bal_summary
1966: set BEST_CURRENT_RECEIVABLES
1967: = nvl(BEST_CURRENT_RECEIVABLES,0)
1968: + DECODE(sign(l_ps_rec.due_date - sysdate),-1,0,
1969: (l_ps_rec.amount_due_original
2023: and NVL(org_id,'-99') = NVL(l_org_id,-99);
2024:
2025: IF SQL%NOTFOUND THEN
2026:
2027: INSERT INTO ar_trx_bal_summary
2028: (CUST_ACCOUNT_ID,
2029: SITE_USE_ID,
2030: ORG_ID,
2031: CURRENCY,
2293: FETCH get_trx_history INTO l_history_rec;
2294: CLOSE get_trx_history ;
2295:
2296: --
2297: -- Update the AR_TRX_BAL_SUMMARY table
2298: --
2299: UPDATE ar_trx_bal_summary
2300: set BEST_CURRENT_RECEIVABLES
2301: = nvl(BEST_CURRENT_RECEIVABLES,0)
2295:
2296: --
2297: -- Update the AR_TRX_BAL_SUMMARY table
2298: --
2299: UPDATE ar_trx_bal_summary
2300: set BEST_CURRENT_RECEIVABLES
2301: = nvl(BEST_CURRENT_RECEIVABLES,0)
2302: - DECODE(sign(l_history_rec.due_date - sysdate),-1,0,
2303: (l_history_rec.amount_due_original
2519:
2520: FOR j in 1..l_ps_tab.COUNT
2521: LOOP
2522: --
2523: -- Update the AR_TRX_BAL_SUMMARY table
2524: --
2525: UPDATE ar_trx_bal_summary
2526: set BEST_CURRENT_RECEIVABLES
2527: = nvl(BEST_CURRENT_RECEIVABLES,0)
2521: LOOP
2522: --
2523: -- Update the AR_TRX_BAL_SUMMARY table
2524: --
2525: UPDATE ar_trx_bal_summary
2526: set BEST_CURRENT_RECEIVABLES
2527: = nvl(BEST_CURRENT_RECEIVABLES,0)
2528: +DECODE(sign(l_ps_tab(j).due_date - sysdate),-1,0,
2529: l_ps_tab(j).amount_due_original),
2540: and NVL(org_id,'-99') = NVL(l_org_id,-99);
2541:
2542: IF SQL%NOTFOUND THEN
2543:
2544: INSERT INTO ar_trx_bal_summary
2545: (CUST_ACCOUNT_ID,
2546: SITE_USE_ID,
2547: ORG_ID,
2548: CURRENCY,
2757:
2758: l_tot_inv_amt := 0;
2759:
2760: --
2761: -- Update the AR_TRX_BAL_SUMMARY table
2762: --
2763: UPDATE ar_trx_bal_summary
2764: set BEST_CURRENT_RECEIVABLES
2765: = nvl(BEST_CURRENT_RECEIVABLES,0)
2759:
2760: --
2761: -- Update the AR_TRX_BAL_SUMMARY table
2762: --
2763: UPDATE ar_trx_bal_summary
2764: set BEST_CURRENT_RECEIVABLES
2765: = nvl(BEST_CURRENT_RECEIVABLES,0)
2766: -DECODE(sign(l_history_rec.due_date - sysdate),-1,0,
2767: l_history_rec.amount_due_original),
2960:
2961: FOR j in 1..l_ps_tab.COUNT
2962: LOOP
2963: --
2964: -- Update the AR_TRX_BAL_SUMMARY table
2965: --
2966: UPDATE ar_trx_bal_summary
2967: set BEST_CURRENT_RECEIVABLES
2968: = nvl(BEST_CURRENT_RECEIVABLES,0)
2962: LOOP
2963: --
2964: -- Update the AR_TRX_BAL_SUMMARY table
2965: --
2966: UPDATE ar_trx_bal_summary
2967: set BEST_CURRENT_RECEIVABLES
2968: = nvl(BEST_CURRENT_RECEIVABLES,0)
2969: +DECODE(sign(l_ps_tab(j).due_date - sysdate),-1,0,
2970: l_ps_tab(j).amount_due_original),
2982: and NVL(org_id,'-99') = NVL(l_org_id,-99);
2983:
2984: IF SQL%NOTFOUND THEN
2985:
2986: INSERT INTO ar_trx_bal_summary
2987: (CUST_ACCOUNT_ID,
2988: SITE_USE_ID,
2989: ORG_ID,
2990: CURRENCY,
3201:
3202: l_tot_inv_amt := 0;
3203:
3204: --
3205: -- Update the AR_TRX_BAL_SUMMARY table
3206: --
3207: UPDATE ar_trx_bal_summary
3208: set BEST_CURRENT_RECEIVABLES
3209: = nvl(BEST_CURRENT_RECEIVABLES,0)
3203:
3204: --
3205: -- Update the AR_TRX_BAL_SUMMARY table
3206: --
3207: UPDATE ar_trx_bal_summary
3208: set BEST_CURRENT_RECEIVABLES
3209: = nvl(BEST_CURRENT_RECEIVABLES,0)
3210: -DECODE(sign(l_history_rec.due_date - sysdate),-1,0,
3211: l_history_rec.amount_due_original),
3402: IF l_ps_exists THEN
3403: --this is a chargeback so only one ps exists
3404:
3405: --
3406: -- Update the AR_TRX_BAL_SUMMARY table
3407: --
3408:
3409: UPDATE ar_trx_bal_summary
3410: set BEST_CURRENT_RECEIVABLES
3405: --
3406: -- Update the AR_TRX_BAL_SUMMARY table
3407: --
3408:
3409: UPDATE ar_trx_bal_summary
3410: set BEST_CURRENT_RECEIVABLES
3411: = nvl(BEST_CURRENT_RECEIVABLES,0)
3412: +DECODE(sign(l_ps_rec.due_date - sysdate),-1,0,
3413: l_ps_rec.amount_due_original),
3424: and NVL(org_id,'-99') = NVL(l_org_id,-99);
3425:
3426: IF SQL%NOTFOUND THEN
3427:
3428: INSERT INTO ar_trx_bal_summary
3429: (CUST_ACCOUNT_ID,
3430: SITE_USE_ID,
3431: ORG_ID,
3432: CURRENCY,
3720:
3721: IF (l_receipt_exists)
3722: THEN
3723:
3724: UPDATE ar_trx_bal_summary
3725: set unresolved_cash_value = nvl(unresolved_cash_value,0) +
3726: l_receipt_amount,
3727: unresolved_cash_count = nvl(unresolved_cash_count,0) + 1,
3728: last_payment_amount = DECODE(sign(l_receipt_date-last_payment_date),
3739: and NVL(org_id,'-99') = NVL(l_org_id,-99)
3740: and currency = l_currency_code;
3741:
3742: IF sql%notfound then
3743: INSERT INTO ar_trx_bal_summary
3744: (CUST_ACCOUNT_ID,
3745: SITE_USE_ID,
3746: ORG_ID,
3747: CURRENCY,
3911: p_pmt_number IN VARCHAR2,
3912: p_pmt_date IN DATE,
3913: p_org_id IN NUMBER)IS
3914: select 'Y'
3915: from ar_trx_bal_summary
3916: where cust_account_id = p_customer_id
3917: and site_use_id = p_site_use_id
3918: and currency = p_currency
3919: and last_payment_number = p_pmt_number
4015: END IF;
4016:
4017: CLOSE is_this_last_payment;
4018:
4019: --Update ar_trx_bal_summary
4020: UPDATE ar_trx_bal_summary
4021: set unresolved_cash_value = nvl(unresolved_cash_value,0) -
4022: l_unresolved_cash,
4023: unresolved_cash_count = nvl(unresolved_cash_count,0) - 1,
4016:
4017: CLOSE is_this_last_payment;
4018:
4019: --Update ar_trx_bal_summary
4020: UPDATE ar_trx_bal_summary
4021: set unresolved_cash_value = nvl(unresolved_cash_value,0) -
4022: l_unresolved_cash,
4023: unresolved_cash_count = nvl(unresolved_cash_count,0) - 1,
4024: last_payment_amount = nvl(l_last_receipt_amount,last_payment_amount),
4215: ((l_history2_exists_flag = 'Y') OR (l_receipt_exists = 'Y'))
4216: THEN
4217:
4218: IF l_customer_id = l_hist_rec.customer_id THEN
4219: --Update ar_trx_bal_summary
4220: UPDATE ar_trx_bal_summary
4221: set unresolved_cash_value = nvl(unresolved_cash_value,0) +
4222: (l_receipt_amount -
4223: nvl(l_hist_rec.amount_due_original,0)),
4216: THEN
4217:
4218: IF l_customer_id = l_hist_rec.customer_id THEN
4219: --Update ar_trx_bal_summary
4220: UPDATE ar_trx_bal_summary
4221: set unresolved_cash_value = nvl(unresolved_cash_value,0) +
4222: (l_receipt_amount -
4223: nvl(l_hist_rec.amount_due_original,0)),
4224: unresolved_cash_count = nvl(unresolved_cash_count,0),
4233: and NVL(org_id,'-99') = NVL(l_org_id,-99)
4234: and currency = l_currency_code;
4235:
4236: IF sql%notfound then
4237: INSERT INTO ar_trx_bal_summary
4238: (CUST_ACCOUNT_ID,
4239: SITE_USE_ID,
4240: ORG_ID,
4241: CURRENCY,
4313: 1);
4314:
4315: END IF;
4316: ELSIF l_customer_id IS NULL AND l_hist_rec.customer_id IS NOT NULL THEN
4317: --Update ar_trx_bal_summary
4318: UPDATE ar_trx_bal_summary
4319: set unresolved_cash_value = nvl(unresolved_cash_value,0)
4320: - nvl(l_hist_rec.amount_due_original,0),
4321: unresolved_cash_count = nvl(unresolved_cash_count,0) -1,
4314:
4315: END IF;
4316: ELSIF l_customer_id IS NULL AND l_hist_rec.customer_id IS NOT NULL THEN
4317: --Update ar_trx_bal_summary
4318: UPDATE ar_trx_bal_summary
4319: set unresolved_cash_value = nvl(unresolved_cash_value,0)
4320: - nvl(l_hist_rec.amount_due_original,0),
4321: unresolved_cash_count = nvl(unresolved_cash_count,0) -1,
4322: last_payment_amount = nvl(l_hist_rec.amount_due_original,0),
4330: and NVL(org_id,'-99') = NVL(l_org_id,-99)
4331: and currency = l_currency_code;
4332:
4333: IF sql%notfound then
4334: INSERT INTO ar_trx_bal_summary
4335: (CUST_ACCOUNT_ID,
4336: SITE_USE_ID,
4337: ORG_ID,
4338: CURRENCY,
4406: l_hist_rec.amount_due_original,
4407: 1);
4408: END IF;
4409: ELSIF l_customer_id IS NOT NULL AND l_hist_rec.customer_id IS NULL THEN
4410: --Update ar_trx_bal_summary
4411: UPDATE ar_trx_bal_summary
4412: set unresolved_cash_value = nvl(unresolved_cash_value,0)
4413: +l_receipt_amount ,
4414: unresolved_cash_count = nvl(unresolved_cash_count,0) +1,
4407: 1);
4408: END IF;
4409: ELSIF l_customer_id IS NOT NULL AND l_hist_rec.customer_id IS NULL THEN
4410: --Update ar_trx_bal_summary
4411: UPDATE ar_trx_bal_summary
4412: set unresolved_cash_value = nvl(unresolved_cash_value,0)
4413: +l_receipt_amount ,
4414: unresolved_cash_count = nvl(unresolved_cash_count,0) +1,
4415: last_payment_amount = l_receipt_amount,
4423: and NVL(org_id,'-99') = NVL(l_org_id,-99)
4424: and currency = l_currency_code;
4425:
4426: IF sql%notfound then
4427: INSERT INTO ar_trx_bal_summary
4428: (CUST_ACCOUNT_ID,
4429: SITE_USE_ID,
4430: ORG_ID,
4431: CURRENCY,
4500: 1);
4501: END IF;
4502: ELSIF nvl(l_customer_id,0) <> nvl(l_hist_rec.customer_id,0) THEN
4503:
4504: --Update ar_trx_bal_summary
4505: UPDATE ar_trx_bal_summary
4506: set unresolved_cash_value = nvl(unresolved_cash_value,0)
4507: - nvl(l_hist_rec.amount_due_original,0),
4508: unresolved_cash_count = nvl(unresolved_cash_count,0) -1,
4501: END IF;
4502: ELSIF nvl(l_customer_id,0) <> nvl(l_hist_rec.customer_id,0) THEN
4503:
4504: --Update ar_trx_bal_summary
4505: UPDATE ar_trx_bal_summary
4506: set unresolved_cash_value = nvl(unresolved_cash_value,0)
4507: - nvl(l_hist_rec.amount_due_original,0),
4508: unresolved_cash_count = nvl(unresolved_cash_count,0) -1,
4509: last_payment_amount = nvl(l_hist_rec.amount_due_original,0),
4517: and NVL(org_id,'-99') = NVL(l_org_id,-99)
4518: and currency = l_currency_code;
4519:
4520: IF sql%notfound then
4521: INSERT INTO ar_trx_bal_summary
4522: (CUST_ACCOUNT_ID,
4523: SITE_USE_ID,
4524: ORG_ID,
4525: CURRENCY,
4593: l_hist_rec.amount_due_original,
4594: 1);
4595: END IF;
4596:
4597: --Update ar_trx_bal_summary
4598: UPDATE ar_trx_bal_summary
4599: set unresolved_cash_value = nvl(unresolved_cash_value,0)
4600: +l_receipt_amount ,
4601: unresolved_cash_count = nvl(unresolved_cash_count,0)+1,
4594: 1);
4595: END IF;
4596:
4597: --Update ar_trx_bal_summary
4598: UPDATE ar_trx_bal_summary
4599: set unresolved_cash_value = nvl(unresolved_cash_value,0)
4600: +l_receipt_amount ,
4601: unresolved_cash_count = nvl(unresolved_cash_count,0)+1,
4602: last_payment_amount = l_receipt_amount,
4610: and NVL(org_id,'-99') = NVL(l_org_id,-99)
4611: and currency = l_currency_code;
4612:
4613: IF sql%notfound then
4614: INSERT INTO ar_trx_bal_summary
4615: (CUST_ACCOUNT_ID,
4616: SITE_USE_ID,
4617: ORG_ID,
4618: CURRENCY,
4806: p_pmt_number IN VARCHAR2,
4807: p_pmt_date IN DATE,
4808: p_org_id IN NUMBER) IS
4809: SELECT 'Y'
4810: FROM ar_trx_bal_summary
4811: WHERE cust_account_id = p_customer_id
4812: AND site_use_id = p_site_use_id
4813: AND currency = p_currency
4814: AND last_payment_number = p_pmt_number
4923: END IF;
4924:
4925: CLOSE is_this_last_payment;
4926:
4927: --Update ar_trx_bal_summary
4928: UPDATE ar_trx_bal_summary
4929: SET unresolved_cash_value = NVL(unresolved_cash_value,0) -
4930: NVL(k.amount_due_original * -1, 0),
4931: unresolved_cash_count = NVL(unresolved_cash_count,0) - 1,
4924:
4925: CLOSE is_this_last_payment;
4926:
4927: --Update ar_trx_bal_summary
4928: UPDATE ar_trx_bal_summary
4929: SET unresolved_cash_value = NVL(unresolved_cash_value,0) -
4930: NVL(k.amount_due_original * -1, 0),
4931: unresolved_cash_count = NVL(unresolved_cash_count,0) - 1,
4932: last_payment_amount = NVL(l_last_receipt_amount,last_payment_amount),
5113: credit memo application
5114: AR_TRX_SUMMARY
5115: ==================
5116:
5117: AR_TRX_BAL_SUMMARY
5118: ==================
5119: 1) OP_INVOICES_VALUE
5120: 2) OP_INVOICES_COUNT
5121: 3) OP_DEBIT_MEMOS_VALUE
5321: credit memo application
5322: AR_TRX_SUMMARY
5323: ==================
5324:
5325: AR_TRX_BAL_SUMMARY
5326: ==================
5327: 1) OP_INVOICES_VALUE
5328: 2) OP_INVOICES_COUNT
5329: 3) OP_DEBIT_MEMOS_VALUE
5600: 10)COUNT_OF_INV_INST_PAID_LATE
5601: 11)COUNT_OF_DISC_INV_INST
5602: 12)DAYS_CREDIT_GRANTED_SUM
5603:
5604: AR_TRX_BAL_SUMMARY
5605: ==================
5606: 1) OP_INVOICES_VALUE
5607: 2) OP_INVOICES_COUNT
5608: 3) OP_DEBIT_MEMOS_VALUE
5986: 10)COUNT_OF_INV_INST_PAID_LATE
5987: 11)COUNT_OF_DISC_INV_INST
5988: 12)DAYS_CREDIT_GRANTED_SUM
5989:
5990: AR_TRX_BAL_SUMMARY
5991: ==================
5992: 1) OP_INVOICES_VALUE
5993: 2) OP_INVOICES_COUNT
5994: 3) OP_DEBIT_MEMOS_VALUE
7123: past_due_inv_inst_count
7124: past_due_inv_value
7125:
7126: In the original bug, lockbox receipts were corrupting these columns in
7127: ar_trx_bal_summary for partial receipts, multiple applications to one
7128: trx from different receipts, and receipts with apply_dates that
7129: occurr before the trx.due_date. */
7130: PROCEDURE refresh_counts(
7131: p_customer_id_tab IN ar_bus_event_sub_pvt.generic_id_type,
7141: debug ('ar_bus_event_sub_pvt.refresh_counts()+');
7142: END IF;
7143:
7144: FORALL i IN p_customer_id_tab.FIRST .. p_customer_id_tab.LAST
7145: update ar_trx_bal_summary main_sum
7146: set (op_invoices_count,
7147: op_invoices_value,
7148: past_due_inv_inst_count,
7149: past_due_inv_value,
7236: /*bug 13858491 */
7237: If (p_cash_receipt_id is null) then
7238:
7239: FORALL i IN p_customer_id_tab.FIRST .. p_customer_id_tab.LAST
7240: UPDATE ar_trx_bal_summary main_sum
7241: SET receipts_at_risk_value =
7242: (SELECT SUM(DECODE(rap.applied_payment_schedule_id, -2, 0,
7243: crh.amount))
7244: FROM ar_cash_receipts_all cr,
7278: THEN
7279: debug ('ar_bus_event_sub_pvt.refresh_at_risk_value() Call from CE_AUTO_BANK_REC');
7280: END IF;
7281:
7282: UPDATE ar_trx_bal_summary main_sum
7283: SET receipts_at_risk_value = receipts_at_risk_value -
7284: (SELECT SUM(DECODE(rap.applied_payment_schedule_id, -2, 0,
7285: crh.amount))
7286: FROM ar_cash_receipts_all cr,