Envi-Receipts is a free open-source resource for ESX (using ox inventory) or QB-Core (using qb-inventory) This script utilizes item metadata and a simple UI to create an immersive shopping experience!
- Integration with ESX/QB-Core: The system is compatible with popular frameworks, ensuring seamless functionality with your existing setup.
- Customizable item display: You can easily add metadata to display item information in our realistic user interface.
- Ox_lib Support: The Receipt System requires and supports ox_lib v3 for a clean user experience.
- Simple and Advanced Usage: The system provides both simple and advanced methods for using the Receipt System, catering to users with different needs and skill levels.
- Server-side exports: Several server-side exports are available for integrating the Receipt System with other resources or utilizing more advanced functionality.
- User-friendly Menus: The Receipt System offers an intuitive in-game menu for adding, reviewing, and managing items and receipts.
- Flexible receipt printing: Users can print receipts with customizable details, such as payment status and the number of copies.
- Add items to receipt: The Receipt System allows users to easily add items to the bill by entering their details in the provided menu.
- Clear receipt: Users can clear the bill to remove all items and start fresh.
- Show receipt: The Receipt System provides a feature to review the items added to the receipt and their prices.
- Print receipt: The system allows users to give a receipt to a player with the bill's contents.
- Multiple item management: You can add as many items as needed via simple or advanced methods, and choose to print the bill via the item, providing a lot of flexibility and possibilities.
- Realistic UI: View the receipts and all it's info including tax, sub-total, itemised list and more!
- Tax System: Will allow you to set your own tax percentage in the config file.
- AP-Government Compatibility: Easy linked with AP Script's Government system to automatically calculate current item tax!
- Custom Prop from BzZz: Payment terminal prop from the amazingly talented BzZz! - https://bzzz.tebex.io
Preview: https://youtu.be/srlHgmRgGWY
Before using the Receipt System, ensure that you have added the necessary items into the appropriate resource. This will enable the system to recognize and process the items needed.
To display the item information, insert the following code into your app.js file:
} else if (itemData.name == "receipt") {
var items = "";
var i = 1;
while (itemData.info["item" + i]) {
items += "<p><strong>Item " + i + ": </strong><span>" + itemData.info["item" + i] + " - $" + itemData.info["price" + i] + "</span></p>";
i++;
}
$(".item-info-title").html("<p>" + itemData.label + "</p>");
$(".item-info-description").html(
"<p><strong>Date: </strong><span>" + itemData.info.date + "</span></p>" +
"<p><strong>Time: </strong><span>" + itemData.info.time + "</span></p>" +
items +
"<p><strong>Total: </strong><span>$" + itemData.info.total + "</span></p>" +
"<p><strong>Tax Amount: </strong><span>$" + itemData.info.tax_amount + "</span></p>" +
"<p><strong>Total After Tax: </strong><span>$" + itemData.info.total_after_tax + "</span></p>" +
"<p><strong>Status: </strong><span>" + itemData.info.description.split(' - ')[1] + "</span></p>"
)
}
Make sure you have ox_lib installed on your server. This library is required for the Receipt System to work correctly.
The simple method of using the Receipt System involves the following steps:
- Trigger menu via item: To open the Receipt System menu, interact with the in-game item.
- Add items manually: Once the menu is open, you can add items to the receipt by entering their details in the provided menu.
- Show Basket: You can review the items added to the receipt and their prices by checking the basket. If you need to remove any items, simply click the "Clear Basket" button.
- Print Receipt: After finalizing the items and their prices, click the "Print Receipt" button. You will be prompted to select whether the bill is paid in full or not and the number of receipt copies you want to print.
To integrate the Receipt System into other resources or utilize server exports for more advanced functionality.
addToBill This server-side export allows you to add an item to a player's bill:
-- addToBill(player, itemName, itemPrice)
exports['envi-receipts']:addToBill(source, itemName, itemPrice)
clearBill This server-side export allows you to clear a player's bill:
-- clearBill(player)
exports['envi-receipts']:clearBill(source)
showBasket This server-side export allows you to get a player's bill as a table of items and their prices:
-- showBasket(player)
local basket = exports['envi-receipts']:showBasket(source)
giveBill This server-side export allows you to give a receipt to a player with the bill's contents:
-- giveBill(player, howMany, paid)
exports['envi-receipts']:giveBill(source, 1, true)
When you want to give a receipt for a single item, you can follow this sequence:
Clear the bill. Add the item to the bill. Give the bill to the player. Clear the bill again.
Here's an example of how to do this after a QBCore.Function.AddItem in another script:
RegisterServerEvent('burger:example', function(source)
local Player = QB.Functions.GetPlayer(source)
Player.Functions.AddItem("burger", 1)
exports['envi-receipts']:clearBill(source) -- clears any old data
exports['envi-receipts']:addToBill(source, "Burger", 50) -- adds it to the total bill
exports['envi-receipts']:giveBill(source, 1, true) -- prints the items currently added and rewards receipt item
exports['envi-receipts']:clearBill(source) -- clear the bill again for good measure
end)
You can also add as many items as you like/ choose when to print the bill via the item. Lots of possibilities!