Thursday, 3 November 2016


Calculate EmpExperienceusing Run Base batch

Form Path:- Human resources/Common/Workers/Workers:-
-------------------------------------------------------

if we edit any one worker record in that form another form should be open by clicking edit button.
there is a tab called Employeement tab in that we have
"Employeement Start Date and EmployeeMent End Date"
in that tab add  one more field called WorkerExperence field.

If Emp End Date = SystemDateToday() should not calculate Total expereance else calculate Total expereance.

To achieve this scenario we have to wor k on run base batch;-

duplicate the Tutorial_RunBaseBatch class:-

Tutorial_RunBaseBatch class--->Run()

ClassDeclaration:-

DialogField     dlgCustAccount;
    DialogField     dlgTransDate;
    HcmEmployment   employement;
    date             fromdate,todate;
;


Tutorial_RunBaseBatch class--->Run()
        ttsbegin;
        while select forupdate employement
        {
            fromdate = DateTimeUtil::date(employement.ValidFrom);
            todate = DateTimeUtil::date(employement.ValidTo);
            employement.ValidTimeStateUpdateMode (ValidTimeStateUpdate::Correction);

         if(todate!=today())
         {
            employement.EmployeeExperiance = -Global::yearDiff(fromdate,today());
            employement.update();
         }
          else if(todate <= today())
        {
            employement.EmployeeExperiance = 0;
            employement.update();

        }

        }
        ttscommit;

No comments:

Post a Comment