// calculating the agBasePrice
const amicAmount = 1;
const amicFactor = 0.2;
const amicPrice = 31.5;
const agAmount = 10;
const amicQuantity = amicAmount / amicFactor;
const agBasePrice = (amicQuantity * amicPrice) * agAmount / amicQuantity; // this should be recaclucated if the agrantisAmount changes via connect/disconnect from article!
console.log('agBasePrice', agBasePrice); // 157.50
// calculating amicPrice for line using agBasePrice:
// const amicPrice2 = (agBasePrice / amicFactor * amicAmount / agAmount) * amicFactor / amicAmount;
// happens in agrantis
const agQuantity = 2;
const agLineTotal = agAmount * 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)) / agAmount);
const amicLineQuantity = (agAmount * agQuantity) / amicQuantity;
const amicTotalLineQuantity = amicLineQuantity * amicQuantity;
console.dir({
agBasePrice,
amicQuantity,
agLineTotal,
agAmount,
agQuantity,
amicLinePrice,
amicLineQuantity,
amicTotalLineQuantity
})
// console.log('amicLinePrice', amicLinePrice)
// console.log('amicLineQuantity', amicLineQuantity)
// console.log('amicTotalLineQuantity', amicTotalLineQuantity)