Renames of report html files
This commit is contained in:
@@ -5,7 +5,8 @@ from app.utils.helpers import login_required
|
|||||||
|
|
||||||
file_import_bp = Blueprint("file_import", __name__, url_prefix="/file")
|
file_import_bp = Blueprint("file_import", __name__, url_prefix="/file")
|
||||||
|
|
||||||
@file_import_bp.route("/import", methods=["GET", "POST"])
|
# this is contractractor immport routes
|
||||||
|
@file_import_bp.route("/import_Subcontractor", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def import_file():
|
def import_file():
|
||||||
subcontractors = Subcontractor.query.all()
|
subcontractors = Subcontractor.query.all()
|
||||||
@@ -21,13 +22,13 @@ def import_file():
|
|||||||
flash(msg, "success" if success else "danger")
|
flash(msg, "success" if success else "danger")
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"file_import.html",
|
"file_import_subcontractor.html",
|
||||||
title="Sub-cont. File Import",
|
title="Sub-cont. File Import",
|
||||||
subcontractors=subcontractors
|
subcontractors=subcontractors
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# this route import client files
|
# this is client import routes
|
||||||
@file_import_bp.route("/import_client", methods=["GET", "POST"])
|
@file_import_bp.route("/import_client", methods=["GET", "POST"])
|
||||||
@login_required
|
@login_required
|
||||||
def client_import_file():
|
def client_import_file():
|
||||||
|
|||||||
@@ -167,8 +167,12 @@ class SubcontractorBill:
|
|||||||
>>>>>>> pankaj-dev
|
>>>>>>> pankaj-dev
|
||||||
=======
|
=======
|
||||||
# --- subcontractor report only ---
|
# --- subcontractor report only ---
|
||||||
|
<<<<<<< HEAD
|
||||||
>>>>>>> pankaj-dev
|
>>>>>>> pankaj-dev
|
||||||
@file_report_bp.route("/report", methods=["GET", "POST"])
|
@file_report_bp.route("/report", methods=["GET", "POST"])
|
||||||
|
=======
|
||||||
|
@file_report_bp.route("/Subcontractor_report", methods=["GET", "POST"])
|
||||||
|
>>>>>>> pankaj-dev
|
||||||
@login_required
|
@login_required
|
||||||
def report_file():
|
def report_file():
|
||||||
subcontractors = Subcontractor.query.all()
|
subcontractors = Subcontractor.query.all()
|
||||||
@@ -264,7 +268,6 @@ def report_file():
|
|||||||
return send_file(output, download_name=file_name, as_attachment=True)
|
return send_file(output, download_name=file_name, as_attachment=True)
|
||||||
|
|
||||||
# We add bootstrap classes directly to the pandas output
|
# 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"
|
table_classes = "table table-bordered table-striped table-hover table-sm mb-0"
|
||||||
tables = {
|
tables = {
|
||||||
"tr": bill_gen.df_tr.to_html(classes=table_classes, index=False),
|
"tr": bill_gen.df_tr.to_html(classes=table_classes, index=False),
|
||||||
@@ -275,7 +278,7 @@ def report_file():
|
|||||||
selected_sc_id = subcontractor_id
|
selected_sc_id = subcontractor_id
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"report.html",
|
"subcontractor_report.html",
|
||||||
subcontractors=subcontractors,
|
subcontractors=subcontractors,
|
||||||
tables=tables,
|
tables=tables,
|
||||||
selected_sc_id=selected_sc_id,
|
selected_sc_id=selected_sc_id,
|
||||||
@@ -283,12 +286,17 @@ def report_file():
|
|||||||
download_all=download_all
|
download_all=download_all
|
||||||
)
|
)
|
||||||
|
|
||||||
|
<<<<<<< HEAD
|
||||||
<<<<<<< HEAD
|
<<<<<<< HEAD
|
||||||
>>>>>>> pankaj-dev
|
>>>>>>> pankaj-dev
|
||||||
=======
|
=======
|
||||||
# --- client comparison ---
|
# --- client comparison ---
|
||||||
>>>>>>> pankaj-dev
|
>>>>>>> pankaj-dev
|
||||||
@file_report_bp.route("/client_vs_subcont", methods=["GET", "POST"])
|
@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
|
@login_required
|
||||||
def client_vs_all_subcontractor():
|
def client_vs_all_subcontractor():
|
||||||
tables = {"tr": None, "mh": None, "dc": None}
|
tables = {"tr": None, "mh": None, "dc": None}
|
||||||
@@ -444,7 +452,7 @@ def client_vs_all_subcontractor():
|
|||||||
# Aggregate data
|
# Aggregate data
|
||||||
df_sub_tr_grp = aggregate_df(contractorBill.df_tr, ["Location", "MH_NO"], qty_cols)
|
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_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 ---
|
# --- FINAL MERGE LOGIC ---
|
||||||
# We check if "Location" exists in the client data. If not, we add it to prevent the KeyError.
|
# 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:
|
try:
|
||||||
df_tr_cmp = clientBill.df_tr.merge(df_sub_tr_grp, on=["Location", "MH_NO"], how="left", suffixes=("_Client", "_Sub"))
|
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_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:
|
except KeyError as e:
|
||||||
flash(f"Merge Error: Missing column {str(e)}. Check if 'Location' is defined in your database models.", "danger")
|
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)
|
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
|
# Convert to HTML for preview
|
||||||
tables["tr"] = df_tr_cmp.to_html(classes='table table-striped table-hover table-sm', index=False)
|
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["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)
|
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)
|
return render_template("generate_comparison_client_vs_subcont.html", tables=tables, ra_val=ra_val)
|
||||||
|
|
||||||
>>>>>>> pankaj-dev
|
>>>>>>> pankaj-dev
|
||||||
|
=======
|
||||||
|
|
||||||
|
return render_template("client_report.html", tables=tables, ra_val=ra_val)
|
||||||
|
|
||||||
|
>>>>>>> pankaj-dev
|
||||||
|
|||||||
Binary file not shown.
@@ -68,12 +68,12 @@
|
|||||||
</a>
|
</a>
|
||||||
<ul class="dropdown-menu dropdown-menu-dark">
|
<ul class="dropdown-menu dropdown-menu-dark">
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="/file/import">
|
<a class="dropdown-item" href="/file/import_Subcontractor">
|
||||||
<i class="bi bi-upload me-2"></i> Import File
|
<i class="bi bi-upload me-2"></i> Import File
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="/file/report">
|
<a class="dropdown-item" href="/file/Subcontractor_report">
|
||||||
<i class="bi bi-download me-2"></i> Show Reports
|
<i class="bi bi-download me-2"></i> Show Reports
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@@ -93,7 +93,7 @@
|
|||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a class="dropdown-item" href="/file/client_vs_subcont">
|
<a class="dropdown-item" href="/file/client_report">
|
||||||
<i class="bi bi-arrow-left-right me-2"></i> Show Report
|
<i class="bi bi-arrow-left-right me-2"></i> Show Report
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|||||||
@@ -13,8 +13,8 @@
|
|||||||
<div class="col-12 col-md-4">
|
<div class="col-12 col-md-4">
|
||||||
<div class="card text-white bg-primary shadow h-100">
|
<div class="card text-white bg-primary shadow h-100">
|
||||||
<div class="card-body text-center text-md-start">
|
<div class="card-body text-center text-md-start">
|
||||||
<h6>Total Work</h6>
|
<h6>Test Total Work</h6>
|
||||||
<h3 class="fw-bold">410</h3>
|
<h3 class="fw-bold">30%</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -23,8 +23,8 @@
|
|||||||
<div class="col-12 col-md-4">
|
<div class="col-12 col-md-4">
|
||||||
<div class="card text-white bg-success shadow h-100">
|
<div class="card text-white bg-success shadow h-100">
|
||||||
<div class="card-body text-center text-md-start">
|
<div class="card-body text-center text-md-start">
|
||||||
<h6>Completed</h6>
|
<h6>test Completed</h6>
|
||||||
<h3 class="fw-bold">265</h3>
|
<h3 class="fw-bold">35%</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
<div class="card text-dark bg-warning shadow h-100">
|
<div class="card text-dark bg-warning shadow h-100">
|
||||||
<div class="card-body text-center text-md-start">
|
<div class="card-body text-center text-md-start">
|
||||||
<h6>Pending</h6>
|
<h6>Pending</h6>
|
||||||
<h3 class="fw-bold">145</h3>
|
<h3 class="fw-bold">35%</h3>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user