log
This commit is contained in:
parent
ce8bb41bda
commit
0f79425d65
17 changed files with 611 additions and 202 deletions
|
|
@ -35,6 +35,9 @@ import { EmployeePosType } from "../entities/EmployeePosType";
|
|||
import { EmployeePosLevel } from "../entities/EmployeePosLevel";
|
||||
import { SalaryOrgEmployee } from "../entities/SalaryOrgEmployee";
|
||||
import { SalaryProfileEmployee } from "../entities/SalaryProfileEmployee";
|
||||
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
|
||||
import CallAPI from "../interfaces/call-api";
|
||||
@Route("api/v1/salary/report")
|
||||
@Tags("Report")
|
||||
|
|
@ -2101,7 +2104,7 @@ export class ReportController extends Controller {
|
|||
});
|
||||
const root = _root?.root == null ? "" : _root.root;
|
||||
// const agency = salaryProfile[0] == null ? "" : salaryProfile[0].root;
|
||||
|
||||
|
||||
const formattedData = salaryProfile.map((item, index) => ({
|
||||
no: Extension.ToThaiNumber(String(index + 1)),
|
||||
fullname: item.prefix + item.firstName + " " + item.lastName,
|
||||
|
|
@ -2114,8 +2117,10 @@ export class ReportController extends Controller {
|
|||
(item.root == undefined && item.root == null ? "" : item.root),
|
||||
posType: item.posType,
|
||||
posLevel: item.posLevel,
|
||||
posExecutive: item.posExecutive ? item.posExecutive:null,
|
||||
fullPositionName: item.posExecutive ? item.position + " (" + item.posExecutive + ")" : item.position || null,
|
||||
posExecutive: item.posExecutive ? item.posExecutive : null,
|
||||
fullPositionName: item.posExecutive
|
||||
? item.position + " (" + item.posExecutive + ")"
|
||||
: item.position || null,
|
||||
posMasterNo:
|
||||
Extension.ToThaiNumber(item.orgShortName) +
|
||||
Extension.ToThaiNumber(String(item.posMasterNo.toLocaleString())),
|
||||
|
|
@ -4186,8 +4191,8 @@ export class ReportController extends Controller {
|
|||
reportName: "emp2-02",
|
||||
data: {
|
||||
year: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year))),
|
||||
yearOld: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-1))),
|
||||
yearOld2: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year-2))),
|
||||
yearOld: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year - 1))),
|
||||
yearOld2: Extension.ToThaiNumber(String(Extension.ToThaiYear(salaryPeriod.year - 2))),
|
||||
agency: _root?.root == null ? "" : _root?.root,
|
||||
data: formattedData,
|
||||
},
|
||||
|
|
@ -4694,7 +4699,7 @@ export class ReportController extends Controller {
|
|||
: null,
|
||||
score: profile.result,
|
||||
reason: profile.remark,
|
||||
remark:null,
|
||||
remark: null,
|
||||
};
|
||||
});
|
||||
|
||||
|
|
@ -4766,7 +4771,6 @@ export class ReportController extends Controller {
|
|||
.join("/");
|
||||
const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`;
|
||||
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
|
|
@ -5210,7 +5214,7 @@ export class ReportController extends Controller {
|
|||
const agency = _salaryPeriod[0] == null ? "" : _salaryPeriod[0].root;
|
||||
|
||||
const formattedData = _salaryPeriod.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
|
|
@ -5321,7 +5325,7 @@ export class ReportController extends Controller {
|
|||
const agency = salaryProfile[0] == null ? "" : salaryProfile[0].root;
|
||||
|
||||
const formattedData = salaryProfile.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
|
|
@ -5404,7 +5408,7 @@ export class ReportController extends Controller {
|
|||
const agency = _salaryProfileEmp[0] == null ? "" : _salaryProfileEmp[0].root;
|
||||
|
||||
const formattedData = _salaryProfileEmp.map((profile, index) => {
|
||||
const fullNameParts = [
|
||||
const fullNameParts = [
|
||||
profile.child4,
|
||||
profile.child3,
|
||||
profile.child2,
|
||||
|
|
@ -5504,7 +5508,7 @@ export class ReportController extends Controller {
|
|||
.filter((part) => part !== undefined && part !== null)
|
||||
.join("/");
|
||||
const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`;
|
||||
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
|
|
@ -5895,7 +5899,6 @@ export class ReportController extends Controller {
|
|||
.join("/");
|
||||
const fullName = `${profile.prefix}${profile.firstName} ${profile.lastName}`;
|
||||
|
||||
|
||||
return {
|
||||
no: Extension.ToThaiNumber((index + 1).toLocaleString()),
|
||||
fullName: fullName,
|
||||
|
|
@ -6273,7 +6276,7 @@ export class ReportController extends Controller {
|
|||
async SalaryReport33Resume(
|
||||
@Body()
|
||||
body: { result: { id: string; refCommandNo: string; templateDoc: string; personId: string }[] },
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await Promise.all(
|
||||
body.result.map(async (v) => {
|
||||
|
|
@ -6282,6 +6285,7 @@ export class ReportController extends Controller {
|
|||
id: v.id,
|
||||
},
|
||||
});
|
||||
|
||||
if (salary != null) {
|
||||
await new CallAPI()
|
||||
.PostData(request, "/org/profile/salary", {
|
||||
|
|
@ -6301,8 +6305,10 @@ export class ReportController extends Controller {
|
|||
templateDoc: v.templateDoc,
|
||||
})
|
||||
.then(async (x) => {
|
||||
const before = null;
|
||||
salary.status = "DONE";
|
||||
await this.salaryProfileRepository.save(salary);
|
||||
await this.salaryProfileRepository.save(salary, { data: request });
|
||||
setLogDataDiff(request, { before, after: salary });
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
|
@ -6321,7 +6327,7 @@ export class ReportController extends Controller {
|
|||
async SalaryReport34Resume(
|
||||
@Body()
|
||||
body: { result: { id: string; refCommandNo: string; templateDoc: string; personId: string }[] },
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await Promise.all(
|
||||
body.result.map(async (v) => {
|
||||
|
|
@ -6349,8 +6355,10 @@ export class ReportController extends Controller {
|
|||
templateDoc: v.templateDoc,
|
||||
})
|
||||
.then(async (x) => {
|
||||
const before = null;
|
||||
salary.status = "DONE";
|
||||
await this.salaryProfileRepository.save(salary);
|
||||
await this.salaryProfileRepository.save(salary, { data: request });
|
||||
setLogDataDiff(request, { before, after: salary });
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
|
@ -6369,7 +6377,7 @@ export class ReportController extends Controller {
|
|||
async SalaryReport35Resume(
|
||||
@Body()
|
||||
body: { result: { id: string; refCommandNo: string; templateDoc: string; personId: string }[] },
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await Promise.all(
|
||||
body.result.map(async (v) => {
|
||||
|
|
@ -6397,8 +6405,10 @@ export class ReportController extends Controller {
|
|||
templateDoc: v.templateDoc,
|
||||
})
|
||||
.then(async (x) => {
|
||||
const before = null;
|
||||
salary.status = "DONE";
|
||||
await this.salaryProfileRepository.save(salary);
|
||||
await this.salaryProfileRepository.save(salary, { data: request });
|
||||
setLogDataDiff(request, { before, after: salary });
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
|
@ -6417,7 +6427,7 @@ export class ReportController extends Controller {
|
|||
async SalaryReport36Resume(
|
||||
@Body()
|
||||
body: { result: { id: string; refCommandNo: string; templateDoc: string; personId: string }[] },
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await Promise.all(
|
||||
body.result.map(async (v) => {
|
||||
|
|
@ -6445,8 +6455,10 @@ export class ReportController extends Controller {
|
|||
templateDoc: v.templateDoc,
|
||||
})
|
||||
.then(async (x) => {
|
||||
const before = null;
|
||||
salary.status = "DONE";
|
||||
await this.salaryProfileEmployeeRepository.save(salary);
|
||||
await this.salaryProfileEmployeeRepository.save(salary, { data: request });
|
||||
setLogDataDiff(request, { before, after: salary });
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
|
@ -6465,7 +6477,7 @@ export class ReportController extends Controller {
|
|||
async SalaryReport37Resume(
|
||||
@Body()
|
||||
body: { result: { id: string; refCommandNo: string; templateDoc: string; personId: string }[] },
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await Promise.all(
|
||||
body.result.map(async (v) => {
|
||||
|
|
@ -6493,8 +6505,10 @@ export class ReportController extends Controller {
|
|||
templateDoc: v.templateDoc,
|
||||
})
|
||||
.then(async (x) => {
|
||||
const before = null;
|
||||
salary.status = "DONE";
|
||||
await this.salaryProfileEmployeeRepository.save(salary);
|
||||
await this.salaryProfileEmployeeRepository.save(salary, { data: request });
|
||||
setLogDataDiff(request, { before, after: salary });
|
||||
});
|
||||
}
|
||||
}),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue