This feature contains two parts:
1. Automatic Billing will execute the same functions as the current Agent Billing feature on the Sales > Invoices screen. However, users will be able to save their preferred settings, and the function will run automatically based on a pre-set schedule.
2. For agents who meet certain conditions, their preferred payment method will be charged for the bill as soon as the invoice is generated.
Create a setup option in Settings > Darwin AI Training called "Agent Billing"
The setup should have two screens.
Primary setup screen:
- ai automation (dropdown)
- name (text)
- company (dropdown)
sort order (numeric)

Secondary setup screen:
"Applies to" section:
- Company (dropdown)
- Office (multi-select dropdown)
- Person type selection (radio buttons)
Billing type selection (radio buttons)
- If "special billing" is selected, user should select the special billing type from the "special billing" dropdown (screenshot on right, below)
"Settings" section:
- If "special billing" is selected, user should select the special billing type from the "special billing" dropdown (screenshot on right, below)
- Day of the month (selection)
- include recurring billing items (toggle)
- include reimbursable items (toggle)
- include terminated agents (toggle)
- post invoice (toggle)
- Automatically pay agent bills (toggle)


When saved, the process should run based on the parameters entered by the user on the day of the month indicated by the user.
- Bills will be generated based on the type indicated by the user (recurring billing, reimbursable items, or both)
- Bills will be generated for all active agents in the indicated Company and Office(s) (based on the individual agent's setup)
- If "include terminated agents" is "ON," bills will be generated for all terminated agents in addition to active agents (based on the individual agent's setup)
- If "Automatically pay Agent's bills " is set to "ON," agents who have authorized auto-payment will be charged according to their preferred payment method.
The Authorization for auto-payment is indicated by a toggle on the People > Payment Methods screen.
The People > Payment Methods screen also has a field called "Payment plan." The amount in the "Payment Plan" field is the maximum amount that should be charged to the agent's account through automatic bill payment.
If autopay is selected here, it should work this way:
- first apply all credits to the agent's bill
- then, add AR payments to make up the balance due (OR, if the agent has an amount entered in the "Payment Plan" field that is less than the total balance due, pay the amount indicated in the "Payment Plan" field.
Repeat this for all agents that have auto-billing authorized = TRUE
Process the payments based on the agent's preferred payment method.