Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -1200,17 +1200,33 @@ def order_summary():
|
|
1200 |
ORDER BY CreatedDate DESC
|
1201 |
LIMIT 1
|
1202 |
""")
|
|
|
|
|
|
|
|
|
1203 |
order = result.get("records", [])[0] if result.get("records") else None
|
1204 |
|
1205 |
if not order:
|
1206 |
return render_template("order.html", order=None)
|
1207 |
|
|
|
|
|
|
|
1208 |
# Convert the amounts to float and format them with a single decimal place
|
1209 |
-
|
1210 |
-
|
1211 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1212 |
|
1213 |
return render_template("order.html", order=order)
|
|
|
1214 |
except Exception as e:
|
1215 |
print(f"Error fetching order details: {str(e)}")
|
1216 |
return render_template("order.html", order=None, error=str(e))
|
@@ -1219,7 +1235,6 @@ def order_summary():
|
|
1219 |
|
1220 |
|
1221 |
|
1222 |
-
|
1223 |
import smtplib
|
1224 |
from email.mime.multipart import MIMEMultipart
|
1225 |
from email.mime.text import MIMEText
|
|
|
1200 |
ORDER BY CreatedDate DESC
|
1201 |
LIMIT 1
|
1202 |
""")
|
1203 |
+
|
1204 |
+
# Debugging: Print the fetched result to check if the order is returned
|
1205 |
+
print("Fetched order data:", result)
|
1206 |
+
|
1207 |
order = result.get("records", [])[0] if result.get("records") else None
|
1208 |
|
1209 |
if not order:
|
1210 |
return render_template("order.html", order=None)
|
1211 |
|
1212 |
+
# Debugging: Check the order values before formatting
|
1213 |
+
print("Order before formatting:", order)
|
1214 |
+
|
1215 |
# Convert the amounts to float and format them with a single decimal place
|
1216 |
+
if 'Total_Amount__c' in order:
|
1217 |
+
order['Total_Amount__c'] = "{:.1f}".format(float(order['Total_Amount__c']))
|
1218 |
+
|
1219 |
+
if 'Discount__c' in order:
|
1220 |
+
order['Discount__c'] = "{:.1f}".format(float(order['Discount__c']))
|
1221 |
+
|
1222 |
+
if 'Total_Bill__c' in order:
|
1223 |
+
order['Total_Bill__c'] = "{:.1f}".format(float(order['Total_Bill__c']))
|
1224 |
+
|
1225 |
+
# Debugging: Check the order values after formatting
|
1226 |
+
print("Order after formatting:", order)
|
1227 |
|
1228 |
return render_template("order.html", order=order)
|
1229 |
+
|
1230 |
except Exception as e:
|
1231 |
print(f"Error fetching order details: {str(e)}")
|
1232 |
return render_template("order.html", order=None, error=str(e))
|
|
|
1235 |
|
1236 |
|
1237 |
|
|
|
1238 |
import smtplib
|
1239 |
from email.mime.multipart import MIMEMultipart
|
1240 |
from email.mime.text import MIMEText
|