Calculation for a Discount Unit Price.

I need a calculation that would take Unit Price and either multiple or subtract the Discount Amount, based off it being a percent or dollar amount, that returns me the discounted unit price. Can anyone help me? I know its probably an ifElse but haven't quite figured it out. Thanks!

Parents
  • Hi Nicole Rios,

    The stock field, Line Item Total (total_amount) on the Quoted Line Item module does what you have described using the following formula:

    ifElse(and(isNumeric(toString($quantity)), isNumeric(toString($discount_price))),
    currencySubtract(
    currencyMultiply(
    $discount_price,
    $quantity
    ),
    ifElse(equal($discount_select, "1"),
    currencyMultiply(currencyMultiply($discount_price, $quantity), currencyDivide($discount_amount, 100)),
    ifElse(isNumeric(toString($discount_amount)), $discount_amount, 0)
    )
    ),
    ""
    )

    I hope this helps.

Reply
  • Hi Nicole Rios,

    The stock field, Line Item Total (total_amount) on the Quoted Line Item module does what you have described using the following formula:

    ifElse(and(isNumeric(toString($quantity)), isNumeric(toString($discount_price))),
    currencySubtract(
    currencyMultiply(
    $discount_price,
    $quantity
    ),
    ifElse(equal($discount_select, "1"),
    currencyMultiply(currencyMultiply($discount_price, $quantity), currencyDivide($discount_amount, 100)),
    ifElse(isNumeric(toString($discount_amount)), $discount_amount, 0)
    )
    ),
    ""
    )

    I hope this helps.

Children