testing code

This commit is contained in:
2026-04-04 14:18:58 +05:30
parent 0ec878d2ec
commit 7981ad0206
12 changed files with 930 additions and 595 deletions

View File

@@ -1,14 +1,15 @@
from flask import Blueprint, render_template, send_from_directory
from flask import Blueprint, render_template, send_from_directory,send_file
from flask_login import login_required
from model.PmcReport import PmcReport
# from model.PmcReport import PmcReport
from model.UnifiedReportService import UnifiedReportService
pmc_report_bp = Blueprint("pmc_report", __name__)
# ---------------- Contractor Report by pmc no ----------------
@pmc_report_bp.route("/pmc_report/<pmc_no>")
@login_required
def pmc_report(pmc_no):
data = PmcReport.get_pmc_report(pmc_no)
data = UnifiedReportService.get_report(pmc_no=pmc_no)
if not data:
return "No PMC found with this number", 404
@@ -17,24 +18,22 @@ def pmc_report(pmc_no):
info=data["info"],
invoices=data["invoices"],
hold_types=data["hold_types"],
hold_data=data["hold_data"], # <-- add this line
gst_rel=data["gst_rel"],
payments=data["payments"],
credit_note=data["credit_note"],
hold_release=data["hold_release"],
total=data["total"]
)
# ---------------- Contractor Download Report by pmc no ----------------
@pmc_report_bp.route("/download_pmc_report/<pmc_no>")
@login_required
def download_pmc_report(pmc_no):
result = PmcReport.download_pmc_report(pmc_no)
output_file = UnifiedReportService.download(pmc_no=pmc_no)
if not result:
if not output_file:
return "No contractor found for this PMC No", 404
output_folder, file_name = result
return send_from_directory(output_folder, file_name, as_attachment=True)
return send_file(output_file, as_attachment=True)