Calculating money spent during period
Hi guys,
I'm trying to count how much money i'll spend during data period. I have data field with start date and end data and i have daily tariff.
Trying formula @period * @tariff doesn't help. What should i do?
As i wrote this question i've asked myself what if i had hourly rate? So i would need to count hours in the period of @data field
Any help would be appreciated!
-
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.
Please sign in to leave a comment.
Comments
5 comments