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

@@ -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',
[

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)

View File

@@ -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
file_path = UnifiedReportService.download(contractor_id=contractor_id)
if not file_path:
return "Report not found", 404
# Send the file to the user
return send_file(output_file, as_attachment=True)
return send_file(file_path, as_attachment=True)

View File

@@ -9263,3 +9263,321 @@ Timestamp: 2026-04-01 19:23:10 | User: Unknown | Action: Search Contractor | Det
Timestamp: 2026-04-01 19:23:10 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-01 19:23:13 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-01 19:23:16 | User: Unknown | Action: Download PMC Report | Details:
Timestamp: 2026-04-02 10:33:02 | User: Unknown | Action: Login | Details:
Timestamp: 2026-04-02 10:33:05 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 10:33:06 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 10:33:08 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 10:55:31 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 10:55:32 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 10:55:33 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:06:51 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:06:52 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:06:52 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:06:53 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:06:54 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:06:54 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:07:32 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:07:32 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:07:33 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:07:33 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:07:35 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:19:31 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:19:31 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:19:33 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:23:34 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:23:34 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:23:36 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:28:47 | User: Unknown | Action: Login | Details:
Timestamp: 2026-04-02 11:28:52 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:28:52 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:28:52 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:28:54 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:28:57 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:29:45 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:29:46 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:29:47 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:29:47 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:29:47 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:29:49 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:30:06 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:30:06 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:30:07 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:30:07 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:30:10 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:30:10 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:30:11 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:30:11 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:30:11 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 11:30:24 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:03:05 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:03:05 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:03:05 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:03:06 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:03:06 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:03:12 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:03:13 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:05:48 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:05:48 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:05:50 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:06:03 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:06:04 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:06:04 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:06:05 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:06:06 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:06:07 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:06:35 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:06:35 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:06:36 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:06:36 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 12:06:38 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 13:15:22 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 13:15:29 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 14:52:17 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-02 14:53:17 | User: Unknown | Action: Login | Details:
Timestamp: 2026-04-02 14:53:25 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-02 14:54:01 | User: Unknown | Action: Login | Details:
Timestamp: 2026-04-02 14:54:17 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 14:54:21 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:01:17 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 15:01:17 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 15:01:18 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 15:02:19 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-02 15:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:23 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:02:31 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 15:02:31 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 15:02:33 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 15:03:31 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-02 15:06:09 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-02 15:06:12 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:12 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:12 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:12 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:12 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:12 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:12 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:12 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:12 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:13 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-02 15:06:20 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 15:06:21 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 15:06:23 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 18:12:06 | User: Unknown | Action: Login | Details:
Timestamp: 2026-04-02 18:30:50 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 18:30:50 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 18:30:50 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 18:30:52 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 18:30:53 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 18:41:05 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 18:41:06 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-02 18:41:07 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 10:00:04 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 10:00:05 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 10:00:05 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 10:00:07 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 17:42:58 | User: Unknown | Action: Login | Details:
Timestamp: 2026-04-03 17:43:03 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 17:43:03 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 17:43:04 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 18:01:33 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 18:01:33 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 18:01:35 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 18:01:35 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 18:01:35 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 18:01:49 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-03 18:01:49 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-03 18:02:07 | User: Unknown | Action: Add Hold Type | Details:
Timestamp: 2026-04-03 18:02:19 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:22 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:02:36 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 18:02:36 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 18:02:37 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 18:09:48 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 18:09:51 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-03 18:09:59 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-03 18:10:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:06:38 | User: Unknown | Action: Login | Details:
Timestamp: 2026-04-04 12:06:45 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-04 12:06:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:06:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:06:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:06:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:06:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:06:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:06:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:06:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:06:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:06:58 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 12:07:01 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 12:20:57 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-04 12:21:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:21:02 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:21:03 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:21:03 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:21:03 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:21:03 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:21:03 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:21:03 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:21:03 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:21:12 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 12:21:12 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 12:21:13 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 12:24:38 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 12:24:47 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-04 12:24:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:24:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:24:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:24:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:24:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:24:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:24:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:24:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:24:49 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 12:24:57 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 12:24:57 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 12:25:00 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 14:07:44 | User: Unknown | Action: Login | Details:
Timestamp: 2026-04-04 14:07:53 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 14:07:55 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 14:09:31 | User: Unknown | Action: Upload Excel File | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:35 | User: Unknown | Action: Data saved | Details:
Timestamp: 2026-04-04 14:09:42 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 14:09:42 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 14:09:44 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 14:14:02 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 14:14:02 | User: Unknown | Action: Search Contractor | Details:
Timestamp: 2026-04-04 14:14:04 | User: Unknown | Action: Search Contractor | Details:

View File

@@ -1,185 +1,185 @@
import openpyxl
from openpyxl.styles import Font, PatternFill
import config
from flask_login import current_user
from model.Log import LogHelper
from model.excel import excel
from model.Report import ReportHelper
from model.FolderAndFile import FolderAndFile
# import openpyxl
# from openpyxl.styles import Font, PatternFill
# import config
# from flask_login import current_user
# from model.Log import LogHelper
# from model.excel import excel
# from model.Report import ReportHelper
# from model.FolderAndFile import FolderAndFile
class PmcReport:
# class PmcReport:
@staticmethod
def get_pmc_report(pmc_no):
# @staticmethod
# def get_pmc_report(pmc_no):
connection = config.get_db_connection()
cursor = connection.cursor(dictionary=True, buffered=True)
# connection = config.get_db_connection()
# cursor = connection.cursor(dictionary=True, buffered=True)
try:
pmc_info = ReportHelper.execute_sp(cursor, 'GetContractorInfoByPmcNo', [pmc_no], True)
# try:
# pmc_info = ReportHelper.execute_sp(cursor, 'GetContractorInfoByPmcNo', [pmc_no], True)
if not pmc_info:
return None
# if not pmc_info:
# return None
cursor.callproc("Get_pmc_hold_types", (pmc_no, pmc_info["Contractor_Id"]))
hold_types = next(cursor.stored_results()).fetchall()
# cursor.callproc("Get_pmc_hold_types", (pmc_no, pmc_info["Contractor_Id"]))
# hold_types = next(cursor.stored_results()).fetchall()
# Extract hold_type_ids
hold_type_ids = [ht['hold_type_id'] for ht in hold_types]
# # Extract hold_type_ids
# hold_type_ids = [ht['hold_type_id'] for ht in hold_types]
invoices = []
hold_amount_total = 0
hold_type_ids_str = ",".join(map(str, hold_type_ids))
cursor.callproc(
'GetInvoices_WithHold',
[pmc_no, pmc_info["Contractor_Id"], hold_type_ids_str]
)
# invoices = []
# hold_amount_total = 0
# hold_type_ids_str = ",".join(map(str, hold_type_ids))
# cursor.callproc(
# 'GetInvoices_WithHold',
# [pmc_no, pmc_info["Contractor_Id"], hold_type_ids_str]
# )
for result in cursor.stored_results():
invoices = result.fetchall()
# for result in cursor.stored_results():
# invoices = result.fetchall()
if hold_type_ids:
hold_amount_total = sum(row.get('hold_amount', 0) or 0 for row in invoices)
# if hold_type_ids:
# hold_amount_total = sum(row.get('hold_amount', 0) or 0 for row in invoices)
total_invo_final = sum(row.get('Final_Amount', 0) or 0 for row in invoices)
# total_invo_final = sum(row.get('Final_Amount', 0) or 0 for row in invoices)
gst_rel = ReportHelper.execute_sp(cursor, 'GetGSTReleaseByPMC', [pmc_no])
total_gst_basic = sum(row.get('basic_amount', 0) or 0 for row in gst_rel)
total_gst_final = sum(row.get('final_amount', 0) or 0 for row in gst_rel)
# gst_rel = ReportHelper.execute_sp(cursor, 'GetGSTReleaseByPMC', [pmc_no])
# total_gst_basic = sum(row.get('basic_amount', 0) or 0 for row in gst_rel)
# total_gst_final = sum(row.get('final_amount', 0) or 0 for row in gst_rel)
hold_release = ReportHelper.execute_sp(cursor, 'GetHoldReleaseByPMC', [pmc_no])
# hold_release = ReportHelper.execute_sp(cursor, 'GetHoldReleaseByPMC', [pmc_no])
credit_note = ReportHelper.execute_sp(cursor, 'GetCreditNoteByPMC', [pmc_no])
# credit_note = ReportHelper.execute_sp(cursor, 'GetCreditNoteByPMC', [pmc_no])
payments = ReportHelper.execute_sp(cursor, 'GetPaymentsByPMC', [pmc_no])
total_pay_amount = sum(row.get('Payment_Amount', 0) or 0 for row in payments)
total_pay_total = sum(row.get('Total_amount', 0) or 0 for row in payments)
# payments = ReportHelper.execute_sp(cursor, 'GetPaymentsByPMC', [pmc_no])
# total_pay_amount = sum(row.get('Payment_Amount', 0) or 0 for row in payments)
# total_pay_total = sum(row.get('Total_amount', 0) or 0 for row in payments)
totals = {
"sum_invo_basic_amt": sum(row.get('Basic_Amount', 0) or 0 for row in invoices),
"sum_invo_debit_amt": sum(row.get('Debit_Amount', 0) or 0 for row in invoices),
"sum_invo_after_debit_amt": sum(row.get('After_Debit_Amount', 0) or 0 for row in invoices),
"sum_invo_amt": sum(row.get('Amount', 0) or 0 for row in invoices),
"sum_invo_gst_amt": sum(row.get('GST_Amount', 0) or 0 for row in invoices),
"sum_invo_tds_amt": sum(row.get('TDS_Amount', 0) or 0 for row in invoices),
"sum_invo_ds_amt": sum(row.get('SD_Amount', 0) or 0 for row in invoices),
"sum_invo_on_commission": sum(row.get('On_Commission', 0) or 0 for row in invoices),
"sum_invo_hydro_test": sum(row.get('Hydro_Testing', 0) or 0 for row in invoices),
"sum_invo_gst_sd_amt": sum(row.get('GST_SD_Amount', 0) or 0 for row in invoices),
"sum_invo_final_amt": total_invo_final,
"sum_invo_hold_amt": hold_amount_total,
"sum_gst_basic_amt": total_gst_basic,
"sum_gst_final_amt": total_gst_final,
"sum_pay_payment_amt": total_pay_amount,
"sum_pay_tds_payment_amt": sum(row.get('TDS_Payment_Amount', 0) or 0 for row in payments),
"sum_pay_total_amt": total_pay_total
}
# totals = {
# "sum_invo_basic_amt": sum(row.get('Basic_Amount', 0) or 0 for row in invoices),
# "sum_invo_debit_amt": sum(row.get('Debit_Amount', 0) or 0 for row in invoices),
# "sum_invo_after_debit_amt": sum(row.get('After_Debit_Amount', 0) or 0 for row in invoices),
# "sum_invo_amt": sum(row.get('Amount', 0) or 0 for row in invoices),
# "sum_invo_gst_amt": sum(row.get('GST_Amount', 0) or 0 for row in invoices),
# "sum_invo_tds_amt": sum(row.get('TDS_Amount', 0) or 0 for row in invoices),
# "sum_invo_ds_amt": sum(row.get('SD_Amount', 0) or 0 for row in invoices),
# "sum_invo_on_commission": sum(row.get('On_Commission', 0) or 0 for row in invoices),
# "sum_invo_hydro_test": sum(row.get('Hydro_Testing', 0) or 0 for row in invoices),
# "sum_invo_gst_sd_amt": sum(row.get('GST_SD_Amount', 0) or 0 for row in invoices),
# "sum_invo_final_amt": total_invo_final,
# "sum_invo_hold_amt": hold_amount_total,
# "sum_gst_basic_amt": total_gst_basic,
# "sum_gst_final_amt": total_gst_final,
# "sum_pay_payment_amt": total_pay_amount,
# "sum_pay_tds_payment_amt": sum(row.get('TDS_Payment_Amount', 0) or 0 for row in payments),
# "sum_pay_total_amt": total_pay_total
# }
return {
"info": pmc_info,
"invoices": invoices,
"hold_types": hold_types,
"gst_rel": gst_rel,
"payments": payments,
"credit_note": credit_note,
"hold_release": hold_release,
"total": totals
}
# return {
# "info": pmc_info,
# "invoices": invoices,
# "hold_types": hold_types,
# "gst_rel": gst_rel,
# "payments": payments,
# "credit_note": credit_note,
# "hold_release": hold_release,
# "total": totals
# }
finally:
cursor.close()
connection.close()
# finally:
# cursor.close()
# connection.close()
@staticmethod
def download_pmc_report(pmc_no):
# @staticmethod
# def download_pmc_report(pmc_no):
connection = config.get_db_connection()
if not connection:
return None
# connection = config.get_db_connection()
# if not connection:
# return None
cursor = connection.cursor(dictionary=True)
# cursor = connection.cursor(dictionary=True)
try:
filename = f"PMC_Report_{pmc_no}.xlsx"
# try:
# filename = f"PMC_Report_{pmc_no}.xlsx"
output_folder = FolderAndFile.get_download_folder()
output_file = FolderAndFile.get_download_path(filename)
# output_folder = FolderAndFile.get_download_folder()
# output_file = FolderAndFile.get_download_path(filename)
# ================= DATA FETCH =================
# # ================= DATA FETCH =================
contractor_info = ReportHelper.execute_sp(
cursor, 'GetContractorInfoByPmcNo', [pmc_no]
)
# contractor_info = ReportHelper.execute_sp(
# cursor, 'GetContractorInfoByPmcNo', [pmc_no]
# )
contractor_info = contractor_info[0] if contractor_info else None
print("contractor_info:::",contractor_info)
# contractor_info = contractor_info[0] if contractor_info else None
# print("contractor_info:::",contractor_info)
if not contractor_info:
return None
# if not contractor_info:
# return None
hold_types = ReportHelper.execute_sp(
cursor, 'GetHoldTypesByContractor',
[contractor_info["Contractor_Id"]]
)
# hold_types = ReportHelper.execute_sp(
# cursor, 'GetHoldTypesByContractor',
# [contractor_info["Contractor_Id"]]
# )
hold_type_map = {
ht['hold_type_id']: ht['hold_type'] for ht in hold_types
}
# hold_type_map = {
# ht['hold_type_id']: ht['hold_type'] for ht in hold_types
# }
invoices = ReportHelper.execute_sp(
cursor, 'GetInvoicesByContractorOrPMCNo', [None,pmc_no]
)
# invoices = ReportHelper.execute_sp(
# cursor, 'GetInvoicesByContractorOrPMCNo', [None,pmc_no]
# )
credit_notes = ReportHelper.execute_sp(
cursor, 'NewGetCreditNotesByPMCNo', [pmc_no]
)
credit_note_map = {}
for cn in credit_notes:
key = (
str(cn['PMC_No']).strip()
)
credit_note_map.setdefault(key, []).append(cn)
# credit_notes = ReportHelper.execute_sp(
# cursor, 'NewGetCreditNotesByPMCNo', [pmc_no]
# )
# credit_note_map = {}
# for cn in credit_notes:
# key = (
# str(cn['PMC_No']).strip()
# )
# credit_note_map.setdefault(key, []).append(cn)
hold_amounts = ReportHelper.execute_sp(
cursor, 'GetHoldAmountsByContractor',
[contractor_info["Contractor_Id"]]
)
# hold_amounts = ReportHelper.execute_sp(
# cursor, 'GetHoldAmountsByContractor',
# [contractor_info["Contractor_Id"]]
# )
gst_releases = ReportHelper.execute_sp(
cursor, 'GetGSTReleaseDetailsByPMC', [pmc_no]
)
gst_release_map = {}
for gr in gst_releases:
# gst_releases = ReportHelper.execute_sp(
# cursor, 'GetGSTReleaseDetailsByPMC', [pmc_no]
# )
# gst_release_map = {}
# for gr in gst_releases:
key = (
str(gr['PMC_No']).strip()
)
gst_release_map.setdefault(key, []).append(gr)
# key = (
# str(gr['PMC_No']).strip()
# )
# gst_release_map.setdefault(key, []).append(gr)
# ================= DATA MAPPING =================
hold_data = {}
for h in hold_amounts:
hold_data.setdefault(h['Invoice_Id'], {})[h['hold_type_id']] = h['hold_amount']
# # ================= DATA MAPPING =================
# hold_data = {}
# for h in hold_amounts:
# hold_data.setdefault(h['Invoice_Id'], {})[h['hold_type_id']] = h['hold_amount']
# ================= LOG =================
LogHelper.log_action(
"Download PMC Report",
f"User {current_user.id} Download PMC Report '{pmc_no}'"
)
# # ================= LOG =================
# LogHelper.log_action(
# "Download PMC Report",
# f"User {current_user.id} Download PMC Report '{pmc_no}'"
# )
excel.generate_excel(
0, contractor_info, invoices, hold_types, hold_data,
credit_note_map,gst_release_map, output_file
)
# excel.generate_excel(
# 0, contractor_info, invoices, hold_types, hold_data,
# credit_note_map,gst_release_map, output_file
# )
return output_folder, filename
# return output_folder, filename
except Exception as e:
print(f"Error generating PMC report: {e}")
return None
# except Exception as e:
# print(f"Error generating PMC report: {e}")
# return None
finally:
cursor.close()
connection.close()
# finally:
# cursor.close()
# connection.close()

View File

@@ -86,67 +86,7 @@ class ReportHelper:
return data
@staticmethod
def get_contractor_report(contractor_id):
connection = config.get_db_connection()
cursor = connection.cursor(dictionary=True, buffered=True)
try:
# Contractor Info (only one fetch)
contInfo = ReportHelper.execute_sp(cursor, 'GetContractorInfo', [contractor_id], True)
# Hold Types
hold_types = ReportHelper.execute_sp(cursor, 'GetContractorHoldTypes', [contractor_id])
# Invoices
invoices = ReportHelper.execute_sp(cursor, 'GetContractorInvoices', [contractor_id])
# GST Release
gst_rel = ReportHelper.execute_sp(cursor, 'GetGSTRelease', [contractor_id])
# Hold Release
hold_release = ReportHelper.execute_sp(cursor, 'GetHoldRelease', [contractor_id])
# Credit Note
credit_note = ReportHelper.execute_sp(cursor, 'GetCreditNotesByContractor', [contractor_id])
# Payments
payments = ReportHelper.execute_sp(cursor, 'GetPayments', [contractor_id])
# Totals
total = {
"sum_invo_basic_amt": float(sum(row['Basic_Amount'] or 0 for row in invoices)),
"sum_invo_debit_amt": float(sum(row['Debit_Amount'] or 0 for row in invoices)),
"sum_invo_after_debit_amt": float(sum(row['After_Debit_Amount'] or 0 for row in invoices)),
"sum_invo_amt": float(sum(row['Amount'] or 0 for row in invoices)),
"sum_invo_gst_amt": float(sum(row['GST_Amount'] or 0 for row in invoices)),
"sum_invo_tds_amt": float(sum(row['TDS_Amount'] or 0 for row in invoices)),
"sum_invo_ds_amt": float(sum(row['SD_Amount'] or 0 for row in invoices)),
"sum_invo_on_commission": float(sum(row['On_Commission'] or 0 for row in invoices)),
"sum_invo_hydro_test": float(sum(row['Hydro_Testing'] or 0 for row in invoices)),
"sum_invo_gst_sd_amt": float(sum(row['GST_SD_Amount'] or 0 for row in invoices)),
"sum_invo_final_amt": float(sum(row['Final_Amount'] or 0 for row in invoices)),
"sum_invo_hold_amt": float(sum(row['hold_amount'] or 0 for row in invoices)),
"sum_gst_basic_amt": float(sum(row['basic_amount'] or 0 for row in gst_rel)),
"sum_gst_final_amt": float(sum(row['final_amount'] or 0 for row in gst_rel)),
"sum_pay_payment_amt": float(sum(row['Payment_Amount'] or 0 for row in payments)),
"sum_pay_tds_payment_amt": float(sum(row['TDS_Payment_Amount'] or 0 for row in payments)),
"sum_pay_total_amt": float(sum(row['Total_amount'] or 0 for row in payments))
}
current_date = datetime.now().strftime('%Y-%m-%d')
finally:
cursor.close()
connection.close()
return {
"contInfo": contInfo,
"invoices": invoices,
"hold_types": hold_types,
"gst_rel": gst_rel,
"payments": payments,
"credit_note": credit_note,
"hold_release": hold_release,
"total": total,
"current_date": current_date
}
@staticmethod
def get_contractor_info(contractor_id):
from model.ContractorInfo import ContractorInfo
@@ -154,53 +94,4 @@ class ReportHelper:
return contractor.contInfo if contractor.contInfo else None
@staticmethod
def create_contractor_report(contractor_id):
fileName=f"Contractor_Report_{contractor_id}.xlsx"
output_file = FolderAndFile.get_download_path(filename=fileName)
# Fetch Data
contInfo = ReportHelper.get_contractor_info(contractor_id)
if not contInfo:
return None, "No contractor found"
connection = config.get_db_connection()
cursor = connection.cursor(dictionary=True, buffered=True)
hold_types = ReportHelper.execute_sp(cursor, 'HoldTypesByContractorId', [contractor_id])
invoices = ReportHelper.execute_sp(cursor, 'GetInvoicesByContractorOrPMCNo', [contractor_id,None])
hold_amounts = ReportHelper.execute_sp(cursor, 'HoldAmountsByContractorId', [contractor_id])
hold_data = {}
for h in hold_amounts:
hold_data.setdefault(h['Invoice_Id'], {})[h['hold_type_id']] = h['hold_amount']
# -------- Credit Note MAP --------
credit_note_raw = ReportHelper.execute_sp(cursor, 'GetCreditNotesByContractor', [contractor_id])
credit_note_map = {}
for cn in credit_note_raw:
key = (
str(cn['PMC_No']).strip()
)
credit_note_map.setdefault(key, []).append(cn)
# -------- GST MAP --------
gst_release_raw = ReportHelper.execute_sp(cursor, 'GstReleasesByContractorId', [contractor_id])
gst_release_map = {}
for gr in gst_release_raw:
key = (
str(gr['PMC_No']).strip()
)
gst_release_map.setdefault(key, []).append(gr)
excel.generate_excel(
contractor_id, contInfo, invoices, hold_types, hold_data,
credit_note_map, gst_release_map, output_file
)
return output_file, None

View File

@@ -0,0 +1,159 @@
import config
from model.excel import excel
from model.Report import ReportHelper
from model.FolderAndFile import FolderAndFile
from decimal import Decimal
class UnifiedReportService:
# Static variable to cache report data
_cached_report_data = None
_cached_contractor_id = None
_cached_pmc_no = None
@staticmethod
def get_report(contractor_id=None, pmc_no=None):
# If cached and same request, return cached data
if (UnifiedReportService._cached_report_data and
contractor_id == UnifiedReportService._cached_contractor_id and
pmc_no == UnifiedReportService._cached_pmc_no):
return UnifiedReportService._cached_report_data
connection = config.get_db_connection()
cursor = connection.cursor(dictionary=True, buffered=True)
try:
# ================= BASIC INFO =================
if contractor_id:
info = ReportHelper.execute_sp(cursor,'GetContractorInfo',[contractor_id],True)
else:
info = ReportHelper.execute_sp(cursor,'GetContractorInfoByPmcNo',[pmc_no],True)
contractor_id = info["Contractor_Id"] if info else None
if not info:
return None
# ================= HOLD TYPES =================
hold_types = ReportHelper.execute_sp(cursor,'GetHoldTypesByContractor',[contractor_id]) or []
# ================= INVOICES =================
if pmc_no:
invoices = ReportHelper.execute_sp(cursor,'GetInvoicesByContractorOrPMCNo',[None, pmc_no]) or []
credit_notes = ReportHelper.execute_sp(cursor,'NewGetCreditNotesByPMCNo',[pmc_no]) or []
gst_rel = ReportHelper.execute_sp(cursor,'GetGSTReleaseDetailsByPMC',[pmc_no]) or []
payments = ReportHelper.execute_sp(cursor,'GetPaymentsByPMC',[pmc_no]) or []
else:
invoices = ReportHelper.execute_sp(cursor,'GetInvoicesByContractorOrPMCNo',[contractor_id, None]) or []
credit_notes = ReportHelper.execute_sp(cursor,'GetCreditNotesByContractor',[contractor_id]) or []
gst_rel = ReportHelper.execute_sp(cursor,'GstReleasesByContractorId',[contractor_id]) or []
payments = ReportHelper.execute_sp(cursor,'GetPayments',[contractor_id]) or []
# ================= HOLD AMOUNTS =================
hold_amounts = ReportHelper.execute_sp(cursor,'GetHoldAmountsByContractor',[contractor_id]) or []
hold_data = {}
for h in hold_amounts:
hold_data.setdefault(h["Invoice_Id"], {})[h["hold_type_id"]] = h["hold_amount"]
# ================= CREDIT NOTES =================
credit_note_map = {}
for cn in credit_notes:
key = str(cn.get("PMC_No")).strip()
credit_note_map.setdefault(key, []).append(cn)
# ================= GST RELEASE =================
gst_release_map = {}
for gr in gst_rel:
key = str(gr.get("PMC_No")).strip()
gst_release_map.setdefault(key, []).append(gr)
# ================= PAYMENTS =================
total = {
"sum_invo_basic_amt": sum(row.get('Basic_Amount', 0) or 0 for row in invoices),
"sum_invo_debit_amt": sum(row.get('Debit_Amount', 0) or 0 for row in invoices),
"sum_invo_after_debit_amt": sum(row.get('After_Debit_Amount', 0) or 0 for row in invoices),
"sum_invo_amt": sum(row.get('Amount', 0) or 0 for row in invoices),
"sum_invo_gst_amt": sum(row.get('GST_Amount', 0) or 0 for row in invoices),
"sum_invo_tds_amt": sum(row.get('TDS_Amount', 0) or 0 for row in invoices),
"sum_invo_ds_amt": sum(row.get('SD_Amount', 0) or 0 for row in invoices),
"sum_invo_on_commission": sum(row.get('On_Commission', 0) or 0 for row in invoices),
"sum_invo_hydro_test": sum(row.get('Hydro_Testing', 0) or 0 for row in invoices),
"sum_invo_gst_sd_amt": sum(row.get('GST_SD_Amount', 0) or 0 for row in invoices),
"sum_invo_final_amt": sum(r.get("Final_Amount", 0) or 0 for r in invoices),
"sum_invo_hold_amt": sum(r.get("hold_amount", 0) or 0 for r in hold_amounts),
"sum_gst_basic_amt": sum(r.get("Basic_Amount", 0) or 0 for r in gst_rel),
"sum_gst_final_amt": sum(r.get("Final_Amount", 0) or 0 for r in gst_rel),
"sum_gst_total_amt": sum(r.get("Total_Amount", 0) or 0 for r in gst_rel),
"sum_pay_total_amt": sum(Decimal(r.get("Total_amount") or 0) for r in payments),
"sum_pay_payment_amt": sum(Decimal(r.get("Total_amount") or 0) for r in payments), # same as above if you want
"sum_pay_tds_payment_amt": sum(Decimal(r.get("TDS_Payment_Amount") or 0) for r in payments),
}
# Prepare final report
report_data = {
"info": info,
"invoices": invoices,
"hold_types": hold_types,
"payments": payments,
"hold_data": hold_data,
"hold_release": hold_data,
"credit_note_map": credit_note_map,
"credit_note": credit_notes,
"gst_release_map": gst_release_map,
"gst_rel": gst_rel,
"total": total
}
# Cache the report
UnifiedReportService._cached_report_data = report_data
UnifiedReportService._cached_contractor_id = contractor_id
UnifiedReportService._cached_pmc_no = pmc_no
return report_data
finally:
cursor.close()
connection.close()
# ================= DOWNLOAD EXCEL =================
@staticmethod
def download(contractor_id=None, pmc_no=None):
# Use cached report if available
report_data = UnifiedReportService.get_report(contractor_id, pmc_no)
if not report_data:
return None
fileName = (
f"Contractor_Report_{contractor_id}.xlsx"
if contractor_id else f"PMC_Report_{pmc_no}.xlsx"
)
output_file = FolderAndFile.get_download_path(fileName)
excel.generate_excel(
contractor_id or 0,
report_data["info"],
report_data["invoices"],
report_data["hold_types"],
report_data["hold_data"],
report_data["credit_note_map"],
report_data["gst_release_map"],
report_data["payments"],
output_file
)
return output_file

View File

@@ -10,16 +10,26 @@ from model.FolderAndFile import FolderAndFile
class excel:
@staticmethod
def generate_excel(contractor_id, contInfo, invoices, hold_types, hold_data,
credit_note_map, gst_release_map, output_file):
# def generate_excel(contractor_id, contInfo, invoices, hold_types, hold_data,
# credit_note_map, gst_release_map, output_file):
def generate_excel(
contractor_id,
info,
invoices,
hold_types,
hold_data,
credit_note_map,
gst_release_map,
payments,
output_file
):
workbook = openpyxl.Workbook()
sheet = workbook.active
sheet.title = "Contractor Report"
# Contractor Info
for field, value in contInfo.items():
for field, value in info.items():
sheet.append([field.replace("_", " "), value])
sheet.append([])

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -34,7 +34,7 @@
<a href="/logout">Logout</a>
</div>
<div class="sidebar">
<img src="https://lceplpmprod.btltech.xyz/assets/images/lcpl.png" alt="logo-image" class="logo">
<img src="http://lceplpmprod.btltech.xyz/assets/images/lcpl.png" alt="logo-image" class="logo">
<ul class="nav-menu">
<li class="nav-item">
@@ -70,7 +70,7 @@
</ul>
<div class="user-section">
<img src="{{ url_for('static', filename='images/icons/male_profile.jpg') }}" alt="User Avatar">
<img src="{{ url_for('static', filename='images/icons/male_profile.jpeg') }}" alt="User Avatar">
<div class="user-info">
<span>admin</span>
</div>

View File

@@ -83,8 +83,8 @@
</div>
<h3>Invoice Details</h3>
<table>
<h3>Invoice Details</h3>
<table border="1" cellpadding="5" cellspacing="0">
<thead>
<tr>
<th>PMC No</th>
@@ -104,9 +104,8 @@
<th>Hydro Testing</th>
<!-- Dynamic Hold Types -->
{% set hold_types = invoices | map(attribute='hold_type') | reject('none') | unique | list %}
{% for hold in hold_types %}
<th>{{ hold }}</th>
{% for ht in hold_types %}
<th>{{ ht.hold_type }}</th>
{% endfor %}
<th>GST SD (18%)</th>
@@ -118,11 +117,11 @@
{% for invoice in invoices %}
<tr>
<td>{{ invoice.PMC_No }}</td>
<td>{{ invoice.Village_Name.capitalize() if invoice.Village_Name else '' }}</td>
<td>{{ invoice.Village_Name }}</td>
<td>{{ invoice.Work_Type }}</td>
<td>{{ invoice.Invoice_Details }}</td>
<td>{{ invoice.Invoice_Date }}</td>
<td>{{ invoice.Invoice_No }}</td>
<td>{{ invoice.invoice_no }}</td>
<td>{{ invoice.Basic_Amount }}</td>
<td>{{ invoice.Debit_Amount }}</td>
<td>{{ invoice.After_Debit_Amount }}</td>
@@ -133,114 +132,94 @@
<td>{{ invoice.On_Commission }}</td>
<td>{{ invoice.Hydro_Testing }}</td>
<!-- Dynamic Hold Amounts -->
{% for hold in hold_types %}
<td>
{% if invoice.hold_type == hold %}
{{ invoice.hold_amount }}
{% else %}
0
{% endif %}
</td>
<!-- Hold Amounts -->
{% for ht in hold_types %}
<td>{{ hold_data.get(invoice.Invoice_Id, {}).get(ht.hold_type_id, 0) }}</td>
{% endfor %}
<td>{{ invoice.GST_SD_Amount }}</td>
<td>{{ invoice.Final_Amount }}</td>
</tr>
{% endfor %}
<!-- Total Row -->
<tr>
<th colspan="6">Total</th>
<th>{{total["sum_invo_basic_amt"]}}</th>
<th>{{total["sum_invo_debit_amt"]}}</th>
<th>{{total["sum_invo_after_debit_amt"]}}</th>
<th>{{total["sum_invo_gst_amt"]}}</th>
<th>{{total["sum_invo_amt"]}}</th>
<th>{{total["sum_invo_tds_amt"]}}</th>
<th>{{total["sum_invo_ds_amt"]}}</th>
<th>{{total["sum_invo_on_commission"]}}</th>
<th>{{total["sum_invo_hydro_test"]}}</th>
{% set hold_types = invoices | map(attribute='hold_type') | unique | list %}
{% for hold in hold_types %}
<th>{{total["sum_invo_hold_amt"]}}</th>
{% endfor %}
<th>{{total["sum_invo_gst_sd_amt"]}}</th>
<th>{{total["sum_invo_final_amt"]}}</th>
</tr>
<th>{{ total.sum_invo_basic_amt }}</th>
<th>{{ total.get('sum_invo_debit_amt', 0) }}</th>
<th>{{ total.get('sum_invo_after_debit_amt', 0) }}</th>
<th>{{ total.get('sum_invo_gst_amt', 0) }}</th>
<th>{{ total.get('sum_invo_amt', 0) }}</th>
<th>{{ total.get('sum_invo_tds_amt', 0) }}</th>
<th>{{ total.get('sum_invo_ds_amt', 0) }}</th>
<th>{{ total.get('sum_invo_on_commission', 0) }}</th>
<th>{{ total.get('sum_invo_hydro_test', 0) }}</th>
{% for ht in hold_types %}
<th>{{ total.sum_invo_hold_amt }}</th>
{% endfor %}
<th>{{ total.get('sum_invo_gst_sd_amt', 0) }}</th>
<th>{{ total.sum_invo_final_amt }}</th>
</tr>
{% else %}
<tr>
<td colspan="{{ 17 + hold_types|length }}">No invoices found.</td>
</tr>
{% endif %}
</tbody>
</table>
<h3>Hold Release</h3>
<table>
<thead>
<tr>
<th>PMC No</th>
<th>Invoice No</th>
<th>Invoice Details</th>
<th>Basic Amount</th>
<th>Total Amount</th>
<th>UTR</th>
</tr>
</thead>
<tbody>
{%if hold_release%}
{%for hold in hold_release%}
<tr>
<td>{{ hold['PMC_No'] }}</td>
<td>{{ hold['Invoice_No'] }}</td>
<td>{{ hold['Invoice_Details'] }}</td>
<td>{{ hold['Basic_Amount'] }}</td>
<td>{{ hold['Total_Amount'] }}</td>
<td>{{ hold['UTR'] }}</td>
</tr>
{%endfor%}
{%else%}
<tr>
<td colspan="6" style="text-align:center;">No data present</td>
</tr>
{%endif%}
</tbody>
</table>
</table>
<br>
<h3>GST Release Note Details</h3>
<table>
<h3>GST Release Note Details</h3>
<table>
<thead>
<tr>
<th>PMC No</th>
<th>Invoice No</th>
<th>Basic Amount</th>
<th>Final Amount</th>
<th>UTR</th>
</tr>
</thead>
<tbody>
{% if gst_rel %}
{% for gst in gst_rel %}
<tr>
<td>{{ gst.pmc_no }}</td>
<td>{{ gst.PMC_No }}</td>
<td>{{ gst.invoice_no }}</td>
<td>{{ gst.basic_amount }}</td>
<td>{{ gst.final_amount }}</td>
<td>{{ gst.Basic_Amount }}</td>
<td>{{ gst.Final_Amount }}</td>
<td>{{gst.UTR}}</td></TD>
</tr>
{% endfor %}
<tr>
<th colspan="2">Total</th>
<th>{{total["sum_gst_basic_amt"]}}</th>
<th>{{total["sum_gst_final_amt"]}}</th>
<th>{{ total["sum_gst_basic_amt"] }}</th>
<th>{{ total["sum_gst_final_amt"] }}</th>
<th></th>
</tr>
{% else %}
<tr>
<td colspan="4">No GST release found.</td>
<td colspan="5">No GST release found.</td>
</tr>
{% endif %}
</tbody>
</table>
</table>
<tr>
<h3>Credit Details</h3>

View File

@@ -19,52 +19,52 @@
<div class="row2">
<div>
<label for="subcontractor">Subcontractor Name:</label>
<input type="text" id="subcontractor" name="subcontractor" value="{{ contInfo.Contractor_Name }}"
<input type="text" id="subcontractor" name="subcontractor" value="{{ info.Contractor_Name }}"
readonly/>
</div>
<div>
<label for="Address">Address :</label>
<textarea id="Address" name="Address" readonly>{{ contInfo.Address }}</textarea>
<textarea id="Address" name="Address" readonly>{{ info.Address }}</textarea>
</div>
</div>
<div class="row3">
<div>
<label for="PAN_No">PAN No :</label>
<input type="text" id="PAN_No" name="PAN_No" value="{{ contInfo.PAN_No }}" readonly/>
<input type="text" id="PAN_No" name="PAN_No" value="{{ info.PAN_No }}" readonly/>
</div>
<div>
<label for="Mobile_No">Mobile Number :</label>
<input type="text" id="Mobile_No" name="Mobile_No" value="{{ contInfo.Mobile_No }}" readonly/>
<input type="text" id="Mobile_No" name="Mobile_No" value="{{ info.Mobile_No }}" readonly/>
</div>
<div>
<label for="Email">Email :</label>
<input type="text" id="Email" name="Email" value="{{ contInfo.Email }}" readonly/>
<input type="text" id="Email" name="Email" value="{{ info.Email }}" readonly/>
</div>
</div>
<div class="row2">
<div>
<label for="GST_Registration_Type">GST Registration Type :</label>
<input type="text" id="GST_Registration_Type" name="GST_Registration_Type"
value="{{ contInfo.GST_Registration_Type }}" readonly/>
value="{{ info.GST_Registration_Type }}" readonly/>
</div>
<div>
<label for="GST_No">GST No:</label>
<input type="text" id="GST_No" name="GST_No" value="{{ contInfo.GST_No }}" readonly/>
<input type="text" id="GST_No" name="GST_No" value="{{ info.GST_No }}" readonly/>
</div>
</div>
<div class="row3">
<div>
<label for="State">State :</label>
<input type="text" id="State" name="State" value="{{ contInfo.State_Name }}" readonly/>
<input type="text" id="State" name="State" value="{{ info.State_Name }}" readonly/>
</div>
<div>
<label for="District">District :</label>
<input type="text" id="District" name="District" value="{{ contInfo.District_Name }}" readonly/>
<input type="text" id="District" name="District" value="{{ info.District_Name }}" readonly/>
</div>
<div>
<label for="Block">Block :</label>
<input type="text" id="Block" name="Block" value="{{ contInfo.Block_Name }}" readonly/>
<input type="text" id="Block" name="Block" value="{{ info.Block_Name }}" readonly/>
</div>
</div>
</div>
@@ -107,7 +107,7 @@
<h3>Invoice Details</h3>
<table>
<table border="1" cellpadding="5" cellspacing="0">
<thead>
<tr>
<th>PMC No</th>
@@ -127,9 +127,8 @@
<th>Hydro Testing</th>
<!-- Dynamic Hold Types -->
{% set hold_types = invoices | map(attribute='hold_type') | unique | list %}
{% for hold in hold_types %}
<th>{{ hold }}</th>
{% for ht in hold_types %}
<th>{{ ht.hold_type }}</th>
{% endfor %}
<th>GST SD (18%)</th>
@@ -141,11 +140,11 @@
{% for invoice in invoices %}
<tr>
<td>{{ invoice.PMC_No }}</td>
<td>{{ invoice.Village_Name.capitalize() }}</td>
<td>{{ invoice.Village_Name }}</td>
<td>{{ invoice.Work_Type }}</td>
<td>{{ invoice.Invoice_Details }}</td>
<td>{{ invoice.Invoice_Date }}</td>
<td>{{ invoice.Invoice_No }}</td>
<td>{{ invoice.invoice_no }}</td>
<td>{{ invoice.Basic_Amount }}</td>
<td>{{ invoice.Debit_Amount }}</td>
<td>{{ invoice.After_Debit_Amount }}</td>
@@ -156,45 +155,36 @@
<td>{{ invoice.On_Commission }}</td>
<td>{{ invoice.Hydro_Testing }}</td>
<!-- Dynamic Hold Amounts -->
{% set hold_types = invoices | map(attribute='hold_type') | unique | list %}
{% for hold in hold_types %}
<td>
{% if invoice.hold_type == hold %}
{{ invoice.hold_amount }}
{% else %}
0.00
{% endif %}
</td>
<!-- Hold Amounts -->
{% for ht in hold_types %}
<td>{{ hold_data.get(invoice.Invoice_Id, {}).get(ht.hold_type_id, 0) }}</td>
{% endfor %}
<td>{{ invoice.GST_SD_Amount }}</td>
<td>{{ invoice.Final_Amount }}</td>
</tr>
{% endfor %}
<!-- Total Row -->
<tr>
<th colspan="6">Total</th>
<th>{{total["sum_invo_basic_amt"]}}</th>
<th>{{total["sum_invo_debit_amt"]}}</th>
<th>{{total["sum_invo_after_debit_amt"]}}</th>
<th>{{total["sum_invo_gst_amt"]}}</th>
<th>{{total["sum_invo_amt"]}}</th>
<th>{{total["sum_invo_tds_amt"]}}</th>
<th>{{total["sum_invo_ds_amt"]}}</th>
<th>{{total["sum_invo_on_commission"]}}</th>
<th>{{total["sum_invo_hydro_test"]}}</th>
<th>{{ total.sum_invo_basic_amt }}</th>
<th>{{ total.get('sum_invo_debit_amt', 0) }}</th>
<th>{{ total.get('sum_invo_after_debit_amt', 0) }}</th>
<th>{{ total.get('sum_invo_gst_amt', 0) }}</th>
<th>{{ total.get('sum_invo_amt', 0) }}</th>
<th>{{ total.get('sum_invo_tds_amt', 0) }}</th>
<th>{{ total.get('sum_invo_ds_amt', 0) }}</th>
<th>{{ total.get('sum_invo_on_commission', 0) }}</th>
<th>{{ total.get('sum_invo_hydro_test', 0) }}</th>
{% set hold_types = invoices | map(attribute='hold_type') | unique | list %}
{% for hold in hold_types %}
<th>{{total["sum_invo_hold_amt"]}}</th>
{% for ht in hold_types %}
<th>{{ total.sum_invo_hold_amt}}</th>
{% endfor %}
<th>{{total["sum_invo_gst_sd_amt"]}}</th>
<th>{{total["sum_invo_final_amt"]}}</th>
<th>{{ total.get('sum_invo_gst_sd_amt', 0) }}</th>
<th>{{ total.sum_invo_final_amt }}</th>
</tr>
{% else %}
<tr>
<td colspan="{{ 17 + hold_types|length }}">No invoices found.</td>
@@ -203,37 +193,6 @@
</tbody>
</table>
<h3>Hold Release</h3>
<table>
<thead>
<tr>
<th>PMC No</th>
<th>Invoice No</th>
<th>Invoice Details</th>
<th>Basic Amount</th>
<th>Total Amount</th>
<th>UTR</th>
</tr>
</thead>
<tbody>
{% if hold_release %}
{% for hold in hold_release %}
<tr>
<td>{{ hold['PMC_No'] }}</td>
<td>{{ hold['Invoice_No'] }}</td>
<td>{{ hold['Invoice_Details'] }}</td>
<td>{{ hold['Basic_Amount'] }}</td>
<td>{{ hold['Total_Amount'] }}</td>
<td>{{ hold['UTR'] }}</td>
</tr>
{% endfor %}
{% else %}
<tr>
<td colspan="6" style="text-align:center;">No data present</td>
</tr>
{% endif %}
</tbody>
</table>
<br>
@@ -286,6 +245,7 @@
</thead>
</table>
<h3>GST Release Note Details</h3>
<table>
<thead>
<tr>
@@ -293,31 +253,47 @@
<th>Invoice No</th>
<th>Basic Amount</th>
<th>Final Amount</th>
<th>Total_Amount</th>
<th>UTR</th>
</tr>
</thead>
<tbody>
{% if gst_rel %}
{% for gst in gst_rel %}
<tr>
<td>{{ gst.pmc_no }}</td>
<td>{{ gst.invoice_no }}</td>
<td>{{ gst.basic_amount }}</td>
<td>{{ gst.final_amount }}</td>
<td>{{ gst.PMC_No }}</td>
<td>{{ gst.Invoice_No }}</td>
<td>{{ gst.Basic_Amount }}</td>
<td>{{ gst.Final_Amount }}</td>
<td>{{gst.Total_Amount}}</td>
<td>{{gst.UTR}}</td></TD>
</tr>
{% endfor %}
<tr>
<th colspan="2">Total</th>
<th>{{total["sum_gst_basic_amt"]}}</th>
<th>{{total["sum_gst_final_amt"]}}</th>
<th>{{ total["sum_gst_basic_amt"] }}</th>
<th>{{ total["sum_gst_final_amt"] }}</th>
<th>{{total["sum_gst_total_amt"]}}</th>
<th></th>
</tr>
{% else %}
<tr>
<td colspan="4">No GST release found.</td>
<td colspan="5">No GST release found.</td>
</tr>
{% endif %}
</tbody>
</table>
@@ -350,7 +326,8 @@
<tr>
<th colspan="2">Total</th>
<th>{{total["sum_pay_payment_amt"]}}</th>
<!-- <th>{{total["sum_pay_payment_amt "]}}</th> -->
<th>0.00</th>
<th>{{total["sum_pay_tds_payment_amt"]}}</th>
<th>{{total["sum_pay_total_amt"]}}</th>
<th></th>