To create a new employee.
As you could see in the client, the basic there are only five basic fields to create a new employee and the rest would be filled in thee next page,
Using this code snippet you could create those basic fields and hence a new employee would be created.
CompanyInfo companyInfo;
HcmEmploymentRecId newEmploymentRecId;
ValidFromDateTime employmentStartDateTime;
ValidToDateTime employmentEndDateTime;
HcmWorker newHcmWorker;
DirPerson dirPerson;
DirPersonName dirPersonName;
HcmEmploymentType hcmEmploymentType = HcmEmploymentType::Employee;
NumberSeq numberSeqPersonnelNum;
HcmPersonPrivateDetails HcmPersonPrivateDetails;
//HcmEmployment hcmEmployment;
HcmEmploymentType hcmEmployment;
HcmWorkerTitle hcmWorkerTitle;
DirParty dirparty;
DirPartyContactInfoView contactView;
HcmPersonDetails persondetails;
HcmPersonIdentificationNumber hcmPersonIdentificationNumber;
utcdatetime _validFrom = DateTimeUtil::utcNow();
Struct struct;
container ledgerDimension;
DimensionDefault DimensionDefault;
int k;
TransDate HireDate,DOB;
HcmPersonID Employeecode;
str FirstName,Title,MobilePhone,email,MaritalStatus,NationalityCode,NationalityName,PaymentMode,MiddleName,LastName;
str DepartmentCode,DepartmentName,SubDivisionCode,SubDivisionName,DivisionCode,DivisionName ,SectorCode, SectorName;
str DesignationCode,DesignationName,SponsorCode,SponsorDesc,MOLNo,PASSPORTNUMBER,Gender,BloodGroup,ReligionCategory,EmployeeCategory,Emiratization;
;
Employeecode = "0005292";
FirstName = "Aravind";
MiddleName = "";
LastName = "Swamy";
companyInfo = companyInfo::find();
newHcmWorker = HcmWorker::findByPersonnelNumber(Employeecode);
if(! newHcmWorker)
{
employmentStartDateTime = datetobeginUtcDateTime(HireDate, DateTimeUtil::getUserPreferredTimeZone());
employmentEndDateTime = DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::maxValue(), DateTimeUtil::getUserPreferredTimeZone());
dirPersonName.FirstName = FirstName;
dirPersonName.MiddleName = Middlename;
dirPersonName.LastName = LastName;
newHcmWorker = HcmWorker::find(HcmWorkerTransition::newCreateHcmWorker(dirPersonName
, Employeecode
, companyInfo.RecId
, hcmEmploymentType
, employmentStartDateTime
, employmentEndDateTime));
}
else
{
dirPersonName = DirPersonName::find(newHcmWorker.Person,true);
dirPersonName.FirstName = FirstName;
dirPersonName.MiddleName = Middlename;
dirPersonName.LastName = LastName;
dirPersonName.update();
}
As you could see in the client, the basic there are only five basic fields to create a new employee and the rest would be filled in thee next page,
Using this code snippet you could create those basic fields and hence a new employee would be created.
CompanyInfo companyInfo;
HcmEmploymentRecId newEmploymentRecId;
ValidFromDateTime employmentStartDateTime;
ValidToDateTime employmentEndDateTime;
HcmWorker newHcmWorker;
DirPerson dirPerson;
DirPersonName dirPersonName;
HcmEmploymentType hcmEmploymentType = HcmEmploymentType::Employee;
NumberSeq numberSeqPersonnelNum;
HcmPersonPrivateDetails HcmPersonPrivateDetails;
//HcmEmployment hcmEmployment;
HcmEmploymentType hcmEmployment;
HcmWorkerTitle hcmWorkerTitle;
DirParty dirparty;
DirPartyContactInfoView contactView;
HcmPersonDetails persondetails;
HcmPersonIdentificationNumber hcmPersonIdentificationNumber;
utcdatetime _validFrom = DateTimeUtil::utcNow();
Struct struct;
container ledgerDimension;
DimensionDefault DimensionDefault;
int k;
TransDate HireDate,DOB;
HcmPersonID Employeecode;
str FirstName,Title,MobilePhone,email,MaritalStatus,NationalityCode,NationalityName,PaymentMode,MiddleName,LastName;
str DepartmentCode,DepartmentName,SubDivisionCode,SubDivisionName,DivisionCode,DivisionName ,SectorCode, SectorName;
str DesignationCode,DesignationName,SponsorCode,SponsorDesc,MOLNo,PASSPORTNUMBER,Gender,BloodGroup,ReligionCategory,EmployeeCategory,Emiratization;
;
Employeecode = "0005292";
FirstName = "Aravind";
MiddleName = "";
LastName = "Swamy";
companyInfo = companyInfo::find();
newHcmWorker = HcmWorker::findByPersonnelNumber(Employeecode);
if(! newHcmWorker)
{
employmentStartDateTime = datetobeginUtcDateTime(HireDate, DateTimeUtil::getUserPreferredTimeZone());
employmentEndDateTime = DateTimeUtil::applyTimeZoneOffset(DateTimeUtil::maxValue(), DateTimeUtil::getUserPreferredTimeZone());
dirPersonName.FirstName = FirstName;
dirPersonName.MiddleName = Middlename;
dirPersonName.LastName = LastName;
newHcmWorker = HcmWorker::find(HcmWorkerTransition::newCreateHcmWorker(dirPersonName
, Employeecode
, companyInfo.RecId
, hcmEmploymentType
, employmentStartDateTime
, employmentEndDateTime));
}
else
{
dirPersonName = DirPersonName::find(newHcmWorker.Person,true);
dirPersonName.FirstName = FirstName;
dirPersonName.MiddleName = Middlename;
dirPersonName.LastName = LastName;
dirPersonName.update();
}
No comments:
Post a Comment