Spaces:
Running
Running
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +9 -9
src/streamlit_app.py
CHANGED
|
@@ -1496,26 +1496,26 @@ elif len(st.session_state.batch_results) > 0:
|
|
| 1496 |
|
| 1497 |
# Display non-editable totals row immediately below (looks integrated)
|
| 1498 |
if len(edited_df) > 0:
|
| 1499 |
-
|
| 1500 |
-
|
| 1501 |
-
|
| 1502 |
-
|
| 1503 |
-
|
| 1504 |
totals_df = pd.DataFrame([{
|
| 1505 |
"Description": "ββββ TOTAL ββββ",
|
| 1506 |
"Quantity": "",
|
| 1507 |
"Unit Price": "",
|
| 1508 |
"Amount": f"{total_amount:,.2f}",
|
| 1509 |
-
"IO Number/Cost Centre": "",
|
| 1510 |
"Tax": f"{total_tax:,.2f}",
|
| 1511 |
"Line Total": f"{total_line_total:,.2f}"
|
| 1512 |
}])
|
| 1513 |
-
|
| 1514 |
st.dataframe(
|
| 1515 |
totals_df,
|
| 1516 |
-
|
| 1517 |
hide_index=True,
|
| 1518 |
-
height=38
|
| 1519 |
)
|
| 1520 |
|
| 1521 |
# Add spacing before save button to prevent overlap
|
|
|
|
| 1496 |
|
| 1497 |
# Display non-editable totals row immediately below (looks integrated)
|
| 1498 |
if len(edited_df) > 0:
|
| 1499 |
+
# Use clean_float so weird types (lists, strings, etc.) don't break things
|
| 1500 |
+
total_amount = sum(clean_float(v) for v in edited_df["Amount"])
|
| 1501 |
+
total_tax = sum(clean_float(v) for v in edited_df["Tax"])
|
| 1502 |
+
total_line_total = sum(clean_float(v) for v in edited_df["Line Total"])
|
| 1503 |
+
|
| 1504 |
totals_df = pd.DataFrame([{
|
| 1505 |
"Description": "ββββ TOTAL ββββ",
|
| 1506 |
"Quantity": "",
|
| 1507 |
"Unit Price": "",
|
| 1508 |
"Amount": f"{total_amount:,.2f}",
|
| 1509 |
+
"IO Number/Cost Centre": "",
|
| 1510 |
"Tax": f"{total_tax:,.2f}",
|
| 1511 |
"Line Total": f"{total_line_total:,.2f}"
|
| 1512 |
}])
|
| 1513 |
+
|
| 1514 |
st.dataframe(
|
| 1515 |
totals_df,
|
| 1516 |
+
width="stretch", # <- see note below
|
| 1517 |
hide_index=True,
|
| 1518 |
+
height=38
|
| 1519 |
)
|
| 1520 |
|
| 1521 |
# Add spacing before save button to prevent overlap
|