// calculating the agBasePrice
const amicAmount = 100;
const amicFactor = 1;
const amicPrice = 110;
const agAmount = 40;
const amicQuantity = amicAmount / amicFactor;
const agBasePrice = (amicQuantity * amicPrice) * agAmount / amicQuantity;Â // this should be recaclucated if the agrantisAmount changes via connect/disconnect from article!
// calculating amicPrice for line using agBasePrice:
// const amicPrice2 = (agBasePrice / amicFactor * amicAmount / agAmount) * amicFactor / amicAmount;
// happens in agrantis
const agQuantity = 1;
const agLineTotal = agQuantity * agBasePrice;
// calculate amicPrice for line using agQuantity, agAmount and agLineTotal
// const amicLinePrice = ((agLineTotal / (agAmount * agQuantity)) / amicFactor * amicAmount / agAmount) * amicFactor / amicAmount;
const amicLinePrice = ((agLineTotal / (agAmount * agQuantity)));
const amicLineQuantity = (agAmount * agQuantity) / amicQuantity;
const amicTotalLineQuantity = amicLineQuantity * amicQuantity;
console.dir({
agBasePrice,
agAmount,
agQuantity,
agLineTotal,
amicQuantity,
amicLinePrice,
amicLineQuantity,
amicTotalLineQuantity
})
// console.log('amicLinePrice', amicLinePrice)
// console.log('amicLineQuantity', amicLineQuantity)
// console.log('amicTotalLineQuantity', amicTotalLineQuantity)