Calculate and display bookings payments for staff members.
In this example, we retrieve appointment and class bookings for staff members within a given date range. We then calculate the payments due to each staff member based on the given amounts per appointment and class participant.
To use this example:
We added the following to our site:
The code in this file initializes the page’s state, retrieves staff data from the backend, and displays the calculated payments.
In this file, we:
The code in this file retrieves and formats the staff booking information we need to make our payment calculations.
We defined the following methods:
getBookingsByStaff()
: Calls the other methods to retrieve the bookings and format the information so that it is sorted by staff member.retrieveAllBookings()
: Retrieves all the bookings in the given range. Since you can only query for 100 bookings at a time, this method uses the query paging information to repeatedly query for more bookings if necessary. Bookings where the participants did not attend are not returned.sortByStaff()
: Takes the raw bookings information and sorts it by staff member to allow for easy calculation of staff payments.The code in this file calculates staff payments based on their retrieved bookings.
We defined the following methods:
getStaffData()
: A web method that retrieves the staff bookings data and then calculates the staff payments.calculatePayments()
: Calculates each staff member’s payments based on the number of participants in the staff member’s appointments and classes.Join the Wix Studio community on Discord, where experienced developers and fellow creators come together to share tips, troubleshoot issues, and collaborate.
Building a coded solution on your own can be challenging. Let an experienced Wix developer build it for you, so you can keep working on your site or business. Visit the Wix Marketplace to find a trusted developer.