# Integration

| Resource Name                                                    | Kompatibilität        |
| ---------------------------------------------------------------- | --------------------- |
| [bcs\_companymanager](https://masbagus.tebex.io/package/4914090) | ✅ im Script eingebaut |
| [okokBilling](https://okok.tebex.io/package/5246431)             | ✅ im Script eingebaut |

## bcs\_companymanager

1. Öffne bcs\_companymanager → bridge → esx → server.lua
2. Füge den Codeabschnitt am ganz Ende der Datei ein

```lua
RegisterNetEvent("wavecore_krankenversicherung:bcs:sendBill", function(target, amount, reason, society, plyID)
    if not target or not amount or not reason then
        print('[Krankenversicherung] Ungültige Parameter: target, amount oder reason fehlt')
        return
    end
    
    if amount <= 0 then
        print(string.format('[Krankenversicherung] Ungültiger Betrag: %s (muss > 0 sein)', tostring(amount)))
        return
    end
    
    local xPlayer = ESX.GetPlayerFromId(plyID)
    local xTarget = ESX.GetPlayerFromId(target)
    
    if not xTarget then
        print(string.format('[Krankenversicherung] Zielspieler %s ist nicht online, Rechnung kann nicht erstellt werden', target))
        return
    end
    
    local identifier = ""
    local jobName = ""
    local jobLabel = ""
    
    if xPlayer then
        identifier = xPlayer.identifier
        jobName = xPlayer.job.name
        jobLabel = xPlayer.job.label or xPlayer.job.name
    else
        print(string.format('[Krankenversicherung] Behandler ist offline für Rechnung an %s', target))
        return
    end
    
    if society and society ~= "" then
        identifier = society
        jobName = string.gsub(society, "society_", "")
        jobLabel = jobName
    end
    
    local from = {
        name = jobName,
        label = jobLabel,
        job = jobName,
        identifier = identifier,
    }

    local item = {
        {
            name = reason,
            price = amount,
            amount = 1,
        },
    
    }

    Billing.Create(xPlayer.source, target, amount, "Medizinische Behandlung", item, from)
end)

RegisterNetEvent("wavecore_krankenversicherung:bcs:sendBillCompany", function(target, amount, reason, society, plyID)
    if not target or not amount or not reason then
        print('[Krankenversicherung] Ungültige Parameter: target, amount oder reason fehlt')
        return
    end
    
    if amount <= 0 then
        print(string.format('[Krankenversicherung] Ungültiger Betrag: %s (muss > 0 sein)', tostring(amount)))
        return
    end
    
    local xPlayer = ESX.GetPlayerFromId(plyID)
    
    local identifier = ""
    local jobName = ""
    local jobLabel = ""
    
    if xPlayer then
        identifier = xPlayer.identifier
        jobName = xPlayer.job.name
        jobLabel = xPlayer.job.label or xPlayer.job.name
    else
        print(string.format('[Krankenversicherung] Behandler ist offline für Rechnung an %s', target))
        return
    end
    
    if society and society ~= "" then
        identifier = society
        jobName = string.gsub(society, "society_", "")
        jobLabel = jobName
    end
    
    -- Rechnung erstellen
    local from = {
        name = jobName,
        label = jobLabel,
        job = jobName,
        identifier = identifier,
    }

    local item = {
        {
            name = reason,
            price = amount,
            amount = 1,
        },
    
    }

    Billing.Create(xPlayer.source, target, amount, "Medizinische Behandlung", item, from)
end)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wavecore.dev/wavecore/krankenversicherung/integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
