SCO Autolavados calculates laundrer compensation using a commission pool (pozo) model. Instead of per-order tips or fixed salaries, all revenue from completed service orders is pooled together. A configurable percentage of that pool becomes the shared commission, which is then split equally among all laundrers who clocked in on that day. This model aligns incentives — laundrers benefit collectively from a busy day — and simplifies end-of-day accounting to a single API call.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Luisangelebp/SCO_Autolavados/llms.txt
Use this file to discover all available pages before exploring further.
How the Commission Pool Works
At the end of each day, the admin retrieves the payroll summary usingGET /api/payroll/daily. The backend:
- Identifies all laundrers with
isWorkingToday = trueor alastShiftStarttimestamp within the target day. - Fetches all service orders with
state: "FINALIZADO"and atimeEndwithin the same day. - Calculates the total pool (
totalPozoUsd) based on the configuredcommissionType. - Divides
totalPozoUsdequally among the active laundrers to determinepayoutPerLaundrer.
AutoLavado.commissionPercent (default: 40%). For example, if the day’s completed washes totaled 20, split among active laundrers.
Commission Types
The commission calculation mode is configured inAutoLavado.commissionType:
FULL_PRICE
Commission is calculated on the full price of each service actually performed. Each finished service order contributes
service.priceUsd × (commissionPercent / 100) to the pool. Use this mode when prices vary significantly by service type and you want laundrers to benefit from higher-value washes.BASE_SERVICE
Commission is calculated on the base service price for the vehicle type, regardless of the actual service performed. The system finds the
Services record with isBaseService: true matching the vehicle’s typeCarId and uses that price for the commission calculation. Use this mode to standardize commission payouts across all wash types.BASE_SERVICE mode requires that at least one service in the catalogue has isBaseService: true set for each vehicle type. If no base service is found for a vehicle type, that order will contribute $0 to the pool for commission purposes.Shift Tracking
Laundrers must have their shift started for the day to be included in the payroll pool. There are two ways a shift gets activated:- Explicit start — An Admin calls
PATCH /api/laundrers/:id/shift/start, settingisWorkingToday: trueand recordinglastShiftStart. - Implicit start — When an Admin assigns a laundrer to a service order via
PATCH /api/service-orders/:id/start, the system automatically activates the laundrer’s shift if it wasn’t already.
isWorkingToday = false for all laundrers, clearing the shift state for the new workday. Historical payroll lookups use lastShiftStart timestamps to determine which laundrers were active on any past date.
Viewing Payroll
The payroll endpoint is Admin-only and returns a full summary for any given day:?date, the endpoint defaults to the current day (adjusted to VET, UTC-4).
Response (200):
Registering Payroll Payment
After reviewing the payroll summary, the admin can record the commission payout as an expense:Expense record describing the total payout ("Pago de Nómina (N lavadores) - Fecha: ...") and deducts it from the AutoLavado balance, keeping the books balanced.
Configuring Commission
Update commission settings via theAutoLavado configuration endpoint:
payrollPeriod field accepts "DAILY" or "WEEKLY" and defaults to "DAILY". Changes take effect immediately for the next payroll calculation. Historical payroll data is not retroactively recalculated.
Payroll API Reference
Full endpoint reference for daily payroll calculation and commission configuration.