testing code
This commit is contained in:
@@ -188,7 +188,7 @@ def save_data():
|
|||||||
"SD_Amount": entry.get("SD_Amount", 0.00),
|
"SD_Amount": entry.get("SD_Amount", 0.00),
|
||||||
"On_Commission": entry.get("On_Commission", 0.00),
|
"On_Commission": entry.get("On_Commission", 0.00),
|
||||||
"Hydro_Testing": entry.get("Hydro_Testing", 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),
|
"GST_SD_Amount": entry.get("GST_SD_Amount", 0.00),
|
||||||
"Final_Amount": entry.get("Final_Amount", 0.00),
|
"Final_Amount": entry.get("Final_Amount", 0.00),
|
||||||
"Payment_Amount": entry.get("Payment_Amount", 0.00),
|
"Payment_Amount": entry.get("Payment_Amount", 0.00),
|
||||||
@@ -300,7 +300,8 @@ def save_data():
|
|||||||
else:
|
else:
|
||||||
print("Hold columns data is not a valid list of dictionaries.")
|
print("Hold columns data is not a valid list of dictionaries.")
|
||||||
#---------------------------------------------Credit Note---------------------------------------------------------------------------
|
#---------------------------------------------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(
|
cursor.callproc(
|
||||||
'AddCreditNoteFromExcel',
|
'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 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__)
|
pmc_report_bp = Blueprint("pmc_report", __name__)
|
||||||
|
|
||||||
# ---------------- Contractor Report by pmc no ----------------
|
# ---------------- Contractor Report by pmc no ----------------
|
||||||
|
|
||||||
@pmc_report_bp.route("/pmc_report/<pmc_no>")
|
@pmc_report_bp.route("/pmc_report/<pmc_no>")
|
||||||
@login_required
|
@login_required
|
||||||
def pmc_report(pmc_no):
|
def pmc_report(pmc_no):
|
||||||
data = PmcReport.get_pmc_report(pmc_no)
|
data = UnifiedReportService.get_report(pmc_no=pmc_no)
|
||||||
if not data:
|
if not data:
|
||||||
return "No PMC found with this number", 404
|
return "No PMC found with this number", 404
|
||||||
|
|
||||||
@@ -17,24 +18,22 @@ def pmc_report(pmc_no):
|
|||||||
info=data["info"],
|
info=data["info"],
|
||||||
invoices=data["invoices"],
|
invoices=data["invoices"],
|
||||||
hold_types=data["hold_types"],
|
hold_types=data["hold_types"],
|
||||||
|
hold_data=data["hold_data"], # <-- add this line
|
||||||
gst_rel=data["gst_rel"],
|
gst_rel=data["gst_rel"],
|
||||||
payments=data["payments"],
|
payments=data["payments"],
|
||||||
credit_note=data["credit_note"],
|
credit_note=data["credit_note"],
|
||||||
hold_release=data["hold_release"],
|
hold_release=data["hold_release"],
|
||||||
total=data["total"]
|
total=data["total"]
|
||||||
)
|
)
|
||||||
|
|
||||||
# ---------------- Contractor Download Report by pmc no ----------------
|
# ---------------- Contractor Download Report by pmc no ----------------
|
||||||
|
|
||||||
@pmc_report_bp.route("/download_pmc_report/<pmc_no>")
|
@pmc_report_bp.route("/download_pmc_report/<pmc_no>")
|
||||||
@login_required
|
@login_required
|
||||||
def download_pmc_report(pmc_no):
|
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
|
return "No contractor found for this PMC No", 404
|
||||||
|
|
||||||
output_folder, file_name = result
|
return send_file(output_file, as_attachment=True)
|
||||||
|
|
||||||
return send_from_directory(output_folder, file_name, as_attachment=True)
|
|
||||||
|
|
||||||
@@ -4,7 +4,7 @@ from flask_login import login_required, current_user
|
|||||||
from model.Report import ReportHelper
|
from model.Report import ReportHelper
|
||||||
from model.Log import LogHelper
|
from model.Log import LogHelper
|
||||||
import os
|
import os
|
||||||
|
from model.UnifiedReportService import UnifiedReportService
|
||||||
# DOWNLOAD_FOLDER = "static/download"
|
# DOWNLOAD_FOLDER = "static/download"
|
||||||
report_bp = Blueprint("report", __name__)
|
report_bp = Blueprint("report", __name__)
|
||||||
|
|
||||||
@@ -33,11 +33,13 @@ def search_contractor():
|
|||||||
return jsonify(data)
|
return jsonify(data)
|
||||||
|
|
||||||
# ---------------- Contractor Report by contractor id ----------------
|
# ---------------- Contractor Report by contractor id ----------------
|
||||||
|
|
||||||
@report_bp.route('/contractor_report/<int:contractor_id>')
|
@report_bp.route('/contractor_report/<int:contractor_id>')
|
||||||
@login_required
|
@login_required
|
||||||
def contractor_report(contractor_id):
|
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(
|
return render_template(
|
||||||
'subcontractor_report.html',
|
'subcontractor_report.html',
|
||||||
@@ -49,11 +51,10 @@ def contractor_report(contractor_id):
|
|||||||
|
|
||||||
@report_bp.route('/download_report/<int:contractor_id>')
|
@report_bp.route('/download_report/<int:contractor_id>')
|
||||||
def download_report(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
|
file_path = UnifiedReportService.download(contractor_id=contractor_id)
|
||||||
return send_file(output_file, as_attachment=True)
|
|
||||||
|
if not file_path:
|
||||||
|
return "Report not found", 404
|
||||||
|
|
||||||
|
return send_file(file_path, as_attachment=True)
|
||||||
@@ -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: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:13 | User: Unknown | Action: Search Contractor | Details:
|
||||||
Timestamp: 2026-04-01 19:23:16 | User: Unknown | Action: Download PMC Report | 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:
|
||||||
|
|||||||
@@ -1,185 +1,185 @@
|
|||||||
import openpyxl
|
# import openpyxl
|
||||||
from openpyxl.styles import Font, PatternFill
|
# from openpyxl.styles import Font, PatternFill
|
||||||
import config
|
# import config
|
||||||
from flask_login import current_user
|
# from flask_login import current_user
|
||||||
from model.Log import LogHelper
|
# from model.Log import LogHelper
|
||||||
from model.excel import excel
|
# from model.excel import excel
|
||||||
from model.Report import ReportHelper
|
# from model.Report import ReportHelper
|
||||||
from model.FolderAndFile import FolderAndFile
|
# from model.FolderAndFile import FolderAndFile
|
||||||
|
|
||||||
class PmcReport:
|
# class PmcReport:
|
||||||
|
|
||||||
@staticmethod
|
# @staticmethod
|
||||||
def get_pmc_report(pmc_no):
|
# def get_pmc_report(pmc_no):
|
||||||
|
|
||||||
connection = config.get_db_connection()
|
# connection = config.get_db_connection()
|
||||||
cursor = connection.cursor(dictionary=True, buffered=True)
|
# cursor = connection.cursor(dictionary=True, buffered=True)
|
||||||
|
|
||||||
try:
|
# try:
|
||||||
pmc_info = ReportHelper.execute_sp(cursor, 'GetContractorInfoByPmcNo', [pmc_no], True)
|
# pmc_info = ReportHelper.execute_sp(cursor, 'GetContractorInfoByPmcNo', [pmc_no], True)
|
||||||
|
|
||||||
if not pmc_info:
|
# if not pmc_info:
|
||||||
return None
|
# return None
|
||||||
|
|
||||||
cursor.callproc("Get_pmc_hold_types", (pmc_no, pmc_info["Contractor_Id"]))
|
# cursor.callproc("Get_pmc_hold_types", (pmc_no, pmc_info["Contractor_Id"]))
|
||||||
hold_types = next(cursor.stored_results()).fetchall()
|
# hold_types = next(cursor.stored_results()).fetchall()
|
||||||
|
|
||||||
# Extract hold_type_ids
|
# # Extract hold_type_ids
|
||||||
hold_type_ids = [ht['hold_type_id'] for ht in hold_types]
|
# hold_type_ids = [ht['hold_type_id'] for ht in hold_types]
|
||||||
|
|
||||||
invoices = []
|
# invoices = []
|
||||||
hold_amount_total = 0
|
# hold_amount_total = 0
|
||||||
hold_type_ids_str = ",".join(map(str, hold_type_ids))
|
# hold_type_ids_str = ",".join(map(str, hold_type_ids))
|
||||||
cursor.callproc(
|
# cursor.callproc(
|
||||||
'GetInvoices_WithHold',
|
# 'GetInvoices_WithHold',
|
||||||
[pmc_no, pmc_info["Contractor_Id"], hold_type_ids_str]
|
# [pmc_no, pmc_info["Contractor_Id"], hold_type_ids_str]
|
||||||
)
|
# )
|
||||||
|
|
||||||
for result in cursor.stored_results():
|
# for result in cursor.stored_results():
|
||||||
invoices = result.fetchall()
|
# invoices = result.fetchall()
|
||||||
|
|
||||||
if hold_type_ids:
|
# if hold_type_ids:
|
||||||
hold_amount_total = sum(row.get('hold_amount', 0) or 0 for row in invoices)
|
# 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])
|
# 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_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)
|
# 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])
|
# 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_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)
|
# total_pay_total = sum(row.get('Total_amount', 0) or 0 for row in payments)
|
||||||
|
|
||||||
totals = {
|
# totals = {
|
||||||
"sum_invo_basic_amt": sum(row.get('Basic_Amount', 0) or 0 for row in invoices),
|
# "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_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_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_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_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_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_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_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_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_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_final_amt": total_invo_final,
|
||||||
"sum_invo_hold_amt": hold_amount_total,
|
# "sum_invo_hold_amt": hold_amount_total,
|
||||||
"sum_gst_basic_amt": total_gst_basic,
|
# "sum_gst_basic_amt": total_gst_basic,
|
||||||
"sum_gst_final_amt": total_gst_final,
|
# "sum_gst_final_amt": total_gst_final,
|
||||||
"sum_pay_payment_amt": total_pay_amount,
|
# "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_tds_payment_amt": sum(row.get('TDS_Payment_Amount', 0) or 0 for row in payments),
|
||||||
"sum_pay_total_amt": total_pay_total
|
# "sum_pay_total_amt": total_pay_total
|
||||||
}
|
# }
|
||||||
|
|
||||||
return {
|
# return {
|
||||||
"info": pmc_info,
|
# "info": pmc_info,
|
||||||
"invoices": invoices,
|
# "invoices": invoices,
|
||||||
"hold_types": hold_types,
|
# "hold_types": hold_types,
|
||||||
"gst_rel": gst_rel,
|
# "gst_rel": gst_rel,
|
||||||
"payments": payments,
|
# "payments": payments,
|
||||||
"credit_note": credit_note,
|
# "credit_note": credit_note,
|
||||||
"hold_release": hold_release,
|
# "hold_release": hold_release,
|
||||||
"total": totals
|
# "total": totals
|
||||||
}
|
# }
|
||||||
|
|
||||||
finally:
|
# finally:
|
||||||
cursor.close()
|
# cursor.close()
|
||||||
connection.close()
|
# connection.close()
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
# @staticmethod
|
||||||
def download_pmc_report(pmc_no):
|
# def download_pmc_report(pmc_no):
|
||||||
|
|
||||||
connection = config.get_db_connection()
|
# connection = config.get_db_connection()
|
||||||
if not connection:
|
# if not connection:
|
||||||
return None
|
# return None
|
||||||
|
|
||||||
cursor = connection.cursor(dictionary=True)
|
# cursor = connection.cursor(dictionary=True)
|
||||||
|
|
||||||
try:
|
# try:
|
||||||
filename = f"PMC_Report_{pmc_no}.xlsx"
|
# filename = f"PMC_Report_{pmc_no}.xlsx"
|
||||||
|
|
||||||
output_folder = FolderAndFile.get_download_folder()
|
# output_folder = FolderAndFile.get_download_folder()
|
||||||
output_file = FolderAndFile.get_download_path(filename)
|
# output_file = FolderAndFile.get_download_path(filename)
|
||||||
|
|
||||||
# ================= DATA FETCH =================
|
# # ================= DATA FETCH =================
|
||||||
|
|
||||||
contractor_info = ReportHelper.execute_sp(
|
# contractor_info = ReportHelper.execute_sp(
|
||||||
cursor, 'GetContractorInfoByPmcNo', [pmc_no]
|
# cursor, 'GetContractorInfoByPmcNo', [pmc_no]
|
||||||
)
|
# )
|
||||||
|
|
||||||
contractor_info = contractor_info[0] if contractor_info else None
|
# contractor_info = contractor_info[0] if contractor_info else None
|
||||||
print("contractor_info:::",contractor_info)
|
# print("contractor_info:::",contractor_info)
|
||||||
|
|
||||||
if not contractor_info:
|
# if not contractor_info:
|
||||||
return None
|
# return None
|
||||||
|
|
||||||
hold_types = ReportHelper.execute_sp(
|
# hold_types = ReportHelper.execute_sp(
|
||||||
cursor, 'GetHoldTypesByContractor',
|
# cursor, 'GetHoldTypesByContractor',
|
||||||
[contractor_info["Contractor_Id"]]
|
# [contractor_info["Contractor_Id"]]
|
||||||
)
|
# )
|
||||||
|
|
||||||
hold_type_map = {
|
# hold_type_map = {
|
||||||
ht['hold_type_id']: ht['hold_type'] for ht in hold_types
|
# ht['hold_type_id']: ht['hold_type'] for ht in hold_types
|
||||||
}
|
# }
|
||||||
|
|
||||||
invoices = ReportHelper.execute_sp(
|
# invoices = ReportHelper.execute_sp(
|
||||||
cursor, 'GetInvoicesByContractorOrPMCNo', [None,pmc_no]
|
# cursor, 'GetInvoicesByContractorOrPMCNo', [None,pmc_no]
|
||||||
)
|
# )
|
||||||
|
|
||||||
credit_notes = ReportHelper.execute_sp(
|
# credit_notes = ReportHelper.execute_sp(
|
||||||
cursor, 'NewGetCreditNotesByPMCNo', [pmc_no]
|
# cursor, 'NewGetCreditNotesByPMCNo', [pmc_no]
|
||||||
)
|
# )
|
||||||
credit_note_map = {}
|
# credit_note_map = {}
|
||||||
for cn in credit_notes:
|
# for cn in credit_notes:
|
||||||
key = (
|
# key = (
|
||||||
str(cn['PMC_No']).strip()
|
# str(cn['PMC_No']).strip()
|
||||||
)
|
# )
|
||||||
credit_note_map.setdefault(key, []).append(cn)
|
# credit_note_map.setdefault(key, []).append(cn)
|
||||||
|
|
||||||
hold_amounts = ReportHelper.execute_sp(
|
# hold_amounts = ReportHelper.execute_sp(
|
||||||
cursor, 'GetHoldAmountsByContractor',
|
# cursor, 'GetHoldAmountsByContractor',
|
||||||
[contractor_info["Contractor_Id"]]
|
# [contractor_info["Contractor_Id"]]
|
||||||
)
|
# )
|
||||||
|
|
||||||
gst_releases = ReportHelper.execute_sp(
|
# gst_releases = ReportHelper.execute_sp(
|
||||||
cursor, 'GetGSTReleaseDetailsByPMC', [pmc_no]
|
# cursor, 'GetGSTReleaseDetailsByPMC', [pmc_no]
|
||||||
)
|
# )
|
||||||
gst_release_map = {}
|
# gst_release_map = {}
|
||||||
for gr in gst_releases:
|
# for gr in gst_releases:
|
||||||
|
|
||||||
key = (
|
# key = (
|
||||||
str(gr['PMC_No']).strip()
|
# str(gr['PMC_No']).strip()
|
||||||
)
|
# )
|
||||||
gst_release_map.setdefault(key, []).append(gr)
|
# gst_release_map.setdefault(key, []).append(gr)
|
||||||
|
|
||||||
# ================= DATA MAPPING =================
|
# # ================= DATA MAPPING =================
|
||||||
hold_data = {}
|
# hold_data = {}
|
||||||
for h in hold_amounts:
|
# for h in hold_amounts:
|
||||||
hold_data.setdefault(h['Invoice_Id'], {})[h['hold_type_id']] = h['hold_amount']
|
# hold_data.setdefault(h['Invoice_Id'], {})[h['hold_type_id']] = h['hold_amount']
|
||||||
|
|
||||||
|
|
||||||
# ================= LOG =================
|
# # ================= LOG =================
|
||||||
LogHelper.log_action(
|
# LogHelper.log_action(
|
||||||
"Download PMC Report",
|
# "Download PMC Report",
|
||||||
f"User {current_user.id} Download PMC Report '{pmc_no}'"
|
# f"User {current_user.id} Download PMC Report '{pmc_no}'"
|
||||||
)
|
# )
|
||||||
|
|
||||||
excel.generate_excel(
|
# excel.generate_excel(
|
||||||
0, contractor_info, invoices, hold_types, hold_data,
|
# 0, contractor_info, invoices, hold_types, hold_data,
|
||||||
credit_note_map,gst_release_map, output_file
|
# credit_note_map,gst_release_map, output_file
|
||||||
)
|
# )
|
||||||
|
|
||||||
return output_folder, filename
|
# return output_folder, filename
|
||||||
|
|
||||||
except Exception as e:
|
# except Exception as e:
|
||||||
print(f"Error generating PMC report: {e}")
|
# print(f"Error generating PMC report: {e}")
|
||||||
return None
|
# return None
|
||||||
|
|
||||||
finally:
|
# finally:
|
||||||
cursor.close()
|
# cursor.close()
|
||||||
connection.close()
|
# connection.close()
|
||||||
|
|||||||
113
model/Report.py
113
model/Report.py
@@ -86,67 +86,7 @@ class ReportHelper:
|
|||||||
return data
|
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
|
@staticmethod
|
||||||
def get_contractor_info(contractor_id):
|
def get_contractor_info(contractor_id):
|
||||||
from model.ContractorInfo import ContractorInfo
|
from model.ContractorInfo import ContractorInfo
|
||||||
@@ -154,53 +94,4 @@ class ReportHelper:
|
|||||||
return contractor.contInfo if contractor.contInfo else None
|
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
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
159
model/UnifiedReportService.py
Normal file
159
model/UnifiedReportService.py
Normal 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
|
||||||
@@ -10,16 +10,26 @@ from model.FolderAndFile import FolderAndFile
|
|||||||
class excel:
|
class excel:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def generate_excel(contractor_id, contInfo, invoices, hold_types, hold_data,
|
# def generate_excel(contractor_id, contInfo, invoices, hold_types, hold_data,
|
||||||
credit_note_map, gst_release_map, output_file):
|
# 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()
|
workbook = openpyxl.Workbook()
|
||||||
sheet = workbook.active
|
sheet = workbook.active
|
||||||
sheet.title = "Contractor Report"
|
sheet.title = "Contractor Report"
|
||||||
|
|
||||||
# Contractor Info
|
# Contractor Info
|
||||||
for field, value in contInfo.items():
|
for field, value in info.items():
|
||||||
sheet.append([field.replace("_", " "), value])
|
sheet.append([field.replace("_", " "), value])
|
||||||
sheet.append([])
|
sheet.append([])
|
||||||
|
|
||||||
|
|||||||
BIN
static/images/icons/male_profile.jpeg
Normal file
BIN
static/images/icons/male_profile.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.2 MiB |
@@ -34,7 +34,7 @@
|
|||||||
<a href="/logout">Logout</a>
|
<a href="/logout">Logout</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="sidebar">
|
<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">
|
<ul class="nav-menu">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
@@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
<div class="user-section">
|
<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">
|
<div class="user-info">
|
||||||
<span>admin</span>
|
<span>admin</span>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -83,164 +83,143 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<h3>Invoice Details</h3>
|
<h3>Invoice Details</h3>
|
||||||
<table>
|
<table border="1" cellpadding="5" cellspacing="0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>PMC No</th>
|
<th>PMC No</th>
|
||||||
<th>Village Name</th>
|
<th>Village Name</th>
|
||||||
<th>Work Type</th>
|
<th>Work Type</th>
|
||||||
<th>Invoice Details</th>
|
<th>Invoice Details</th>
|
||||||
<th>Invoice Date</th>
|
<th>Invoice Date</th>
|
||||||
<th>Invoice No</th>
|
<th>Invoice No</th>
|
||||||
<th>Basic Amount</th>
|
<th>Basic Amount</th>
|
||||||
<th>Debit</th>
|
<th>Debit</th>
|
||||||
<th>After Debit Amt</th>
|
<th>After Debit Amt</th>
|
||||||
<th>GST (18%)</th>
|
<th>GST (18%)</th>
|
||||||
<th>Amount</th>
|
<th>Amount</th>
|
||||||
<th>TDS (1%)</th>
|
<th>TDS (1%)</th>
|
||||||
<th>SD (5%)</th>
|
<th>SD (5%)</th>
|
||||||
<th>On Commission</th>
|
<th>On Commission</th>
|
||||||
<th>Hydro Testing</th>
|
<th>Hydro Testing</th>
|
||||||
|
|
||||||
<!-- Dynamic Hold Types -->
|
<!-- Dynamic Hold Types -->
|
||||||
{% set hold_types = invoices | map(attribute='hold_type') | reject('none') | unique | list %}
|
{% for ht in hold_types %}
|
||||||
{% for hold in hold_types %}
|
<th>{{ ht.hold_type }}</th>
|
||||||
<th>{{ hold }}</th>
|
{% endfor %}
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<th>GST SD (18%)</th>
|
<th>GST SD (18%)</th>
|
||||||
<th>Final Amount</th>
|
<th>Final Amount</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% if invoices %}
|
{% if invoices %}
|
||||||
{% for invoice in invoices %}
|
{% for invoice in invoices %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ invoice.PMC_No }}</td>
|
<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.Work_Type }}</td>
|
||||||
<td>{{ invoice.Invoice_Details }}</td>
|
<td>{{ invoice.Invoice_Details }}</td>
|
||||||
<td>{{ invoice.Invoice_Date }}</td>
|
<td>{{ invoice.Invoice_Date }}</td>
|
||||||
<td>{{ invoice.Invoice_No }}</td>
|
<td>{{ invoice.invoice_no }}</td>
|
||||||
<td>{{ invoice.Basic_Amount }}</td>
|
<td>{{ invoice.Basic_Amount }}</td>
|
||||||
<td>{{ invoice.Debit_Amount }}</td>
|
<td>{{ invoice.Debit_Amount }}</td>
|
||||||
<td>{{ invoice.After_Debit_Amount }}</td>
|
<td>{{ invoice.After_Debit_Amount }}</td>
|
||||||
<td>{{ invoice.GST_Amount }}</td>
|
<td>{{ invoice.GST_Amount }}</td>
|
||||||
<td>{{ invoice.Amount }}</td>
|
<td>{{ invoice.Amount }}</td>
|
||||||
<td>{{ invoice.TDS_Amount }}</td>
|
<td>{{ invoice.TDS_Amount }}</td>
|
||||||
<td>{{ invoice.SD_Amount }}</td>
|
<td>{{ invoice.SD_Amount }}</td>
|
||||||
<td>{{ invoice.On_Commission }}</td>
|
<td>{{ invoice.On_Commission }}</td>
|
||||||
<td>{{ invoice.Hydro_Testing }}</td>
|
<td>{{ invoice.Hydro_Testing }}</td>
|
||||||
|
|
||||||
<!-- Dynamic Hold Amounts -->
|
<!-- Hold Amounts -->
|
||||||
{% for hold in hold_types %}
|
{% for ht in hold_types %}
|
||||||
<td>
|
<td>{{ hold_data.get(invoice.Invoice_Id, {}).get(ht.hold_type_id, 0) }}</td>
|
||||||
{% if invoice.hold_type == hold %}
|
{% endfor %}
|
||||||
{{ invoice.hold_amount }}
|
|
||||||
|
<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.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 %}
|
{% else %}
|
||||||
0
|
<tr>
|
||||||
|
<td colspan="{{ 17 + hold_types|length }}">No invoices found.</td>
|
||||||
|
</tr>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</td>
|
</tbody>
|
||||||
{% endfor %}
|
</table>
|
||||||
|
|
||||||
<td>{{ invoice.GST_SD_Amount }}</td>
|
|
||||||
<td>{{ invoice.Final_Amount }}</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
{% endfor %}
|
|
||||||
<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>
|
|
||||||
|
|
||||||
{% 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>
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<h3>GST Release Note Details</h3>
|
<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>
|
|
||||||
</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>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
<tr>
|
|
||||||
<th colspan="2">Total</th>
|
|
||||||
|
|
||||||
<th>{{total["sum_gst_basic_amt"]}}</th>
|
<table>
|
||||||
<th>{{total["sum_gst_final_amt"]}}</th>
|
<thead>
|
||||||
</tr>
|
<tr>
|
||||||
{% else %}
|
<th>PMC No</th>
|
||||||
<tr>
|
<th>Invoice No</th>
|
||||||
<td colspan="4">No GST release found.</td>
|
<th>Basic Amount</th>
|
||||||
</tr>
|
<th>Final Amount</th>
|
||||||
{% endif %}
|
<th>UTR</th>
|
||||||
</tbody>
|
</tr>
|
||||||
</table>
|
</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.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></th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="5">No GST release found.</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<h3>Credit Details</h3>
|
<h3>Credit Details</h3>
|
||||||
|
|||||||
@@ -19,52 +19,52 @@
|
|||||||
<div class="row2">
|
<div class="row2">
|
||||||
<div>
|
<div>
|
||||||
<label for="subcontractor">Subcontractor Name:</label>
|
<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/>
|
readonly/>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label for="Address">Address :</label>
|
<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>
|
</div>
|
||||||
<div class="row3">
|
<div class="row3">
|
||||||
<div>
|
<div>
|
||||||
<label for="PAN_No">PAN No :</label>
|
<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>
|
||||||
<div>
|
<div>
|
||||||
<label for="Mobile_No">Mobile Number :</label>
|
<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>
|
||||||
<div>
|
<div>
|
||||||
<label for="Email">Email :</label>
|
<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>
|
</div>
|
||||||
<div class="row2">
|
<div class="row2">
|
||||||
<div>
|
<div>
|
||||||
<label for="GST_Registration_Type">GST Registration Type :</label>
|
<label for="GST_Registration_Type">GST Registration Type :</label>
|
||||||
<input type="text" id="GST_Registration_Type" name="GST_Registration_Type"
|
<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>
|
||||||
<div>
|
<div>
|
||||||
<label for="GST_No">GST No:</label>
|
<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>
|
</div>
|
||||||
<div class="row3">
|
<div class="row3">
|
||||||
<div>
|
<div>
|
||||||
<label for="State">State :</label>
|
<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>
|
||||||
<div>
|
<div>
|
||||||
<label for="District">District :</label>
|
<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>
|
||||||
<div>
|
<div>
|
||||||
<label for="Block">Block :</label>
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -106,134 +106,93 @@
|
|||||||
<!-- {% endif %}-->
|
<!-- {% endif %}-->
|
||||||
|
|
||||||
|
|
||||||
<h3>Invoice Details</h3>
|
<h3>Invoice Details</h3>
|
||||||
<table>
|
<table border="1" cellpadding="5" cellspacing="0">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>PMC No</th>
|
<th>PMC No</th>
|
||||||
<th>Village Name</th>
|
<th>Village Name</th>
|
||||||
<th>Work Type</th>
|
<th>Work Type</th>
|
||||||
<th>Invoice Details</th>
|
<th>Invoice Details</th>
|
||||||
<th>Invoice Date</th>
|
<th>Invoice Date</th>
|
||||||
<th>Invoice No</th>
|
<th>Invoice No</th>
|
||||||
<th>Basic Amount</th>
|
<th>Basic Amount</th>
|
||||||
<th>Debit</th>
|
<th>Debit</th>
|
||||||
<th>After Debit Amt</th>
|
<th>After Debit Amt</th>
|
||||||
<th>GST (18%)</th>
|
<th>GST (18%)</th>
|
||||||
<th>Amount</th>
|
<th>Amount</th>
|
||||||
<th>TDS (1%)</th>
|
<th>TDS (1%)</th>
|
||||||
<th>SD (5%)</th>
|
<th>SD (5%)</th>
|
||||||
<th>On Commission</th>
|
<th>On Commission</th>
|
||||||
<th>Hydro Testing</th>
|
<th>Hydro Testing</th>
|
||||||
|
|
||||||
<!-- Dynamic Hold Types -->
|
<!-- Dynamic Hold Types -->
|
||||||
{% set hold_types = invoices | map(attribute='hold_type') | unique | list %}
|
{% for ht in hold_types %}
|
||||||
{% for hold in hold_types %}
|
<th>{{ ht.hold_type }}</th>
|
||||||
<th>{{ hold }}</th>
|
{% endfor %}
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<th>GST SD (18%)</th>
|
<th>GST SD (18%)</th>
|
||||||
<th>Final Amount</th>
|
<th>Final Amount</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% if invoices %}
|
{% if invoices %}
|
||||||
{% for invoice in invoices %}
|
{% for invoice in invoices %}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{ invoice.PMC_No }}</td>
|
<td>{{ invoice.PMC_No }}</td>
|
||||||
<td>{{ invoice.Village_Name.capitalize() }}</td>
|
<td>{{ invoice.Village_Name }}</td>
|
||||||
<td>{{ invoice.Work_Type }}</td>
|
<td>{{ invoice.Work_Type }}</td>
|
||||||
<td>{{ invoice.Invoice_Details }}</td>
|
<td>{{ invoice.Invoice_Details }}</td>
|
||||||
<td>{{ invoice.Invoice_Date }}</td>
|
<td>{{ invoice.Invoice_Date }}</td>
|
||||||
<td>{{ invoice.Invoice_No }}</td>
|
<td>{{ invoice.invoice_no }}</td>
|
||||||
<td>{{ invoice.Basic_Amount }}</td>
|
<td>{{ invoice.Basic_Amount }}</td>
|
||||||
<td>{{ invoice.Debit_Amount }}</td>
|
<td>{{ invoice.Debit_Amount }}</td>
|
||||||
<td>{{ invoice.After_Debit_Amount }}</td>
|
<td>{{ invoice.After_Debit_Amount }}</td>
|
||||||
<td>{{ invoice.GST_Amount }}</td>
|
<td>{{ invoice.GST_Amount }}</td>
|
||||||
<td>{{ invoice.Amount }}</td>
|
<td>{{ invoice.Amount }}</td>
|
||||||
<td>{{ invoice.TDS_Amount }}</td>
|
<td>{{ invoice.TDS_Amount }}</td>
|
||||||
<td>{{ invoice.SD_Amount }}</td>
|
<td>{{ invoice.SD_Amount }}</td>
|
||||||
<td>{{ invoice.On_Commission }}</td>
|
<td>{{ invoice.On_Commission }}</td>
|
||||||
<td>{{ invoice.Hydro_Testing }}</td>
|
<td>{{ invoice.Hydro_Testing }}</td>
|
||||||
|
|
||||||
<!-- Dynamic Hold Amounts -->
|
<!-- Hold Amounts -->
|
||||||
{% set hold_types = invoices | map(attribute='hold_type') | unique | list %}
|
{% for ht in hold_types %}
|
||||||
{% for hold in hold_types %}
|
<td>{{ hold_data.get(invoice.Invoice_Id, {}).get(ht.hold_type_id, 0) }}</td>
|
||||||
<td>
|
{% endfor %}
|
||||||
{% if invoice.hold_type == hold %}
|
|
||||||
{{ invoice.hold_amount }}
|
|
||||||
{% else %}
|
|
||||||
0.00
|
|
||||||
{% endif %}
|
|
||||||
</td>
|
|
||||||
{% endfor %}
|
|
||||||
|
|
||||||
<td>{{ invoice.GST_SD_Amount }}</td>
|
<td>{{ invoice.GST_SD_Amount }}</td>
|
||||||
<td>{{ invoice.Final_Amount }}</td>
|
<td>{{ invoice.Final_Amount }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
|
||||||
{% endfor %}
|
<!-- Total Row -->
|
||||||
|
<tr>
|
||||||
|
<th colspan="6">Total</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>
|
||||||
|
|
||||||
<tr>
|
{% for ht in hold_types %}
|
||||||
<th colspan="6">Total</th>
|
<th>{{ total.sum_invo_hold_amt}}</th>
|
||||||
<th>{{total["sum_invo_basic_amt"]}}</th>
|
{% endfor %}
|
||||||
<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 %}
|
<th>{{ total.get('sum_invo_gst_sd_amt', 0) }}</th>
|
||||||
{% for hold in hold_types %}
|
<th>{{ total.sum_invo_final_amt }}</th>
|
||||||
<th>{{total["sum_invo_hold_amt"]}}</th>
|
</tr>
|
||||||
{% endfor %}
|
{% else %}
|
||||||
|
<tr>
|
||||||
<th>{{total["sum_invo_gst_sd_amt"]}}</th>
|
<td colspan="{{ 17 + hold_types|length }}">No invoices found.</td>
|
||||||
<th>{{total["sum_invo_final_amt"]}}</th>
|
</tr>
|
||||||
</tr>
|
{% endif %}
|
||||||
|
</tbody>
|
||||||
{% else %}
|
</table>
|
||||||
<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>
|
|
||||||
<br>
|
<br>
|
||||||
|
|
||||||
|
|
||||||
@@ -286,40 +245,57 @@
|
|||||||
</thead>
|
</thead>
|
||||||
</table>
|
</table>
|
||||||
<h3>GST Release Note Details</h3>
|
<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>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>PMC No</th>
|
||||||
|
<th>Invoice No</th>
|
||||||
|
<th>Basic Amount</th>
|
||||||
|
<th>Final Amount</th>
|
||||||
|
<th>Total_Amount</th>
|
||||||
|
<th>UTR</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
</thead>
|
<tbody>
|
||||||
<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>
|
|
||||||
</tr>
|
|
||||||
{% endfor %}
|
|
||||||
<tr>
|
|
||||||
<th colspan="2">Total</th>
|
|
||||||
|
|
||||||
<th>{{total["sum_gst_basic_amt"]}}</th>
|
{% if gst_rel %}
|
||||||
<th>{{total["sum_gst_final_amt"]}}</th>
|
|
||||||
</tr>
|
{% for gst in gst_rel %}
|
||||||
{% else %}
|
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="4">No GST release found.</td>
|
<td>{{ gst.PMC_No }}</td>
|
||||||
</tr>
|
<td>{{ gst.Invoice_No }}</td>
|
||||||
{% endif %}
|
<td>{{ gst.Basic_Amount }}</td>
|
||||||
</tbody>
|
<td>{{ gst.Final_Amount }}</td>
|
||||||
</table>
|
<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_total_amt"]}}</th>
|
||||||
|
<th></th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% else %}
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td colspan="5">No GST release found.</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
@@ -350,7 +326,8 @@
|
|||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<th colspan="2">Total</th>
|
<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_tds_payment_amt"]}}</th>
|
||||||
<th>{{total["sum_pay_total_amt"]}}</th>
|
<th>{{total["sum_pay_total_amt"]}}</th>
|
||||||
<th></th>
|
<th></th>
|
||||||
|
|||||||
Reference in New Issue
Block a user