Calculating money spent during period

Comments

5 comments

  • Jeff Buford

    Have you considered using a duration field to capture number of days? Or does it need to be off of start and end date?

    0
    Comment actions Permalink
  • Damir Ayginin

    Jeff, thank you for your reply.

    It is needed to be start/end date to be shown in calendar.

    0
    Comment actions Permalink
  • Jan Florian Maas

    This could be done with the new calculation field and some JavaScript. I'll explain an example with calculated days between a start date and an end date – (same could be done just with working days, with more code involved).

    First, set-up two date fields, a "Start_Date" and an "End_Date". Then you'll need a number field for the "Tarif" (the money you wanna get paid). Now, you're prepared to set-up your two calculation fields:

    Script for the field "Calculated_Days":

    if ( @Start_Date == 0) return 0;
    var a = moment( @Start_Date );
    var b = moment( @End_Date );
    var res = b.diff(a, 'days');
    if (res < 0) { 0 } else { res};

    Script for the field "Calculated_Tarif":

    @Calculated_Days * @Tarif

    That's easy :-) If you need more specialised calculations, you're welcome to contact any Podio Partner.

    1
    Comment actions Permalink
  • Damir Ayginin

    Jan, thank you for your solution. I'll try this if it's not possible to count qty of days in period of single field. Is it so?

    0
    Comment actions Permalink
  • Damir Ayginin

    As i wrote, the reason we use single field for start/end date is that in calendar we'll see this occupied period

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk