Good Morning,
I am just not sure what I am doing wrong. I need a form that adds up the hours I am working on client work and subtracts from 40hr work week.
I can't figure out how to get it to calculate. I also would love to be able to add additional clients if needed in the form.
{formtext: name=Clients Name1; default=Client Name1 } - {formtext: name=Client1 ; default=1 } hours work.
{formtext: name=Clients Name2; default=Client Name2 } - {formtext: name=Client2 ; default=0 } hours work.
{formtext: name=Clients Name3; default=Client Name3 } - {formtext: name=Client3 ; default=0 } hours work.
{formtext: name=Hours; default={=Client1+Client2+Client3} }
Hours Needed for the week: {=40 - Hours } needed.
scott
December 2, 2019, 4:35pm
2
For the case of a fixed number of clients you just need to tweak your snippet slightly. Here is the updated version:
{formtext: name=Clients Name1; default=Client Name1 } - {formtext: name=Client1 ; default=1 } hours work.
{formtext: name=Clients Name2; default=Client Name2 } - {formtext: name=Client2 ; default=0 } hours work.
{formtext: name=Clients Name3; default=Client Name3 } - {formtext: name=Client3 ; default=0 } hours work.
Hours Needed for the week: {=40 - (Client1+Client2+Client3) } needed.
You could also make the number of clients dynamic by using {if} commands. It's a bit complex, but here's an example:
Number of clients: {formmenu: 1; default=2; 3; name=clients}
{formtext: name=Clients Name1; default=Client Name1 } - {formtext: name=Client1 ; default=1 } hours work.
{if: clients > 1}
{formtext: name=Clients Name2; default=Client Name2 } - {formtext: name=Client2 ; default=0 } hours work.{endif}
{if: clients > 2}
{formtext: name=Clients Name3; default=Client Name3 } - {formtext: name=Client3 ; default=0 } hours work.{endif}
Hours Needed for the week: {=40 - (Client1+Client2+Client3) } needed.
1 Like
@scott
Any chance you can help me modify this further?
I would like to have the form calculate my remaining billable hours as well.
For example:
Client Name Total hours given -Total hours billed = Total hours left
Client 1 100 hours total- 50 hrs billed= 50 hours left
The form would then just add the remaining client hours and subtract from the 40.
Thanks!
scott
January 17, 2020, 10:16am
5
Not sure I fully understand the last part, but maybe something like:
{formtext: name=Clients Name1; default=Client Name1}: {formtext: name=hours_given1; default=10; cols=10} - {formtext: name=hours_billed1; default=1; cols=10} = {=hours_given1 - hours_billed1} Total hours left
{formtext: name=Clients Name2; default=Client Name2}: {formtext: name=hours_given2; default=10; cols=10} - {formtext: name=hours_billed2; default=1; cols=10} = {=hours_given2 - hours_billed2} Total hours left
@Scott ,
Yes and then like the first form it totals the hours left so it would have 18 hours total:
Hours Needed for the week: 40-18 = 22 hours needed
scott
January 17, 2020, 8:07pm
7
You would do something much like the above. For example:
{formtext: name=Clients Name1; default=Client Name1}: {formtext: name=hours_given1; default=10; cols=10} - {formtext: name=hours_billed1; default=1; cols=10} = {=hours_given1 - hours_billed1} Total hours left
{formtext: name=Clients Name2; default=Client Name2}: {formtext: name=hours_given2; default=10; cols=10} - {formtext: name=hours_billed2; default=1; cols=10} = {=hours_given2 - hours_billed2} Total hours left
Hours Needed for the week: {=40 - (hours_given1 - hours_billed1) - (hours_given2 - hours_billed2)}