updated code by aakash

This commit is contained in:
2026-03-30 11:36:16 +05:30
parent 88e8771b51
commit 0b72adef7d
28 changed files with 505 additions and 700 deletions

View File

@@ -1,10 +1,9 @@
from flask import Blueprint, render_template, request, jsonify
from flask import Blueprint, render_template, request, jsonify,send_file
from flask_login import login_required, current_user
from model.Report import ReportHelper
from model.Log import LogHelper
report_bp = Blueprint("report", __name__)
@@ -46,8 +45,10 @@ def contractor_report(contractor_id):
# ---------------- Contractor Download Report by contractor id ----------------
@report_bp.route('/download_report/<int:contractor_id>')
@login_required
def download_report(contractor_id):
output_file, error = ReportHelper.create_contractor_report(contractor_id)
if error:
return error, 404
return ReportHelper().download_report(contractor_id=contractor_id)
return send_file(output_file, as_attachment=True)