Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -235,7 +235,7 @@ def process_reconciliation(sa_amount, solve_file, sap_file):
|
|
| 235 |
|
| 236 |
# Determine Final Settlement Status
|
| 237 |
if abs(balance) < 0.05:
|
| 238 |
-
status = f"✅ SUCCESS: Perfectly Balanced (Zero-Sum).\n• Total SAP lines matched: {total_sap:,.2f}\n• Statement line: {sa_amount:,.2f}\n• Solve Lines Matched: {matched_count} of {total_targets}\n\n👉 Click the download box to save your
|
| 239 |
else:
|
| 240 |
status = f"❌ EXCEPTION: Imbalance detected! Duplicates were filtered, but totals still do not match.\n• SAP Matched Total: {total_sap:,.2f} \n• Statement Line: {sa_amount:,.2f} \n• Difference: {round(balance, 2):,.2f}\n• Solve Lines Matched: {matched_count} of {total_targets}"
|
| 241 |
|
|
@@ -246,9 +246,32 @@ def process_reconciliation(sa_amount, solve_file, sap_file):
|
|
| 246 |
return f"Error processing files: {str(e)}\n\nDetails:\n{trace}", pd.DataFrame(), None
|
| 247 |
|
| 248 |
|
| 249 |
-
# ---------------- GRADIO UI ENVIRONMENT ---------------- #
|
| 250 |
|
| 251 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
gr.Markdown("# 🤖 Auto-Reconciliation Tool: Branch 7964")
|
| 253 |
gr.Markdown("Upload transaction files to isolate, verify, and match active ledger entries while auto-filtering unreversed integration duplicates.")
|
| 254 |
|
|
@@ -261,8 +284,8 @@ with gr.Blocks(theme=gr.themes.Default()) as demo:
|
|
| 261 |
run_btn = gr.Button("Run Reconciliation", variant="primary")
|
| 262 |
|
| 263 |
with gr.Column():
|
| 264 |
-
status_output = gr.Textbox(label="Reconciliation Status", lines=6)
|
| 265 |
-
download_output = gr.File(label="📥 Download Matched Results (CSV)")
|
| 266 |
|
| 267 |
gr.Markdown("### Match Output Table")
|
| 268 |
table_output = gr.Dataframe(interactive=False)
|
|
|
|
| 235 |
|
| 236 |
# Determine Final Settlement Status
|
| 237 |
if abs(balance) < 0.05:
|
| 238 |
+
status = f"✅ SUCCESS: Perfectly Balanced (Zero-Sum).\n• Total SAP lines matched: {total_sap:,.2f}\n• Statement line: {sa_amount:,.2f}\n• Solve Lines Matched: {matched_count} of {total_targets}\n\n👉 Click the download box below to save your spreadsheet."
|
| 239 |
else:
|
| 240 |
status = f"❌ EXCEPTION: Imbalance detected! Duplicates were filtered, but totals still do not match.\n• SAP Matched Total: {total_sap:,.2f} \n• Statement Line: {sa_amount:,.2f} \n• Difference: {round(balance, 2):,.2f}\n• Solve Lines Matched: {matched_count} of {total_targets}"
|
| 241 |
|
|
|
|
| 246 |
return f"Error processing files: {str(e)}\n\nDetails:\n{trace}", pd.DataFrame(), None
|
| 247 |
|
| 248 |
|
| 249 |
+
# ---------------- GRADIO UI ENVIRONMENT (NAVY & YELLOW THEME) ---------------- #
|
| 250 |
|
| 251 |
+
# Custom layout and CSS tokens injecting the Navy (#002060) and Gold/Yellow (#FFD700) palette
|
| 252 |
+
custom_theme = gr.themes.Default(
|
| 253 |
+
primary_hue="amber",
|
| 254 |
+
neutral_hue="slate"
|
| 255 |
+
).set(
|
| 256 |
+
body_background_fill="#F1F5F9",
|
| 257 |
+
block_background_fill="#FFFFFF",
|
| 258 |
+
block_border_color="#002060",
|
| 259 |
+
block_title_text_color="#002060",
|
| 260 |
+
button_primary_background_fill="#002060", # Corporate Navy
|
| 261 |
+
button_primary_text_color="#FFFFFF",
|
| 262 |
+
button_primary_background_fill_hover="#002B80",
|
| 263 |
+
button_primary_border_color="#FFD700", # Yellow Border highlight
|
| 264 |
+
input_background_fill="#FFFFFF",
|
| 265 |
+
input_border_color="#002060"
|
| 266 |
+
)
|
| 267 |
+
|
| 268 |
+
custom_css = """
|
| 269 |
+
h1 { color: #002060 !important; font-weight: bold !important; border-bottom: 3px solid #FFD700; padding-bottom: 10px; }
|
| 270 |
+
.status-box textarea { border: 2px solid #002060 !important; background-color: #FFFDF0 !important; font-weight: bold; color: #002060 !important; }
|
| 271 |
+
.download-box { border: 2px dashed #FFD700 !important; background-color: #FDFBF0 !important; }
|
| 272 |
+
"""
|
| 273 |
+
|
| 274 |
+
with gr.Blocks(theme=custom_theme, css=custom_css) as demo:
|
| 275 |
gr.Markdown("# 🤖 Auto-Reconciliation Tool: Branch 7964")
|
| 276 |
gr.Markdown("Upload transaction files to isolate, verify, and match active ledger entries while auto-filtering unreversed integration duplicates.")
|
| 277 |
|
|
|
|
| 284 |
run_btn = gr.Button("Run Reconciliation", variant="primary")
|
| 285 |
|
| 286 |
with gr.Column():
|
| 287 |
+
status_output = gr.Textbox(label="Reconciliation Status", lines=6, elem_classes="status-box")
|
| 288 |
+
download_output = gr.File(label="📥 Download Matched Results (CSV)", elem_classes="download-box")
|
| 289 |
|
| 290 |
gr.Markdown("### Match Output Table")
|
| 291 |
table_output = gr.Dataframe(interactive=False)
|