// Define the orders table
let ordersTable = base.getTable("Orders");
// Fetch all order records
let ordersQuery = await ordersTable.selectRecordsAsync({
fields: ["Order Number", "Customer ID", "Name", "Email", "Phone Number", "Address", "Selected Meals", "Order Date", "Delivery Date", "Order Type", "Order Status"]
});
// Loop through each order and generate the ticket
for (let orderRecord of ordersQuery.records) {
// Fetch order details
let orderNumber = orderRecord.getCellValue("Order Number");
let customerId = orderRecord.getCellValue("Customer ID");
let customerName = orderRecord.getCellValue("Name");
let customerEmail = orderRecord.getCellValue("Email");
let customerPhoneNumber = orderRecord.getCellValue("Phone Number");
let customerAddress = orderRecord.getCellValue("Address");
let selectedMeals = orderRecord.getCellValue("Selected Meals");
let orderDate = orderRecord.getCellValue("Order Date");
let deliveryDate = orderRecord.getCellValue("Delivery Date");
let orderType = orderRecord.getCellValue("Order Type");
let orderStatus = orderRecord.getCellValue("Order Status");
// Format the ticket content
let ticketContent = `
**Order Number:** ${orderNumber}
**Customer Name:** ${customerName}
**Email:** ${customerEmail}
**Phone Number:** ${customerPhoneNumber}
**Address:** ${customerAddress}
**Selected Meals:**
**Order Date:** ${orderDate}
**Delivery Date:** ${deliveryDate}
**Order Type:** ${orderType}
**Order Status:** ${orderStatus}
`;
// Output the ticket content
output.markdown(ticketContent);
}
I want this ticket machine to look like an order receipt for online food ordering business. Thank you!