ed
This commit is contained in:
parent
a3269e304b
commit
f8715d76de
2 changed files with 35 additions and 3 deletions
|
@ -239,6 +239,7 @@ end
|
|||
|
||||
-- Function to view received bills
|
||||
function ViewBills()
|
||||
-- Get all bills from ps-banking
|
||||
local bills = lib.callback.await('ps-banking:server:getBills', false)
|
||||
|
||||
if not bills or #bills == 0 then
|
||||
|
@ -255,13 +256,24 @@ function ViewBills()
|
|||
return
|
||||
end
|
||||
|
||||
-- Get bill statuses from our custom table
|
||||
local billStatuses = lib.callback.await('billing:server:getAllBillStatuses', false)
|
||||
local statusMap = {}
|
||||
|
||||
-- Create a map of bill ID to status for quick lookup
|
||||
if billStatuses then
|
||||
for _, status in ipairs(billStatuses) do
|
||||
statusMap[status.bill_id] = status
|
||||
end
|
||||
end
|
||||
|
||||
local billOptions = {}
|
||||
for _, bill in ipairs(bills) do
|
||||
local timestamp = os.date('%Y-%m-%d %H:%M', bill.date)
|
||||
|
||||
-- Check if bill is declined in our custom table
|
||||
local billData = lib.callback.await('billing:server:getBillStatus', false, bill.id)
|
||||
local isDeclined = billData and billData.declined == 1
|
||||
local billStatus = statusMap[bill.id]
|
||||
local isDeclined = billStatus and billStatus.declined == 1
|
||||
|
||||
local status = 'Unbezahlt'
|
||||
if bill.isPaid then
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue