top of page
Bookings Payroll Calculator

Bookings Payroll Calculator

Calculate and display bookings and earnings for each staff member.

Intermediate.png

Advanced

2K

Published:

September 12, 2021

Girl Enjoying her Drink

by

Anchor 1
Hire a Developer

Example Description

In this example we display a list of existing staff members and their payroll calculations in a repeater. Calculations are filtered according to date, and are based on the defined service rates and the number of participants for each session.

 

 

Security Note

 

The code in this example exposes sensitive business and client information. Make sure that only authorized admins can access this data. See below for best security practices for this example.

Example Code

Tab 1

.

Tab 2

.

Tab 3

.

This code solution can be complicated.

How We Built It


Page Elements


  • 2 input elements to set start & end date filters

  • 2 input elements to set the service rates for classes and appointments

  • Submit button

  • Text element to display error messages

  • Repeater to display attendance and payment information for each staff member



Code


For best security practices, verify that the visitor is a logged-in member with an Admin role both on the frontend and backend. The code for this functionality is currently commented out in the example site. You can remove the comments to activate the code.



Backend Code


  • booking-functions.js: Includes functions to return the staff session data based on the date filters.

  • calculator.jsw: Includes functions to calculate and return the staff session data based on rate filters.


Note that the queryBookings() function returns by default only the booking data of the logged-in member. In order to query all booking data, we added the option {“suppressAuth”: true}.



Page Code


  1. Initialize the filters and set default values.

  2. Set the repeater onItemReady() event to show the relevant booking data.

  3. Use the backend getStaffData() function to return the staff data.

  4. Display the returned bookings data in the repeater.

  5. Display error messages if needed.



Security best practices


  • Verify that the visitor is a site member with an Admin role on the frontend and backend. The code is provided in a comment.

  • Build the example as a dashboard page. Dashboard pages can be accessed only by site administrators.

  • If the page is not a dashboard page then restrict page access to admin members only.

  • Restrict backend function access to admins only.

APIs We Used

Non-code example.

Non-code example.

Non-code example.

Non-code example.

Related Articles

Article Link

Hire a Developer

Velo solutions are powerful tools, but building them on your own can be challenging. Let an experienced Velo development shop build it for you, so you can keep working on your site or business.

Related Examples

Did this help?

Yes

|

No

Thanks for your feedback!

Block Off Time for Staff Members

Block Off Time for Staff Members

Block off chunks of time in bookings staff calendars.

Intermediate.png

Advanced

Send SMS on Booking Confirmation

Send SMS on Booking Confirmation

Send a confirmation SMS when customers book a service.

Intermediate.png

Advanced

Anchor 2
bottom of page