summaryrefslogtreecommitdiff
path: root/src/app/api/stock-opname
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/api/stock-opname')
-rw-r--r--src/app/api/stock-opname/route.tsx20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/app/api/stock-opname/route.tsx b/src/app/api/stock-opname/route.tsx
index 1ec79d1..e0a5ee7 100644
--- a/src/app/api/stock-opname/route.tsx
+++ b/src/app/api/stock-opname/route.tsx
@@ -180,6 +180,14 @@ const computeIsDifferent = async ({ companyId, productId }: { companyId: number;
count2EqWithCount3: totalQty["COUNT2"] !== null && totalQty["COUNT3"] !== null && totalQty["COUNT2"] === totalQty["COUNT3"],
};
+ // isDifferent = !(
+ // conditional.verificationCheckAll ||
+ // conditional.anyCountEqWithOnhand ||
+ // conditional.anyCountEqWithAllQty ||
+ // conditional.count1EqWithCount2 ||
+ // conditional.count1EqWithCount3 ||
+ // conditional.count2EqWithCount3
+ // )
if (conditional.verificationCheckAll || conditional.anyCountEqWithOnhand || conditional.count1EqWithCount2 || conditional.count1EqWithCount3 || conditional.count2EqWithCount3) {
isDifferent = false;
} else {
@@ -194,7 +202,7 @@ const computeIsDifferent = async ({ companyId, productId }: { companyId: number;
anyCountEqWithOnhand: totalQty["COUNT1"] === onhandQty || totalQty["COUNT2"] === onhandQty || totalQty["COUNT3"] === onhandQty,
count1EqWithCount2: totalQty["COUNT3"] === 0 && COUNT1.quantity === COUNT2.quantity,
count1EqWithCount3: COUNT1.quantity === COUNT3.quantity,
- count2EqWithCount3: COUNT2.quantity === COUNT3.quantity && COUNT2.quantity !== 0 && COUNT3.quantity !== 0,
+ count2EqWithCount3: totalQty["COUNT2"] !== null && totalQty["COUNT3"] !== null && totalQty["COUNT2"] === totalQty["COUNT3"],
// count3EqWithCount1_2: (COUNT3.quantity !== COUNT1.quantity) && (COUNT3.quantity !== COUNT2.quantity) && (COUNT1.quantity === COUNT2.quantity) && (COUNT3.quantity !== onhandQty)
};
@@ -204,8 +212,18 @@ const computeIsDifferent = async ({ companyId, productId }: { companyId: number;
isDifferent = true;
break;
}
+ console.log("----------------------------------BATAS SUCI ATAS NEW STOCK ------------------------------");
+ console.log("Is Different2222:", isDifferent);
+ console.log("Conditions:", detailCondition);
}
+ console.log("Total Quantity:", totalQty);
+ console.log("Onhand Quantity:", onhandQty);
+ console.log("Difference Quantity:", differenceQty);
+ console.log("Conditions:", conditional);
+ console.log("Is Different tambah data:", isDifferent);
+ console.log("----------------------------------BATAS SUCI BAWAH NEW STOCK------------------------------");
+
await prisma.product.update({
where: { id: product.id },
data: { isDifferent },