เอกสารแนบท้าย

This commit is contained in:
Bright 2024-10-31 13:51:40 +07:00
parent 09701e131a
commit c0a9e177e1

View file

@ -7238,6 +7238,162 @@ export class ReportController extends Controller {
return new HttpSuccess();
}
/**
* .
*
* @summary .
*
*/
@Post("command/officer/report/attachment")
async SalaryReportAttachment(
@Body()
body: {
refIds: {
refId?: string;
Sequence?: any | null;
CitizenId?: any | null;
Prefix?: any | null;
FirstName?: any | null;
LastName?: any | null;
Amount?: any | null;
PositionSalaryAmount?: any | null;
MouthSalaryAmount?: any | null;
RemarkHorizontal?: any | null;
RemarkVertical?: any | null;
CommandYear?: any | null;
}[];
},
@Request() request: RequestWithUser,
) {
let data = new Array();
await Promise.all(
body.refIds.map(async (v) => {
const salary = await this.salaryProfileRepository.findOne({
where: {
id: v.refId,
},
});
if (salary != null) {
const _data = {
no: Extension.ToThaiNumber((data.length + 1).toString()),
fullName: `${v.Prefix}${v.FirstName} ${v.LastName}`,
oc: salary.rootId == null ? salary.position == null ? "-" : salary.position :
salary.child4 != null
? salary.position == null ? salary.child4+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root
: salary.position+"/"+salary.child4+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root :
salary.child3 != null
? salary.position == null ? salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root
: salary.position+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root :
salary.child2 != null
? salary.position == null ? salary.child2+"/"+salary.child1+"/"+salary.root
: salary.position+"/"+salary.child2+"/"+salary.child1+"/"+salary.root :
salary.child1 != null
? salary.position == null ? salary.child1+"/"+salary.root
: salary.position+"/"+salary.child1+"/"+salary.root :
salary.root != null
? salary.position == null ? salary.root
: salary.position+"/"+salary.root : "-",
positionType: salary.posType ? salary.posType : "-",
positionLevel: salary.posLevel ? salary.posLevel : "-",
positionNumber: salary.orgShortName != null && salary.posMasterNo != null
? Extension.ToThaiNumber(salary.orgShortName + salary.posMasterNo)
: "-",
amount: salary.amount
? Extension.ToThaiNumber(salary.amount.toLocaleString()) : "-",
positionSalaryAmount: salary.positionSalaryAmount
? Extension.ToThaiNumber(salary.positionSalaryAmount.toLocaleString()) : "-",
amountSpecial: salary.amountSpecial
? Extension.ToThaiNumber(salary.amountSpecial.toLocaleString()) : "-",
remark: salary.remark ? salary.remark : "-",
remarkVertical: v.RemarkVertical,
remarkHorizontal: v.RemarkHorizontal
}
data.push(_data);
}
}),
);
return new HttpSuccess(data);
}
/**
*
*
* @summary
*
*/
@Post("command/employee/report/attachment")
async SalaryEmployeeReportAttachment(
@Body()
body: {
refIds: {
refId?: string;
Sequence?: any | null;
CitizenId?: any | null;
Prefix?: any | null;
FirstName?: any | null;
LastName?: any | null;
Amount?: any | null;
PositionSalaryAmount?: any | null;
MouthSalaryAmount?: any | null;
RemarkHorizontal?: any | null;
RemarkVertical?: any | null;
CommandYear?: any | null;
}[];
},
@Request() request: RequestWithUser,
) {
let data = new Array();
await Promise.all(
body.refIds.map(async (v) => {
const salary = await this.salaryProfileEmployeeRepository.findOne({
where: {
id: v.refId,
},
});
if (salary != null) {
const _data = {
no: Extension.ToThaiNumber((data.length + 1).toString()),
fullName: `${v.Prefix}${v.FirstName} ${v.LastName}`,
oc: salary.rootId == null ? salary.position == null ? "-" : salary.position :
salary.child4 != null
? salary.position == null ? salary.child4+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root
: salary.position+"/"+salary.child4+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root :
salary.child3 != null
? salary.position == null ? salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root
: salary.position+"/"+salary.child3+"/"+salary.child2+"/"+salary.child1+"/"+salary.root :
salary.child2 != null
? salary.position == null ? salary.child2+"/"+salary.child1+"/"+salary.root
: salary.position+"/"+salary.child2+"/"+salary.child1+"/"+salary.root :
salary.child1 != null
? salary.position == null ? salary.child1+"/"+salary.root
: salary.position+"/"+salary.child1+"/"+salary.root :
salary.root != null
? salary.position == null ? salary.root
: salary.position+"/"+salary.root : "-",
positionType: salary.posType ? salary.posType : "-",
positionLevel: salary.posLevel ? salary.posLevel : "-",
positionNumber: salary.orgShortName != null && salary.posMasterNo != null
? Extension.ToThaiNumber(salary.orgShortName + salary.posMasterNo)
: "-",
amount: salary.amount
? Extension.ToThaiNumber(salary.amount.toLocaleString()) : "-",
positionSalaryAmount: salary.positionSalaryAmount
? Extension.ToThaiNumber(salary.positionSalaryAmount.toLocaleString()) : "-",
amountSpecial: salary.amountSpecial
? Extension.ToThaiNumber(salary.amountSpecial.toLocaleString()) : "-",
remark: salary.remark ? salary.remark : "-",
remarkVertical: v.RemarkVertical,
remarkHorizontal: v.RemarkHorizontal
}
data.push(_data);
}
}),
);
return new HttpSuccess(data);
}
/**
* API
*