diff --git a/src/controllers/03-customer-branch-controller.ts b/src/controllers/03-customer-branch-controller.ts index 0f8e9ca..c1f4045 100644 --- a/src/controllers/03-customer-branch-controller.ts +++ b/src/controllers/03-customer-branch-controller.ts @@ -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 }, diff --git a/src/controllers/03-customer-controller.ts b/src/controllers/03-customer-controller.ts index efd8b79..4b25b4e 100644 --- a/src/controllers/03-customer-controller.ts +++ b/src/controllers/03-customer-controller.ts @@ -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),