Merge branch 'develop' of github.com:Frappet/hrms-api-org into develop
This commit is contained in:
commit
eed60319e4
2 changed files with 94 additions and 38 deletions
|
|
@ -3140,6 +3140,7 @@ export class CommandController extends Controller {
|
||||||
profile.isActive = false;
|
profile.isActive = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
profile.isLeave = item.isLeave;
|
||||||
profile.leaveCommandId = item.commandId ?? _null;
|
profile.leaveCommandId = item.commandId ?? _null;
|
||||||
profile.leaveCommandNo = item.refCommandNo ?? _null;
|
profile.leaveCommandNo = item.refCommandNo ?? _null;
|
||||||
profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
profile.leaveRemark = clearProfile.leaveRemark ?? _null;
|
||||||
|
|
|
||||||
|
|
@ -312,16 +312,44 @@ export class ReportController extends Controller {
|
||||||
)
|
)
|
||||||
.orderBy(`registryOfficer.${sortBy}`, sort)
|
.orderBy(`registryOfficer.${sortBy}`, sort)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
const mapData = lists.map(x => ({
|
||||||
|
profileId: x.profileId,
|
||||||
|
citizenId: x.citizenId,
|
||||||
|
prefix: x.prefix,
|
||||||
|
firstName: x.firstName,
|
||||||
|
lastName: x.lastName,
|
||||||
|
isProbation: x.isProbation,
|
||||||
|
isLeave: x.isLeave,
|
||||||
|
isRetirement: x.isRetirement,
|
||||||
|
leaveType: x.leaveType,
|
||||||
|
posMasterNo: x.posMasterNo,
|
||||||
|
orgRootId: x.orgRootId,
|
||||||
|
orgChild1Id: x.orgChild1Id,
|
||||||
|
orgChild2Id: x.orgChild2Id,
|
||||||
|
orgChild3Id: x.orgChild3Id,
|
||||||
|
orgChild4Id: x.orgChild4Id,
|
||||||
|
orgRootName: x.orgRootName,
|
||||||
|
orgChild1Name: x.orgChild1Name,
|
||||||
|
orgChild2Name: x.orgChild2Name,
|
||||||
|
orgChild3Name: x.orgChild3Name,
|
||||||
|
orgChild4Name: x.orgChild4Name,
|
||||||
|
org: x.org,
|
||||||
|
searchShortName: x.searchShortName,
|
||||||
|
posExecutiveName: x.posExecutiveName,
|
||||||
|
position: x.position,
|
||||||
|
posTypeName: x.posTypeName,
|
||||||
|
posLevelName: x.posLevelName,
|
||||||
|
gender: x.gender,
|
||||||
|
relationship: x.relationship,
|
||||||
|
dateAppoint: x.dateAppoint,
|
||||||
|
birthdate: x.birthdate,
|
||||||
|
degree: x.degree,
|
||||||
|
age: x.age,
|
||||||
|
currentPosition: null,
|
||||||
|
lengthPosition: null,
|
||||||
|
}));
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
// template: "registry-officer",
|
data: mapData,
|
||||||
// reportName: "xlsx-report",
|
|
||||||
// data: {
|
|
||||||
// date: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())),
|
|
||||||
// data: lists,
|
|
||||||
// total: total
|
|
||||||
// },
|
|
||||||
data: lists,
|
|
||||||
total: total
|
total: total
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -477,49 +505,49 @@ export class ReportController extends Controller {
|
||||||
|
|
||||||
let nodeCondition = "1=1";
|
let nodeCondition = "1=1";
|
||||||
if (node === 0 && nodeId) {
|
if (node === 0 && nodeId) {
|
||||||
nodeCondition = "registryOfficer.orgRootId = :nodeId";
|
nodeCondition = "registryEmployee.orgRootId = :nodeId";
|
||||||
}
|
}
|
||||||
else if (node === 1 && nodeId) {
|
else if (node === 1 && nodeId) {
|
||||||
nodeCondition = "registryOfficer.orgChild1Id = :nodeId";
|
nodeCondition = "registryEmployee.orgChild1Id = :nodeId";
|
||||||
}
|
}
|
||||||
else if (node === 2 && nodeId) {
|
else if (node === 2 && nodeId) {
|
||||||
nodeCondition = "registryOfficer.orgChild2Id = :nodeId";
|
nodeCondition = "registryEmployee.orgChild2Id = :nodeId";
|
||||||
}
|
}
|
||||||
else if (node === 3 && nodeId) {
|
else if (node === 3 && nodeId) {
|
||||||
nodeCondition = "registryOfficer.orgChild3Id = :nodeId";
|
nodeCondition = "registryEmployee.orgChild3Id = :nodeId";
|
||||||
}
|
}
|
||||||
else if (node === 4 && nodeId) {
|
else if (node === 4 && nodeId) {
|
||||||
nodeCondition = "registryOfficer.orgChild4Id = :nodeId";
|
nodeCondition = "registryEmployee.orgChild4Id = :nodeId";
|
||||||
}
|
}
|
||||||
let dateAppointCondition = "1=1";
|
let dateAppointCondition = "1=1";
|
||||||
if (startDateAppoint && endDateAppoint) {
|
if (startDateAppoint && endDateAppoint) {
|
||||||
dateAppointCondition = "DATE(registryOfficer.dateAppoint) >= :startDateAppoint AND DATE(registryOfficer.dateAppoint) <= :endDateAppoint";
|
dateAppointCondition = "DATE(registryEmployee.dateAppoint) >= :startDateAppoint AND DATE(registryEmployee.dateAppoint) <= :endDateAppoint";
|
||||||
} else if (startDateAppoint) {
|
} else if (startDateAppoint) {
|
||||||
dateAppointCondition = "DATE(registryOfficer.dateAppoint) >= :startDateAppoint";
|
dateAppointCondition = "DATE(registryEmployee.dateAppoint) >= :startDateAppoint";
|
||||||
} else if (endDateAppoint) {
|
} else if (endDateAppoint) {
|
||||||
dateAppointCondition = "DATE(registryOfficer.dateAppoint) <= :endDateAppoint";
|
dateAppointCondition = "DATE(registryEmployee.dateAppoint) <= :endDateAppoint";
|
||||||
}
|
}
|
||||||
|
|
||||||
const IsLeavecondition = ["registryOfficer.isLeave = :isLeave"];
|
const IsLeavecondition = ["registryEmployee.isLeave = :isLeave"];
|
||||||
const parameters: any = { isLeave: isRetire };
|
const parameters: any = { isLeave: isRetire };
|
||||||
|
|
||||||
if (retireType && retireType.trim() !== "") {
|
if (retireType && retireType.trim() !== "") {
|
||||||
IsLeavecondition.push("registryOfficer.leaveType = :retireType");
|
IsLeavecondition.push("registryEmployee.leaveType = :retireType");
|
||||||
parameters.retireType = retireType;
|
parameters.retireType = retireType;
|
||||||
}
|
}
|
||||||
const [lists, total] = await AppDataSource.getRepository(viewRegistryEmployee)
|
const [lists, total] = await AppDataSource.getRepository(viewRegistryEmployee)
|
||||||
.createQueryBuilder("registryOfficer")
|
.createQueryBuilder("registryEmployee")
|
||||||
.where(nodeCondition, {
|
.where(nodeCondition, {
|
||||||
nodeId: nodeId
|
nodeId: nodeId
|
||||||
})
|
})
|
||||||
.andWhere("registryOfficer.age BETWEEN :ageMin AND :ageMax", {
|
.andWhere("registryEmployee.age BETWEEN :ageMin AND :ageMax", {
|
||||||
ageMin, ageMax
|
ageMin, ageMax
|
||||||
})
|
})
|
||||||
.andWhere(dateAppointCondition, {
|
.andWhere(dateAppointCondition, {
|
||||||
startDateAppoint: startDateAppoint?.toISOString().split("T")[0],
|
startDateAppoint: startDateAppoint?.toISOString().split("T")[0],
|
||||||
endDateAppoint: endDateAppoint?.toISOString().split("T")[0]
|
endDateAppoint: endDateAppoint?.toISOString().split("T")[0]
|
||||||
})
|
})
|
||||||
.andWhere("registryOfficer.isProbation = :isProbation", {
|
.andWhere("registryEmployee.isProbation = :isProbation", {
|
||||||
isProbation: isProbation,
|
isProbation: isProbation,
|
||||||
})
|
})
|
||||||
.andWhere(IsLeavecondition.join(" AND "), parameters)
|
.andWhere(IsLeavecondition.join(" AND "), parameters)
|
||||||
|
|
@ -527,7 +555,7 @@ export class ReportController extends Controller {
|
||||||
new Brackets((qb) => {
|
new Brackets((qb) => {
|
||||||
qb.orWhere(
|
qb.orWhere(
|
||||||
posTypeName != null && posTypeName != ""
|
posTypeName != null && posTypeName != ""
|
||||||
? "registryOfficer.posTypeName LIKE :posTypeName"
|
? "registryEmployee.posTypeName LIKE :posTypeName"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
posTypeName: `%${posTypeName}%`,
|
posTypeName: `%${posTypeName}%`,
|
||||||
|
|
@ -535,7 +563,7 @@ export class ReportController extends Controller {
|
||||||
)
|
)
|
||||||
qb.orWhere(
|
qb.orWhere(
|
||||||
posLevelName != null && posLevelName != ""
|
posLevelName != null && posLevelName != ""
|
||||||
? "registryOfficer.posLevelName LIKE :posLevelName"
|
? "registryEmployee.posLevelName LIKE :posLevelName"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
posLevelName: `%${posLevelName}%`,
|
posLevelName: `%${posLevelName}%`,
|
||||||
|
|
@ -543,7 +571,7 @@ export class ReportController extends Controller {
|
||||||
)
|
)
|
||||||
qb.orWhere(
|
qb.orWhere(
|
||||||
position != null && position != ""
|
position != null && position != ""
|
||||||
? "registryOfficer.position LIKE :position"
|
? "registryEmployee.position LIKE :position"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
position: `%${position}%`,
|
position: `%${position}%`,
|
||||||
|
|
@ -551,7 +579,7 @@ export class ReportController extends Controller {
|
||||||
)
|
)
|
||||||
qb.orWhere(
|
qb.orWhere(
|
||||||
gender != null && gender != ""
|
gender != null && gender != ""
|
||||||
? "registryOfficer.gender LIKE :gender"
|
? "registryEmployee.gender LIKE :gender"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
gender: `%${gender}%`,
|
gender: `%${gender}%`,
|
||||||
|
|
@ -559,7 +587,7 @@ export class ReportController extends Controller {
|
||||||
)
|
)
|
||||||
qb.orWhere(
|
qb.orWhere(
|
||||||
relationship != null && relationship != ""
|
relationship != null && relationship != ""
|
||||||
? "registryOfficer.relationship LIKE :relationship"
|
? "registryEmployee.relationship LIKE :relationship"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
relationship: `%${relationship}%`,
|
relationship: `%${relationship}%`,
|
||||||
|
|
@ -567,7 +595,7 @@ export class ReportController extends Controller {
|
||||||
)
|
)
|
||||||
qb.orWhere(
|
qb.orWhere(
|
||||||
degree != null && degree != ""
|
degree != null && degree != ""
|
||||||
? "registryOfficer.degree LIKE :degree"
|
? "registryEmployee.degree LIKE :degree"
|
||||||
: "1=1",
|
: "1=1",
|
||||||
{
|
{
|
||||||
degree: `%${degree}%`,
|
degree: `%${degree}%`,
|
||||||
|
|
@ -575,18 +603,45 @@ export class ReportController extends Controller {
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.orderBy(`registryOfficer.${sortBy}`, sort)
|
.orderBy(`registryEmployee.${sortBy}`, sort)
|
||||||
.getManyAndCount();
|
.getManyAndCount();
|
||||||
|
const mapData = lists.map(x => ({
|
||||||
|
profileId: x.profileEmployeeId,
|
||||||
|
citizenId: x.citizenId,
|
||||||
|
prefix: x.prefix,
|
||||||
|
firstName: x.firstName,
|
||||||
|
lastName: x.lastName,
|
||||||
|
isProbation: x.isProbation,
|
||||||
|
isLeave: x.isLeave,
|
||||||
|
isRetirement: x.isRetirement,
|
||||||
|
leaveType: x.leaveType,
|
||||||
|
posMasterNo: x.posMasterNo,
|
||||||
|
orgRootId: x.orgRootId,
|
||||||
|
orgChild1Id: x.orgChild1Id,
|
||||||
|
orgChild2Id: x.orgChild2Id,
|
||||||
|
orgChild3Id: x.orgChild3Id,
|
||||||
|
orgChild4Id: x.orgChild4Id,
|
||||||
|
orgRootName: x.orgRootName,
|
||||||
|
orgChild1Name: x.orgChild1Name,
|
||||||
|
orgChild2Name: x.orgChild2Name,
|
||||||
|
orgChild3Name: x.orgChild3Name,
|
||||||
|
orgChild4Name: x.orgChild4Name,
|
||||||
|
org: x.org,
|
||||||
|
searchShortName: x.searchShortName,
|
||||||
|
position: x.position,
|
||||||
|
posTypeName: x.posTypeName,
|
||||||
|
posLevelName: x.posLevelName,
|
||||||
|
gender: x.gender,
|
||||||
|
relationship: x.relationship,
|
||||||
|
dateAppoint: x.dateAppoint,
|
||||||
|
birthdate: x.birthdate,
|
||||||
|
degree: x.degree,
|
||||||
|
age: x.age,
|
||||||
|
currentPosition: null,
|
||||||
|
lengthPosition: null,
|
||||||
|
}));
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
// template: "registry-officer",
|
data: mapData,
|
||||||
// reportName: "xlsx-report",
|
|
||||||
// data: {
|
|
||||||
// date: Extension.ToThaiNumber(Extension.ToThaiShortDate(new Date())),
|
|
||||||
// data: lists,
|
|
||||||
// total: total
|
|
||||||
// },
|
|
||||||
data: lists,
|
|
||||||
total: total
|
total: total
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue