Announcement

Collapse
No announcement yet.

Formula Calculations - Commissions

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • yuri
    replied
    Check your formula. I calculated manually and got the same result as formula gave.

    Leave a comment:


  • khopper
    replied
    Using what you provided its now giving me a result of 319.33 - it went up instead of down.

    Leave a comment:


  • yuri
    replied
    Hi,

    Try replacing the file application/Espo/Core/Formula/Parser.php with:

    Leave a comment:


  • yuri
    replied
    Hi,

    There might be a bug in parser. I will take a look.

    Leave a comment:


  • khopper
    started a topic Formula Calculations - Commissions

    Formula Calculations - Commissions

    I am having trouble with a Formula to calculate Commissions under Entity Accounts, am I doing something wrong? Can i limit the calculations to 2 decimal places? USD
    I know its a lot but, just trying to be as detailed as possible.

    Problem # 1 - the Calculation is off by decimal places for the total on field commissions.
    Problem # 2 - the Calculation below if I change filed voice to anything other than 'New" it does not finish the calculation for the other 2 fields 'voice' and 'internet' and just enters a 0 or null value.

    I was able to duplicate all of this in the Demo CRM at http://demo.espocrm.com/advanced/?lang=en_US#

    field mrc should total $241.35 (correct)
    Code:
    ifThen(
       client == 'COMCAST',
       mrc = (( ccblmrc  +ccfflmrc + ccmlmrc + ccimrc + ccvmrc) - (discountinternet + discountvideo + discountvoice))
    );
    
    ifThenElse(
        client == 'COMCAST' && term = '24 Mo',
        commission =
           ifThenElse(
               voice == 'New',
               (ccblmrc + ccfflmrc + ccmlmrc) - discountvoice * 0.5,
               0
           )
           +
           ifThenElse(
               internet == 'New',
               (ccimrc - discountinternet) * 0.5,
               0
           )
           +
           ifThenElse(
               video == 'New',
               (ccvmrc - discountvideo) * 0.5,
               0
           ),
        0
    );
    example test info for fields:
    client = 'COMCAST',
    term = '24 Mo',
    voice = 'New',
    internet = 'New',
    video = 'New',
    ccblmrc = '24.95',
    ccfflmrc = '0',
    ccmlmrc = '134.85',
    ccimrc = '149.95',
    ccvmrc = '81.55',
    discountinternet = '70.00',
    discountvoice = '79.95',
    discountvideo = '0'


    commission field calculated from CRM = $119.85 , should equal $120.675 rounded to $120.68

    https://www.calculatorsoup.com/calcu...9&action=solve
    Last edited by yuri; 07-18-2018, 01:49 PM.
Working...
X