Need help with a snippet, please

I am trying to create a snippet to calculate all move in costs for a rental. The pet fee should be assigned based on # of pets and then calculated into the formula. I can't figure out how to assign a petfee variable so I can then include it in my calculation.

Here is what I have thusfar. You can see at the end where I am trying to assign petfee variable.

{note}
Monthly rent: ${formtext: name=mr; default=}
Move-in Day: {formtext: name=mid}
Days in Month: {formmenu: default=30; 31; 28; name=dim}
Pets:{formmenu: default=0; 1; 2; 3; name=petnum; cols=2}
Concession: {formmenu: default=None; First full month of rent free; $500 off first full month of rent; $500 first responder/military discount; name=concession}
{endnote: trim=right}

Move In Funds
Reservation binder fee: $550
$400 goes towards pro-rate, $150 admin fee
Security deposit: ${formtext: name=mr; default=}
Pro-rated rent: {if: mid < 25}{=(mr/dim)(dim-mid+1) +(petnum * 35 / dim) * (dim - mid +1) - 400; format=$,.2f}{else}{=(mr/dim)(dim-mid+1) +(petnum * 35 / dim) * (dim - mid +1) + mr + (petnum *35) - 400; format=$,.2f}{endif}

  • minus $400 from reservation binder
    {if: mid >= 25} * including following month's rent if move-in is the 25th or after{endif}
    {if: petnum > 0} * including pet rent for {formtext: name=petnum} animals{endif}
    Non-refundable pet fee: {if: petnum == 0}n/a{elseif: petnum == 1; trim=yes}$250.00{elseif: petnum == 2; trim=yes} $350.00
  • $250 first pet, $100 second pet{elseif: petnum == 3; trim=yes}$450.00
  • $250 first pet, $100 for second and third pet{endif}
    Total due after reservation binder fee of $550: {if: mid <= 24}{x =(mr/dim)(dim-mid+1) +(petnum * 35 / dim) * (dim - mid +1) + mr - 400; format=$,.2f}{else}{=(mr/dim)(dim-mid+1) +(petnum * 35 / dim) * (dim - mid +1) + mr + mr + (petnum *35) - 400; format=$,.2f}{endif}

Other details
Monthly rent: ${=mr + (petnum * 35)} {if: petnum > 0}includes pet rent of $35 per pet/month{endif}
Move-in concession: {=concession}

{if: petnum == 1}{=petfee == 250} {=petfee + mr}{endif}
{if: petnum == 2}{=petfee == 350} {=petfee + mr}{endif}
{if: petnum == 3}{=petfee == 450} {=petfee + mr}{endif}

I think I might have figured it out! Stay tuned...

This is an impressive use case with many dependencies. Curious - do you write code in other languages?

Light coding only in javascript and python, but basically a hack.

1 Like