structura foldere

mutat kq- folders in un singur folder [kq]
This commit is contained in:
2026-03-30 01:55:03 +03:00
parent af1286d583
commit c291b81f26
2319 changed files with 0 additions and 14 deletions

View File

@@ -0,0 +1,23 @@
if Config.Billing ~= 'RxBilling' then return end
---@param src number
---@return Invoice[]
function GetInvoices(src)
local identifier = GetIdentifier(src)
local invoices = exports.RxBilling:GetPlayerInvoices(identifier, 'incoming')
local data = {}
for k, v in pairs(invoices) do
if v.status ~= 'pending' then goto continue end
table.insert(data, {
id = v.id,
price = v.amount,
label = v.reason or 'No reason',
})
::continue::
end
return data
end

View File

@@ -0,0 +1,26 @@
if Config.Billing ~= 'codemv2' then return end
---@param source number
---@return Invoice[]
function GetInvoices(source)
local src = source
local bills = exports['codem-billingv2']:GetPlayerUnpaidBillings(src)
local data = {}
if bills then
for _, v in pairs(bills) do
table.insert(data, {
id = v.invoiceid,
price = v.amount,
label = v.reason,
})
end
end
return data
end
RegisterNetEvent('codemBilling:PayInvoice', function(invoiceId)
local src = source
exports['codem-billingv2']:PayBilling(src, invoiceId)
end)

View File

@@ -0,0 +1,19 @@
if Config.Billing ~= 'esx_billing' then return end
---@param source number
---@return Invoice[]
function GetInvoices(source)
local xPlayer = ESX.GetPlayerFromId(source)
local invoices = MySQL.query.await('SELECT amount, id, label FROM billing WHERE identifier = ?', { xPlayer.identifier })
local data = {}
for k, v in pairs(invoices) do
table.insert(data, {
id = v.id,
price = v.amount,
label = v.label or 'No reason',
})
end
return data
end

View File

@@ -0,0 +1,21 @@
if Config.Billing ~= 'okok' then return end
---@param source number
---@return Invoice[]
function GetInvoices(source)
local src = source
local identifier = GetIdentifier(src)
local invoices = MySQL.Sync.fetchAll('SELECT * FROM okokbilling WHERE receiver_identifier = ? ORDER BY CASE WHEN status = "unpaid" THEN 1 WHEN status = "autopaid" THEN 2 WHEN status = "paid" THEN 3 WHEN status = "cancelled" THEN 4 END ASC, id DESC', { identifier })
local data = {}
for k, v in pairs(invoices) do
if v.status == 'paid' then goto continue end
table.insert(data, {
id = v.id,
price = v.invoice_value,
label = v.notes or 'No reason',
})
::continue::
end
return data
end

View File

@@ -0,0 +1,22 @@
if Config.Billing ~= 'qs' then return end
---@param source number
---@return Invoice[]
function GetInvoices(source)
local src = source
local identifier = GetIdentifier(src)
-- Consulta ajustada a la tabla qs_billing
local invoices = MySQL.Sync.fetchAll('SELECT * FROM qs_billing WHERE receiver_identifier = ? ORDER BY CASE WHEN status = "unpaid" THEN 1 WHEN status = "autopaid" THEN 2 WHEN status = "paid" THEN 3 WHEN status = "cancelled" THEN 4 END ASC, id DESC', { identifier })
local data = {}
for k, v in pairs(invoices) do
-- Ignora facturas no pagadas
if v.status == 'unpaid' then goto continue end
table.insert(data, {
id = v.id,
price = v.invoice_value, -- Mapeo directo de invoice_value
label = v.notes or 'No reason', -- Mapeo directo de notes
})
::continue::
end
return data
end

View File

@@ -0,0 +1,43 @@
if Config.Billing ~= 'standalone' then return end
---@param source number
---@return Invoice[]
function GetInvoices(source)
local src = source
local identifier = GetIdentifier(src)
local invoices = MySQL.Sync.fetchAll('SELECT * FROM phone_bills WHERE `identifier` = ?', { identifier })
return invoices
end
RegisterCommand('sendbill', function(source, args)
local job = GetJobName(source)
local existJob = table.find(Config.BillJobs, function(v)
return v == job
end)
if not existJob then
return TriggerClientEvent('phone:client:sendTextMessage', source, Lang('PHONE_NOTIFICATION_BANK_BILL_WHITELIST'), 'error')
end
local target = tonumber(args[1])
local price = tonumber(args[2])
local reason = table.concat(args, ' ', 3)
reason = reason == '' and Lang('PHONE_NOTIFICATION_BANK_INVOICE_NO_REASON') or reason
if not target or not price then
return TriggerClientEvent('phone:client:sendTextMessage', source, Lang('PHONE_NOTIFICATION_BANK_NO_PLAYER'), 'error')
end
local identifier = GetIdentifier(target)
if not identifier then
return TriggerClientEvent('phone:client:sendTextMessage', source, Lang('PHONE_NOTIFICATION_BANK_NO_PLAYER'), 'error')
end
MySQL.Sync.execute('INSERT INTO `phone_bills` (`identifier`, `sender`, `price`, `label`) VALUES (?, ?, ?, ?)', {
identifier,
GetIdentifier(source),
price,
reason
})
TriggerClientEvent('phone:client:sendTextMessage', source, Lang('PHONE_NOTIFICATION_BANK_BILL_SENT') .. ' ' .. GetPlayerName(target), 'success')
TriggerClientEvent('phone:sendNotificationOld', target, {
app = 'bank',
title = Lang('PHONE_NOTIFICATION_BANK_TITLE'),
text = Lang('PHONE_NOTIFICATION_BANK_BILL_RECEIVED') .. ' ' .. GetPlayerName(source)
})
end, false)