Fix cumulative tax calculation in FalukantService by using falukantUser.id instead of user.id for accurate regional tax assessments.

This commit is contained in:
Torsten Schulz (local)
2025-12-20 11:04:21 +01:00
parent d08022ab94
commit c69a414f78

View File

@@ -1694,7 +1694,7 @@ class FalukantService extends BaseService {
const knowledgeVal = item.productType.knowledges[0]?.knowledge || 0; const knowledgeVal = item.productType.knowledges[0]?.knowledge || 0;
const regionId = item.stock.branch.regionId; const regionId = item.stock.branch.regionId;
const pricePerUnit = await calcRegionalSellPrice(item.productType, knowledgeVal, regionId); const pricePerUnit = await calcRegionalSellPrice(item.productType, knowledgeVal, regionId);
const cumulativeTax = await getCumulativeTaxPercentWithExemptions(user.id, regionId); const cumulativeTax = await getCumulativeTaxPercentWithExemptions(falukantUser.id, regionId);
const inflationFactor = cumulativeTax >= 100 ? 1 : (1 / (1 - cumulativeTax / 100)); const inflationFactor = cumulativeTax >= 100 ? 1 : (1 / (1 - cumulativeTax / 100));
const adjustedPricePerUnit = Math.round(pricePerUnit * inflationFactor * 100) / 100; const adjustedPricePerUnit = Math.round(pricePerUnit * inflationFactor * 100) / 100;
total += item.quantity * adjustedPricePerUnit; total += item.quantity * adjustedPricePerUnit;