54: validation_value in varchar2) return boolean is
55: --
56: begin
57: --
58: hr_utility.set_location('HR_PAYMENTS.VALIDATE_MAGNETIC',1);
59: --
60: -- Check mand values for mag method are there.
61: --
62: if validate is null then
60: -- Check mand values for mag method are there.
61: --
62: if validate is null then
63: --
64: hr_utility.set_message(801,'HR_6227_PAYM_MAND_MAG_DETAILS');
65: hr_utility.raise_error;
66: return(false);
67: --
68: end if;
61: --
62: if validate is null then
63: --
64: hr_utility.set_message(801,'HR_6227_PAYM_MAND_MAG_DETAILS');
65: hr_utility.raise_error;
66: return(false);
67: --
68: end if;
69: --
74: -- Magnetic validation required. Days and values must be set
75: --
76: if validation_days is null or validation_value is null then
77: --
78: hr_utility.set_message(801,'HR_6228_PAYM_NO_VALIDATION');
79: hr_utility.raise_error;
80: return(false);
81: --
82: end if;
75: --
76: if validation_days is null or validation_value is null then
77: --
78: hr_utility.set_message(801,'HR_6228_PAYM_NO_VALIDATION');
79: hr_utility.raise_error;
80: return(false);
81: --
82: end if;
83: --
98: */
99: function check_ok_default(category in varchar2) return boolean is
100: begin
101: --
102: hr_utility.set_location('HR_PAYMENTS.CHECK_DEFAULT',1);
103: --
104: if category = 'CA' or category = 'CH' then
105: --
106: return(true);
106: return(true);
107: --
108: else
109: --
110: hr_utility.set_message(801,'HR_6229_PAYM_BAD_DEFAULT_TYPE');
111: hr_utility.raise_error;
112: return(false);
113: --
114: end if;
107: --
108: else
109: --
110: hr_utility.set_message(801,'HR_6229_PAYM_BAD_DEFAULT_TYPE');
111: hr_utility.raise_error;
112: return(false);
113: --
114: end if;
115: --
166: begin
167: --
168: -- One row each from EXA and PPT.
169: --
170: hr_utility.set_location('HR_PAYMENTS.CHECK_ACCOUNT',1);
171: --
172: select ppt.territory_code,
173: exa.territory_code
174: into required_territory,
179: and ppt.payment_type_id = type;
180: --
181: -- Check that they are the same and generate an error if not
182: --
183: hr_utility.set_location('HR_PAYMENTS.CHECK_ACCOUNT',2);
184: --
185: if required_territory <> actual_territory then
186: --
187: hr_utility.set_message(801,'HR_6220_PAYM_INVALID_ACT');
183: hr_utility.set_location('HR_PAYMENTS.CHECK_ACCOUNT',2);
184: --
185: if required_territory <> actual_territory then
186: --
187: hr_utility.set_message(801,'HR_6220_PAYM_INVALID_ACT');
188: hr_utility.set_message_token('TERITORY',required_territory);
189: hr_utility.raise_error;
190: return(false);
191: --
184: --
185: if required_territory <> actual_territory then
186: --
187: hr_utility.set_message(801,'HR_6220_PAYM_INVALID_ACT');
188: hr_utility.set_message_token('TERITORY',required_territory);
189: hr_utility.raise_error;
190: return(false);
191: --
192: else
185: if required_territory <> actual_territory then
186: --
187: hr_utility.set_message(801,'HR_6220_PAYM_INVALID_ACT');
188: hr_utility.set_message_token('TERITORY',required_territory);
189: hr_utility.raise_error;
190: return(false);
191: --
192: else
193: --
198: exception
199: --
200: when no_data_found then
201: --
202: hr_utility.set_message(801,'HR_6230_PAYM_NO_ACCT_TYPE');
203: hr_utility.raise_error;
204: return(false);
205: --
206: --
199: --
200: when no_data_found then
201: --
202: hr_utility.set_message(801,'HR_6230_PAYM_NO_ACCT_TYPE');
203: hr_utility.raise_error;
204: return(false);
205: --
206: --
207: end check_account;
221: opm_currency in varchar2) return boolean is
222: required_currency varchar2(16);
223: begin
224: --
225: hr_utility.set_location('HR_PAYMENTS.CHECK_CURRENCY',1);
226: --
227: select ppt.currency_code
228: into required_currency
229: from pay_payment_types ppt
232: -- Check that they are the same. If not report the error
233: --
234: if nvl(required_currency,opm_currency) <> opm_currency then
235: --
236: hr_utility.set_message(801,'HR_6231_PAYM_INVALID_CURRENCY');
237: hr_utility.set_message_token('CURRENCY',required_currency);
238: hr_utility.raise_error;
239: return(false);
240: --
233: --
234: if nvl(required_currency,opm_currency) <> opm_currency then
235: --
236: hr_utility.set_message(801,'HR_6231_PAYM_INVALID_CURRENCY');
237: hr_utility.set_message_token('CURRENCY',required_currency);
238: hr_utility.raise_error;
239: return(false);
240: --
241: else
234: if nvl(required_currency,opm_currency) <> opm_currency then
235: --
236: hr_utility.set_message(801,'HR_6231_PAYM_INVALID_CURRENCY');
237: hr_utility.set_message_token('CURRENCY',required_currency);
238: hr_utility.raise_error;
239: return(false);
240: --
241: else
242: --
247: exception
248: --
249: when no_data_found then
250: --
251: hr_utility.set_message(801,'HR_6232_PAYM_NO_TYPE');
252: hr_utility.raise_error;
253: return(false);
254: --
255: --
248: --
249: when no_data_found then
250: --
251: hr_utility.set_message(801,'HR_6232_PAYM_NO_TYPE');
252: hr_utility.raise_error;
253: return(false);
254: --
255: --
256: end check_currency;
273: bal_type varchar2(9);
274: bal_currency varchar2(16);
275: begin
276: --
277: hr_utility.set_location('HR_PAYMENTS.MATCH_CURRENCY',1);
278: --
279: if check_currency(type,opm_currency) then
280: --
281: select pdb.balance_type_id
323: begin
324: --
325: -- Get it then (if its there)
326: --
327: hr_utility.set_location('HR_PAYMENTS.GEN_BALANCE',1);
328: --
329: select pdb.defined_balance_id
330: into defined_balance
331: from pay_balance_types pbt,
345: exception
346: --
347: when no_data_found then
348: --
349: hr_utility.set_message(801,'HR_6233_PAYM_NO_PAY_BALANCE');
350: hr_utility.raise_error;
351: return(0);
352: --
353: end gen_balance;
346: --
347: when no_data_found then
348: --
349: hr_utility.set_message(801,'HR_6233_PAYM_NO_PAY_BALANCE');
350: hr_utility.raise_error;
351: return(0);
352: --
353: end gen_balance;
354: --
366: val_start_date in varchar2) return boolean is
367: dummy varchar2(2);
368: begin
369: --
370: hr_utility.set_location('HR_PAYMENTS.CHECK_PREPAY',1);
371: --
372: select 1
373: into dummy
374: from dual
392: exception
393: --
394: when no_data_found then
395: --
396: hr_utility.set_message(801,'HR_6234_PAYM_ENTRIES_EXIST');
397: hr_utility.raise_error;
398: return(false);
399: --
400: end check_prepay;
393: --
394: when no_data_found then
395: --
396: hr_utility.set_message(801,'HR_6234_PAYM_ENTRIES_EXIST');
397: hr_utility.raise_error;
398: return(false);
399: --
400: end check_prepay;
401: --
423: -- If there is a ppm which finishes after the validation start date, then
424: -- the (DE) delete is invalid. This case is given if no rows are returned
425: -- and is picked up in the error handler.
426: --
427: hr_utility.set_location('HR_PAYMENTS.CHECK_PPM',1);
428: --
429: select 1
430: into dummy
431: from dual
446: exception
447: --
448: when no_data_found then
449: --
450: hr_utility.set_message(801,'HR_6235_PAYM_EXISTING_PPMS');
451: hr_utility.raise_error;
452: return(false);
453: --
454: end check_ppm;
447: --
448: when no_data_found then
449: --
450: hr_utility.set_message(801,'HR_6235_PAYM_EXISTING_PPMS');
451: hr_utility.raise_error;
452: return(false);
453: --
454: end check_ppm;
455: --
469: begin
470: --
471: -- Check if any payrolls use this OPM whichare valid after the delete date.
472: --
473: hr_utility.set_location('HR_PAYMENTS.CHECK_DEFAULT',1);
474: --
475: select 'Y'
476: into valid_del
477: from dual
492: exception
493: --
494: when no_data_found then
495: --
496: hr_utility.set_message(801,'HR_6236_PAYM_USED_AS_DEFAULT');
497: hr_utility.raise_error;
498: return(false);
499: --
500: end check_default;
493: --
494: when no_data_found then
495: --
496: hr_utility.set_message(801,'HR_6236_PAYM_USED_AS_DEFAULT');
497: hr_utility.raise_error;
498: return(false);
499: --
500: end check_default;
501: --
522: return(true);
523: --
524: else
525: --
526: hr_utility.set_message(801,'HR_6221_PAYM_INVALID_PPM');
527: hr_utility.raise_error;
528: return(false);
529: --
530: end if;
523: --
524: else
525: --
526: hr_utility.set_message(801,'HR_6221_PAYM_INVALID_PPM');
527: hr_utility.raise_error;
528: return(false);
529: --
530: end if;
531: --
549: begin
550: --
551: -- Check if an account is specified and if so get the territory
552: --
553: hr_utility.set_location('HR_PAYMENTS.MT_CHECKS',1);
554: --
555: if account_id is null then
556: --
557: actual_territory := 'NONE';
570: exception
571: --
572: when no_data_found then
573: --
574: hr_utility.set_message(801,'HR_6223_PAYM_BAD_ACCT');
575: hr_utility.raise_error;
576: --
577: end;
578: --
571: --
572: when no_data_found then
573: --
574: hr_utility.set_message(801,'HR_6223_PAYM_BAD_ACCT');
575: hr_utility.raise_error;
576: --
577: end;
578: --
579: end if;
579: end if;
580: --
581: -- Now make sure its in the right territory (if required)
582: --
583: hr_utility.set_location('HR_PAYMENTS.MT_CHECKS',2);
584: --
585: select nvl(ppt.territory_code, 'NONE'),
586: ppt.category
587: into required_territory,
594: opm.effective_start_date and opm.effective_end_date;
595: --
596: -- Check the category. If it is 'MT' do the checks...
597: --
598: hr_utility.set_location('HR_PAYMENTS.MT_CHECKS',3);
599: --
600: if category = 'MT' then
601: --
602: if actual_territory <> required_territory then
602: if actual_territory <> required_territory then
603: --
604: if required_territory <> 'NONE' then
605: --
606: hr_utility.set_message(801,'HR_6220_PAYM_INVALID_ACT');
607: hr_utility.set_message_token('TERITORY',required_territory);
608: hr_utility.raise_error;
609: return(false);
610: --
603: --
604: if required_territory <> 'NONE' then
605: --
606: hr_utility.set_message(801,'HR_6220_PAYM_INVALID_ACT');
607: hr_utility.set_message_token('TERITORY',required_territory);
608: hr_utility.raise_error;
609: return(false);
610: --
611: end if;
604: if required_territory <> 'NONE' then
605: --
606: hr_utility.set_message(801,'HR_6220_PAYM_INVALID_ACT');
607: hr_utility.set_message_token('TERITORY',required_territory);
608: hr_utility.raise_error;
609: return(false);
610: --
611: end if;
612: end if;
618: exception
619: --
620: when no_data_found then
621: --
622: hr_utility.set_message(801,'HR_6224_PAYM_NO_OPM');
623: hr_utility.raise_error;
624: return(false);
625: --
626: end mt_checks;
619: --
620: when no_data_found then
621: --
622: hr_utility.set_message(801,'HR_6224_PAYM_NO_OPM');
623: hr_utility.raise_error;
624: return(false);
625: --
626: end mt_checks;
627: --
642: assignment in varchar2) return boolean is
643: duplicate varchar2(2);
644: begin
645: --
646: hr_utility.set_location('HR_PAYMENTS.UNIQUE_PRIORITY',1);
647: --
648: select 'N'
649: into duplicate
650: from sys.dual
667: exception
668: --
669: when no_data_found then
670: --
671: hr_utility.set_message(801,'HR_6225_PAYM_DUP_PRIORITY');
672: hr_utility.raise_error;
673: return false;
674: --
675: end unique_priority;
668: --
669: when no_data_found then
670: --
671: hr_utility.set_message(801,'HR_6225_PAYM_DUP_PRIORITY');
672: hr_utility.raise_error;
673: return false;
674: --
675: end unique_priority;
676: --
688: val_start_date in varchar2) return boolean is
689: status varchar2(2);
690: begin
691: --
692: hr_utility.set_location('HR_PAYMENTS.CHECK_PP',1);
693: --
694: -- WWbug 264094. Changed below from effective_date >= val_start_date to
695: -- effective_date > val_start_date. This has the effect of allowing the
696: -- delete if there are pre-payments on the deleteion date, providing there
710: and pa.effective_date > fnd_date.canonical_to_date(val_start_date));
711: --
712: -- If there is a row, then all is cool, but check anyhow to be defensive.
713: --
714: hr_utility.set_location('HR_PAYMENTS.CHECK_PP',2);
715: --
716: if status = 'Y' then
717: --
718: return true;
724: when no_data_found then
725: --
726: -- This means future PPs exist so flag it.
727: --
728: hr_utility.set_message(801,'HR_6226_PAYM_PPS_EXIST');
729: hr_utility.raise_error;
730: return false;
731: --
732: end check_pp;
725: --
726: -- This means future PPs exist so flag it.
727: --
728: hr_utility.set_message(801,'HR_6226_PAYM_PPS_EXIST');
729: hr_utility.raise_error;
730: return false;
731: --
732: end check_pp;
733: --