Check in/out

Hey all!

I have a question hopefully someone can help me but first let me tell you what I want to create!

I want to create an app that tells you how much you should be paid based on check in and out. Check in and out are two different buttons.

On google sheets:
There are three google spreadsheets:

  1. User Profile contains name, email address and image.
  2. Check in contains name and email address (both pulled up from user profile), and timestamp (current date/time).
  3. Check out contains name and email address (both pulled up from user profile), and timestamp (current date/time).

I used split function in check in and out spreadsheets to split date from time when convert time to numbers to be easy to recognize by Glide when I run math on Glide.

On Glide:
I created multiple relations using email addresses.
Relation 1: User profile to check in to look up check in time.
Relation 2: User profile to check out to look up check out time.

Math: Since I looked up check in and out timings, I then ran Math column that subtract check out time from check in (Check out - Check in) multiplied by the rate.

Rollup: Using count for both check in and out in order to match the criteria using IF THEN ELSE that if "check in count EQUALS check out counts, run math (subtraction) otherwise lead it empty since the employee forgets to check out. I works perfect where there are check in and out submissions.

My questions:

  1. When I check in and forget to check out, glide keeps calculating. How to stop this? in other words, I want glide to show last payment unless I check out then it sums it up and gets me the new total.
  2. Is there any method to limit their daily payment to 75/day?I.e. if the gap between check in and out really huge which means he will get more this time. I want to limit it to DAILY basis if possible to be 75/day.
  3. Sometimes I end up having negative results (e.g. -200). How to get rid of the negative sign?

If someone can help me with some tricks to solve this! Thank you