Exports
This page documents all available exports provided by the g-order-system resource.
Client Export
Open Menu
--- Open Pos menu
---@param job string The job name
exports['g-order-system']:OpenPos('cat_cafe')
Server Exports
Create Pos Order
local newOrder = {
job = "burgershot",
name = "John Doe",
orderId = exports['g-order-system']:GenerateOrderId(),
orderType = "dine-in",
status = "pending",
isPaid = false,
tableNumber = "5",
orderItems = {
{ orderId = "BS12345", itemName = "burger", quantity = 2, price = 10 },
{ orderId = "BS12345", itemName = "fries", quantity = 1, price = 5 }
},
paymentMethod = "cash",
subtotal = 25
}
--
-- Create order without giving receipt item
local orderId = exports['g-order-system']:CreatePosOrder(newOrder)
--
-- Create order and also give receipt item to player (source 1) (recommended)
local orderIdWithReceipt = exports['g-order-system']:CreatePosOrder(newOrder,source)
Update order status
--- Updates the status of a POS order.
---@param orderId string The unique order ID
---@param status "pending"|"completed"|"cancelled" The new order status
---@return number? result The database update result (e.g., affected rows)
exports['g-order-system']:UpdatePosOrder("ORD-20250901070113", "completed")
Check if order is paid
--- Checks if an order is paid
---@param orderId string The ID of the order
---@return boolean isPaid Whether the order is paid
exports['g-order-system']:IsOrderPaid("ORD-20250901070034")
Create New product
local newProduct = {
job = "cat_cafe",
restaurantId = "BS001",
itemName = "test_burger",
itemLabel = "Test Burger",
image = "burger.png",
isAvailable = true,
category = "Food",
price = 15,
count = 10,
pdid = "BS-BURGER-TEST"
}
--- Creates a new product in the POS system.
---@param object The product data
---@return number? id The created product's database ID
exports['g-order-system']:CreatePosProduct(newProduct)
Create transaction
local transaction = {
amount = 100,
type = "sale",
job = "cat_cafe",
createdAt = os.date("%Y-%m-%d %H:%M:%S")
}
--- Creates a new transaction in the POS system.
--- Used for recording deposits, withdrawals, and sales.
---@param object The transaction data
---@return number? id The created transaction's database ID
exports['g-order-system']:CreatePosTransaction(transaction)
Deposit Money
--- Deposits money into a job account
---@param job string The job name
---@param amount number The amount to deposit
---@return boolean success Whether the deposit was successful
exports['g-order-system']:DepositPosMoney("cat_cafe", 500)
Withdraws Money
--- Withdraws money from a job account
---@param job string The job name
---@param amount number The amount to withdraw
---@return boolean success Whether the withdrawal was successful
exports['g-order-system']:WithdrawPosMoney("cat_cafe", 200)
Get Account Balance
--- Retrieves the account balance for a job
---@param job string The job name
---@return number balance The current account balance
exports['g-order-system']:GetPosAccountBalance("cat_cafe")
Last updated