This commit is contained in:
AdisakKanthawilang 2025-06-04 15:32:01 +07:00
parent 0af89e7ecf
commit f1c134cb09

View file

@ -4926,8 +4926,8 @@ export class ReportController extends Controller {
* @summary 04- ( ..1)
*
*/
@Get("emp2-04/{rootId}/{salaryPeriodId}")
async SalaryReportEmp2_4(@Path() rootId: string, @Path() salaryPeriodId: string) {
@Get("emp2-04/{rootId}/{salaryPeriodId}/{type}")
async SalaryReportEmp2_4(@Path() rootId: string, @Path() salaryPeriodId: string, @Path() type: string = 'ALL') {
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: {
id: salaryPeriodId,
@ -4938,16 +4938,32 @@ export class ReportController extends Controller {
if (!salaryPeriod) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการขึ้นเงินเดือน");
}
let condition: any = {
salaryOrg: {
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
};
condition.type = Not("NONE");
if(salaryPeriod.period == "APR"){
if(type == "HAFT"){
condition.type = "HAFT";
}else if(type == "FULL"){
condition.type = "FULL";
}
}else{
if(type == "HAFT"){
condition.type = "HAFT";
}else if(type == "FULL"){
condition.type = "FULL";
}else if(type == "FULLHAFT"){
condition.type = "FULLHAFT";
}
}
const _salaryProfileEmp = await this.salaryProfileEmployeeRepository.find({
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
where: {
salaryOrg: {
snapshot: "SNAP2",
rootId: rootId,
salaryPeriodId: salaryPeriodId,
},
type: Not("NONE"),
},
where: condition,
order: {
rootOrder: "ASC",
child1Order: "ASC",
@ -4958,7 +4974,6 @@ export class ReportController extends Controller {
posMasterNo: "ASC",
},
});
if (!_salaryProfileEmp) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}