diff --git a/src/controllers/ImportDataController.ts b/src/controllers/ImportDataController.ts index 3e1a1b2b..3d7a083a 100644 --- a/src/controllers/ImportDataController.ts +++ b/src/controllers/ImportDataController.ts @@ -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,29 @@ 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 ( + salaryTemp.commandCode === "12" || + salaryTemp.commandCode === "15" || + salaryTemp.commandCode === "16" + ) { + salaryTemp.isGovernment = false; + salaryTemp.dateGovernment = salaryTemp.commandDateAffect; + } + // 1,2,3,4,10,11,20 isGovernment = true & dateGovernment = salaryTemp.commandDateAffect + else if ( + salaryTemp.commandCode === "1" || + salaryTemp.commandCode === "2" || + salaryTemp.commandCode === "3" || + salaryTemp.commandCode === "4" || + salaryTemp.commandCode === "10" || + salaryTemp.commandCode === "11" || + salaryTemp.commandCode === "20" + ) { + salaryTemp.isGovernment = true; + salaryTemp.dateGovernment = salaryTemp.commandDateAffect; + } + salaryTemps.push(salaryTemp); } @@ -7127,7 +7150,7 @@ export class ImportDataController extends Controller { jsDate.getHours(), jsDate.getMinutes(), jsDate.getSeconds(), - jsDate.getMilliseconds() + jsDate.getMilliseconds(), ); } return jsDate; @@ -7151,7 +7174,7 @@ export class ImportDataController extends Controller { jsDate.getHours(), jsDate.getMinutes(), jsDate.getSeconds(), - jsDate.getMilliseconds() + jsDate.getMilliseconds(), ); } return jsDate; @@ -7285,7 +7308,7 @@ export class ImportDataController extends Controller { // Index 28: commandId salaryTemp.commandId = row[28] || null; - + // Index 29: commandCode salaryTemp.commandCode = row[29] || null; @@ -7301,6 +7324,28 @@ 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 ( + salaryTemp.commandCode === "12" || + salaryTemp.commandCode === "15" || + salaryTemp.commandCode === "16" + ) { + salaryTemp.isGovernment = false; + salaryTemp.dateGovernment = salaryTemp.commandDateAffect; + } + // 1,2,3,4,10,11,20 isGovernment = true & dateGovernment = salaryTemp.commandDateAffect + else if ( + salaryTemp.commandCode === "1" || + salaryTemp.commandCode === "2" || + salaryTemp.commandCode === "3" || + salaryTemp.commandCode === "4" || + salaryTemp.commandCode === "10" || + salaryTemp.commandCode === "11" || + salaryTemp.commandCode === "20" + ) { + salaryTemp.isGovernment = true; + salaryTemp.dateGovernment = salaryTemp.commandDateAffect; + } salaryTemps.push(salaryTemp); }