save profile salary

This commit is contained in:
kittapath 2025-01-08 14:15:28 +07:00
parent 3a0fc39397
commit 479e9a3938
14 changed files with 817 additions and 129 deletions

View file

@ -46,7 +46,7 @@ export class ImportDataController extends Controller {
private profileFamilyCoupleRepository = AppDataSource.getRepository(ProfileFamilyCouple);
private profileFamilyMotherRepository = AppDataSource.getRepository(ProfileFamilyMother);
private profileFamilyFatherRepository = AppDataSource.getRepository(ProfileFamilyFather);
private salaryRepository = AppDataSource.getRepository(ProfileSalary);
private salaryRepo = AppDataSource.getRepository(ProfileSalary);
private profileRepo = AppDataSource.getRepository(Profile);
private profileEmpRepo = AppDataSource.getRepository(ProfileEmployee);
private posLevelRepo = AppDataSource.getRepository(PosLevel);
@ -323,14 +323,36 @@ export class ImportDataController extends Controller {
const SALARY: any =
item.SALARY == null || item.SALARY == "" ? null_ : Number(item.SALARY);
profileSalary.amount = SALARY;
const SAL_POS_AMOUNT_1: any =
item.SAL_POS_AMOUNT_1 == null || item.SAL_POS_AMOUNT_1 == ""
? null_
: Number(item.SAL_POS_AMOUNT_1);
const SAL_POS_AMOUNT_2: any =
item.SAL_POS_AMOUNT_2 == null || item.SAL_POS_AMOUNT_2 == ""
? null_
: Number(item.SAL_POS_AMOUNT_2);
profileSalary.positionSalaryAmount = SAL_POS_AMOUNT_1 ?? SAL_POS_AMOUNT_2;
const SPECIAL_AMT: any =
item.SPECIAL_AMT == null || item.SPECIAL_AMT == "" ? null_ : Number(item.SPECIAL_AMT);
profileSalary.amountSpecial = SPECIAL_AMT;
profileSalary.profileId = _item.id;
profileSalary.refCommandNo = item.MP_COMMAND_NUM;
profileSalary.posNo = item.POS_NUM_NAME + item.POS_NUM_CODE;
profileSalary.position = item.FLAG_TO_NAME;
profileSalary.positionLine = item.WORK_LINE_NAME;
profileSalary.position = item.WORK_LINE_NAME;
profileSalary.positionPathSide = item.SPECIALIST_NAME;
profileSalary.positionExecutive = item.ADMIN_NAME;
profileSalary.templateDoc = item.REMARK;
profileSalary.refCommandDate =
item.MP_COMMAND_DATE == ""
? null_
: new Date(item.MP_COMMAND_DATE.replace(" +0700 +07:00", ""));
profileSalary.refCommandCode = item.FLAG_TO_NAME_CODE;
profileSalary.refCommandName = item.FLAG_TO_NAME;
profileSalary.orgRoot = item.DEPARTMENT_NAME;
profileSalary.orgChild1 = item.DIVISION_NAME;
profileSalary.orgChild2 = item.SECTION_NAME;
profileSalary.orgChild3 = item.JOB_NAME;
profileSalary.mpCee = item.MP_CEE;
const ORDER_MOVE_POSITION: any =
item.ORDER_MOVE_POSITION == null || item.ORDER_MOVE_POSITION == ""
? null_
@ -340,10 +362,16 @@ export class ImportDataController extends Controller {
profileSalary.createdFullName = request.user.name;
profileSalary.lastUpdateUserId = request.user.sub;
profileSalary.lastUpdateFullName = request.user.name;
profileSalary.createdAt = new Date();
profileSalary.lastUpdatedAt = new Date();
profileSalary.createdAt =
item.USER_CREATE == ""
? null_
: new Date(item.USER_CREATE.replace(" +0700 +07:00", ""));
profileSalary.lastUpdatedAt =
item.USER_UPDATE == ""
? null_
: new Date(item.USER_UPDATE.replace(" +0700 +07:00", ""));
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
await this.salaryRepository.save(profileSalary);
await this.salaryRepo.save(profileSalary);
}),
);
}),
@ -407,14 +435,36 @@ export class ImportDataController extends Controller {
const SALARY: any =
item.SALARY == null || item.SALARY == "" ? null_ : Number(item.SALARY);
profileSalary.amount = SALARY;
const SAL_POS_AMOUNT_1: any =
item.SAL_POS_AMOUNT_1 == null || item.SAL_POS_AMOUNT_1 == ""
? null_
: Number(item.SAL_POS_AMOUNT_1);
const SAL_POS_AMOUNT_2: any =
item.SAL_POS_AMOUNT_2 == null || item.SAL_POS_AMOUNT_2 == ""
? null_
: Number(item.SAL_POS_AMOUNT_2);
profileSalary.positionSalaryAmount = SAL_POS_AMOUNT_1 ?? SAL_POS_AMOUNT_2;
const SPECIAL_AMT: any =
item.SPECIAL_AMT == null || item.SPECIAL_AMT == "" ? null_ : Number(item.SPECIAL_AMT);
profileSalary.amountSpecial = SPECIAL_AMT;
profileSalary.profileEmployeeId = _item.id;
profileSalary.refCommandNo = item.MP_COMMAND_NUM;
profileSalary.posNo = item.POS_NUM_NAME + item.POS_NUM_CODE;
// profileSalary.position = item.FLAG_TO_NAME;
profileSalary.position = item.WORK_LINE_NAME;
profileSalary.positionPathSide = item.SPECIALIST_NAME;
profileSalary.positionExecutive = item.ADMIN_NAME;
profileSalary.templateDoc = item.REMARK;
profileSalary.refCommandDate =
item.MP_COMMAND_DATE == ""
? null_
: new Date(item.MP_COMMAND_DATE.replace(" +0700 +07:00", ""));
profileSalary.refCommandCode = item.FLAG_TO_NAME_CODE;
profileSalary.refCommandName = item.FLAG_TO_NAME;
profileSalary.orgRoot = item.DEPARTMENT_NAME;
profileSalary.orgChild1 = item.DIVISION_NAME;
profileSalary.orgChild2 = item.SECTION_NAME;
profileSalary.orgChild3 = item.JOB_NAME;
profileSalary.mpCee = item.MP_CEE;
const ORDER_MOVE_POSITION: any =
item.ORDER_MOVE_POSITION == null || item.ORDER_MOVE_POSITION == ""
? null_
@ -424,10 +474,16 @@ export class ImportDataController extends Controller {
profileSalary.createdFullName = request.user.name;
profileSalary.lastUpdateUserId = request.user.sub;
profileSalary.lastUpdateFullName = request.user.name;
profileSalary.createdAt = new Date();
profileSalary.lastUpdatedAt = new Date();
profileSalary.createdAt =
item.USER_CREATE == ""
? null_
: new Date(item.USER_CREATE.replace(" +0700 +07:00", ""));
profileSalary.lastUpdatedAt =
item.USER_UPDATE == ""
? null_
: new Date(item.USER_UPDATE.replace(" +0700 +07:00", ""));
console.log(">>>>>>>>>>>>>>>>>>>" + rowCount);
await this.salaryRepository.save(profileSalary);
await this.salaryRepo.save(profileSalary);
}),
);
}),