Compare commits
2 commits
3163b701c9
...
190a5d665a
| Author | SHA1 | Date | |
|---|---|---|---|
| 190a5d665a | |||
| 2a5fba2dfc |
4 changed files with 92 additions and 11 deletions
|
|
@ -6864,7 +6864,7 @@ export class ImportDataController extends Controller {
|
|||
|
||||
// กรณี 1: Excel serial number (ตัวเลข)
|
||||
if (typeof value === "number") {
|
||||
// Excel serial number = จำนวนวันตั้งแต่ 1 ม.ค. 1900
|
||||
// Excel serial number = จำนวนวันตั้งแต่ 1 ม.ค. 1900
|
||||
// แปลงเป็น JavaScript Date (epoch 1970)
|
||||
let jsDate = new Date(Math.round((value - 25569) * 86400 * 1000));
|
||||
|
||||
|
|
@ -6878,7 +6878,7 @@ export class ImportDataController extends Controller {
|
|||
jsDate.getHours(),
|
||||
jsDate.getMinutes(),
|
||||
jsDate.getSeconds(),
|
||||
jsDate.getMilliseconds()
|
||||
jsDate.getMilliseconds(),
|
||||
);
|
||||
}
|
||||
return jsDate;
|
||||
|
|
@ -6902,7 +6902,7 @@ export class ImportDataController extends Controller {
|
|||
jsDate.getHours(),
|
||||
jsDate.getMinutes(),
|
||||
jsDate.getSeconds(),
|
||||
jsDate.getMilliseconds()
|
||||
jsDate.getMilliseconds(),
|
||||
);
|
||||
}
|
||||
return jsDate;
|
||||
|
|
@ -7036,7 +7036,7 @@ export class ImportDataController extends Controller {
|
|||
|
||||
// Index 28: commandId
|
||||
salaryTemp.commandId = row[28] || null;
|
||||
|
||||
|
||||
// Index 29: commandCode
|
||||
salaryTemp.commandCode = row[29] || null;
|
||||
|
||||
|
|
@ -7052,6 +7052,17 @@ export class ImportDataController extends Controller {
|
|||
salaryTemp.lastUpdateUserId = req.user?.sub || "";
|
||||
salaryTemp.lastUpdateFullName = req.user?.name || "System Administrator";
|
||||
|
||||
// 12,15,16 isGovernment = false & dateGovernment = salaryTemp.commandDateAffect
|
||||
if (["12", "15", "16"].includes(salaryTemp.commandCode ?? "")) {
|
||||
salaryTemp.isGovernment = false;
|
||||
salaryTemp.dateGovernment = salaryTemp.commandDateAffect;
|
||||
}
|
||||
// 1,2,3,4,10,11,20 isGovernment = true & dateGovernment = salaryTemp.commandDateAffect
|
||||
else if (["1", "2", "3", "4", "10", "11", "20"].includes(salaryTemp.commandCode ?? "")) {
|
||||
salaryTemp.isGovernment = true;
|
||||
salaryTemp.dateGovernment = salaryTemp.commandDateAffect;
|
||||
}
|
||||
|
||||
salaryTemps.push(salaryTemp);
|
||||
}
|
||||
|
||||
|
|
@ -7127,7 +7138,7 @@ export class ImportDataController extends Controller {
|
|||
jsDate.getHours(),
|
||||
jsDate.getMinutes(),
|
||||
jsDate.getSeconds(),
|
||||
jsDate.getMilliseconds()
|
||||
jsDate.getMilliseconds(),
|
||||
);
|
||||
}
|
||||
return jsDate;
|
||||
|
|
@ -7151,7 +7162,7 @@ export class ImportDataController extends Controller {
|
|||
jsDate.getHours(),
|
||||
jsDate.getMinutes(),
|
||||
jsDate.getSeconds(),
|
||||
jsDate.getMilliseconds()
|
||||
jsDate.getMilliseconds(),
|
||||
);
|
||||
}
|
||||
return jsDate;
|
||||
|
|
@ -7285,7 +7296,7 @@ export class ImportDataController extends Controller {
|
|||
|
||||
// Index 28: commandId
|
||||
salaryTemp.commandId = row[28] || null;
|
||||
|
||||
|
||||
// Index 29: commandCode
|
||||
salaryTemp.commandCode = row[29] || null;
|
||||
|
||||
|
|
@ -7301,6 +7312,16 @@ export class ImportDataController extends Controller {
|
|||
salaryTemp.lastUpdateUserId = req.user?.sub || "";
|
||||
salaryTemp.lastUpdateFullName = req.user?.name || "System Administrator";
|
||||
|
||||
// 12,15,16 isGovernment = false & dateGovernment = salaryTemp.commandDateAffect
|
||||
if (["12", "15", "16"].includes(salaryTemp.commandCode ?? "")) {
|
||||
salaryTemp.isGovernment = false;
|
||||
salaryTemp.dateGovernment = salaryTemp.commandDateAffect;
|
||||
}
|
||||
// 1,2,3,4,10,11,20 isGovernment = true & dateGovernment = salaryTemp.commandDateAffect
|
||||
else if (["1", "2", "3", "4", "10", "11", "20"].includes(salaryTemp.commandCode ?? "")) {
|
||||
salaryTemp.isGovernment = true;
|
||||
salaryTemp.dateGovernment = salaryTemp.commandDateAffect;
|
||||
}
|
||||
salaryTemps.push(salaryTemp);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -919,6 +919,17 @@ export class ProfileSalaryController extends Controller {
|
|||
else if (body.commandCode == "19") body.commandName = "ไม่ได้เลื่อนเงินเดือน/ค่าจ้าง";
|
||||
}
|
||||
Object.assign(data, { ...body, ...meta });
|
||||
// 12,15,16 isGovernment = false & dateGovernment = commandDateAffect
|
||||
if (["12", "15", "16"].includes(body.commandCode ?? "")) {
|
||||
data.isGovernment = false;
|
||||
if (body.commandDateAffect) data.dateGovernment = body.commandDateAffect;
|
||||
}
|
||||
// 1,2,3,4,10,11,20 isGovernment = true & dateGovernment = commandDateAffect
|
||||
else if (["1", "2", "3", "4", "10", "11", "20"].includes(body.commandCode ?? "")) {
|
||||
data.isGovernment = true;
|
||||
if (body.commandDateAffect) data.dateGovernment = body.commandDateAffect;
|
||||
}
|
||||
|
||||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...data, id: undefined });
|
||||
await this.salaryRepo.save(data, { data: req });
|
||||
|
|
@ -1043,6 +1054,17 @@ export class ProfileSalaryController extends Controller {
|
|||
else if (body.commandCode == "19") body.commandName = "ไม่ได้เลื่อนเงินเดือน/ค่าจ้าง";
|
||||
}
|
||||
Object.assign(record, body);
|
||||
// 12,15,16 isGovernment = false & dateGovernment = commandDateAffect
|
||||
if (["12", "15", "16"].includes(body.commandCode ?? "")) {
|
||||
record.isGovernment = false;
|
||||
if (body.commandDateAffect) record.dateGovernment = body.commandDateAffect;
|
||||
}
|
||||
// 1,2,3,4,10,11,20 isGovernment = true & dateGovernment = commandDateAffect
|
||||
else if (["1", "2", "3", "4", "10", "11", "20"].includes(body.commandCode ?? "")) {
|
||||
record.isGovernment = true;
|
||||
if (body.commandDateAffect) record.dateGovernment = body.commandDateAffect;
|
||||
}
|
||||
|
||||
Object.assign(history, { ...record, id: undefined });
|
||||
|
||||
history.profileSalaryId = salaryId;
|
||||
|
|
|
|||
|
|
@ -403,6 +403,17 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
else if (body.commandCode == "19") body.commandName = "ไม่ได้เลื่อนเงินเดือน/ค่าจ้าง";
|
||||
}
|
||||
Object.assign(data, { ...body, ...meta });
|
||||
// 12,15,16 isGovernment = false & dateGovernment = commandDateAffect
|
||||
if (["12", "15", "16"].includes(body.commandCode ?? "")) {
|
||||
data.isGovernment = false;
|
||||
if (body.commandDateAffect) data.dateGovernment = body.commandDateAffect;
|
||||
}
|
||||
// 1,2,3,4,10,11,20 isGovernment = true & dateGovernment = commandDateAffect
|
||||
else if (["1", "2", "3", "4", "10", "11", "20"].includes(body.commandCode ?? "")) {
|
||||
data.isGovernment = true;
|
||||
if (body.commandDateAffect) data.dateGovernment = body.commandDateAffect;
|
||||
}
|
||||
|
||||
const history = new ProfileSalaryHistory();
|
||||
Object.assign(history, { ...data, id: undefined });
|
||||
const _null: any = null;
|
||||
|
|
@ -537,6 +548,16 @@ export class ProfileSalaryEmployeeController extends Controller {
|
|||
else if (body.commandCode == "19") body.commandName = "ไม่ได้เลื่อนเงินเดือน/ค่าจ้าง";
|
||||
}
|
||||
Object.assign(record, body);
|
||||
// 12,15,16 isGovernment = false & dateGovernment = commandDateAffect
|
||||
if (["12", "15", "16"].includes(body.commandCode ?? "")) {
|
||||
record.isGovernment = false;
|
||||
if (body.commandDateAffect) record.dateGovernment = body.commandDateAffect ?? null;
|
||||
}
|
||||
// 1,2,3,4,10,11,20 isGovernment = true & dateGovernment = commandDateAffect
|
||||
else if (["1", "2", "3", "4", "10", "11", "20"].includes(body.commandCode ?? "")) {
|
||||
record.isGovernment = true;
|
||||
if (body.commandDateAffect) record.dateGovernment = body.commandDateAffect ?? null;
|
||||
}
|
||||
Object.assign(history, { ...record, id: undefined });
|
||||
|
||||
history.profileSalaryId = salaryId;
|
||||
|
|
|
|||
|
|
@ -133,8 +133,8 @@ export class ProfileSalaryTempController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`current_holders.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
|
|
@ -545,8 +545,8 @@ export class ProfileSalaryTempController extends Controller {
|
|||
_data.child1 != undefined && _data.child1 != null
|
||||
? _data.child1[0] != null
|
||||
? `current_holders.orgChild1Id IN (:...child1)`
|
||||
// : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
: `current_holders.orgChild1Id is null`
|
||||
: // : `current_holders.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
|
||||
`current_holders.orgChild1Id is null`
|
||||
: "1=1",
|
||||
{
|
||||
child1: _data.child1,
|
||||
|
|
@ -1233,6 +1233,13 @@ export class ProfileSalaryTempController extends Controller {
|
|||
isDelete: false,
|
||||
};
|
||||
Object.assign(data, { ...body, ...meta });
|
||||
if (["12", "15", "16"].includes(body.commandCode ?? "")) {
|
||||
data.isGovernment = false;
|
||||
if (body.commandDateAffect) data.dateGovernment = body.commandDateAffect;
|
||||
} else if (["1", "2", "3", "4", "10", "11", "20"].includes(body.commandCode ?? "")) {
|
||||
data.isGovernment = true;
|
||||
if (body.commandDateAffect) data.dateGovernment = body.commandDateAffect;
|
||||
}
|
||||
await this.salaryRepo.save(data, { data: req });
|
||||
setLogDataDiff(req, { before, after: data });
|
||||
|
||||
|
|
@ -1509,6 +1516,16 @@ export class ProfileSalaryTempController extends Controller {
|
|||
const before = structuredClone(record);
|
||||
|
||||
Object.assign(record, body);
|
||||
// 12,15,16 isGovernment = false & dateGovernment = commandDateAffect
|
||||
if (["12", "15", "16"].includes(body.commandCode ?? "")) {
|
||||
record.isGovernment = false;
|
||||
if (body.commandDateAffect) record.dateGovernment = body.commandDateAffect;
|
||||
}
|
||||
// 1,2,3,4,10,11,20 isGovernment = true & dateGovernment = commandDateAffect
|
||||
else if (["1", "2", "3", "4", "10", "11", "20"].includes(body.commandCode ?? "")) {
|
||||
record.isGovernment = true;
|
||||
if (body.commandDateAffect) record.dateGovernment = body.commandDateAffect;
|
||||
}
|
||||
|
||||
record.isEdit = true;
|
||||
record.lastUpdateUserId = req.user.sub;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue