57: x_return_status := FND_API.G_RET_STS_SUCCESS;
58: i := 1;
59:
60:
61: IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
62: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' get_zone (+)',
63: p_msg_level=>fnd_log.level_procedure);
64: END IF;
65:
59:
60:
61: IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
62: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' get_zone (+)',
63: p_msg_level=>fnd_log.level_procedure);
64: END IF;
65:
66: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
67: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Param p_location_table_name '||p_location_table_name
62: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' get_zone (+)',
63: p_msg_level=>fnd_log.level_procedure);
64: END IF;
65:
66: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
67: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Param p_location_table_name '||p_location_table_name
68: ||' p_location_id '||p_location_id
69: ||' p_zone_type '||p_zone_type
70: ||' p_date '||p_date,
67: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Param p_location_table_name '||p_location_table_name
68: ||' p_location_id '||p_location_id
69: ||' p_zone_type '||p_zone_type
70: ||' p_date '||p_date,
71: p_msg_level=>fnd_log.level_statement);
72: END IF;
73:
74:
75: -- Validate zone type
101: AND status = 'A'
102: AND rownum = 1;
103: END;
104:
105: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
106: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>'For Zone type '||p_zone_type||' Relationship type count is '||l_count,
107: p_msg_level=>fnd_log.level_statement);
108: END IF;
109:
103: END;
104:
105: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
106: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>'For Zone type '||p_zone_type||' Relationship type count is '||l_count,
107: p_msg_level=>fnd_log.level_statement);
108: END IF;
109:
110: IF l_count = 0 THEN
111: x_return_status := FND_API.G_RET_STS_ERROR;
128: FROM hr_locations
129: WHERE location_id = p_location_id;
130: END IF;
131:
132: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
133: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Country Code for location '||p_location_id||' is '||l_country_code,
134: p_msg_level=>fnd_log.level_statement);
135: END IF;
136:
130: END IF;
131:
132: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
133: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Country Code for location '||p_location_id||' is '||l_country_code,
134: p_msg_level=>fnd_log.level_statement);
135: END IF;
136:
137:
138: EXCEPTION WHEN others THEN
148: WHERE location_table_name = p_location_table_name
149: AND location_id = p_location_id
150: AND rownum = 1;
151:
152: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
153: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For location '||p_location_id||' Geo Name References count is '||l_gnr_count,
154: p_msg_level=>fnd_log.level_statement);
155: END IF;
156:
150: AND rownum = 1;
151:
152: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
153: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For location '||p_location_id||' Geo Name References count is '||l_gnr_count,
154: p_msg_level=>fnd_log.level_statement);
155: END IF;
156:
157: -- Below code is commenmted for bug # 5011582
158: -- Will display the message after the end loop of included_geo_types
184: WHERE location_table_name = p_location_table_name
185: AND location_id = p_location_id
186: AND geography_type = l_ref_geo_type;
187:
188: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
189: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>'For geography_type '||l_ref_geo_type||' and Location '||
190: p_location_id||', Geography_id is '||l_geography_id,
191: p_msg_level=>fnd_log.level_statement);
192: END IF;
187:
188: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
189: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>'For geography_type '||l_ref_geo_type||' and Location '||
190: p_location_id||', Geography_id is '||l_geography_id,
191: p_msg_level=>fnd_log.level_statement);
192: END IF;
193:
194: EXCEPTION WHEN NO_DATA_FOUND THEN
195: l_geography_id := NULL;
203: AND geography_type = l_ref_geo_type
204: -- Bug 5410283 (Added on 07-Aug-2006)
205: AND p_date BETWEEN start_date AND end_date;
206: END IF;
207: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
208: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>'In Exception blk - For geography_type '||l_ref_geo_type||' and Location '||
209: p_location_id||', Geography_id is '||l_geography_id,
210: p_msg_level=>fnd_log.level_exception);
211: END IF;
206: END IF;
207: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
208: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>'In Exception blk - For geography_type '||l_ref_geo_type||' and Location '||
209: p_location_id||', Geography_id is '||l_geography_id,
210: p_msg_level=>fnd_log.level_exception);
211: END IF;
212:
213: END;
214:
219: FETCH c_get_zones INTO l_zone_id;
220: EXIT WHEN C_GET_ZONES%NOTFOUND;
221: l_zone_tbl(i).zone_id := l_zone_id;
222:
223: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
224: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For Geo Type '||l_ref_geo_type
225: ||' and Geograpphy Id '||l_geography_id
226: ||' Zone information :'||l_zone_id,
227: p_msg_level=>fnd_log.level_statement);
223: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
224: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For Geo Type '||l_ref_geo_type
225: ||' and Geograpphy Id '||l_geography_id
226: ||' Zone information :'||l_zone_id,
227: p_msg_level=>fnd_log.level_statement);
228: END IF;
229:
230: IF l_zone_id IS NOT NULL THEN
231: SELECT postal_code_range_flag, geography_use
232: INTO l_postal_code_range_flag, l_geography_use
233: FROM hz_geography_types_b
234: WHERE geography_type = p_zone_type;
235:
236: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
237: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For Geography Type '||p_zone_type
238: ||' postal_code_range_flag is '||l_postal_code_range_flag
239: ||' and geography_use is '||l_geography_use,
240: p_msg_level=>fnd_log.level_statement);
236: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
237: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For Geography Type '||p_zone_type
238: ||' postal_code_range_flag is '||l_postal_code_range_flag
239: ||' and geography_use is '||l_geography_use,
240: p_msg_level=>fnd_log.level_statement);
241: END IF;
242:
243: -- Postal code range flag is applicable only for eTax
244: -- if geography_use is not TAX then return the zone id
263: AND geography_type = p_zone_type
264: AND geography_use = 'TAX'
265: AND rownum = 1;
266:
267: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
268: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For Geo Type : '||p_zone_type
269: ||' and Geograpphy Id '||l_zone_id||' GEOGRAPHY Ranges count is ' ||l_count,
270: p_msg_level=>fnd_log.level_statement);
271: END IF;
266:
267: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
268: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For Geo Type : '||p_zone_type
269: ||' and Geograpphy Id '||l_zone_id||' GEOGRAPHY Ranges count is ' ||l_count,
270: p_msg_level=>fnd_log.level_statement);
271: END IF;
272: IF l_count > 0 THEN
273:
274: -- Removed PO_VENDOR_SITES_ALL from the below if condition. Bug # 4584465
286: INTO l_postal_code
287: FROM hz_locations
288: WHERE location_id = p_location_id;
289:
290: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
291: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For Location '||p_location_id||' Postal Code is '||l_postal_code,
292: p_msg_level=>fnd_log.level_statement);
293: END IF;
294:
288: WHERE location_id = p_location_id;
289:
290: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
291: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For Location '||p_location_id||' Postal Code is '||l_postal_code,
292: p_msg_level=>fnd_log.level_statement);
293: END IF;
294:
295:
296: END IF;
309: AND p_date between start_date and end_date
310: AND rownum = 1;
311:
312:
313: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
314: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For Geo Type : '||p_zone_type
315: ||' and Postal code range Geography Ranges count is ' ||l_count,
316: p_msg_level=>fnd_log.level_statement);
317: END IF;
312:
313: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
314: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For Geo Type : '||p_zone_type
315: ||' and Postal code range Geography Ranges count is ' ||l_count,
316: p_msg_level=>fnd_log.level_statement);
317: END IF;
318:
319:
320:
322: -- If count = 0,
323: l_zone_id := NULL;
324: l_zone_tbl(i).zone_id := l_zone_id;
325: i := i-1;
326: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
327: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Making Zone_id NULL in array. ',
328: p_msg_level=>fnd_log.level_statement);
329: END IF;
330: END IF;
324: l_zone_tbl(i).zone_id := l_zone_id;
325: i := i-1;
326: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
327: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Making Zone_id NULL in array. ',
328: p_msg_level=>fnd_log.level_statement);
329: END IF;
330: END IF;
331:
332: ELSE -- no range record found
359: FND_MSG_PUB.ADD;
360: RAISE FND_API.G_EXC_ERROR;
361: END IF;
362:
363: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
364: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Array l_zone_tbl Count is '||l_zone_tbl.COUNT,
365: p_msg_level=>fnd_log.level_statement);
366: END IF;
367:
361: END IF;
362:
363: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
364: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Array l_zone_tbl Count is '||l_zone_tbl.COUNT,
365: p_msg_level=>fnd_log.level_statement);
366: END IF;
367:
368: IF l_zone_tbl.COUNT > 0 THEN
369: i := l_zone_tbl.FIRST;
381: EXIT WHEN j = l_zone_tbl_final.LAST;
382: j := l_zone_tbl_final.NEXT(j);
383: END LOOP;
384:
385: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
386: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For '||l_zone_tbl(i).zone_id||' populate_tbl flag is '||l_populate_tbl,
387: p_msg_level=>fnd_log.level_statement);
388: END IF;
389:
383: END LOOP;
384:
385: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
386: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' For '||l_zone_tbl(i).zone_id||' populate_tbl flag is '||l_populate_tbl,
387: p_msg_level=>fnd_log.level_statement);
388: END IF;
389:
390: IF l_populate_tbl = 'Y' THEN
391: l_tbl_count := l_zone_tbl_final.COUNT;
399: -- Bug 5410283 (Added on 07-Aug-2006)
400: AND p_date BETWEEN start_date AND end_date;
401: l_zone_tbl_final(l_tbl_count+1).zone_type := p_zone_type;
402:
403: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
404: HZ_UTILITY_V2PUB.DEBUG(P_PREFIX=>L_DEBUG_PREFIX,P_MESSAGE=>' Array Index : '||TO_CHAR(L_TBL_COUNT+1)
405: ||' Zone Id '||TO_CHAR(L_ZONE_TBL_FINAL(L_TBL_COUNT+1).ZONE_ID)
406: ||' Zone Code '||TO_CHAR(L_ZONE_TBL_FINAL(L_TBL_COUNT+1).ZONE_CODE)
407: ||' Zone Name '||TO_CHAR(L_ZONE_TBL_FINAL(L_TBL_COUNT+1).ZONE_NAME)
405: ||' Zone Id '||TO_CHAR(L_ZONE_TBL_FINAL(L_TBL_COUNT+1).ZONE_ID)
406: ||' Zone Code '||TO_CHAR(L_ZONE_TBL_FINAL(L_TBL_COUNT+1).ZONE_CODE)
407: ||' Zone Name '||TO_CHAR(L_ZONE_TBL_FINAL(L_TBL_COUNT+1).ZONE_NAME)
408: ||' Zone Type '||TO_CHAR(L_ZONE_TBL_FINAL(L_TBL_COUNT+1).ZONE_TYPE)
409: , p_msg_level=>fnd_log.level_statement);
410: END IF;
411: EXCEPTION
412: WHEN NO_DATA_FOUND THEN
413: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
409: , p_msg_level=>fnd_log.level_statement);
410: END IF;
411: EXCEPTION
412: WHEN NO_DATA_FOUND THEN
413: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
414: HZ_UTILITY_V2PUB.DEBUG(P_PREFIX=>L_DEBUG_PREFIX,P_MESSAGE=>'Geography information is missing for geography_id '||l_zone_tbl(i).zone_id
415: ||'. Either data does not exists or out of date range.'
416: , p_msg_level=>fnd_log.level_exception);
417: END IF;
412: WHEN NO_DATA_FOUND THEN
413: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
414: HZ_UTILITY_V2PUB.DEBUG(P_PREFIX=>L_DEBUG_PREFIX,P_MESSAGE=>'Geography information is missing for geography_id '||l_zone_tbl(i).zone_id
415: ||'. Either data does not exists or out of date range.'
416: , p_msg_level=>fnd_log.level_exception);
417: END IF;
418: WHEN OTHERS THEN
419: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
420: HZ_UTILITY_V2PUB.DEBUG(P_PREFIX=>L_DEBUG_PREFIX,P_MESSAGE=>'Geography information is missing for geography_id ERRROR - '||SQLERRM
415: ||'. Either data does not exists or out of date range.'
416: , p_msg_level=>fnd_log.level_exception);
417: END IF;
418: WHEN OTHERS THEN
419: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
420: HZ_UTILITY_V2PUB.DEBUG(P_PREFIX=>L_DEBUG_PREFIX,P_MESSAGE=>'Geography information is missing for geography_id ERRROR - '||SQLERRM
421: , p_msg_level=>fnd_log.level_exception);
422: END IF;
423:
417: END IF;
418: WHEN OTHERS THEN
419: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
420: HZ_UTILITY_V2PUB.DEBUG(P_PREFIX=>L_DEBUG_PREFIX,P_MESSAGE=>'Geography information is missing for geography_id ERRROR - '||SQLERRM
421: , p_msg_level=>fnd_log.level_exception);
422: END IF;
423:
424: END;
425: END IF;
433: AND p_date BETWEEN start_date AND end_date;
434:
435: l_zone_tbl_final(i).zone_type := p_zone_type;
436:
437: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
438: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' First insert in l_zone_tbl_final ',
439: p_msg_level=>fnd_log.level_statement);
440: END IF;
441:
435: l_zone_tbl_final(i).zone_type := p_zone_type;
436:
437: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
438: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' First insert in l_zone_tbl_final ',
439: p_msg_level=>fnd_log.level_statement);
440: END IF;
441:
442: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
443: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Array Index : '||i
438: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' First insert in l_zone_tbl_final ',
439: p_msg_level=>fnd_log.level_statement);
440: END IF;
441:
442: IF fnd_log.level_statement>=fnd_log.g_current_runtime_level THEN
443: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Array Index : '||i
444: ||' Zone Id '||l_zone_tbl_final(i).zone_id
445: ||' Zone Code '||l_zone_tbl_final(i).zone_code
446: ||' Zone Name '||l_zone_tbl_final(i).zone_name,
443: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' Array Index : '||i
444: ||' Zone Id '||l_zone_tbl_final(i).zone_id
445: ||' Zone Code '||l_zone_tbl_final(i).zone_code
446: ||' Zone Name '||l_zone_tbl_final(i).zone_name,
447: p_msg_level=>fnd_log.level_statement);
448: END IF;
449: EXCEPTION
450: WHEN NO_DATA_FOUND THEN
451: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
447: p_msg_level=>fnd_log.level_statement);
448: END IF;
449: EXCEPTION
450: WHEN NO_DATA_FOUND THEN
451: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
452: HZ_UTILITY_V2PUB.DEBUG(P_PREFIX=>L_DEBUG_PREFIX,P_MESSAGE=>'Geography information is missing for geography_id '||l_zone_tbl(i).zone_id
453: ||'. Either data does not exists or out of date range.'
454: , p_msg_level=>fnd_log.level_exception);
455: END IF;
450: WHEN NO_DATA_FOUND THEN
451: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
452: HZ_UTILITY_V2PUB.DEBUG(P_PREFIX=>L_DEBUG_PREFIX,P_MESSAGE=>'Geography information is missing for geography_id '||l_zone_tbl(i).zone_id
453: ||'. Either data does not exists or out of date range.'
454: , p_msg_level=>fnd_log.level_exception);
455: END IF;
456: WHEN OTHERS THEN
457: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
458: HZ_UTILITY_V2PUB.DEBUG(P_PREFIX=>L_DEBUG_PREFIX,P_MESSAGE=>'Geography information is missing for geography_id ERRROR - '||SQLERRM
453: ||'. Either data does not exists or out of date range.'
454: , p_msg_level=>fnd_log.level_exception);
455: END IF;
456: WHEN OTHERS THEN
457: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
458: HZ_UTILITY_V2PUB.DEBUG(P_PREFIX=>L_DEBUG_PREFIX,P_MESSAGE=>'Geography information is missing for geography_id ERRROR - '||SQLERRM
459: , p_msg_level=>fnd_log.level_exception);
460: END IF;
461: END;
455: END IF;
456: WHEN OTHERS THEN
457: IF fnd_log.level_exception>=fnd_log.g_current_runtime_level THEN
458: HZ_UTILITY_V2PUB.DEBUG(P_PREFIX=>L_DEBUG_PREFIX,P_MESSAGE=>'Geography information is missing for geography_id ERRROR - '||SQLERRM
459: , p_msg_level=>fnd_log.level_exception);
460: END IF;
461: END;
462: END IF;
463: END IF;
466: END LOOP;
467: END IF;
468:
469: x_zone_tbl := l_zone_tbl_final;
470: IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
471: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' get_zone (-)',
472: p_msg_level=>fnd_log.level_procedure);
473: END IF;
474:
468:
469: x_zone_tbl := l_zone_tbl_final;
470: IF fnd_log.level_procedure>=fnd_log.g_current_runtime_level THEN
471: hz_utility_v2pub.debug(p_prefix=>l_debug_prefix,p_message=>' get_zone (-)',
472: p_msg_level=>fnd_log.level_procedure);
473: END IF;
474:
475: EXCEPTION
476: WHEN FND_API.G_EXC_ERROR THEN