Renames of report html files
This commit is contained in:
@@ -167,8 +167,12 @@ class SubcontractorBill:
|
||||
>>>>>>> pankaj-dev
|
||||
=======
|
||||
# --- subcontractor report only ---
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> pankaj-dev
|
||||
@file_report_bp.route("/report", methods=["GET", "POST"])
|
||||
=======
|
||||
@file_report_bp.route("/Subcontractor_report", methods=["GET", "POST"])
|
||||
>>>>>>> pankaj-dev
|
||||
@login_required
|
||||
def report_file():
|
||||
subcontractors = Subcontractor.query.all()
|
||||
@@ -264,7 +268,6 @@ def report_file():
|
||||
return send_file(output, download_name=file_name, as_attachment=True)
|
||||
|
||||
# We add bootstrap classes directly to the pandas output
|
||||
# table_classes = "table table-hover table-bordered table-striped"
|
||||
table_classes = "table table-bordered table-striped table-hover table-sm mb-0"
|
||||
tables = {
|
||||
"tr": bill_gen.df_tr.to_html(classes=table_classes, index=False),
|
||||
@@ -275,7 +278,7 @@ def report_file():
|
||||
selected_sc_id = subcontractor_id
|
||||
|
||||
return render_template(
|
||||
"report.html",
|
||||
"subcontractor_report.html",
|
||||
subcontractors=subcontractors,
|
||||
tables=tables,
|
||||
selected_sc_id=selected_sc_id,
|
||||
@@ -283,12 +286,17 @@ def report_file():
|
||||
download_all=download_all
|
||||
)
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<<<<<< HEAD
|
||||
>>>>>>> pankaj-dev
|
||||
=======
|
||||
# --- client comparison ---
|
||||
>>>>>>> pankaj-dev
|
||||
@file_report_bp.route("/client_vs_subcont", methods=["GET", "POST"])
|
||||
=======
|
||||
# --- client report only ---
|
||||
@file_report_bp.route("/client_report", methods=["GET", "POST"])
|
||||
>>>>>>> pankaj-dev
|
||||
@login_required
|
||||
def client_vs_all_subcontractor():
|
||||
tables = {"tr": None, "mh": None, "dc": None}
|
||||
@@ -444,7 +452,7 @@ def client_vs_all_subcontractor():
|
||||
# Aggregate data
|
||||
df_sub_tr_grp = aggregate_df(contractorBill.df_tr, ["Location", "MH_NO"], qty_cols)
|
||||
df_sub_mh_grp = aggregate_df(contractorBill.df_mh, ["Location", "MH_NO"], qty_cols)
|
||||
df_sub_dc_grp = aggregate_df(contractorBill.df_dc, ["Location", "Node_No"], mh_dc_qty_cols)
|
||||
df_sub_dc_grp = aggregate_df(contractorBill.df_dc, ["Location", "MH_NO"], mh_dc_qty_cols)
|
||||
|
||||
# --- FINAL MERGE LOGIC ---
|
||||
# We check if "Location" exists in the client data. If not, we add it to prevent the KeyError.
|
||||
@@ -455,18 +463,23 @@ def client_vs_all_subcontractor():
|
||||
try:
|
||||
df_tr_cmp = clientBill.df_tr.merge(df_sub_tr_grp, on=["Location", "MH_NO"], how="left", suffixes=("_Client", "_Sub"))
|
||||
df_mh_cmp = clientBill.df_mh.merge(df_sub_mh_grp, on=["Location", "MH_NO"], how="left", suffixes=("_Client", "_Sub"))
|
||||
df_dc_cmp = clientBill.df_dc.merge(df_sub_dc_grp, on=["Location", "Node_No"], how="left", suffixes=("_Client", "_Sub"))
|
||||
df_dc_cmp = clientBill.df_dc.merge(df_sub_dc_grp, on=["Location", "MH_NO"], how="left", suffixes=("_Client", "_Sub"))
|
||||
except KeyError as e:
|
||||
flash(f"Merge Error: Missing column {str(e)}. Check if 'Location' is defined in your database models.", "danger")
|
||||
return render_template("generate_comparison_client_vs_subcont.html", tables=tables, ra_val=ra_val)
|
||||
|
||||
# ... (Rest of your calculation and download logic) ...
|
||||
|
||||
|
||||
# Convert to HTML for preview
|
||||
tables["tr"] = df_tr_cmp.to_html(classes='table table-striped table-hover table-sm', index=False)
|
||||
tables["mh"] = df_mh_cmp.to_html(classes='table table-striped table-hover table-sm', index=False)
|
||||
tables["dc"] = df_dc_cmp.to_html(classes='table table-striped table-hover table-sm', index=False)
|
||||
|
||||
<<<<<<< HEAD
|
||||
return render_template("generate_comparison_client_vs_subcont.html", tables=tables, ra_val=ra_val)
|
||||
|
||||
>>>>>>> pankaj-dev
|
||||
=======
|
||||
|
||||
return render_template("client_report.html", tables=tables, ra_val=ra_val)
|
||||
|
||||
>>>>>>> pankaj-dev
|
||||
|
||||
Reference in New Issue
Block a user