Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,7 +29,7 @@ def generate_invoice(customer_name, table_number, selected_items, wishes):
|
|
| 29 |
]
|
| 30 |
total = sum(item['price'] for item in items)
|
| 31 |
|
| 32 |
-
invoice = f
|
| 33 |
-----------------------------------------
|
| 34 |
Restaurant Invoice
|
| 35 |
-----------------------------------------
|
|
@@ -38,20 +38,28 @@ def generate_invoice(customer_name, table_number, selected_items, wishes):
|
|
| 38 |
Table Number: {table_number}
|
| 39 |
-----------------------------------------
|
| 40 |
Items Ordered:
|
| 41 |
-
|
| 42 |
for item in items:
|
| 43 |
-
invoice += f
|
| 44 |
|
| 45 |
-
invoice += """
|
| 46 |
-----------------------------------------
|
| 47 |
Total Amount: ${total:.2f}
|
| 48 |
-----------------------------------------
|
| 49 |
Customer Wishes:
|
| 50 |
-
|
| 51 |
for wish in wishes.split(','):
|
| 52 |
-
invoice += f
|
| 53 |
|
| 54 |
invoice += """
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 55 |
-----------------------------------------
|
| 56 |
Thank you for dining with us!
|
| 57 |
Have a great day!
|
|
|
|
| 29 |
]
|
| 30 |
total = sum(item['price'] for item in items)
|
| 31 |
|
| 32 |
+
invoice = f"""
|
| 33 |
-----------------------------------------
|
| 34 |
Restaurant Invoice
|
| 35 |
-----------------------------------------
|
|
|
|
| 38 |
Table Number: {table_number}
|
| 39 |
-----------------------------------------
|
| 40 |
Items Ordered:
|
| 41 |
+
"""
|
| 42 |
for item in items:
|
| 43 |
+
invoice += f"- {item['name']} (${item['price']})\\n"
|
| 44 |
|
| 45 |
+
invoice += f"""
|
| 46 |
-----------------------------------------
|
| 47 |
Total Amount: ${total:.2f}
|
| 48 |
-----------------------------------------
|
| 49 |
Customer Wishes:
|
| 50 |
+
"""
|
| 51 |
for wish in wishes.split(','):
|
| 52 |
+
invoice += f"- {wish.strip()}\\n"
|
| 53 |
|
| 54 |
invoice += """
|
| 55 |
+
-----------------------------------------
|
| 56 |
+
Thank you for dining with us!
|
| 57 |
+
Have a great day!
|
| 58 |
+
"""
|
| 59 |
+
return invoice
|
| 60 |
+
except Exception as e:
|
| 61 |
+
return f"Error generating invoice: {str(e)}"
|
| 62 |
+
|
| 63 |
-----------------------------------------
|
| 64 |
Thank you for dining with us!
|
| 65 |
Have a great day!
|