参考1:&NUM_DAYS = Abs(Days(HIRE_Date) - Days(RELEASE_Date));
参考2:
/*计算时间差直接用系统函数AgeInYears*/
/*来源于修改人员页面的日期计算*/
DeclareFunctionAgeInYears PeopleCode FUNCLIB_HR.AGE FieldFormula;
DeclareFunctionAgeInMonth PeopleCode FUNCLIB_HR.AGE FieldFormula;
SQLExec("SELECT SPG_WORKSTART_TIME,SPG_WORKEND_TIME FROMPS_SPG_WORKSTART_T",&START_TIME,&END_TIME);
SPG_WORKSTART_T.AGE_YEARS =AgeInYears(SPG_WORKSTART_T.SPG_WORKSTART_TIME,SPG_WORKSTART_T.SPG_WORKEND_TIME);
SPG_WORKSTART_T.AGE_MONTH =AgeInMonth(SPG_WORKSTART_T.SPG_WORKSTART_TIME,SPG_WORKSTART_T.SPG_WORKEND_TIME);
&SUM=SQLExec("selectSUM(AGE_YEARS),SUM(AGE_MONTH) fromps_spg_workstart_t", &SUMYEARS,&SUMMONTHS);
If &SUMMONTHS /12>0Then
SPG_YEARMON_WRK.AGE_YEARS =&SUMYEARS +&SUMMONTHS /12;
SPG_YEARMON_WRK.AGE_MONTH =(Mod(&SUMMONTHS,12));
End-If;
/*对输入逻辑错误的判断,如两个时间段中间还夹杂有其他的时间段,在grid中点添加时提示输入错误*/ &RS1 = GetLevel0(); Local Rowset &WrkDeRs;
&WrkDeRs = GetLevel0()(1).GetRowset(Scroll.SPG_WORKSTART_T); If &WrkDeRs.RowCount >1Then &CURRENTIME_ST = SPG_WORKSTART_T.SPG_WORKSTART_TIME.Value; &CURRENTIME_END = SPG_WORKSTART_T.SPG_WORKEND_TIME.Value; For &I =1To &WrkDeRs.RowCount &TIME_END = &WrkDeRs(&I).SPG_WORKSTART_T.SPG_WORKSTART_TIME.Value; &TIME_BEGIN = &WrkDeRs(&I).SPG_WORKSTART_T.SPG_WORKEND_TIME.Value; REM Warning &TIME_BEGIN;
Warning &CURRENTIME_ST; REM Warning SPG_WORK_DE_TBL.SPG_WORK_DE_ST.Value; If(&CURRENTIME_ST > &TIME_BEGIN)And (&CURRENTIME_ST < &TIME_END)Or (&CURRENTIME_END > &TIME_BEGIN)And (&CURRENTIME_END < &TIME_END)Then |