From aa43f1bcfd3fc783c991d13e2e543866fb0bdd89 Mon Sep 17 00:00:00 2001 From: FIN-IT_AndriFP Date: Thu, 12 Feb 2026 09:09:25 +0700 Subject: (andri) fix ketika qty = 0 --- .../[companyId]/product/[productId]/compute-different/route.tsx | 4 ++-- src/app/api/stock-opname/route.tsx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/api/company/[companyId]/product/[productId]/compute-different/route.tsx b/src/app/api/company/[companyId]/product/[productId]/compute-different/route.tsx index c2ae5bb..1b641d3 100644 --- a/src/app/api/company/[companyId]/product/[productId]/compute-different/route.tsx +++ b/src/app/api/company/[companyId]/product/[productId]/compute-different/route.tsx @@ -61,7 +61,7 @@ export async function POST(request: NextRequest, { params }: PostParams) { const conditional = { verificationCheckAll: verificationCounter > 0 && verificationCounter === stockOpnames.length, // anyCountEqWithOnhand: [totalQty['COUNT1'], totalQty['COUNT2'], totalQty['COUNT3']].includes(onhandQty), - anyCountEqWithOnhand: (totalQty["COUNT1"] === onhandQty && zeroCount2 && zeroCount3) || (totalQty["COUNT2"] === onhandQty && zeroCount3 && onhandQty!== 0) || (totalQty["COUNT3"] === onhandQty && onhandQty!== 0), + anyCountEqWithOnhand: (totalQty["COUNT1"] === onhandQty && zeroCount2 && zeroCount3) || (totalQty["COUNT2"] === onhandQty && zeroCount3) || (totalQty["COUNT3"] === onhandQty), anyCountEqWithAllQty: [totalQty["COUNT1"], totalQty["COUNT2"], totalQty["COUNT3"]].includes(allQty), count1EqWithCount2: totalQty["COUNT1"] !== 0 && totalQty["COUNT2"] !== 0 && totalQty["COUNT1"] === totalQty["COUNT2"] && totalQty["COUNT3"] === null && totalQty["COUNT1"] !== onhandQty, count1EqWithCount3: totalQty["COUNT1"] !== 0 && totalQty["COUNT3"] !== 0 && totalQty["COUNT1"] === totalQty["COUNT3"], @@ -84,7 +84,7 @@ export async function POST(request: NextRequest, { params }: PostParams) { const detailCondition = { verificationCheckAll: _.isNumber(VERIFICATION.quantity), - anyCountEqWithOnhand: (totalQty["COUNT1"] === onhandQty && zeroCount2 && zeroCount3) || (totalQty["COUNT2"] === onhandQty && zeroCount3 && onhandQty!== 0) || (totalQty["COUNT3"] === onhandQty && onhandQty!== 0), + anyCountEqWithOnhand: (totalQty["COUNT1"] === onhandQty && zeroCount2 && zeroCount3) || (totalQty["COUNT2"] === onhandQty && zeroCount3) || (totalQty["COUNT3"] === onhandQty), count1EqWithCount2: totalQty["COUNT3"] === 0 && count1 === count2, // count1EqWithCount3: count1 == count3, count1EqWithCount3: count1 != 0 && count1 === count3, diff --git a/src/app/api/stock-opname/route.tsx b/src/app/api/stock-opname/route.tsx index ec943c5..8e09351 100644 --- a/src/app/api/stock-opname/route.tsx +++ b/src/app/api/stock-opname/route.tsx @@ -181,7 +181,7 @@ const computeIsDifferent = async ({ companyId, productId }: { companyId: number; // Jika tidak ada qty verifikasi, cek kondisi tim 1/2/3 const conditional = { // anyCountEqWithOnhand: [totalQty['COUNT1'], totalQty['COUNT2'], totalQty['COUNT3']].includes(onhandQty), - anyCountEqWithOnhand: (totalQty["COUNT1"] === onhandQty && zeroCount2 && zeroCount3) || (totalQty["COUNT2"] === onhandQty && zeroCount3 && onhandQty!== 0) || (totalQty["COUNT3"] === onhandQty && onhandQty!== 0), + anyCountEqWithOnhand: (totalQty["COUNT1"] === onhandQty && zeroCount2 && zeroCount3) || (totalQty["COUNT2"] === onhandQty && zeroCount3) || (totalQty["COUNT3"] === onhandQty), anyCountEqWithAllQty: [totalQty["COUNT1"], totalQty["COUNT2"], totalQty["COUNT3"]].includes(allQty), count1EqWithCount2: totalQty["COUNT1"] !== null && totalQty["COUNT2"] !== null && totalQty["COUNT1"] === totalQty["COUNT2"] && totalQty["COUNT3"] === null, count1EqWithCount3: totalQty["COUNT1"] !== null && totalQty["COUNT3"] !== null && totalQty["COUNT1"] === totalQty["COUNT3"], @@ -206,7 +206,7 @@ const computeIsDifferent = async ({ companyId, productId }: { companyId: number; const detailCondition = { verificationCheckAll: _.isNumber(VERIFICATION.quantity), - anyCountEqWithOnhand: (totalQty["COUNT1"] === onhandQty && zeroCount2 && zeroCount3) || (totalQty["COUNT2"] === onhandQty && zeroCount3 && onhandQty!== 0) || (totalQty["COUNT3"] === onhandQty && onhandQty!== 0), + anyCountEqWithOnhand: (totalQty["COUNT1"] === onhandQty && zeroCount2 && zeroCount3) || (totalQty["COUNT2"] === onhandQty && zeroCount3) || (totalQty["COUNT3"] === onhandQty), count1EqWithCount2: totalQty["COUNT3"] === 0 && count1 === count2, // count1EqWithCount3: count1 === count3, count1EqWithCount3: count1 != 0 && count1 === count3, -- cgit v1.2.3