85 lines
3.0 KiB
Python
85 lines
3.0 KiB
Python
import os
|
|
from flask import Flask, render_template
|
|
|
|
from tools.eib import eib_bp
|
|
from tools.donor_report import donor_report_bp
|
|
from tools.financial_reports import financial_reports_bp
|
|
from tools.payslip import payslip_bp
|
|
|
|
# ── Tool registry ────────────────────────────────────────────────────────────
|
|
# Each entry drives one card on the landing page. Add a new tool by
|
|
# registering its blueprint below and appending an entry here — nothing
|
|
# else on the home page needs to change.
|
|
TOOLS = [
|
|
{
|
|
"name": "EIB Processor",
|
|
"tagline": "Equals Money → Workday EIB",
|
|
"description": (
|
|
"Converts raw Equals Money card-spend exports into clean Workday "
|
|
"EIB files, with an optional per-cardholder statement audit "
|
|
"against CSV or PDF statements."
|
|
),
|
|
"url": "/eib/",
|
|
"status": "online",
|
|
},
|
|
{
|
|
"name": "Donor Revenue Report",
|
|
"tagline": "Trial Balance → Per-Donor Financial Extract",
|
|
"description": (
|
|
"Generates a formatted financial extract workbook from the "
|
|
"revenue trial balance, with one sheet per donor."
|
|
),
|
|
"url": "/donor-report/",
|
|
"status": "online",
|
|
},
|
|
{
|
|
"name": "Financial Reports",
|
|
"tagline": "Trial Balance → Category Summary & Balance Sheet",
|
|
"description": (
|
|
"Generates a Category Summary (Account/Category/Project Code, "
|
|
"Canada/US split) and a Balance Sheet snapshot from the revenue "
|
|
"and expense trial balances, reconciled back to the source files."
|
|
),
|
|
"url": "/financial-reports/",
|
|
"status": "online",
|
|
},
|
|
{
|
|
"name": "Payslip Generator",
|
|
"tagline": "Fill in, preview, download PDF",
|
|
"description": (
|
|
"Generates a formatted payslip from company/employee details and "
|
|
"earnings/deductions lines, entirely in the browser - nothing is "
|
|
"uploaded to a server."
|
|
),
|
|
"url": "/payslip/",
|
|
"status": "online",
|
|
},
|
|
]
|
|
|
|
|
|
def create_app():
|
|
app = Flask(__name__, template_folder="../templates", static_folder="../static")
|
|
app.config["UPLOAD_FOLDER"] = os.environ.get("UPLOAD_FOLDER", "/app/uploads")
|
|
app.config["OUTPUT_FOLDER"] = os.environ.get("OUTPUT_FOLDER", "/app/outputs")
|
|
app.config["MAX_CONTENT_LENGTH"] = 50 * 1024 * 1024 # 50MB
|
|
|
|
app.register_blueprint(eib_bp)
|
|
app.register_blueprint(donor_report_bp)
|
|
app.register_blueprint(financial_reports_bp)
|
|
app.register_blueprint(payslip_bp)
|
|
|
|
@app.route("/")
|
|
def home():
|
|
return render_template("home.html", tools=TOOLS)
|
|
|
|
return app
|
|
|
|
|
|
app = create_app()
|
|
|
|
if __name__ == "__main__":
|
|
os.makedirs(app.config["UPLOAD_FOLDER"], exist_ok=True)
|
|
os.makedirs(app.config["OUTPUT_FOLDER"], exist_ok=True)
|
|
port = int(os.environ.get("PORT", 8080))
|
|
app.run(host="0.0.0.0", port=port, debug=False, threaded=True)
|