256: and ptp.end_date > p_start_date;
257:
258: cursor c_terminated(p_asg in NUMBER) is
259: select actual_termination_date,
260: last_standard_process_date,
261: final_process_date
262: from per_periods_of_service pos,
263: fnd_sessions ses,
264: per_all_assignments_f asg
265: where asg.assignment_id = p_asg
266: and ses.session_id = userenv('sessionid')
267: and ses.effective_date between asg.effective_start_date and asg.effective_end_date
268: and asg.person_id = pos.person_id
269: and ses.effective_date between pos.date_start and pos.last_standard_process_date
270: and pos.actual_termination_date is not null;
271:
272: cursor c_periods_left(p_asg in NUMBER,
273: p_termination_date in DATE) is
280: and ptp.end_date >= p_start_date;
281:
282: l_dummy VARCHAR2(2);
283: l_actual_termination_date DATE;
284: l_last_standard_process_date DATE;
285: l_final_process_date DATE;
286: l_date_to_check DATE;
287: l_periods_left NUMBER;
288: l_periods_within_check NUMBER := 3;
339: close c_tax_credit_starting;
340:
341: open c_terminated(p_assignment_id);
342: fetch c_terminated into l_actual_termination_date,
343: l_last_standard_process_date,
344: l_final_process_date;
345: if c_terminated%FOUND then
346: --
347: -- Employee has been terminated
347: -- Employee has been terminated
348: -- Work out which date to check
349: --
350: close c_terminated;
351: if l_last_standard_process_date is not null then
352: l_date_to_check := l_last_standard_process_date;
353: else
354: l_date_to_check := l_actual_termination_date;
355: end if;
348: -- Work out which date to check
349: --
350: close c_terminated;
351: if l_last_standard_process_date is not null then
352: l_date_to_check := l_last_standard_process_date;
353: else
354: l_date_to_check := l_actual_termination_date;
355: end if;
356: --