Merge branch 'develop' of github.com:Frappet/hrms-api-org into develop

This commit is contained in:
mamoss 2025-07-21 23:30:45 +07:00
commit 37b324babf
8 changed files with 34 additions and 15 deletions

View file

@ -1783,7 +1783,7 @@ export class CommandController extends Controller {
? Extension.ToThaiNumber(shortName)
: "-"
: Extension.ToThaiNumber(
`${profile?.rootShortNameTemp}${profile?.posMasterNoTemp}`,
`${profile?.rootShortNameTemp} ${profile?.posMasterNoTemp}`,
),
amount: x.amount ? Extension.ToThaiNumber(x.amount.toLocaleString()) : "-",
dateRetire: profile?.dateRetire

View file

@ -170,6 +170,10 @@ export class ProfileFamilyCoupleController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_OFFICER", profile.id);
await this.ProfileFamilyCouple.update(
{ profileId: profile.id },
{ couple: false },
);
const before = null;
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
familyCouple.createdUserId = req.user.sub;
@ -178,7 +182,7 @@ export class ProfileFamilyCoupleController extends Controller {
familyCouple.lastUpdateFullName = req.user.name;
familyCouple.createdAt = new Date();
familyCouple.lastUpdatedAt = new Date();
familyCouple.couple = true;
profile.relationship = familyCouple.relationship; //update profileEmployee.relationship
const history = new ProfileFamilyCoupleHistory();
Object.assign(history, { ...familyCouple, id: undefined });

View file

@ -161,6 +161,10 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
await new permission().PermissionOrgUserUpdate(req, "SYS_REGISTRY_EMP", profile.id);
await this.ProfileFamilyCouple.update(
{ profileEmployeeId: profile.id },
{ couple: false },
);
const before = null;
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
familyCouple.createdUserId = req.user.sub;
@ -169,7 +173,7 @@ export class ProfileFamilyCoupleEmployeeController extends Controller {
familyCouple.lastUpdateFullName = req.user.name;
familyCouple.createdAt = new Date();
familyCouple.lastUpdatedAt = new Date();
familyCouple.couple = true;
profile.relationship = familyCouple.relationship; //update profileEmployee.relationship
const history = new ProfileFamilyCoupleHistory();
Object.assign(history, { ...familyCouple, id: undefined });

View file

@ -161,6 +161,10 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
if (!profile) {
throw new HttpError(HttpStatus.BAD_REQUEST, "ไม่พบ profile ดังกล่าว");
}
await this.ProfileFamilyCouple.update(
{ profileEmployeeId: profile.id },
{ couple: false },
);
familyCouple.coupleCitizenId = Extension.CheckCitizen(String(body.coupleCitizenId));
familyCouple.createdUserId = req.user.sub;
familyCouple.createdFullName = req.user.name;
@ -168,6 +172,7 @@ export class ProfileFamilyCoupleEmployeeTempController extends Controller {
familyCouple.lastUpdateFullName = req.user.name;
familyCouple.createdAt = new Date();
familyCouple.lastUpdatedAt = new Date();
familyCouple.couple = true;
await this.ProfileFamilyCouple.save(familyCouple);
profile.relationship = familyCouple.relationship; //update profileEmployee.relationship

View file

@ -1005,7 +1005,7 @@ export class ProfileSalaryTempController extends Controller {
...rest,
isDelete: false,
isEdit: false,
isEntry: rest.isEntry,
isEntry: rest.isEntry ?? false,
createdUserId: req.user.sub,
createdFullName: req.user.name,
lastUpdateUserId: req.user.sub,
@ -1045,7 +1045,7 @@ export class ProfileSalaryTempController extends Controller {
...rest,
isDelete: false,
isEdit: false,
isEntry: rest.isEntry,
isEntry: rest.isEntry ?? false,
createdUserId: req.user.sub,
createdFullName: req.user.name,
lastUpdateUserId: req.user.sub,

View file

@ -356,6 +356,8 @@ export class CreateProfileSalaryEmployee {
positionLine?: string | null;
positionPathSide?: string | null;
positionExecutive?: string | null;
positionExecutiveField?: string | null;
positionArea?: string | null;
amount?: Double | null;
amountSpecial?: Double | null;
positionSalaryAmount?: Double | null;
@ -390,6 +392,8 @@ export class UpdateProfileSalaryEmployee {
positionLine?: string | null;
positionPathSide?: string | null;
positionExecutive?: string | null;
positionExecutiveField?: string | null;
positionArea?: string | null;
amount?: Double | null;
amountSpecial?: Double | null;
positionSalaryAmount?: Double | null;
@ -424,6 +428,8 @@ export type UpdateProfileSalary = {
positionLine?: string | null;
positionPathSide?: string | null;
positionExecutive?: string | null;
positionExecutiveField?: string | null;
positionArea?: string | null;
amount?: Double | null;
amountSpecial?: Double | null;
positionSalaryAmount?: Double | null;

View file

@ -24,11 +24,11 @@ import { ViewColumn, ViewEntity } from "typeorm";
orgChild3.orgChild3Name,
orgChild4.orgChild4Name,
CASE
WHEN pm.orgChild1Id IS NULL THEN CONCAT(orgRoot.orgRootShortName, pm.posMasterNo)
WHEN pm.orgChild2Id IS NULL THEN CONCAT(orgChild1.orgChild1ShortName, pm.posMasterNo)
WHEN pm.orgChild3Id IS NULL THEN CONCAT(orgChild2.orgChild2ShortName, pm.posMasterNo)
WHEN pm.orgChild4Id IS NULL THEN CONCAT(orgChild3.orgChild3ShortName, pm.posMasterNo)
ELSE CONCAT(orgChild4.orgChild4ShortName, pm.posMasterNo)
WHEN pm.orgChild1Id IS NULL THEN CONCAT(orgRoot.orgRootShortName, " ", pm.posMasterNo)
WHEN pm.orgChild2Id IS NULL THEN CONCAT(orgChild1.orgChild1ShortName, " ", pm.posMasterNo)
WHEN pm.orgChild3Id IS NULL THEN CONCAT(orgChild2.orgChild2ShortName, " ", pm.posMasterNo)
WHEN pm.orgChild4Id IS NULL THEN CONCAT(orgChild3.orgChild3ShortName, " ", pm.posMasterNo)
ELSE CONCAT(orgChild4.orgChild4ShortName, " ", pm.posMasterNo)
END AS searchShortName,
ROW_NUMBER() OVER (PARTITION BY pm.current_holderId ORDER BY pm.posMasterNo DESC) AS pm_number
FROM employeePosMaster pm

View file

@ -29,11 +29,11 @@ import { ViewColumn, ViewEntity } from "typeorm";
orgChild4.orgChild4Name,
pn.posExecutiveName,
CASE
WHEN pm.orgChild1Id IS NULL THEN CONCAT(orgRoot.orgRootShortName, pm.posMasterNo)
WHEN pm.orgChild2Id IS NULL THEN CONCAT(orgChild1.orgChild1ShortName, pm.posMasterNo)
WHEN pm.orgChild3Id IS NULL THEN CONCAT(orgChild2.orgChild2ShortName, pm.posMasterNo)
WHEN pm.orgChild4Id IS NULL THEN CONCAT(orgChild3.orgChild3ShortName, pm.posMasterNo)
ELSE CONCAT(orgChild4.orgChild4ShortName, pm.posMasterNo)
WHEN pm.orgChild1Id IS NULL THEN CONCAT(orgRoot.orgRootShortName, " ", pm.posMasterNo)
WHEN pm.orgChild2Id IS NULL THEN CONCAT(orgChild1.orgChild1ShortName, " ", pm.posMasterNo)
WHEN pm.orgChild3Id IS NULL THEN CONCAT(orgChild2.orgChild2ShortName, " ", pm.posMasterNo)
WHEN pm.orgChild4Id IS NULL THEN CONCAT(orgChild3.orgChild3ShortName, " ", pm.posMasterNo)
ELSE CONCAT(orgChild4.orgChild4ShortName, " ", pm.posMasterNo)
END AS searchShortName,
ROW_NUMBER() OVER (PARTITION BY pm.current_holderId ORDER BY pm.posMasterNo DESC) AS pm_number
FROM posMaster pm