emp2 (01-10)

This commit is contained in:
Bright 2024-04-10 14:54:52 +07:00
parent 224e5baf23
commit 20bf111442

View file

@ -3912,7 +3912,7 @@ export class ReportController extends Controller {
} }
const totalEmp2step = emp2step.size ?? 0; const totalEmp2step = emp2step.size ?? 0;
const agency = octSnap1.salaryProfiles[0] == null ? "" : octSnap1.salaryProfiles[0].root; // const agency = octSnap1.salaryProfiles[0] == null ? "" : octSnap1.salaryProfiles[0].root;
return new HttpSuccess({ return new HttpSuccess({
template: "emp2-01", template: "emp2-01",
reportName: "emp2-01", reportName: "emp2-01",
@ -3921,35 +3921,35 @@ export class ReportController extends Controller {
yearShort: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))).slice( yearShort: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))).slice(
-2, -2,
), ),
agency: agency, agency: octSnap1.root == null ? "" : octSnap1.root,
totalUser: octSnap1 == null ? "" : Extension.ToThaiNumber(octSnap1.total.toString()), totalUser: octSnap1 == null ? "" : Extension.ToThaiNumber(octSnap1.total.toLocaleString()),
totalSalary: totalSalary:
octSnap1 == null ? "" : Extension.ToThaiNumber(octSnap1.currentAmount.toString()), octSnap1 == null ? "" : Extension.ToThaiNumber(octSnap1.currentAmount.toLocaleString()),
sixPercent: sixPercent:
octSnap1 == null ? "" : Extension.ToThaiNumber(octSnap1.sixPercentAmount.toString()), octSnap1 == null ? "" : Extension.ToThaiNumber(octSnap1.sixPercentAmount.toLocaleString()),
remainingAmountApr: remainingAmountApr:
aprSnap2 == null ? "" : Extension.ToThaiNumber(aprSnap2.useAmount.toString()), //จำนวนเงินที่ใช้เลื่อนขั้นค่าจ้างไปแล้วในวันที่ 1 เม.ย. aprSnap2 == null ? "" : Extension.ToThaiNumber(aprSnap2.useAmount.toLocaleString()), //จำนวนเงินที่ใช้เลื่อนขั้นค่าจ้างไปแล้วในวันที่ 1 เม.ย.
remainingAmountOct: remainingAmountOct:
octSnap2 == null ? "" : Extension.ToThaiNumber(octSnap2.spentAmount.toString()), //เหลือเงินใช้เลื่อนขั้นค่าจ้างในวันที่ 1 ต.ค. octSnap2 == null ? "" : Extension.ToThaiNumber(octSnap2.spentAmount.toLocaleString()), //เหลือเงินใช้เลื่อนขั้นค่าจ้างในวันที่ 1 ต.ค.
totalOld: aprSnap2 == null ? "" : Extension.ToThaiNumber(aprSnap2.total.toString()), //จำนวน(คน)(โควตาเลื่อนขั้นค่าจ้าง) totalOld: aprSnap2 == null ? "" : Extension.ToThaiNumber(aprSnap2.total.toLocaleString()), //จำนวน(คน)(โควตาเลื่อนขั้นค่าจ้าง)
fifteenPercentOld: fifteenPercentOld:
aprSnap2 == null ? "" : Extension.ToThaiNumber(aprSnap2.fifteenPercent.toString()), aprSnap2 == null ? "" : Extension.ToThaiNumber(aprSnap2.fifteenPercent.toLocaleString()),
totalUseOld: totalUseOld:
aprSnap2 == null ? "" : Extension.ToThaiNumber(aprSnap2.quantityUsed.toString()), //พิจารณาให้(คน)(โควตาเลื่อนขั้นค่าจ้าง) aprSnap2 == null ? "" : Extension.ToThaiNumber(aprSnap2.quantityUsed.toLocaleString()), //พิจารณาให้(คน)(โควตาเลื่อนขั้นค่าจ้าง)
full2: totalEmp2step == null ? "" : Extension.ToThaiNumber(totalEmp2step.toString()), //เลื่อนขั้นค่าจ้างรวมทั้งปีสองขั้นจำนวน(คน) full2: totalEmp2step == null ? "" : Extension.ToThaiNumber(totalEmp2step.toLocaleString()), //เลื่อนขั้นค่าจ้างรวมทั้งปีสองขั้นจำนวน(คน)
fullHaft: fullHaftCount == null ? "" : Extension.ToThaiNumber(fullHaftCount.toString()), //จำนวน(คน)(หนึ่งขั้นครึ่ง) fullHaft: fullHaftCount == null ? "" : Extension.ToThaiNumber(fullHaftCount.toLocaleString()), //จำนวน(คน)(หนึ่งขั้นครึ่ง)
fullHaftSalary: fullHaftSalary:
fullHaftTotalAmount == null ? "" : Extension.ToThaiNumber(fullHaftTotalAmount.toString()), //ใช้เงิน(หนึ่งขั้นครึ่ง) fullHaftTotalAmount == null ? "" : Extension.ToThaiNumber(fullHaftTotalAmount.toLocaleString()), //ใช้เงิน(หนึ่งขั้นครึ่ง)
full: fullCount == null ? "" : Extension.ToThaiNumber(fullCount.toString()), //จำนวน(คน)(หนึ่งขั้น) full: fullCount == null ? "" : Extension.ToThaiNumber(fullCount.toLocaleString()), //จำนวน(คน)(หนึ่งขั้น)
fullSalary: fullSalary:
fullTotalAmount == null ? "" : Extension.ToThaiNumber(fullTotalAmount.toString()), //ใช้เงิน(หนึ่งขั้น) fullTotalAmount == null ? "" : Extension.ToThaiNumber(fullTotalAmount.toLocaleString()), //ใช้เงิน(หนึ่งขั้น)
haft: haftCount == null ? "" : Extension.ToThaiNumber(haftCount.toString()), //จำนวน(คน)(ครึ่งขั้น) haft: haftCount == null ? "" : Extension.ToThaiNumber(haftCount.toLocaleString()), //จำนวน(คน)(ครึ่งขั้น)
haftSalary: haftSalary:
haftTotalAmount == null ? "" : Extension.ToThaiNumber(haftTotalAmount.toString()), //ใช้เงิน(ครึ่งขั้น) haftTotalAmount == null ? "" : Extension.ToThaiNumber(haftTotalAmount.toLocaleString()), //ใช้เงิน(ครึ่งขั้น)
notPromoted: noneCount == null ? "" : Extension.ToThaiNumber(noneCount.toString()), //ไม่ได้เลื่อนขั้นค่าจ้างจำนวน(คน) notPromoted: noneCount == null ? "" : Extension.ToThaiNumber(noneCount.toLocaleString()), //ไม่ได้เลื่อนขั้นค่าจ้างจำนวน(คน)
total: octSnap2 == null ? "" : Extension.ToThaiNumber(octSnap2.useAmount.toString()), //รวมใช้เงิน total: octSnap2 == null ? "" : Extension.ToThaiNumber(octSnap2.useAmount.toLocaleString()), //รวมใช้เงิน
summary: summary:
octSnap2 == null ? "" : Extension.ToThaiNumber(octSnap2.remainingAmount.toString()), //เหลือเงิน octSnap2 == null ? "" : Extension.ToThaiNumber(octSnap2.remainingAmount.toLocaleString()), //เหลือเงิน
}, },
}); });
} }
@ -4052,8 +4052,13 @@ export class ReportController extends Controller {
if (!_salaryPeriod) { if (!_salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
} }
const _root = await this.salaryOrgEmployeeRepository.findOne({
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; where: {
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
});
// const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
const formattedData = _salaryPeriod.map((profile: any, index: number) => { const formattedData = _salaryPeriod.map((profile: any, index: number) => {
if (!profile) { if (!profile) {
@ -4155,7 +4160,7 @@ export class ReportController extends Controller {
reportName: "emp2-02", reportName: "emp2-02",
data: { data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency, agency: _root?.root == null ? "" : _root?.root,
data: formattedData, data: formattedData,
}, },
}); });
@ -4283,7 +4288,7 @@ export class ReportController extends Controller {
}); });
} }
const agency = _salaryProfileEmployee[0] == null ? "" : _salaryProfileEmployee[0].root; // const agency = _salaryProfileEmployee[0] == null ? "" : _salaryProfileEmployee[0].root;
const formattedData = _salaryProfileEmployee.map((profile, index) => { const formattedData = _salaryProfileEmployee.map((profile, index) => {
const fullNameParts = [ const fullNameParts = [
@ -4391,7 +4396,7 @@ export class ReportController extends Controller {
String(Extension.ToThaiYear(salaryPeriod.year - 1)), String(Extension.ToThaiYear(salaryPeriod.year - 1)),
).slice(-2), ).slice(-2),
fifteenPercent: fifteenPercentData + fifteenPointData, fifteenPercent: fifteenPercentData + fifteenPointData,
agency: agency, agency: fifteenPoint?.root == null ? "" : fifteenPoint?.root,
data: formattedData, data: formattedData,
}, },
}); });
@ -4434,8 +4439,13 @@ export class ReportController extends Controller {
if (!_salaryProfileEmp) { if (!_salaryProfileEmp) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
} }
const _root = await this.salaryOrgEmployeeRepository.findOne({
const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root; where: {
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
});
// const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root;
const formattedData = _salaryProfileEmp.map((profile, index) => { const formattedData = _salaryProfileEmp.map((profile, index) => {
const fullNameParts = [ const fullNameParts = [
@ -4480,7 +4490,7 @@ export class ReportController extends Controller {
reportName: "emp2-04", reportName: "emp2-04",
data: { data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency, agency: _root?.root == null ? "" : _root?.root,
data: formattedData, data: formattedData,
}, },
}); });
@ -4522,8 +4532,13 @@ export class ReportController extends Controller {
if (!_salaryPeriod) { if (!_salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
} }
const _root = await this.salaryOrgEmployeeRepository.findOne({
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; where: {
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
});
// const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
const formattedData = _salaryPeriod.map((profile, index) => { const formattedData = _salaryPeriod.map((profile, index) => {
const fullNameParts = [ const fullNameParts = [
@ -4562,7 +4577,7 @@ export class ReportController extends Controller {
reportName: "emp2-05", reportName: "emp2-05",
data: { data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency, agency: _root?.root == null ? "" : _root?.root,
data: formattedData, data: formattedData,
}, },
}); });
@ -4604,8 +4619,13 @@ export class ReportController extends Controller {
if (!_salaryProfileEmp) { if (!_salaryProfileEmp) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
} }
const _root = await this.salaryOrgEmployeeRepository.findOne({
const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root; where: {
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
});
// const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root;
const formattedData = _salaryProfileEmp.map((profile, index) => { const formattedData = _salaryProfileEmp.map((profile, index) => {
const fullNameParts = [ const fullNameParts = [
@ -4650,7 +4670,7 @@ export class ReportController extends Controller {
reportName: "emp2-06", reportName: "emp2-06",
data: { data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency, agency: _root?.root == null ? "" : _root?.root,
data: formattedData, data: formattedData,
}, },
}); });
@ -4691,8 +4711,13 @@ export class ReportController extends Controller {
if (!_salaryPeriod) { if (!_salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
} }
const _root = await this.salaryOrgEmployeeRepository.findOne({
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; where: {
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
});
// const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
const formattedData = _salaryPeriod.map((profile, index) => { const formattedData = _salaryPeriod.map((profile, index) => {
const fullNameParts = [ const fullNameParts = [
@ -4728,7 +4753,7 @@ export class ReportController extends Controller {
reportName: "emp2-07", reportName: "emp2-07",
data: { data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency, agency: _root?.root == null ? "" : _root?.root,
data: formattedData, data: formattedData,
}, },
}); });
@ -4767,8 +4792,13 @@ export class ReportController extends Controller {
if (!_salaryPeriod) { if (!_salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
} }
const _root = await this.salaryOrgEmployeeRepository.findOne({
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root; where: {
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
});
// const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
const formattedData = _salaryPeriod.map((profile, index) => { const formattedData = _salaryPeriod.map((profile, index) => {
const fullNameParts = [ const fullNameParts = [
@ -4801,7 +4831,7 @@ export class ReportController extends Controller {
reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01", reportName: salaryPeriod.period == "APR" ? "gov1-01" : "gov2-01",
data: { data: {
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))), year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
agency: agency, agency: _root?.root == null ? "" : _root?.root,
data: formattedData, data: formattedData,
}, },
}); });
@ -4886,8 +4916,13 @@ export class ReportController extends Controller {
}, },
}); });
} }
const _root = await this.salaryOrgEmployeeRepository.findOne({
const agency = _salaryPeriodTarget[0] == null ? "" : _salaryPeriodTarget[0].root; where: {
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
});
// const agency = _salaryPeriodTarget[0] == null ? "" : _salaryPeriodTarget[0].root;
const formattedData = _salaryPeriodTarget.map((profile, index) => { const formattedData = _salaryPeriodTarget.map((profile, index) => {
const fullNameParts = [ const fullNameParts = [
@ -4992,7 +5027,7 @@ export class ReportController extends Controller {
yearShortOld: Extension.ToThaiNumber( yearShortOld: Extension.ToThaiNumber(
String(Extension.ToThaiYear(salaryPeriod.year - 1)), String(Extension.ToThaiYear(salaryPeriod.year - 1)),
).slice(-2), ).slice(-2),
agency: agency, agency: _root?.root == null ? "" : _root?.root,
data: formattedData, data: formattedData,
}, },
}); });
@ -5034,8 +5069,13 @@ export class ReportController extends Controller {
if (!_salaryProfileEmp) { if (!_salaryProfileEmp) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล"); throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
} }
const _root = await this.salaryOrgEmployeeRepository.findOne({
const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root; where: {
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
});
// const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root;
const formattedData = _salaryProfileEmp.map((profile, index) => { const formattedData = _salaryProfileEmp.map((profile, index) => {
const fullNameParts = [ const fullNameParts = [
@ -5086,7 +5126,7 @@ export class ReportController extends Controller {
year: year, year: year,
yearSlice: year.slice(-2), yearSlice: year.slice(-2),
yearOldSlice: yearOld.slice(-2), yearOldSlice: yearOld.slice(-2),
agency: agency, agency: _root?.root == null ? "" : _root?.root,
data: formattedData, data: formattedData,
}, },
}); });