summaryrefslogtreecommitdiff
path: root/src/app/api/company
diff options
context:
space:
mode:
authorMqdd <ahmadmiqdad27@gmail.com>2026-01-27 15:19:11 +0700
committerMqdd <ahmadmiqdad27@gmail.com>2026-01-27 15:19:11 +0700
commit7376e70d47d429787900eb49cb6102b389e0690c (patch)
tree1abb756d57dcdef1f344bf419c9945c971db69d8 /src/app/api/company
parent629d60902e53af31e87ad905ec9a20f93932969a (diff)
<Miqdad> 2026
Diffstat (limited to 'src/app/api/company')
-rw-r--r--src/app/api/company/[companyId]/product/[productId]/compute-different/route.tsx14
1 files changed, 11 insertions, 3 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 a99bb3f..61e6db3 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
@@ -55,6 +55,9 @@ export async function POST(request: NextRequest, { params }: PostParams) {
const zeroCount2: boolean = totalQty["COUNT2"] === 0;
const zeroCount3: boolean = totalQty["COUNT3"] === 0;
+ if (verificationCounter > 0){
+ isDifferent = false
+ } else {
const conditional = {
verificationCheckAll: verificationCounter > 0 && verificationCounter === stockOpnames.length,
// anyCountEqWithOnhand: [totalQty['COUNT1'], totalQty['COUNT2'], totalQty['COUNT3']].includes(onhandQty),
@@ -70,16 +73,21 @@ export async function POST(request: NextRequest, { params }: PostParams) {
} else {
isDifferent = true;
}
+ }
for (const opname of stockOpnames) {
let { COUNT1, COUNT2, COUNT3, VERIFICATION } = opname;
+ const count1 = _.isNumber(COUNT1.quantity) ? COUNT1.quantity : 0;
+ const count2 = _.isNumber(COUNT2.quantity) ? COUNT2.quantity : 0;
+ const count3 = _.isNumber(COUNT3.quantity) ? COUNT3.quantity : 0;
+
const detailCondition = {
verificationCheckAll: _.isNumber(VERIFICATION.quantity),
anyCountEqWithOnhand: (totalQty["COUNT1"] === onhandQty && zeroCount2 && zeroCount3) || (totalQty["COUNT2"] === onhandQty && zeroCount3 && onhandQty!== 0) || (totalQty["COUNT3"] === onhandQty && onhandQty!== 0),
- count1EqWithCount2: totalQty["COUNT3"] === 0 && COUNT1.quantity === COUNT2.quantity && totalQty["COUNT1"] !== onhandQty,
- count1EqWithCount3: COUNT1.quantity === COUNT3.quantity,
- count2EqWithCount3: totalQty["COUNT2"] !== 0 && totalQty["COUNT3"] !== 0 && totalQty["COUNT2"] === totalQty["COUNT3"],
+ count1EqWithCount2: totalQty["COUNT3"] === 0 && count1 === count2,
+ count1EqWithCount3: count1 == count3,
+ count2EqWithCount3: totalQty["COUNT2"] !== 0 && totalQty["COUNT3"] !== 0 && count2 === count3,
// count3EqWithCount1_2: (COUNT3.quantity !== COUNT1.quantity) && (COUNT3.quantity !== COUNT2.quantity) && (COUNT1.quantity === COUNT2.quantity) && (COUNT3.quantity !== onhandQty)
};