48: -- Added a session date parameter and changed
49: -- the view to base table
50: CURSOR retro_pay_trans(session_date DATE) IS
51: SELECT 'R', retro_batch_id
52: FROM hxt_det_hours_worked_f
53: WHERE tim_id = p_tim_id
54: AND session_date BETWEEN effective_start_date
55: AND effective_end_date
56: AND pay_status = 'R';
56: AND pay_status = 'R';
57:
58: CURSOR complete_pay_trans IS
59: SELECT 'R'
60: FROM hxt_det_hours_worked_f
61: WHERE tim_id = p_tim_id
62: AND pay_status = 'C';
63:
64: CURSOR retro_pa_trans IS
62: AND pay_status = 'C';
63:
64: CURSOR retro_pa_trans IS
65: SELECT 'R'
66: FROM hxt_det_hours_worked_f
67: WHERE tim_id = p_tim_id
68: AND pa_status = 'R';
69:
70: CURSOR complete_pa_trans IS
68: AND pa_status = 'R';
69:
70: CURSOR complete_pa_trans IS
71: SELECT 'R'
72: FROM hxt_det_hours_worked_f
73: WHERE tim_id = p_tim_id
74: AND pa_status = 'C';
75:
76: CURSOR check_for_details IS
80: WHERE tim.id = p_tim_id
81: AND tbs.batch_id = tim.batch_id
82: AND tbs.status = 'VT'
83: AND NOT EXISTS (SELECT '1'
84: FROM hxt_det_hours_worked_f det
85: WHERE det.tim_id = tim.id
86: AND NVL(det.hours,0) > 0);
87:
88: -- Bug 9367730
385: -- Modifications
386: -- 2/15/96 Changed line_status field write to always be null as children
387: -- hours worked records do not need their parents' status. AVS
388: -- 4/23/97 Added the get_ovt_rates_cur to fetch premium types and amounts
389: -- which need to be inserted into hxt_det_hours_worked table.
390: -- Fixed under Oracle Bugs #465434 & #464850.
391: -- 1/07/98 SIR69 Cursor get_ovt_rates_cur now handles all premiums and
392: -- not just overtime. Was ignoring earn types of OTH etc.
393: -- 1/22/98 SIR092 Hours are not written to premium types of FIXED.
391: -- 1/07/98 SIR69 Cursor get_ovt_rates_cur now handles all premiums and
392: -- not just overtime. Was ignoring earn types of OTH etc.
393: -- 1/22/98 SIR092 Hours are not written to premium types of FIXED.
394: --
395: v_amount hxt_det_hours_worked.amount%type := null; --SIR029
396: l_costable_type PAY_ELEMENT_LINKS_F.COSTABLE_TYPE%TYPE;
397: l_ffv_cost_center_id HXT_DET_HOURS_WORKED_F.FFV_COST_CENTER_ID%TYPE;
398:
399: CURSOR next_id_cur IS
393: -- 1/22/98 SIR092 Hours are not written to premium types of FIXED.
394: --
395: v_amount hxt_det_hours_worked.amount%type := null; --SIR029
396: l_costable_type PAY_ELEMENT_LINKS_F.COSTABLE_TYPE%TYPE;
397: l_ffv_cost_center_id HXT_DET_HOURS_WORKED_F.FFV_COST_CENTER_ID%TYPE;
398:
399: CURSOR next_id_cur IS
400: SELECT hxt_seqno.nextval next_id
401: FROM dual;
430: l_rate_multiple hxt_pay_element_types_f_ddf_v.hxt_premium_amount%TYPE ;
431: l_hourly_rate hxt_pay_element_types_f_ddf_v.hxt_premium_amount%TYPE ;
432: l_amount hxt_pay_element_types_f_ddf_v.hxt_premium_amount%TYPE ;
433:
434: l_hours hxt_det_hours_worked_f.hours%TYPE ; -- SIR092
435: -- *********************************
436: -- ORACLE END Bugs #465434 & #464850
437: -- *********************************
438:
583: hr_utility.trace('l_ffv_cost_center_id :'||l_ffv_cost_center_id);
584: end if;
585: END IF;
586:
587: /* INSERT INTO hxt_det_hours_worked_f(id,
588: parent_id,
589: tim_id,
590: date_worked,
591: assignment_id,
655: --g_group_id
656: ); */
657:
658:
659: /* Call dml to insert hours into hxt_det_hours_worked_f */
660: if g_debug then
661: hr_utility.set_location('hxt_time_pay.INSERT_HRS',140);
662: end if;
663:
660: if g_debug then
661: hr_utility.set_location('hxt_time_pay.INSERT_HRS',140);
662: end if;
663:
664: hxt_dml.insert_HXT_DET_HOURS_WORKED(
665: p_rowid => l_rowid,
666: p_id => p_id,
667: p_parent_id => g_id,
668: p_tim_id => g_tim_id,
812: -- Premium override multiple
813: l_rate hxt_pay_element_types_f_ddf_v.hxt_premium_amount%TYPE;
814: -- Premium override rate ORA131
815:
816: l_hours hxt_det_hours_worked_f.hours%TYPE ; -- SIR092
817: l_time_in hxt_det_hours_worked_f.time_in%TYPE ;
818: l_time_out hxt_det_hours_worked_f.time_out%TYPE ;
819: l_seqno NUMBER; -- Line seqno
820: l_error_code NUMBER DEFAULT 0; -- Default to no error
813: l_rate hxt_pay_element_types_f_ddf_v.hxt_premium_amount%TYPE;
814: -- Premium override rate ORA131
815:
816: l_hours hxt_det_hours_worked_f.hours%TYPE ; -- SIR092
817: l_time_in hxt_det_hours_worked_f.time_in%TYPE ;
818: l_time_out hxt_det_hours_worked_f.time_out%TYPE ;
819: l_seqno NUMBER; -- Line seqno
820: l_error_code NUMBER DEFAULT 0; -- Default to no error
821: l_location VARCHAR2(120); -- Current Path for locating source
814: -- Premium override rate ORA131
815:
816: l_hours hxt_det_hours_worked_f.hours%TYPE ; -- SIR092
817: l_time_in hxt_det_hours_worked_f.time_in%TYPE ;
818: l_time_out hxt_det_hours_worked_f.time_out%TYPE ;
819: l_seqno NUMBER; -- Line seqno
820: l_error_code NUMBER DEFAULT 0; -- Default to no error
821: l_location VARCHAR2(120); -- Current Path for locating source
822: -- of errors
825: l_min_detail_seqno NUMBER;
826: l_max_detail_seqno NUMBER;
827:
828: l_costable_type pay_element_links_f.costable_type%TYPE;
829: l_ffv_cost_center_id hxt_det_hours_worked_f.ffv_cost_center_id%TYPE;
830:
831: l_rowid ROWID;
832: l_object_version_number NUMBER DEFAULT NULL;
833: l_id NUMBER;
938: -- Get the minimum sequence number of the current detail row
939: --
940:
941: -- Bug 7359347
942: -- Changed the below cursor to work with HXT_DET_HOURS_WORKED_F
943: -- rather than HXT_DET_HOURS_WORKED to avoid contention on FND_SESSIONS
944: /*
945: CURSOR get_min_detail_seqno IS
946: SELECT seqno
939: --
940:
941: -- Bug 7359347
942: -- Changed the below cursor to work with HXT_DET_HOURS_WORKED_F
943: -- rather than HXT_DET_HOURS_WORKED to avoid contention on FND_SESSIONS
944: /*
945: CURSOR get_min_detail_seqno IS
946: SELECT seqno
947: FROM hxt_det_hours_worked
943: -- rather than HXT_DET_HOURS_WORKED to avoid contention on FND_SESSIONS
944: /*
945: CURSOR get_min_detail_seqno IS
946: SELECT seqno
947: FROM hxt_det_hours_worked
948: WHERE id = p_BASE_ID;
949: --
950: -- Get the maximum sequence number of the current detail row
951: --
952: CURSOR get_max_detail_seqno IS
953: SELECT nvl(min(hrw.seqno),9999)
954: FROM hxt_pay_element_types_f_ddf_v eltv
955: ,pay_element_types_f elt
956: ,hxt_det_hours_worked hrw
957: WHERE hrw.tim_id = g_TIM_ID
958: AND hrw.date_worked = g_DATE_WORKED
959: AND hrw.parent_id = g_ID
960: AND hrw.seqno > l_min_detail_seqno
993: FROM hxt_pay_element_types_f_ddf_v eltv,
994: pay_element_types_f elt,
995: pay_element_types_f_tl eltt,
996: hxt_prem_interact_rules pir,
997: hxt_det_hours_worked hrw -- C421
998: WHERE hrw.tim_id = g_TIM_ID
999: AND hrw.date_worked = g_DATE_WORKED
1000: AND hrw.parent_id = g_ID -- same parent as base record
1001: AND pir.elt_prior_prem_id = hrw.element_type_id
1020: */
1021:
1022: CURSOR get_min_detail_seqno IS
1023: SELECT seqno
1024: FROM hxt_det_hours_worked_f
1025: WHERE id = p_BASE_ID
1026: AND g_pay_session_date BETWEEN effective_start_date
1027: AND effective_end_date;
1028: --
1031: CURSOR get_max_detail_seqno IS
1032: SELECT nvl(min(hrw.seqno),9999)
1033: FROM hxt_pay_element_types_f_ddf_v eltv
1034: ,pay_element_types_f elt
1035: ,hxt_det_hours_worked_f hrw
1036: WHERE hrw.tim_id = g_TIM_ID
1037: AND hrw.date_worked = g_DATE_WORKED
1038: AND hrw.parent_id = g_ID
1039: AND g_pay_session_date BETWEEN hrw.effective_start_date
1057: FROM hxt_pay_element_types_f_ddf_v eltv,
1058: pay_element_types_f elt,
1059: pay_element_types_f_tl eltt,
1060: hxt_prem_interact_rules pir,
1061: hxt_det_hours_worked_f hrw -- C421
1062: WHERE hrw.tim_id = g_TIM_ID
1063: AND hrw.date_worked = g_DATE_WORKED
1064: AND hrw.parent_id = g_ID -- same parent as base record
1065: AND pir.elt_prior_prem_id = hrw.element_type_id
1265:
1266: -- i.e.,IF the shift differential override is applicable to the time_in and
1267: -- time_outs ,then p_sdf_id has been set to g_sdovr_id n hxt_time_summary.
1268: -- gen_details ,so that the cursor cur_elig_prem returns a row and the
1269: -- logic gets called to insert the data into hxt_det_hours_worked
1270:
1271: if g_debug then
1272: hr_utility.set_location('hxt_time_pay.Gen_Premiums',64.3);
1273: end if;
1568:
1569: if g_debug then
1570: hr_utility.set_location('hxt_time_pay.Gen_Premiums',340);
1571: end if;
1572: UPDATE hxt_det_hours_worked_f hrw
1573: SET rate_multiple = l_mult
1574: WHERE hrw.rowid = hrw_rowid;
1575: EXCEPTION
1576: WHEN OTHERS THEN
1601:
1602: if g_debug then
1603: hr_utility.set_location('hxt_time_pay.Gen_Premiums',380);
1604: end if;
1605: UPDATE hxt_det_hours_worked_f hrw
1606: SET hourly_rate = l_rate
1607: WHERE hrw.rowid = hrw_rowid;
1608: EXCEPTION
1609: WHEN OTHERS THEN
1677: hr_utility.set_location('hxt_time_pay.Gen_Premiums',450);
1678: end if;
1679:
1680:
1681: /* INSERT into hxt_det_hours_worked_f
1682: (ID,PARENT_ID,TIM_ID,
1683: DATE_WORKED,ASSIGNMENT_ID,
1684: HOURS,TIME_IN,TIME_OUT,
1685: ELEMENT_TYPE_ID,FCL_EARN_REASON_CODE,
1754: hr_utility.trace('l_hourly_rate :'||l_hourly_rate);
1755: hr_utility.trace('l_amount :'||l_amount);
1756: hr_utility.set_location('hxt_time_pay.Gen_Premiums',460);
1757: end if;
1758: hxt_dml.insert_HXT_DET_HOURS_WORKED(
1759: p_rowid => l_rowid,
1760: p_id => l_id,
1761: p_parent_id => g_id,
1762: p_tim_id => g_tim_id,
1879: -- Changed the below cursor to use base table instead of view.
1880: /*
1881: CURSOR next_seq_cur IS
1882: SELECT nvl(max(seqno),0) next_seq
1883: FROM hxt_det_hours_worked --C421
1884: WHERE parent_id = g_id
1885: AND tim_id = g_tim_id
1886: AND date_worked = g_date_worked;
1887: */
1886: AND date_worked = g_date_worked;
1887: */
1888: CURSOR next_seq_cur IS
1889: SELECT nvl(max(seqno),0) next_seq
1890: FROM hxt_det_hours_worked_f --C421
1891: WHERE parent_id = g_id
1892: AND tim_id = g_tim_id
1893: AND g_pay_session_date BETWEEN effective_start_date
1894: AND effective_end_date