diff --git a/src/controllers/employee-controller.ts b/src/controllers/employee-controller.ts index 966f437..e24969a 100644 --- a/src/controllers/employee-controller.ts +++ b/src/controllers/employee-controller.ts @@ -345,10 +345,10 @@ export class EmployeeController extends Controller { async (tx) => { const last = await tx.runningNo.upsert({ where: { - key: `EMPLOYEE_${customerBranch.customer.code}-${customerBranch.branchNo}-${new Date().getFullYear().toString().slice(-2).padStart(2, "0")}`, + key: `EMPLOYEE_${customerBranch.customer.code}-${customerBranch.branchNo.toString().padStart(2, "0")}-${new Date().getFullYear().toString().slice(-2).padStart(2, "0")}`, }, create: { - key: `EMPLOYEE_${customerBranch.customer.code}-${customerBranch.branchNo}-${new Date().getFullYear().toString().slice(-2).padStart(2, "0")}`, + key: `EMPLOYEE_${customerBranch.customer.code}-${customerBranch.branchNo.toString().padStart(2, "0")}-${new Date().getFullYear().toString().slice(-2).padStart(2, "0")}`, value: 1, }, update: { value: { increment: 1 } }, @@ -369,7 +369,7 @@ export class EmployeeController extends Controller { }, data: { ...rest, - code: `${customerBranch.customer.code}-${customerBranch.branchNo}-${new Date().getFullYear().toString().slice(-2).padStart(2, "0")}${last.value.toString().padStart(4, "0")}`, + code: `${customerBranch.customer.code}-${customerBranch.branchNo.toString().padStart(2, "0")}-${new Date().getFullYear().toString().slice(-2).padStart(2, "0")}${last.value.toString().padStart(4, "0")}`, employeeWork: { createMany: { data: employeeWork || [],