Merge branch 'develop' into adiDev
This commit is contained in:
commit
331c3ef2ac
3 changed files with 114 additions and 87 deletions
|
|
@ -3826,6 +3826,8 @@ export class ReportController extends Controller {
|
||||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
id: salaryPeriodId,
|
id: salaryPeriodId,
|
||||||
|
period: "OCT",
|
||||||
|
isActive: true
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (!salaryPeriod) {
|
if (!salaryPeriod) {
|
||||||
|
|
@ -3835,30 +3837,25 @@ export class ReportController extends Controller {
|
||||||
where:{
|
where:{
|
||||||
salaryPeriodId: salaryPeriodId,
|
salaryPeriodId: salaryPeriodId,
|
||||||
rootId: rootId,
|
rootId: rootId,
|
||||||
snapshot: "SNAP1",
|
snapshot: "SNAP2",
|
||||||
} ,
|
}
|
||||||
select:[
|
});
|
||||||
"fifteenPoint",
|
|
||||||
"fifteenPercent"
|
|
||||||
]
|
|
||||||
})
|
|
||||||
|
|
||||||
const fifteenPercentData =
|
const fifteenPercentData =
|
||||||
fifteenPoint?.fifteenPercent == undefined || fifteenPoint?.fifteenPercent == null
|
fifteenPoint?.fifteenPercent == undefined || fifteenPoint?.fifteenPercent == null
|
||||||
? "๐"
|
? "๐"
|
||||||
: Extension.ToThaiNumber(String(fifteenPoint?.fifteenPercent));
|
: Extension.ToThaiNumber(String(fifteenPoint?.fifteenPercent));
|
||||||
|
|
||||||
const fifteenPointData =
|
const fifteenPointData =
|
||||||
fifteenPoint?.fifteenPoint == undefined || fifteenPoint?.fifteenPoint == null
|
fifteenPoint?.fifteenPoint == undefined || fifteenPoint?.fifteenPoint == null
|
||||||
? ".๐๐"
|
? ".๐๐"
|
||||||
: "." + Extension.ToThaiNumber(String(fifteenPoint?.fifteenPoint));
|
: "." + Extension.ToThaiNumber(String(fifteenPoint?.fifteenPoint));
|
||||||
|
|
||||||
const _salaryPeriodTarget = await this.salaryProfileEmployeeRepository.find({
|
const _salaryProfileEmployee = await this.salaryProfileEmployeeRepository.find({
|
||||||
relations: ["salaryOrg"],
|
relations: ["salaryOrg"],
|
||||||
where: {
|
where: {
|
||||||
type: "FULL",
|
type: Not("NONE"),
|
||||||
salaryOrg: {
|
salaryOrg: {
|
||||||
snapshot: "SNAP1",
|
snapshot: "SNAP2",
|
||||||
rootId: rootId,
|
rootId: rootId,
|
||||||
salaryPeriodId: salaryPeriodId,
|
salaryPeriodId: salaryPeriodId,
|
||||||
},
|
},
|
||||||
|
|
@ -3869,30 +3866,54 @@ export class ReportController extends Controller {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!_salaryPeriodTarget) {
|
if (!_salaryProfileEmployee) {
|
||||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const aprSalaryPeriodCurrent = await this.salaryPeriodRepository.findOne({
|
||||||
|
where: {
|
||||||
|
period: "APR",
|
||||||
|
year: salaryPeriod.year,
|
||||||
|
isActive: true
|
||||||
|
},
|
||||||
|
});
|
||||||
const octPreviousYear = await this.salaryPeriodRepository.findOne({
|
const octPreviousYear = await this.salaryPeriodRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
period: "OCT",
|
period: "OCT",
|
||||||
year: salaryPeriod?.year - 1,
|
year: salaryPeriod?.year - 1,
|
||||||
|
isActive: true
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
const octPreviousYear2 = await this.salaryPeriodRepository.findOne({
|
const aprPreviousYear2 = await this.salaryPeriodRepository.findOne({
|
||||||
where: {
|
where: {
|
||||||
period: "OCT",
|
period: "APR",
|
||||||
year: salaryPeriod?.year - 2,
|
year: salaryPeriod?.year - 1,
|
||||||
|
isActive: true
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
let aprPreviousYearProfileCurrent: SalaryProfileEmployee[] = [];
|
||||||
|
if (aprSalaryPeriodCurrent) {
|
||||||
|
aprPreviousYearProfileCurrent = await this.salaryProfileEmployeeRepository.find({
|
||||||
|
relations: ["salaryOrg"],
|
||||||
|
where: {
|
||||||
|
type: Not("NONE"),
|
||||||
|
salaryOrg: {
|
||||||
|
snapshot: "SNAP2",
|
||||||
|
rootId: rootId,
|
||||||
|
salaryPeriodId: aprSalaryPeriodCurrent?.id,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
let octPreviousYearProfile: SalaryProfileEmployee[] = [];
|
let octPreviousYearProfile: SalaryProfileEmployee[] = [];
|
||||||
if (octPreviousYear) {
|
if (octPreviousYear) {
|
||||||
octPreviousYearProfile = await this.salaryProfileEmployeeRepository.find({
|
octPreviousYearProfile = await this.salaryProfileEmployeeRepository.find({
|
||||||
relations: ["salaryOrg"],
|
relations: ["salaryOrg"],
|
||||||
where: {
|
where: {
|
||||||
type: "FULL",
|
type: Not("NONE"),
|
||||||
salaryOrg: {
|
salaryOrg: {
|
||||||
snapshot: "SNAP2",
|
snapshot: "SNAP2",
|
||||||
rootId: rootId,
|
rootId: rootId,
|
||||||
|
|
@ -3902,24 +3923,24 @@ export class ReportController extends Controller {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let octPreviousYearProfile2: SalaryProfileEmployee[] = [];
|
let aprPreviousYearProfile2: SalaryProfileEmployee[] = [];
|
||||||
if (octPreviousYear2) {
|
if (aprPreviousYear2) {
|
||||||
octPreviousYearProfile2 = await this.salaryProfileEmployeeRepository.find({
|
aprPreviousYearProfile2 = await this.salaryProfileEmployeeRepository.find({
|
||||||
relations: ["salaryOrg"],
|
relations: ["salaryOrg"],
|
||||||
where: {
|
where: {
|
||||||
type: "FULL",
|
type: Not("NONE"),
|
||||||
salaryOrg: {
|
salaryOrg: {
|
||||||
snapshot: "SNAP2",
|
snapshot: "SNAP2",
|
||||||
salaryPeriodId: octPreviousYear2?.id,
|
salaryPeriodId: aprPreviousYear2?.id,
|
||||||
rootId: rootId,
|
rootId: rootId,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const agency = _salaryPeriodTarget[0] == null ? "" : _salaryPeriodTarget[0].root;
|
const agency = _salaryProfileEmployee[0] == null ? "" : _salaryProfileEmployee[0].root;
|
||||||
|
|
||||||
const formattedData = _salaryPeriodTarget.map((profile, index) => {
|
const formattedData = _salaryProfileEmployee.map((profile, index) => {
|
||||||
const fullNameParts = [
|
const fullNameParts = [
|
||||||
profile.child4,
|
profile.child4,
|
||||||
profile.child3,
|
profile.child3,
|
||||||
|
|
@ -3941,28 +3962,11 @@ export class ReportController extends Controller {
|
||||||
posNumber:
|
posNumber:
|
||||||
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
profile.orgShortName + Extension.ToThaiNumber(profile.posMasterNo.toLocaleString()),
|
||||||
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
amount: profile.amount ? Extension.ToThaiNumber(profile.amount.toLocaleString()) : null,
|
||||||
typeOld2:
|
typeOld2: //เมษา ปีก่อนหน้า
|
||||||
octPreviousYear2 && octPreviousYearProfile2.length > 0 ? (() => {
|
aprPreviousYear2 && aprPreviousYearProfile2.length > 0 ? (() => {
|
||||||
const _profile = octPreviousYearProfile2
|
const _profile = aprPreviousYearProfile2
|
||||||
.filter((profileOCT2) => profileOCT2.citizenId === profile.citizenId);
|
.filter((profileAPR2) => profileAPR2.citizenId === profile.citizenId);
|
||||||
if (_profile.length > 0) {
|
if (_profile.length > 0) {
|
||||||
return _profile[0]?.type === "HAFT"
|
|
||||||
? "๐.๕ ขั้น"
|
|
||||||
: _profile[0]?.type === "FULL"
|
|
||||||
? "๑ ขั้น"
|
|
||||||
: profile?.type === "FULLHAFT"
|
|
||||||
? "๑.๕ ขั้น"
|
|
||||||
: "ไม่ได้เลื่อนขั้นฯ";
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
})()
|
|
||||||
: null,
|
|
||||||
yearOld: octPreviousYear == null ? null : Extension.ToThaiNumber(octPreviousYear.year.toString()),
|
|
||||||
typeOld1:
|
|
||||||
octPreviousYear && octPreviousYearProfile.length > 0 ? (() => {
|
|
||||||
const _profile = octPreviousYearProfile
|
|
||||||
.filter((profileOCT) => profileOCT.citizenId === profile.citizenId);
|
|
||||||
if (_profile.length > 0) {
|
|
||||||
return _profile[0]?.type === "HAFT"
|
return _profile[0]?.type === "HAFT"
|
||||||
? "๐.๕ ขั้น"
|
? "๐.๕ ขั้น"
|
||||||
: _profile[0]?.type === "FULL"
|
: _profile[0]?.type === "FULL"
|
||||||
|
|
@ -3970,38 +3974,56 @@ export class ReportController extends Controller {
|
||||||
: profile?.type === "FULLHAFT"
|
: profile?.type === "FULLHAFT"
|
||||||
? "๑.๕ ขั้น"
|
? "๑.๕ ขั้น"
|
||||||
: "ไม่ได้เลื่อนขั้นฯ";
|
: "ไม่ได้เลื่อนขั้นฯ";
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
})()
|
|
||||||
: null,
|
|
||||||
typeOld:
|
|
||||||
_salaryPeriodTarget.length > 0
|
|
||||||
? (() => {
|
|
||||||
const _profile = _salaryPeriodTarget
|
|
||||||
.filter((profileAPR) => profileAPR.citizenId === profile.citizenId)
|
|
||||||
.map((profile) => ({
|
|
||||||
type: profile.type,
|
|
||||||
}));
|
|
||||||
return _profile[0]?.type === "HAFT"
|
|
||||||
? "๐.๕ ขั้น"
|
|
||||||
: _profile[0]?.type === "FULL"
|
|
||||||
? "๑ ขั้น"
|
|
||||||
: profile?.type === "FULLHAFT"
|
|
||||||
? "๑.๕ ขั้น"
|
|
||||||
: "ไม่ได้เลื่อนขั้นฯ";
|
|
||||||
})()
|
})()
|
||||||
: null, //เมษา ปีเดียวกัน
|
: null,
|
||||||
type:
|
yearOld:
|
||||||
profile.type === "HAFT"
|
octPreviousYear == null ? null : Extension.ToThaiNumber(octPreviousYear.year.toString()),
|
||||||
? "๐.๕ ขั้น"
|
typeOld1: //ตุลา ปีก่อนหน้า
|
||||||
: profile.type === "FULL"
|
octPreviousYear && octPreviousYearProfile.length > 0 ? (() => {
|
||||||
? "๑ ขั้น"
|
const _profile = octPreviousYearProfile
|
||||||
: profile.type === "FULLHAFT"
|
.filter((profileOCT) => profileOCT.citizenId === profile.citizenId);
|
||||||
? "๑.๕ ขั้น"
|
if (_profile.length > 0) {
|
||||||
: "ไม่ได้เลื่อนขั้นฯ",
|
return _profile[0]?.type === "HAFT"
|
||||||
score1: null,
|
? "๐.๕ ขั้น"
|
||||||
score2: null,
|
: _profile[0]?.type === "FULL"
|
||||||
};
|
? "๑ ขั้น"
|
||||||
|
: profile?.type === "FULLHAFT"
|
||||||
|
? "๑.๕ ขั้น"
|
||||||
|
: "ไม่ได้เลื่อนขั้นฯ";
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
})()
|
||||||
|
: null,
|
||||||
|
typeOld:
|
||||||
|
aprPreviousYearProfileCurrent.length > 0
|
||||||
|
? (() => {
|
||||||
|
const _profile = aprPreviousYearProfileCurrent
|
||||||
|
.filter((profileAPR) => profileAPR.citizenId === profile.citizenId)
|
||||||
|
.map((profile) => ({
|
||||||
|
type: profile.type,
|
||||||
|
}));
|
||||||
|
return _profile[0]?.type === "HAFT"
|
||||||
|
? "๐.๕ ขั้น"
|
||||||
|
: _profile[0]?.type === "FULL"
|
||||||
|
? "๑ ขั้น"
|
||||||
|
: profile?.type === "FULLHAFT"
|
||||||
|
? "๑.๕ ขั้น"
|
||||||
|
: "ไม่ได้เลื่อนขั้นฯ";
|
||||||
|
})()
|
||||||
|
: null, //เมษา
|
||||||
|
type:
|
||||||
|
profile.type === "HAFT"
|
||||||
|
? "๐.๕ ขั้น"
|
||||||
|
: profile.type === "FULL"
|
||||||
|
? "๑ ขั้น"
|
||||||
|
: profile.type === "FULLHAFT"
|
||||||
|
? "๑.๕ ขั้น"
|
||||||
|
: "ไม่ได้เลื่อนขั้นฯ",
|
||||||
|
score1: null,
|
||||||
|
score2: null,
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
return new HttpSuccess({
|
return new HttpSuccess({
|
||||||
|
|
@ -4009,14 +4031,16 @@ export class ReportController extends Controller {
|
||||||
reportName: "emp2-03",
|
reportName: "emp2-03",
|
||||||
data: {
|
data: {
|
||||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||||
yearShort: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))).slice(-2,),
|
yearOld: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-1))),
|
||||||
yearShortOld: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-1))).slice(-2,),
|
yearShort: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))).slice(-2),
|
||||||
|
yearShortOld: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-1))).slice(-2),
|
||||||
fifteenPercent: fifteenPercentData + fifteenPointData,
|
fifteenPercent: fifteenPercentData + fifteenPointData,
|
||||||
agency: agency,
|
agency: agency,
|
||||||
data: formattedData,
|
data: formattedData,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API 04-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้สมควรได้เลื่อนขั้นค่าจ้าง (แบบ ลจ.กทม.1)
|
* API 04-บัญชีรายชื่อลูกจ้างประจำกรุงเทพมหานครผู้สมควรได้เลื่อนขั้นค่าจ้าง (แบบ ลจ.กทม.1)
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,11 @@ export class SalaryPeriodController extends Controller {
|
||||||
org: item.root,
|
org: item.root,
|
||||||
total: item.total + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.total),
|
total: item.total + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.total),
|
||||||
fifteenPercent:
|
fifteenPercent:
|
||||||
item.fifteenPercent + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.fifteenPercent),
|
item.fifteenPercent +
|
||||||
|
item.fifteenPoint / 100 +
|
||||||
|
(_salaryOrgGROUP2 == null
|
||||||
|
? 0
|
||||||
|
: _salaryOrgGROUP2.fifteenPercent + _salaryOrgGROUP2.fifteenPoint / 100),
|
||||||
chosen:
|
chosen:
|
||||||
item.quantityUsed + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.quantityUsed),
|
item.quantityUsed + (_salaryOrgGROUP2 == null ? 0 : _salaryOrgGROUP2.quantityUsed),
|
||||||
remaining:
|
remaining:
|
||||||
|
|
@ -1713,7 +1717,6 @@ export class SalaryPeriodController extends Controller {
|
||||||
});
|
});
|
||||||
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee);
|
await this.salaryProfileEmployeeRepository.remove(salaryProfileEmployee);
|
||||||
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee);
|
await this.salaryOrgEmployeeRepository.remove(salaryOrgEmployee);
|
||||||
|
|
||||||
let orgs = await new CallAPI().GetData(request, "org/unauthorize/active/root/id");
|
let orgs = await new CallAPI().GetData(request, "org/unauthorize/active/root/id");
|
||||||
let total = 1000;
|
let total = 1000;
|
||||||
let _orgProfiles = await new CallAPI().PostData(request, "org/unauthorize/salary/gen", {
|
let _orgProfiles = await new CallAPI().PostData(request, "org/unauthorize/salary/gen", {
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ export class SalaryPeriodEmployeeController extends Controller {
|
||||||
const data = {
|
const data = {
|
||||||
org: item.root,
|
org: item.root,
|
||||||
total: item.total,
|
total: item.total,
|
||||||
fifteenPercent: item.fifteenPercent,
|
fifteenPercent: item.fifteenPercent + item.fifteenPoint / 100,
|
||||||
chosen: item.quantityUsed,
|
chosen: item.quantityUsed,
|
||||||
remaining: item.remainQuota,
|
remaining: item.remainQuota,
|
||||||
currentAmount: item.currentAmount,
|
currentAmount: item.currentAmount,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue