1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152
| Function inputJob(&perRcd As Record) Returns string Local ApiObject &oJobCollection, &oJob; Local ApiObject &oCompensationCollection, &oCompensation; try &oSession = %Session; rem ***** Set the PeopleSoft Session Error Message Mode *****; rem ***** 0 - None *****; rem ***** 1 - PSMessage Collection only (default) *****; rem ***** 2 - Message Box only *****; rem ***** 3 - Both collection and message box *****; &oSession.PSMessagesMode = 1; rem ***** Get the Component Interface *****; &oCJobDataEmpCi = &oSession.GetCompIntfc(CompIntfc.C_JOB_DATA_EMP_CI); If &oCJobDataEmpCi = Null Then &rtnMsg = errorHandler(); REM throw CreateException(0, 0, "GetCompIntfc failed"); End-If; rem ***** Set the Component Interface Mode *****; &oCJobDataEmpCi.InteractiveMode = False; &oCJobDataEmpCi.GetHistoryItems = True; &oCJobDataEmpCi.EditHistoryItems = False; rem ***** Set Component Interface Get/Create Keys *****; &oCJobDataEmpCi.EMPLID = &perRcd.EMPLID.Value; &oCJobDataEmpCi.EMPL_RCD = 0; rem If Not &oCJobDataEmpCi.Get() Then rem ***** No rows exist for the specified keys.*****; rem &rtnMsg = errorHandler(); rem throw CreateException(0, 0, "Get failed"); rem End-If; rem ***** Execute Create ******; If Not &oCJobDataEmpCi.Create() Then; rem ***** Unable to Create Component Interface for the Add keys provided. *****; &rtnMsg = errorHandler(); rem throw CreateException(0, 0, "Create failed"); Else &oJobCollection = &oCJobDataEmpCi.JOB; Local integer &i164; For &i164 = 1 To &oJobCollection.Count; &oJob = &oJobCollection.Item(&i164); &oJob.EFFDT_0 = &perRcd.HIRE_DT.Value; rem &oJob.EFFSEQ = [*]; &oJob.DEPTID = &perRcd.DEPTID.Value;; rem &oJob.JOBCODE = [*]; &oJob.SUPERVISOR_ID = &perRcd.SUPERVISOR_ID.Value;
&oJob.COMPANY = &perRcd.COMPANYID.Value;
&oJob.EMPL_CLASS = &perRcd.EMPL_CLASS.Value;
&oJob.PAY_SYSTEM_FLG = "OT"; &oJob.BUSINESS_UNIT = &perRcd.BUSINESS_UNIT.Value; &oJob.C_STD_POSN_ID = &perRcd.C_POSITION_ID.Value; rem WinMessage(&perRcd.C_POSN_RANK_ID.Value); rem &oJob.C_POSN_RANK_ID = &perRcd.C_POSN_RANK_ID.Value; &oJob.C_LINE_MANAGEMENT = &perRcd.C_LINE_MANAGEMENT.Value; &oJob.COUNTRY_0 = &perRcd.COUNTRY.Value; &oJob.CITY = &perRcd.CITY.Value; &oJob.C_HIR_MNG_ID = &perRcd.C_HIR_MNG_ID.Value; &oJob.C_IS_EXIST_HC = &perRcd.C_IS_EXIST_HC.Value; rem &oJob.C_ACTION_SUBREASON = [*]; rem Local string &cSalaryType; rem SQLExec("SELECT h.C_SALARY_TYPE FROM PS_C_HIRE_TBL h WHERE h.emplid = :1 ", &perRcd.EMPLID.Value, &cSalaryType); rem &oJob.C_SALARY_TYPE = &cSalaryType; &oJob.C_SALARY_TYPE = &perRcd.C_SALARY_TYPE.Value;
Local Rowset &xcRs = CreateRowset(Record.C_HIRE_XC_TBL); &xcRs.Fill(" WHERE emplid = :1", &perRcd.EMPLID.Value); rem ***** Set COMPENSATION Collection Field Properties -- Parent: JOB Collection *****; &oCompensationCollection = &oJob.COMPENSATION; Local integer &i29; For &i29 = 1 To &xcRs.ActiveRowCount; If &i29 = 1 Then &oCompensation = &oCompensationCollection.Item(1); Else &oCompensation = &oCompensationCollection.insertItem(1); End-If; &oCompensation.COMP_EFFSEQ = &xcRs.GetRow(&i29).C_HIRE_XC_TBL.COMP_EFFSEQ.Value; &oCompensation.COMP_RATECD = &xcRs.GetRow(&i29).C_HIRE_XC_TBL.COMP_RATECD.Value; &oCompensation.COMP_RATE_POINTS = &xcRs.GetRow(&i29).C_HIRE_XC_TBL.COMP_RATE_POINTS.Value; &oCompensation.COMPRATE_0 = &xcRs.GetRow(&i29).C_HIRE_XC_TBL.COMPRATE.Value; &oCompensation.COMP_PCT = &xcRs.GetRow(&i29).C_HIRE_XC_TBL.COMP_PCT.Value; &oCompensation.COMP_FREQUENCY_0 = &xcRs.GetRow(&i29).C_HIRE_XC_TBL.COMP_FREQUENCY.Value; &oCompensation.CURRENCY_CD_0 = &xcRs.GetRow(&i29).C_HIRE_XC_TBL.CURRENCY_CD.Value; End-For; End-For; rem ***** Execute Save *****; If Not &oCJobDataEmpCi.Save() Then; &rtnMsg = errorHandler(); rem throw CreateException(0, 0, "Save failed"); End-If; End-If;
catch Exception &ex &rtnMsg = &ex.ToString(); end-try;
Return &rtnMsg; End-Function;
|