fix: change running no to custoer branch id instead
This commit is contained in:
parent
fc5279b855
commit
0af6dbaae1
1 changed files with 3 additions and 3 deletions
|
|
@ -321,10 +321,10 @@ export class QuotationController extends Controller {
|
||||||
const nonExistEmployee = body.worker.filter((v) => typeof v !== "string");
|
const nonExistEmployee = body.worker.filter((v) => typeof v !== "string");
|
||||||
const lastEmployee = await tx.runningNo.upsert({
|
const lastEmployee = await tx.runningNo.upsert({
|
||||||
where: {
|
where: {
|
||||||
key: `EMPLOYEE_${customerBranch.code}-${`${new Date().getFullYear()}`.slice(-2).padStart(2, "0")}`,
|
key: `EMPLOYEE_${customerBranch.id}-${`${new Date().getFullYear()}`.slice(-2).padStart(2, "0")}`,
|
||||||
},
|
},
|
||||||
create: {
|
create: {
|
||||||
key: `EMPLOYEE_${customerBranch.code}-${`${new Date().getFullYear()}`.slice(-2).padStart(2, "0")}`,
|
key: `EMPLOYEE_${customerBranch.id}-${`${new Date().getFullYear()}`.slice(-2).padStart(2, "0")}`,
|
||||||
value: nonExistEmployee.length,
|
value: nonExistEmployee.length,
|
||||||
},
|
},
|
||||||
update: { value: { increment: nonExistEmployee.length } },
|
update: { value: { increment: nonExistEmployee.length } },
|
||||||
|
|
@ -334,7 +334,7 @@ export class QuotationController extends Controller {
|
||||||
tx.employee.create({
|
tx.employee.create({
|
||||||
data: {
|
data: {
|
||||||
...v,
|
...v,
|
||||||
code: `${customerBranch.code}-${`${new Date().getFullYear()}`.slice(-2).padStart(2, "0")}${`${lastEmployee.value - nonExistEmployee.length + i + 1}`.padStart(7, "0")}`,
|
code: `${customerBranch.id}-${`${new Date().getFullYear()}`.slice(-2).padStart(2, "0")}${`${lastEmployee.value - nonExistEmployee.length + i + 1}`.padStart(7, "0")}`,
|
||||||
customerBranchId: customerBranch.id,
|
customerBranchId: customerBranch.id,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue