|
|
|
|
@ -42,8 +42,12 @@ def upload_file():
|
|
|
|
|
filename = secure_filename(file.filename)
|
|
|
|
|
filepath = os.path.join(app.config["UPLOAD_FOLDER"], filename)
|
|
|
|
|
file.save(filepath)
|
|
|
|
|
flash("Bestand geüpload en verwerkt! <a href='" +
|
|
|
|
|
url_for('show_result') + "'>Bekijk de resultaten</a>", "success")
|
|
|
|
|
flash(
|
|
|
|
|
"Bestand geüpload en verwerkt! <a href='"
|
|
|
|
|
+ url_for("show_result")
|
|
|
|
|
+ "'>Bekijk de resultaten</a>",
|
|
|
|
|
"success",
|
|
|
|
|
)
|
|
|
|
|
process_excel(filepath)
|
|
|
|
|
return redirect(url_for("upload_file"))
|
|
|
|
|
|
|
|
|
|
@ -79,7 +83,7 @@ def download_excel():
|
|
|
|
|
return Response(
|
|
|
|
|
output,
|
|
|
|
|
mimetype="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
|
|
|
headers={"Content-Disposition": f"attachment; filename={filename}"}
|
|
|
|
|
headers={"Content-Disposition": f"attachment; filename={filename}"},
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -87,7 +91,8 @@ def getextrapolation(extrapolateYears):
|
|
|
|
|
conn, cursor = get_db_connection()
|
|
|
|
|
|
|
|
|
|
# Haal de originele data op zonder extrapolatie
|
|
|
|
|
cursor.execute("""
|
|
|
|
|
cursor.execute(
|
|
|
|
|
"""
|
|
|
|
|
SELECT
|
|
|
|
|
Object_code,
|
|
|
|
|
Object_omschrijving,
|
|
|
|
|
@ -104,7 +109,8 @@ def getextrapolation(extrapolateYears):
|
|
|
|
|
Klasse_object,
|
|
|
|
|
Categorie
|
|
|
|
|
FROM onderhoud
|
|
|
|
|
""")
|
|
|
|
|
"""
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Haal de kolomnamen op
|
|
|
|
|
columns = [desc[0] for desc in cursor.description]
|
|
|
|
|
@ -137,7 +143,8 @@ def getextrapolation(extrapolateYears):
|
|
|
|
|
|
|
|
|
|
if pd.notna(vervaldatum): # Controleer of het een geldige datum is
|
|
|
|
|
new_row["Vervaldatum"] = (
|
|
|
|
|
vervaldatum + pd.DateOffset(years=i)).strftime("%Y-%m-%d")
|
|
|
|
|
vervaldatum + pd.DateOffset(years=i)
|
|
|
|
|
).strftime("%Y-%m-%d")
|
|
|
|
|
else:
|
|
|
|
|
# Indien geen geldige datum, zet als None
|
|
|
|
|
new_row["Vervaldatum"] = None
|
|
|
|
|
|