Title: DatePicker Discount ?
Last modified: April 22, 2017

---

# DatePicker Discount ?

 *  Resolved [nathalizator](https://wordpress.org/support/users/nathalizator/)
 * (@nathalizator)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/datepicker-discount/)
 * Hello again !
    As you might know, i’m using the calculated field as calculator
   for car rental. Most of the feature fit my needs but i was wondering something.
 * My client want to include a discount price when more that 3 days are selected.
 * Just to remember, my calculator is made of a date picker + dropdown element.
   
   Total is : `abs(fieldname2-fieldname1+1) * (fieldname6)`
 * `Fieldname1` Is Check in Date and `Fieldname2` is Check out date `Fieldname 6`
   is a dropdown menu with the car ( `Choice = Mercedes` , `Value = 2000` )
 * **QUESTION : Is it possible to decrease the `value` ( for example ) if the client
   select more that 3 days ? **
 * For example :
 * if the client select from 1 to 3 day value is normal : 2000 * nb of days selected
   
   If the client select from 3 to 7 days : 2000-20% = 1600 * nb of days selected
   If the client select more that 8 days : 2000-40% = 1200 * nb of days selected
    -  This topic was modified 9 years, 1 month ago by [nathalizator](https://wordpress.org/support/users/nathalizator/).
    -  This topic was modified 9 years, 1 month ago by [nathalizator](https://wordpress.org/support/users/nathalizator/).
    -  This topic was modified 9 years, 1 month ago by [nathalizator](https://wordpress.org/support/users/nathalizator/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/datepicker-discount/#post-9055829)
 * Hello,
 * Yes of course, and the process is very simple:
 * The equation would be:
 *     ```
       (function(){
       var days = abs(fieldname2-fieldname1+1), discount = 1;
       if(3<days) discount = 0.8;
       if(7<days) discount = 0.6;
       return days*fieldname6*discount;
       })()
       ```
   
 * Best regards.
 *  Thread Starter [nathalizator](https://wordpress.org/support/users/nathalizator/)
 * (@nathalizator)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/datepicker-discount/#post-9056052)
 * Thats work wonderfully good ! You definitly made the most flexible calculated
   field plug-in on wordpress !
    I will need one last thing with this , is this 
   possible to round to the hundredth ? If i have a result like 2370, i would rather
   have it like 2400 ?
 * Thanks a lot again…
    -  This reply was modified 9 years, 1 month ago by [nathalizator](https://wordpress.org/support/users/nathalizator/).
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/datepicker-discount/#post-9057045)
 * Hello,
 * Yes, of course, you simply should apply the operation: `CEIL(Number/100)*100`
 * For example:
 * `CEIL(2370/100)*100 = CEIL(23.7)*100 = 24*100 = 2400`
 * Best regards.
 *  Thread Starter [nathalizator](https://wordpress.org/support/users/nathalizator/)
 * (@nathalizator)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/datepicker-discount/#post-9058406)
 * Perfect ! Thanks

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘DatePicker Discount ?’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [nathalizator](https://wordpress.org/support/users/nathalizator/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/datepicker-discount/#post-9058406)
 * Status: resolved