88: BEGIN
89:
90: -- IF PG_DEBUG < 10 THEN
91: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
92: IEX_DEBUG_PUB.logMessage('IEX_SCORE_CASE_PVT: Calculate_Score: Start time:' || TO_CHAR(SYSDATE, 'HH24:MI:SSSSS'));
93: END IF;
94: FND_FILE.PUT_LINE(FND_FILE.LOG, 'IEX_SCORE_CASE_PVT: Calculate_Score: Start time:' || TO_CHAR(SYSDATE, 'HH24:MI:SSSSS'));
95:
96: --First we load our required variables only once per component
96: --First we load our required variables only once per component
97: IF p_score_component_id = -1 or p_score_component_id is null THEN
98: -- IF PG_DEBUG < 10 THEN
99: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
100: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Load config because of component ID ' || p_score_component_id);
101: END IF;
102: --s_nLastComponentID := p_score_component_id;
103: v_bReturn := Load_Configuration(p_score_component_id);
104: ELSIF s_nAmountOutsdandingLimit = -1 or
110: s_nInvXPctGreaterLimit = -1 or
111: s_nLastComponentID = -1 THEN
112: -- IF PG_DEBUG < 10 THEN
113: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
114: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Load config missing value');
115: END IF;
116: v_bReturn := Load_Configuration(p_score_component_id);
117: END IF;
118:
117: END IF;
118:
119: -- IF PG_DEBUG < 10 THEN
120: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
121: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Values Loaded:');
122: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Score_ComponentID ' || p_score_component_id);
123: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: CASE ID ' || p_case_id);
124: iex_debug_pub.logmessage('-----------------------------------------------------------------');
125: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AmountOutsdandingLimit ' || s_nAmountOutsdandingLimit);
118:
119: -- IF PG_DEBUG < 10 THEN
120: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
121: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Values Loaded:');
122: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Score_ComponentID ' || p_score_component_id);
123: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: CASE ID ' || p_case_id);
124: iex_debug_pub.logmessage('-----------------------------------------------------------------');
125: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AmountOutsdandingLimit ' || s_nAmountOutsdandingLimit);
126: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: DaysPastDueLimit ' || s_nDaysPastDueLimit);
119: -- IF PG_DEBUG < 10 THEN
120: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
121: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Values Loaded:');
122: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Score_ComponentID ' || p_score_component_id);
123: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: CASE ID ' || p_case_id);
124: iex_debug_pub.logmessage('-----------------------------------------------------------------');
125: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AmountOutsdandingLimit ' || s_nAmountOutsdandingLimit);
126: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: DaysPastDueLimit ' || s_nDaysPastDueLimit);
127: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: LastScoreLimit ' || s_nLastScoreLimit);
120: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
121: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Values Loaded:');
122: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Score_ComponentID ' || p_score_component_id);
123: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: CASE ID ' || p_case_id);
124: iex_debug_pub.logmessage('-----------------------------------------------------------------');
125: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AmountOutsdandingLimit ' || s_nAmountOutsdandingLimit);
126: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: DaysPastDueLimit ' || s_nDaysPastDueLimit);
127: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: LastScoreLimit ' || s_nLastScoreLimit);
128: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: TimesDelinquentLimit ' || s_nTimesDelinquentLimit);
121: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Values Loaded:');
122: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Score_ComponentID ' || p_score_component_id);
123: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: CASE ID ' || p_case_id);
124: iex_debug_pub.logmessage('-----------------------------------------------------------------');
125: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AmountOutsdandingLimit ' || s_nAmountOutsdandingLimit);
126: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: DaysPastDueLimit ' || s_nDaysPastDueLimit);
127: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: LastScoreLimit ' || s_nLastScoreLimit);
128: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: TimesDelinquentLimit ' || s_nTimesDelinquentLimit);
129: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: ConsiderPastXMonths ' || s_nConsiderPastXMonths);
122: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Score_ComponentID ' || p_score_component_id);
123: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: CASE ID ' || p_case_id);
124: iex_debug_pub.logmessage('-----------------------------------------------------------------');
125: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AmountOutsdandingLimit ' || s_nAmountOutsdandingLimit);
126: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: DaysPastDueLimit ' || s_nDaysPastDueLimit);
127: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: LastScoreLimit ' || s_nLastScoreLimit);
128: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: TimesDelinquentLimit ' || s_nTimesDelinquentLimit);
129: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: ConsiderPastXMonths ' || s_nConsiderPastXMonths);
130: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: InvXPctGreaterLimit ' || s_nInvXPctGreaterLimit);
123: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: CASE ID ' || p_case_id);
124: iex_debug_pub.logmessage('-----------------------------------------------------------------');
125: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AmountOutsdandingLimit ' || s_nAmountOutsdandingLimit);
126: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: DaysPastDueLimit ' || s_nDaysPastDueLimit);
127: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: LastScoreLimit ' || s_nLastScoreLimit);
128: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: TimesDelinquentLimit ' || s_nTimesDelinquentLimit);
129: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: ConsiderPastXMonths ' || s_nConsiderPastXMonths);
130: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: InvXPctGreaterLimit ' || s_nInvXPctGreaterLimit);
131: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AnnualPayInXDays ' || s_nAnnualPayInXDays);
124: iex_debug_pub.logmessage('-----------------------------------------------------------------');
125: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AmountOutsdandingLimit ' || s_nAmountOutsdandingLimit);
126: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: DaysPastDueLimit ' || s_nDaysPastDueLimit);
127: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: LastScoreLimit ' || s_nLastScoreLimit);
128: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: TimesDelinquentLimit ' || s_nTimesDelinquentLimit);
129: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: ConsiderPastXMonths ' || s_nConsiderPastXMonths);
130: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: InvXPctGreaterLimit ' || s_nInvXPctGreaterLimit);
131: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AnnualPayInXDays ' || s_nAnnualPayInXDays);
132: END IF;
125: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AmountOutsdandingLimit ' || s_nAmountOutsdandingLimit);
126: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: DaysPastDueLimit ' || s_nDaysPastDueLimit);
127: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: LastScoreLimit ' || s_nLastScoreLimit);
128: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: TimesDelinquentLimit ' || s_nTimesDelinquentLimit);
129: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: ConsiderPastXMonths ' || s_nConsiderPastXMonths);
130: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: InvXPctGreaterLimit ' || s_nInvXPctGreaterLimit);
131: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AnnualPayInXDays ' || s_nAnnualPayInXDays);
132: END IF;
133:
126: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: DaysPastDueLimit ' || s_nDaysPastDueLimit);
127: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: LastScoreLimit ' || s_nLastScoreLimit);
128: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: TimesDelinquentLimit ' || s_nTimesDelinquentLimit);
129: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: ConsiderPastXMonths ' || s_nConsiderPastXMonths);
130: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: InvXPctGreaterLimit ' || s_nInvXPctGreaterLimit);
131: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AnnualPayInXDays ' || s_nAnnualPayInXDays);
132: END IF;
133:
134: FND_FILE.PUT_LINE(FND_FILE.LOG, 'Calculating Score for case: ' || p_case_id);
127: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: LastScoreLimit ' || s_nLastScoreLimit);
128: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: TimesDelinquentLimit ' || s_nTimesDelinquentLimit);
129: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: ConsiderPastXMonths ' || s_nConsiderPastXMonths);
130: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: InvXPctGreaterLimit ' || s_nInvXPctGreaterLimit);
131: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AnnualPayInXDays ' || s_nAnnualPayInXDays);
132: END IF;
133:
134: FND_FILE.PUT_LINE(FND_FILE.LOG, 'Calculating Score for case: ' || p_case_id);
135: -- begin raverma 04172003
135: -- begin raverma 04172003
136: -- get the Account for the case
137: -- IF PG_DEBUG < 10 THEN
138: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
139: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Finding AccountID');
140: END IF;
141: BEGIN
142: SELECT column_value
143: INTO l_CustAccountID
147: EXCEPTION
148: WHEN NO_DATA_FOUND THEN
149: -- IF PG_DEBUG < 10 THEN
150: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
151: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: NO AccountID found for case');
152: END IF;
153: RAISE FND_API.G_EXC_ERROR;
154: END;
155: FND_FILE.PUT_LINE(FND_FILE.LOG, 'AccountID: ' || l_CustAccountID);
155: FND_FILE.PUT_LINE(FND_FILE.LOG, 'AccountID: ' || l_CustAccountID);
156:
157: -- IF PG_DEBUG < 10 THEN
158: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
159: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: AccountID found ' || l_CustAccountID);
160: END IF;
161:
162: -- Now that we have the configuration lets load all contracts on the case
163: BEGIN
168: EXIT WHEN c_caseobj%NOTFOUND;
169:
170: -- IF PG_DEBUG < 10 THEN
171: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
172: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Contract ID ' || l_ContractID);
173: END IF;
174: FND_FILE.PUT_LINE(FND_FILE.LOG, 'ContractID: ' || l_ContractID);
175:
176: -- --IF PG_DEBUG < 10 THEN
174: FND_FILE.PUT_LINE(FND_FILE.LOG, 'ContractID: ' || l_ContractID);
175:
176: -- --IF PG_DEBUG < 10 THEN
177: --IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
178: -- iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Getting Number of Contracts');
179: --END IF;
180:
181: -- initialize all variables
182: l_AmountOutstanding := NULL;
198:
199: if l_return_status <> FND_API.G_RET_STS_SUCCESS then
200: -- IF PG_DEBUG < 10 THEN
201: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
202: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Invalid contract found ' || l_ContractID);
203: END IF;
204: FND_FILE.PUT_LINE(FND_FILE.LOG, 'IEX_SCORE_CASE_PVT: Calculate_Score: Invalid contract found ' || l_ContractID);
205: RAISE FND_API.G_EXC_ERROR;
206: else
209:
210: -- 2) Is the amount outstanding > X?
211: -- IF PG_DEBUG < 10 THEN
212: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
213: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Get amount outstanding.');
214: END IF;
215:
216: -- begin raverma 04162003 -- trap no data found and assign 0 to Remaining amount
217: BEGIN
222: EXCEPTION
223: WHEN NO_DATA_FOUND THEN
224: -- IF PG_DEBUG < 10 THEN
225: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
226: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Could not find an outstanding amount => default to 0');
227: END IF;
228: l_AmountOutstanding := 0;
229: END;
230: FND_FILE.PUT_LINE(FND_FILE.LOG, ' Amount outstanding is: ' || l_AmountOutstanding);
229: END;
230: FND_FILE.PUT_LINE(FND_FILE.LOG, ' Amount outstanding is: ' || l_AmountOutstanding);
231: -- IF PG_DEBUG < 10 THEN
232: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
233: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Amount Outstanding: ' || l_AmountOutstanding);
234: END IF;
235:
236: if l_AmountOutstanding > s_nAmountOutsdandingLimit then
237: l_tempScore := ReduceScore(l_tempScore,0);
249: -- 5) Is contract past due > X?
250: l_sReturn := OKL_CONTRACT_INFO.GET_DAYS_PAST_DUE(l_ContractID, l_DaysPastDue);
251: -- IF PG_DEBUG < 10 THEN
252: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
253: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Calculate_Score: Days Past Due ' || l_DaysPastDue);
254: END IF;
255: FND_FILE.PUT_LINE(FND_FILE.LOG, ' Days past due is: ' || l_DaysPastDue);
256:
257: if l_DaysPastDue > 0 and l_DaysPastDue > s_nDaysPastDueLimit then
263: -- also, in the event this is the first time the CASE is being scored
264: -- add WHEN_NO_DATA found
265: -- IF PG_DEBUG < 10 THEN
266: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
267: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Verify last Case score.');
268: END IF;
269:
270: -- we only need to get the last score once per CASE
271: -- since the score is the score of the last run
283: EXCEPTION
284: WHEN NO_DATA_FOUND THEN
285: -- IF PG_DEBUG < 10 THEN
286: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
287: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: No previous score found.');
288: END IF;
289: l_tempScore := s_nLastScoreLimit;
290: END;
291:
290: END;
291:
292: -- IF PG_DEBUG < 10 THEN
293: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
294: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Last Case score: ' || l_LastScore);
295: END IF;
296: FND_FILE.PUT_LINE(FND_FILE.LOG, ' Last case score is: ' || l_LastScore);
297:
298: if l_lastScore < s_nLastScoreLimit then
304: -- begin raverma 04172003 handle no data found
305: -- also, synch up with new PROB definition of broken promises
306: -- IF PG_DEBUG < 10 THEN
307: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
308: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Verify broken promises.');
309: END IF;
310: BEGIN
311: select count(1)
312: into l_NumPromiseBroken
319: WHEN NO_DATA_FOUND THEN
320: l_NumPromiseBroken := 0;
321: -- IF PG_DEBUG < 10 THEN
322: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
323: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: no broken promises found');
324: END IF;
325: END;
326: -- IF PG_DEBUG < 10 THEN
327: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
324: END IF;
325: END;
326: -- IF PG_DEBUG < 10 THEN
327: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
328: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Number of broken promises is ' || l_NumPromiseBroken);
329: END IF;
330: FND_FILE.PUT_LINE(FND_FILE.LOG, ' Number of broken promises is: ' || l_NumPromiseBroken);
331:
332: if l_NumPromiseBroken > 0 then
336: -- 8) Is contract past elegibility date? (TBD)
337: -- If it is not delinquent, maybe pre-delinquent
338: -- IF PG_DEBUG < 10 THEN
339: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
340: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: SCORE NOW ' || l_tempScore);
341: END IF;
342:
343: -- uncomment to force pre-delinquency check
344: -- 05302003 raverma
349:
350: if l_tempScore = 100 then
351: -- IF PG_DEBUG < 10 THEN
352: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
353: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Check pre-delinquency.');
354: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Number of delinquencies in last ' || s_nConsiderPastXMonths || ' months');
355: END IF;
356:
357: -- begin raverma 04172003 append cust_account_id to WHERE clause
350: if l_tempScore = 100 then
351: -- IF PG_DEBUG < 10 THEN
352: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
353: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Check pre-delinquency.');
354: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Number of delinquencies in last ' || s_nConsiderPastXMonths || ' months');
355: END IF;
356:
357: -- begin raverma 04172003 append cust_account_id to WHERE clause
358: BEGIN
367: l_NumDelinquencies := 0;
368: END;
369: -- IF PG_DEBUG < 10 THEN
370: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
371: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Number of delinquencies in last ' || s_nConsiderPastXMonths ||
372: ' months: ' || l_NumDelinquencies);
373: END IF;
374: FND_FILE.PUT_LINE(FND_FILE.LOG, ' Number of delinquencies in past ' || s_nConsiderPastXMonths ||
375: ' months: ' || l_NumDelinquencies);
387: -- begin raverma 04182003 only need to get this ONCE per CASE
388: if l_nAmount is NULL then
389: -- IF PG_DEBUG < 10 THEN
390: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
391: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Is Current contract ' || s_nInvXPctGreaterLimit || '% greater than previous');
392: END IF;
393:
394: OPEN c_invamt(p_case_id);
395: LOOP
403: CLOSE c_invamt;
404:
405: -- IF PG_DEBUG < 10 THEN
406: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
407: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Current Amount: ' || l_nAmount);
408: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Previous Amount: ' || l_nCurrAmount);
409: END IF;
410:
411: if l_nAmount is not null then
404:
405: -- IF PG_DEBUG < 10 THEN
406: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
407: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Current Amount: ' || l_nAmount);
408: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Previous Amount: ' || l_nCurrAmount);
409: END IF;
410:
411: if l_nAmount is not null then
412: FND_FILE.PUT_LINE(FND_FILE.LOG, ' ' || l_nCurrAmount || ' greater than or less than ' || (l_nAmount * (1 + (s_nInvXPctGreaterLimit/100))));
417: l_nAmount := -1;
418: end if;
419: Else
420: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
421: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Skipping Amount: ' || l_nAmount);
422: END IF;
423: End if;
424:
425: --Annual payment coming due in X days
424:
425: --Annual payment coming due in X days
426: -- IF PG_DEBUG < 10 THEN
427: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
428: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Annual payment comming due in ' || s_nAnnualPayInXDays || ' days.');
429: END IF;
430:
431: -- begin raverma 04182003 change AR_PAY_SCHED_ALL to org enabled view
432: BEGIN
459: EXCEPTION
460: WHEN NO_DATA_FOUND THEN
461: -- no payment coming due in next X number of days
462: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
463: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: No payments coming due soon...');
464: END IF;
465: l_DueInDays := s_nAnnualPayInXDays;
466: END;
467:
466: END;
467:
468: -- IF PG_DEBUG < 10 THEN
469: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
470: --iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: due in days limit is ' || s_nAnnualPayInXDays || ' days');
471: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Next payment not coming due in next ' || s_nAnnualPayInXDays || ' days');
472: END IF;
473:
474: FND_FILE.PUT_LINE(FND_FILE.LOG, ' ' || 'Coming due in ' || l_DueInDays || ' days');
467:
468: -- IF PG_DEBUG < 10 THEN
469: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
470: --iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: due in days limit is ' || s_nAnnualPayInXDays || ' days');
471: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Next payment not coming due in next ' || s_nAnnualPayInXDays || ' days');
472: END IF;
473:
474: FND_FILE.PUT_LINE(FND_FILE.LOG, ' ' || 'Coming due in ' || l_DueInDays || ' days');
475: if l_DueInDays < s_nAnnualPayInXDays then
480: end if; --pre-delinquent
481:
482: if l_tempScore < l_caseScore then
483: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
484: iex_debug_pub.logMessage('IEX_SCORE_CASE_PVT: Calculate_Score: ----------------------> new lowest score found: ' || l_tempScore);
485: END IF;
486: l_caseScore := l_tempScore;
487: end if;
488:
493: EXCEPTION
494: WHEN NO_DATA_FOUND THEN
495: -- IF PG_DEBUG < 10 THEN
496: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
497: IEX_DEBUG_PUB.logMessage('IEX_SCORE_CASE_PVT: Calculate_Score: NO CONTRACTS FOUND');
498: END IF;
499: RAISE FND_API.G_EXC_ERROR;
500: END;
501: FND_FILE.PUT_LINE(FND_FILE.LOG, 'IEX_SCORE_CASE_PVT: Calculate_Score: End time:' || TO_CHAR(SYSDATE, 'HH24:MI:SSSSS'));
503: RETURN l_caseScore;
504:
505: -- IF PG_DEBUG < 10 THEN
506: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
507: IEX_DEBUG_PUB.logMessage('IEX_SCORE_CASE_PVT: Calculate_Score: End time:' || TO_CHAR(SYSDATE, 'HH24:MI:SSSSS'));
508: END IF;
509:
510: EXCEPTION
511: WHEN OTHERS THEN
511: WHEN OTHERS THEN
512: FND_FILE.PUT_LINE(FND_FILE.LOG, 'IEX_SCORE_CASE_PVT: Calculate_Score: Exception ' || sqlerrm);
513: -- IF PG_DEBUG < 10 THEN
514: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
515: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Calculate_Score: Exception ' || sqlerrm);
516: END IF;
517: RAISE FND_API.G_EXC_ERROR;
518: END Calculate_Score;
519:
535:
536: BEGIN
537: -- IF PG_DEBUG < 10 THEN
538: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
539: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: Load_Configuration: Loading Configuration Values ....');
540: END IF;
541: OPEN c_values(p_score_component_id);
542:
543: LOOP
579: l_Return NUMBER;
580: BEGIN
581: -- IF PG_DEBUG < 10 THEN
582: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
583: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: pre-ReduceScore: Score= ' || p_Score);
584: END IF;
585: l_Return := p_Score;
586: if p_Score <= 100 and p_Score >= 80 and p_type = 0 then
587: l_Return := l_Return - 20;
592: end if;
593:
594: -- IF PG_DEBUG < 10 THEN
595: IF (FND_LOG.LEVEL_EVENT >= PG_DEBUG) THEN
596: iex_debug_pub.logmessage('IEX_SCORE_CASE_PVT: post-ReduceScore: Score= ' || l_Return);
597: END IF;
598:
599: RETURN l_Return;
600: