testing code
This commit is contained in:
@@ -188,7 +188,7 @@ def save_data():
|
||||
"SD_Amount": entry.get("SD_Amount", 0.00),
|
||||
"On_Commission": entry.get("On_Commission", 0.00),
|
||||
"Hydro_Testing": entry.get("Hydro_Testing", 0.00),
|
||||
"Hold_Amount": 0,
|
||||
"Hold_Amount": entry.get("Hold_Amount", 0.00), # change
|
||||
"GST_SD_Amount": entry.get("GST_SD_Amount", 0.00),
|
||||
"Final_Amount": entry.get("Final_Amount", 0.00),
|
||||
"Payment_Amount": entry.get("Payment_Amount", 0.00),
|
||||
@@ -300,7 +300,8 @@ def save_data():
|
||||
else:
|
||||
print("Hold columns data is not a valid list of dictionaries.")
|
||||
#---------------------------------------------Credit Note---------------------------------------------------------------------------
|
||||
elif any(keyword in Invoice_Details.lower() for keyword in ['credit note','logging report']):
|
||||
# elif any(keyword in Invoice_Details.lower() for keyword in ['credit note ','credit note details','logging report']):
|
||||
elif any(keyword in Invoice_Details.lower() for keyword in ['credit', 'logging report']):
|
||||
cursor.callproc(
|
||||
'AddCreditNoteFromExcel',
|
||||
[
|
||||
|
||||
@@ -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)
|
||||
@@ -4,7 +4,7 @@ from flask_login import login_required, current_user
|
||||
from model.Report import ReportHelper
|
||||
from model.Log import LogHelper
|
||||
import os
|
||||
|
||||
from model.UnifiedReportService import UnifiedReportService
|
||||
# DOWNLOAD_FOLDER = "static/download"
|
||||
report_bp = Blueprint("report", __name__)
|
||||
|
||||
@@ -33,11 +33,13 @@ def search_contractor():
|
||||
return jsonify(data)
|
||||
|
||||
# ---------------- Contractor Report by contractor id ----------------
|
||||
|
||||
@report_bp.route('/contractor_report/<int:contractor_id>')
|
||||
@login_required
|
||||
def contractor_report(contractor_id):
|
||||
|
||||
data = ReportHelper.get_contractor_report(contractor_id)
|
||||
# data = UnifiedReportService.get_report(contractor_id)
|
||||
data = UnifiedReportService.get_report(contractor_id=contractor_id)
|
||||
|
||||
return render_template(
|
||||
'subcontractor_report.html',
|
||||
@@ -49,11 +51,10 @@ def contractor_report(contractor_id):
|
||||
|
||||
@report_bp.route('/download_report/<int:contractor_id>')
|
||||
def download_report(contractor_id):
|
||||
output_file, error = ReportHelper.create_contractor_report(contractor_id)
|
||||
|
||||
if error:
|
||||
return error, 404
|
||||
|
||||
|
||||
# Send the file to the user
|
||||
return send_file(output_file, as_attachment=True)
|
||||
file_path = UnifiedReportService.download(contractor_id=contractor_id)
|
||||
|
||||
if not file_path:
|
||||
return "Report not found", 404
|
||||
|
||||
return send_file(file_path, as_attachment=True)
|
||||
Reference in New Issue
Block a user