Files
payment_reconciliation_soft…/controllers/pmc_report_controller.py

37 lines
1.2 KiB
Python
Raw Normal View History

2026-04-04 14:18:58 +05:30
from flask import Blueprint, render_template, send_from_directory,send_file
2026-03-27 14:17:21 +05:30
from flask_login import login_required
2026-04-04 14:18:58 +05:30
from model.UnifiedReportService import UnifiedReportService
2026-03-27 14:17:21 +05:30
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):
2026-04-04 14:18:58 +05:30
data = UnifiedReportService.get_report(pmc_no=pmc_no)
2026-03-27 14:17:21 +05:30
if not data:
return "No PMC found with this number", 404
return render_template(
"pmc_report.html",
info=data["info"],
invoices=data["invoices"],
hold_types=data["hold_types"],
2026-04-06 10:46:47 +05:30
hold_data=data["hold_data"],
2026-03-27 14:17:21 +05:30
gst_rel=data["gst_rel"],
payments=data["payments"],
credit_note=data["credit_note"],
hold_release=data["hold_release"],
total=data["total"]
)
2026-04-04 14:18:58 +05:30
2026-04-06 10:46:47 +05:30
# ---------------- Contractor Download Report by pmc no ----------------
2026-03-27 14:17:21 +05:30
@pmc_report_bp.route("/download_pmc_report/<pmc_no>")
@login_required
def download_pmc_report(pmc_no):
2026-04-04 14:18:58 +05:30
output_file = UnifiedReportService.download(pmc_no=pmc_no)
2026-03-27 14:17:21 +05:30
2026-04-04 14:18:58 +05:30
if not output_file:
2026-03-27 14:17:21 +05:30
return "No contractor found for this PMC No", 404
2026-04-04 14:18:58 +05:30
return send_file(output_file, as_attachment=True)