comaparison code optimization and cal sum/total mh dc and laying

This commit is contained in:
2026-01-20 16:33:45 +05:30
parent 90c18383da
commit 68a694d2c7
15 changed files with 286 additions and 34 deletions

View File

@@ -0,0 +1,49 @@
from app.config import Config
from app import db
import matplotlib
matplotlib.use("Agg")
from app.routes.dashboard import plot_to_base64
import matplotlib.pyplot as plt
import io
import base64
from app.utils.plot_utils import plot_to_base64
# Subcontractor models import
from app.models.trench_excavation_model import TrenchExcavation
# Client models import
# from app.models.tr_ex_client_model import TrenchExcavationClient
class DashboardService:
# bar chart
def bar_chart_of_tr_ex():
categories = ["Soft Murum", "Hard Murum", "Soft Rock", "Hard Rock"]
values = [120, 80, 150, 60]
tr = TrenchExcavation()
record = TrenchExcavation.query.first()
print(" RA_Bill_No::",record["RA_Bill_No"])
totals = tr.excavation_category_sums()
# print(totals["Soft_Murum_Total"])
# print(totals["Hard_Rock_Total"])
plt.figure()
plt.bar(categories, values)
plt.title("Trench Excavation Work Category Report")
plt.xlabel("Excavation category")
plt.ylabel("Quantity")
return plot_to_base64(plt)
def subcontractor_dash():
return True