fix: customer code should not have company code

This commit is contained in:
Methapon Metanipat 2024-09-16 16:36:02 +07:00
parent 06d4647462
commit 3a8bb7a82d
2 changed files with 4 additions and 4 deletions

View file

@ -390,8 +390,8 @@ export class CustomerBranchController extends Controller {
},
data: {
...rest,
code: `${runningKey.replace("CUSTOMER_BRANCH_", "")}-${`${last.value - 1}`.padStart(2, "0")}`,
codeCustomer: runningKey.replace("CUSTOMER_BRANCH_", ""),
code: `${runningKey.replace(`CUSTOMER_BRANCH_${company}_`, "")}-${`${last.value - 1}`.padStart(2, "0")}`,
codeCustomer: runningKey.replace(`CUSTOMER_BRANCH_${company}_`, ""),
customer: { connect: { id: customerId } },
province: { connect: provinceId ? { id: provinceId } : undefined },
district: { connect: districtId ? { id: districtId } : undefined },

View file

@ -298,8 +298,8 @@ export class CustomerController extends Controller {
branch: {
create: branch.map((v, i) => ({
...v,
code: `${runningKey.replace("CUSTOMER_BRANCH_", "")}-${`${last.value - branch.length + i}`.padStart(2, "0")}`,
codeCustomer: runningKey.replace("CUSTOMER_BRANCH_", ""),
code: `${runningKey.replace(`CUSTOMER_BRANCH_${company}_`, "")}-${`${last.value - branch.length + i}`.padStart(2, "0")}`,
codeCustomer: runningKey.replace(`CUSTOMER_BRANCH_${company}_`, ""),
province: connectOrNot(v.provinceId),
provinceId: undefined,
district: connectOrNot(v.districtId),