Support » Plugin: Calculated Fields Form » Calculation turning zero when same day rent occurs

  • Resolved Yoinkzz

    (@yoinkzz)


    Hi Guys,

    First of all – thank you for an awesome plugin. I’m sure I want the PRO version as soon as I get this solved and maybe tested it a bit more.

    I’m using the plugin for a renting firm. The problem is, I can’t get it to calculate the price if a person wants to rent a thing for just one day.
    Lets say a person wants to come by in the morning, renting the thing and then returns it just before the office closes.
    Here is my calculation:
    (600+fieldname11+fieldname12)*(fieldname9-fieldname10)+3500
    600: Day price
    Fieldname11: Adding extra equipment
    Fieldname12: Adding extra equipment
    Fieldname9 and 10: Dates picked
    3500: Deposit

    So the main thing is, what do I need to do in order for the calculation to return 1 instead of 0 when picking the same date?

    https://wordpress.org/plugins/calculated-fields-form/

Viewing 1 replies (of 1 total)
  • Plugin Author codepeople

    (@codepeople)

    Hi,

    You are subtracting two date fields (fieldname9-fieldname10), but if both fields have the same value the result would be zero, that’s fine, so, if you want to consider in the form that if the values of fields fieldname9 and fieldname10 are equals is the equivalent to a renting day, the equation should be modified like follow:

    (600+fieldname11+fieldname12)*(fieldname9-fieldname10+1)+3500

    If you want be sure that the user has entered the values of fields: fieldname9 and fieldname10, you should to use conditional statements, and in this case the equation would be:

    IF(AND(fieldname9,fieldname10), (600+fieldname11+fieldname12)*(fieldname9-fieldname10+1)+3500, '' )

    Best regards.

Viewing 1 replies (of 1 total)
  • The topic ‘Calculation turning zero when same day rent occurs’ is closed to new replies.