Calculate a Total price, that depends on the sqft variable. Probalby ( <= if then elif )
Hi, I'd like to create an app, where I can get my job's total price.
The price for each Work Type is based on Sqft.
Entry will be :
(number) Sqft: 1,550
(category ) Type of work: [ Tour, Photoshoot, Drone ]
and I'm trying to get total price calculated like that:
Tour Price = ( If Sqft is > 0 and <= 1500 then Tour Price = $170 )
Tour Price = ( If Sqft is > 1500 and <= 2000 then Tour Price = $195 )
Tour Price = ( If Sqft is > 2000 and <= 3000 then Tour Price = $195 )
Tour Price = ( If Sqft is > 3000 and <= 4000 then Tour Price = $245 )
Photoshoot price = ( If Sqft is > 0 and <= 1500 then Photoshoot Price = $89 )
Photoshoot price = ( If Sqft is > 1500 and <= 3000 Photoshoot Tour Price = $119 )
Photoshoot price = ( If Sqft is > 3000 and <= 5000 Photoshoot Tour Price = $149 )
Photoshoot price = ( If Sqft is > 5000 and <= 10000 Photoshoot Tour Price = $199 )
Drone price = ( If Drone is Basic then Drone price = $50 )
Drone price = ( If Drone is Advanced then Drone price = $150 )
Total Price = Tour + Photoshoot + Drone
Discount = If all [ Tour + Photoshoot + Drone ] are selected, then Discounted Price = ( Tour - 30% ) + Photoshoot + Drone
Its’ a bit complicated for me because I’m not so skilled in JS or Podio.
Thank you very much for any help!!!!
-
Hi Lukas,
var sqft = @Sqft;
var type = @Type of Work.toString();
var drone = @Drone;
var tourPrice = sqft > 0 ? ( sqft <= 1500 ? 170 : sqft <= 2000 ? 195 : sqft <= 3000 ? 195 : 245 ) : 0;
var photoshootPrice = sqft > 0 ? ( sqft <= 1500 ? 89 : sqft <= 3000 ? 119 : sqft <= 5000 ? 149 : 199 ) : 0;
var dronePrice = drone == "Basic" ? 50 : drone == "Advanced" ? 150 : 0;
var totalPrice = tourPrice + photoshootPrice + dronePrice;
var discountPrice = (tourPrice * .7) + photoshootPrice + dronePrice;
var finalPrice = type.indexOf("Tour") > -1 && + type.indexOf("Photoshoot") > -1 && type.indexOf("Drone") > -1 ? discountPrice : totalPricePlease be aware that with in var tourPrice every lf sqft > 3000 will be counted with 245 and in var photoshootPrice every lf sqft > 5000 with 199. Maybe you need to adjust the sqft spans because in photoshootPrice (in your posting) you've a max of 10000 and in tourPrice 4000 only. I recommend not to have a max value (like in your posting 4000 and 10000) because if the number is greater you won't get a result.
Rainer -
Thank you very much Rainer for your time.
I added these fields to Podio:
- Sqft ( number )
- Work ( text )
- Drone ( category )
And I added your function to Calculation. It returns "The script returned an undefined result". Could you please help me to solve it, please? I linked all @variables correctly.
Thank you! Lukas -
Ok oh, sure, it works ;) Thank you
I'd like to have these prices optional. Now it returns the
dronePrice + PhotoshootPrice + tourPrice no matter if it's selected or not.
Is there a chance to add a condition, that I can select only one service or two or all three, please?
Now, when I selected just photos, I am still getting calculated tour with the total. Thank you!
Please sign in to leave a comment.
Comments
4 comments