JCKSDocs
JCKS JobsV2Funkce

Invoices, terminal and paychecks

How employees bill players, how the card terminal works, how bills from other billing scripts arrive and how optional paychecks pay salaries.

Invoices and fines

Employees with the billing permission (or any grade of a job in Config.Billing.allGrades) send invoices to a nearby player. The invoice composer has per job quick picks, own lines with quantities and a live preview. The invoice is handed over with an animation.

Players pay or decline in the Invoices sheet: /invoices or F7 (Config.Keybinds.invoices). The sheet shows unpaid, paid and issued invoices, the account balance and Pay all, which checks the balance first. When paid, the company account gets the money and the sender gets commission %. A paid invoice can no longer be declined.

Bosses see every invoice of the company in the boss menu. Unpaid invoices are reminded on join.

Key Type Default What it changes
Config.Billing.enabled boolean true Invoices at all
Config.Billing.requireDuty boolean true Only on duty
Config.Billing.distance number 5.0 Metres to the other player
Config.Billing.allGrades table police, sheriff, ambulance, mechanic Every grade of these jobs bills without the permission
Config.Billing.maxAmount number 100000 Highest invoice
Config.Billing.commission number 10 % for the sender
Config.Billing.account string 'bank' Account invoices are paid from, bank or cash
Config.Billing.allowDecline boolean true Players can decline
Config.Billing.maxPending number 10 Unpaid invoices per player
Config.Billing.remindOnJoin boolean true Reminder on join
Config.Billing.listLimit number 40 Received invoices shown, also the most Pay all pays
Config.Billing.issuedListLimit number 30 Sent invoices shown
Config.Billing.expireDays number 0 Unpaid invoices expire after this many days, 0 = never
Config.Billing.overdueDays number 7 Days until an invoice is overdue
Config.Billing.overdueFeePercent number 0 % added once to an overdue invoice
Config.Billing.presets table police, ambulance, mechanic Quick picks per job

enabled, requireDuty, distance and allGrades are in settings/config.services.lua, the rest in settings/server/config.lua.

lua
Config.Billing.presets = {
    police = {
        { label = 'Speeding', amount = 250 },
        { label = 'Reckless driving', amount = 750 },
    },
}

External billing

ServerEditable.SendInvoice(src, target, jobName, amount, reason) in editable/server.lua runs before JCKS creates an invoice. Return true when your own billing resource handled it.

Billing scripts

Config.BillingCompat in settings/config.lua decides where invoices written by employees and created by jcks_jobs (taxi fares, MDT fines, hospital fees, restaurant orders) go.

Key Type Default What it changes
Config.BillingCompat.provider string 'jobs' jobs (JCKS invoices), auto (first running of esx_billing, okokBilling, qb-phone, otherwise JCKS), esx_billing, okokBilling or qb-phone. When the picked resource does not run or refuses the invoice, a JCKS invoice is written. The other script pays the company itself, so the JCKS commission and terminal are not used
Config.BillingCompat.esxBilling boolean true While esx_billing does not run, its esx_billing:sendBill event, BillPlayer and BillPlayerByIdentifier exports and ESX callbacks create JCKS invoices with the same server checks
Config.BillingCompat.okokBilling boolean true While okokBilling does not run, its CreateInvoice export and the v2 event okokBilling:CreateCustomInvoice create JCKS invoices

Unpaid invoices stay in the database when you switch the provider.

From other resources

Scripts written for esx_billing or okokBilling are answered by Config.BillingCompat above, or by the separate resource jcks_compat_billing, see Existing scripts.

lua
local id, err = exports.jcks_jobs:CreateInvoice(target, 'police', 750, 'Speed camera', senderSrc)
local list = exports.jcks_jobs:GetInvoices(identifier)
local ok, err = exports.jcks_jobs:PayInvoice(src, id)
local ok, err = exports.jcks_jobs:DeclineInvoice(src, id)
local id, err = exports.jcks_jobs:BillFromPlayer(src, target, 750, 'Repair', 'mechanic')

target is a server id or an identifier, so offline players can be billed. CreateInvoice trusts the calling script. BillFromPlayer is for bills a player started: it applies every rule of the invoice window (billing permission, duty, distance, amount up to maxAmount) and job, when given, must be the sender's current job. It returns true instead of an id when ServerEditable.SendInvoice handled the bill.

Card terminal

In the invoice window, Charge on the terminal sends the invoice straight to the customer as a terminal screen with the amount, tip buttons, balance and a countdown. Pay pays the normal invoice from Config.Billing.account, so the company share and the commission work as usual. If the customer closes the terminal, the invoice stays open in F7, or is declined when allowDecline is on.

The server checks the charge token, the customer, the distance to the employee, the balance and the highest tip.

Key Type Default What it changes
Config.Terminal.enabled boolean true Terminal option in the invoice window
Config.Terminal.timeout number 90 Seconds the terminal waits (15 to 600)
Config.Terminal.maxDistance number 6.0 Metres between customer and employee
Config.Terminal.tips table { 0, 10, 15, 20 } Tip buttons in %
Config.Terminal.maxTip number 30 Highest tip in %
Config.Terminal.tipTo string 'employee' employee (bank of the sender) or company
Config.Terminal.provider string 'auto' auto, jobs or electronics. With jcks_electronics a customer with a phone or smartwatch pays on the device

Taxi meter

The taximeter, tariffs, street fares and the driver share have their own page: Taxi. For taxi jobs Config.TaxiMeter.driverShare replaces Config.Billing.commission.

Paychecks

Optional. Pays every employee the salary of their grade every interval minutes. Turn off the paycheck of your framework when you enable it, or players are paid twice: ESX Config.PaycheckInterval, QBCore QBConfig.Money.PayCheckTimeOut, the paycheck settings of qbx_core.

Key Type Default What it changes
Config.Payroll.enabled boolean false Paychecks
Config.Payroll.interval number 15 Minutes
Config.Payroll.onlyOnDuty boolean true Only players on duty
Config.Payroll.afkMinutes number 10 No paycheck when the player has not moved more than 1.5 m for this many minutes, 0 = pay AFK players too
Config.Payroll.fromSociety boolean true Paid from the company account, no money means no paycheck
Config.Payroll.account string 'bank' Where the salary goes