added new changes
This commit is contained in:
2
.env
2
.env
@@ -3,7 +3,7 @@
|
|||||||
# -----------------------------
|
# -----------------------------
|
||||||
FLASK_ENV=development
|
FLASK_ENV=development
|
||||||
FLASK_DEBUG=True
|
FLASK_DEBUG=True
|
||||||
FLASK_HOST='0.0.0.0'
|
FLASK_HOST=0.0.0.0
|
||||||
FLASK_PORT=5001
|
FLASK_PORT=5001
|
||||||
|
|
||||||
# -----------------------------
|
# -----------------------------
|
||||||
|
|||||||
@@ -28,8 +28,8 @@ def bar_chart():
|
|||||||
plt.figure()
|
plt.figure()
|
||||||
plt.bar(categories, values)
|
plt.bar(categories, values)
|
||||||
plt.title("Work Category Report")
|
plt.title("Work Category Report")
|
||||||
plt.xlabel("Category")
|
plt.xlabel("test Category")
|
||||||
plt.ylabel("Count")
|
plt.ylabel("test Quantity")
|
||||||
|
|
||||||
|
|
||||||
return plot_to_base64(plt)
|
return plot_to_base64(plt)
|
||||||
|
|||||||
@@ -73,10 +73,6 @@ class SubcontractorBill:
|
|||||||
if not df.empty:
|
if not df.empty:
|
||||||
df.drop(columns=drop_cols, errors="ignore", inplace=True)
|
df.drop(columns=drop_cols, errors="ignore", inplace=True)
|
||||||
|
|
||||||
print(":::-- TR. EX --:::",self.df_tr,"\n")
|
|
||||||
print(":::--MH EX--:::",self.df_mh,"\n")
|
|
||||||
print(":::--MH DC--:::",self.df_dc,"\n")
|
|
||||||
print(":::--Laying--:::",self.df_laying,"\n")
|
|
||||||
|
|
||||||
# --- subcontractor report only ---
|
# --- subcontractor report only ---
|
||||||
@file_report_bp.route("/Subcontractor_report", methods=["GET", "POST"])
|
@file_report_bp.route("/Subcontractor_report", methods=["GET", "POST"])
|
||||||
@@ -96,7 +92,7 @@ def report_file():
|
|||||||
|
|
||||||
if not subcontractor_id:
|
if not subcontractor_id:
|
||||||
flash("Please select a subcontractor.", "danger")
|
flash("Please select a subcontractor.", "danger")
|
||||||
return render_template("report.html", subcontractors=subcontractors)
|
return render_template("subcontractor_report.html", subcontractors=subcontractors)
|
||||||
|
|
||||||
subcontractor = Subcontractor.query.get(subcontractor_id)
|
subcontractor = Subcontractor.query.get(subcontractor_id)
|
||||||
bill_gen = SubcontractorBill()
|
bill_gen = SubcontractorBill()
|
||||||
@@ -107,13 +103,13 @@ def report_file():
|
|||||||
else:
|
else:
|
||||||
if not ra_bill_no:
|
if not ra_bill_no:
|
||||||
flash("Please enter an RA Bill Number.", "danger")
|
flash("Please enter an RA Bill Number.", "danger")
|
||||||
return render_template("report.html", subcontractors=subcontractors)
|
return render_template("subcontractor_report.html", subcontractors=subcontractors)
|
||||||
bill_gen.Fetch(RA_Bill_No=ra_bill_no, subcontractor_id=subcontractor_id)
|
bill_gen.Fetch(RA_Bill_No=ra_bill_no, subcontractor_id=subcontractor_id)
|
||||||
file_name = f"{subcontractor.subcontractor_name}_RA_{ra_bill_no}_Report.xlsx"
|
file_name = f"{subcontractor.subcontractor_name}_RA_{ra_bill_no}_Report.xlsx"
|
||||||
|
|
||||||
if bill_gen.df_tr.empty and bill_gen.df_mh.empty and bill_gen.df_dc.empty:
|
if bill_gen.df_tr.empty and bill_gen.df_mh.empty and bill_gen.df_dc.empty:
|
||||||
flash("No data found for this selection.", "warning")
|
flash("No data found for this selection.", "warning")
|
||||||
return render_template("report.html", subcontractors=subcontractors)
|
return render_template("subcontractor_report.html", subcontractors=subcontractors)
|
||||||
|
|
||||||
# If download is clicked, return file immediately
|
# If download is clicked, return file immediately
|
||||||
if action == "download":
|
if action == "download":
|
||||||
|
|||||||
@@ -4,17 +4,6 @@
|
|||||||
<div class="container-fluid mt-4">
|
<div class="container-fluid mt-4">
|
||||||
<h2 class="mb-4">Client File Reports</h2>
|
<h2 class="mb-4">Client File Reports</h2>
|
||||||
|
|
||||||
{% with messages = get_flashed_messages(with_categories=true) %}
|
|
||||||
{% if messages %}
|
|
||||||
{% for category, message in messages %}
|
|
||||||
<div class="alert alert-{{ category }} alert-dismissible fade show" role="alert">
|
|
||||||
{{ message }}
|
|
||||||
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
|
||||||
</div>
|
|
||||||
{% endfor %}
|
|
||||||
{% endif %}
|
|
||||||
{% endwith %}
|
|
||||||
|
|
||||||
<div class="card p-4 shadow-sm mb-5">
|
<div class="card p-4 shadow-sm mb-5">
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
<label class="form-label fw-bold">RA Bill No</label>
|
<label class="form-label fw-bold">RA Bill No</label>
|
||||||
@@ -51,7 +40,8 @@
|
|||||||
Comparison</button>
|
Comparison</button>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<button class="nav-link" id="laying-tab" data-bs-toggle="tab" data-bs-target="#laying" type="button">Laying
|
<button class="nav-link" id="laying-tab" data-bs-toggle="tab" data-bs-target="#laying"
|
||||||
|
type="button">Laying
|
||||||
& Bedding Comparison</button>
|
& Bedding Comparison</button>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
@@ -80,5 +70,5 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
@@ -13,7 +13,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label">Contact Person</label>
|
<label class="form-label">Contact Person Name</label>
|
||||||
<input type="text" class="form-control" name="contact_person">
|
<input type="text" class="form-control" name="contact_person">
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -7,3 +7,5 @@ python-dotenv
|
|||||||
cryptography
|
cryptography
|
||||||
xlsxwriter
|
xlsxwriter
|
||||||
matplotlib
|
matplotlib
|
||||||
|
flask_sqlalchemy
|
||||||
|
flask_migrate
|
||||||
Reference in New Issue
Block a user