pankaj-dev #4
7
.gitignore
vendored
Normal file
7
.gitignore
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
venv/
|
||||
*.pyc
|
||||
__pycache__/
|
||||
|
||||
static/downloads/
|
||||
static/uploads/
|
||||
|
||||
Binary file not shown.
7989
activity.log
7989
activity.log
File diff suppressed because it is too large
Load Diff
114
app.log
114
app.log
@@ -1,114 +0,0 @@
|
||||
2025-02-15 11:07:16,100 - INFO - Logging is set up.
|
||||
2025-02-15 11:07:16,100 - INFO - Logging is set up.
|
||||
2025-02-15 11:07:16,131 - WARNING - * Debugger is active!
|
||||
2025-02-15 11:07:16,131 - WARNING - * Debugger is active!
|
||||
2025-02-15 11:07:16,137 - INFO - * Debugger PIN: 558-213-972
|
||||
2025-02-15 11:07:16,137 - INFO - * Debugger PIN: 558-213-972
|
||||
2025-02-15 11:13:26,290 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "GET / HTTP/1.1" 200 -
|
||||
2025-02-15 11:13:26,290 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "GET / HTTP/1.1" 200 -
|
||||
2025-02-15 11:13:26,315 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "[36mGET /static/css/index.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:26,315 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "[36mGET /static/css/index.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:26,504 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:26,504 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:26,626 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "[36mGET /static/js/validateFileInput.js HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:26,626 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "[36mGET /static/js/validateFileInput.js HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:26,633 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "[36mGET /static/js/searchContractor.js HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:26,633 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "[36mGET /static/js/searchContractor.js HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:26,950 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "[33mGET /favicon.ico HTTP/1.1[0m" 404 -
|
||||
2025-02-15 11:13:26,950 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:26] "[33mGET /favicon.ico HTTP/1.1[0m" 404 -
|
||||
2025-02-15 11:13:28,623 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:28] "GET / HTTP/1.1" 200 -
|
||||
2025-02-15 11:13:28,623 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:28] "GET / HTTP/1.1" 200 -
|
||||
2025-02-15 11:13:28,933 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:28] "[36mGET /static/css/index.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:28,933 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:28] "[36mGET /static/css/index.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:28,952 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:28] "[36mGET /static/js/validateFileInput.js HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:28,952 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:28] "[36mGET /static/js/validateFileInput.js HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:28,954 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:28] "[36mGET /static/js/searchContractor.js HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:28,955 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:28] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:28,954 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:28] "[36mGET /static/js/searchContractor.js HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:28,955 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:28] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:31,608 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:31] "GET /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:13:31,608 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:31] "GET /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:13:31,639 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:31] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:31,639 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:31] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:31,649 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:31] "[36mGET /static/images/icons/pen_blue_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:31,649 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:31] "[36mGET /static/images/icons/pen_blue_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:31,967 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:31] "[36mGET /static/images/icons/bin_red_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:13:31,967 - INFO - 127.0.0.1 - - [15/Feb/2025 11:13:31] "[36mGET /static/images/icons/bin_red_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:15:01,349 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:01] "[31m[1mPOST /check_state HTTP/1.1[0m" 409 -
|
||||
2025-02-15 11:15:01,349 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:01] "[31m[1mPOST /check_state HTTP/1.1[0m" 409 -
|
||||
2025-02-15 11:15:21,783 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:21] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:21,783 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:21] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:22,127 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:22] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:22,127 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:22] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:22,151 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:22] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:22,151 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:22] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:22,391 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:22] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:22,391 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:22] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:22,440 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:22] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:22,440 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:22] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:24,266 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:24] "POST /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:24,266 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:24] "POST /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:25,418 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:25] "GET /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:25,418 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:25] "GET /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:15:25,716 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:25] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:15:25,716 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:25] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:15:25,749 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:25] "[36mGET /static/images/icons/pen_blue_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:15:25,749 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:25] "[36mGET /static/images/icons/pen_blue_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:15:25,752 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:25] "[36mGET /static/images/icons/bin_red_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:15:25,752 - INFO - 127.0.0.1 - - [15/Feb/2025 11:15:25] "[36mGET /static/images/icons/bin_red_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:46,338 - INFO - * Detected change in 'C:\\Users\\ADMIN\\PycharmProjects\\ManagementApplicationt\\main.py', reloading
|
||||
2025-02-15 11:16:46,338 - INFO - * Detected change in 'C:\\Users\\ADMIN\\PycharmProjects\\ManagementApplicationt\\main.py', reloading
|
||||
2025-02-15 11:16:48,798 - INFO - Logging is set up.
|
||||
2025-02-15 11:16:48,798 - INFO - Logging is set up.
|
||||
2025-02-15 11:16:48,843 - WARNING - * Debugger is active!
|
||||
2025-02-15 11:16:48,843 - WARNING - * Debugger is active!
|
||||
2025-02-15 11:16:48,847 - INFO - * Debugger PIN: 558-213-972
|
||||
2025-02-15 11:16:48,847 - INFO - * Debugger PIN: 558-213-972
|
||||
2025-02-15 11:16:52,045 - DEBUG - Fetched state data successfully.
|
||||
2025-02-15 11:16:52,045 - DEBUG - Fetched state data successfully.
|
||||
2025-02-15 11:16:52,054 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:52] "GET /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:52,054 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:52] "GET /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:52,076 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:52] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:52,076 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:52] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:52,078 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:52] "[36mGET /static/images/icons/pen_blue_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:52,078 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:52] "[36mGET /static/images/icons/pen_blue_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:52,377 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:52] "[36mGET /static/images/icons/bin_red_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:52,377 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:52] "[36mGET /static/images/icons/bin_red_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:54,758 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:54] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:54,758 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:54] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:54,992 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:54] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:54,992 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:54] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:55,016 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:55] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:55,016 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:55] "POST /check_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:55,669 - INFO - State 'sss' added successfully.
|
||||
2025-02-15 11:16:55,669 - INFO - 'State 'sss added successfully.
|
||||
2025-02-15 11:16:55,670 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:55] "POST /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:55,670 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:55] "POST /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:57,235 - DEBUG - Fetched state data successfully.
|
||||
2025-02-15 11:16:57,235 - DEBUG - Fetched state data successfully.
|
||||
2025-02-15 11:16:57,239 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:57] "GET /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:57,239 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:57] "GET /add_state HTTP/1.1" 200 -
|
||||
2025-02-15 11:16:57,263 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:57] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:57,263 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:57] "[36mGET /static/css/style.css HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:57,483 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:57] "[36mGET /static/images/icons/pen_blue_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:57,483 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:57] "[36mGET /static/images/icons/pen_blue_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:57,567 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:57] "[36mGET /static/images/icons/bin_red_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:16:57,567 - INFO - 127.0.0.1 - - [15/Feb/2025 11:16:57] "[36mGET /static/images/icons/bin_red_icon.png HTTP/1.1[0m" 304 -
|
||||
2025-02-15 11:20:55,547 - INFO - * Detected change in 'C:\\Users\\ADMIN\\PycharmProjects\\ManagementApplicationt\\main.py', reloading
|
||||
2025-02-15 11:20:55,547 - INFO - * Detected change in 'C:\\Users\\ADMIN\\PycharmProjects\\ManagementApplicationt\\main.py', reloading
|
||||
2025-02-15 11:20:56,800 - INFO - Logging is set up.
|
||||
2025-02-15 11:20:56,800 - INFO - Logging is set up.
|
||||
2025-02-15 11:20:56,835 - WARNING - * Debugger is active!
|
||||
2025-02-15 11:20:56,835 - WARNING - * Debugger is active!
|
||||
2025-02-15 11:20:56,837 - INFO - * Debugger PIN: 558-213-972
|
||||
2025-02-15 11:20:56,837 - INFO - * Debugger PIN: 558-213-972
|
||||
2025-02-15 11:21:04,060 - INFO - * Detected change in 'C:\\Users\\ADMIN\\PycharmProjects\\ManagementApplicationt\\main.py', reloading
|
||||
2025-02-15 11:21:04,060 - INFO - * Detected change in 'C:\\Users\\ADMIN\\PycharmProjects\\ManagementApplicationt\\main.py', reloading
|
||||
2025-02-15 11:21:05,429 - INFO - Logging is set up.
|
||||
2025-02-15 11:21:05,429 - INFO - Logging is set up.
|
||||
2025-02-15 11:21:05,461 - WARNING - * Debugger is active!
|
||||
2025-02-15 11:21:05,461 - WARNING - * Debugger is active!
|
||||
2025-02-15 11:21:05,463 - INFO - * Debugger PIN: 558-213-972
|
||||
2025-02-15 11:21:05,463 - INFO - * Debugger PIN: 558-213-972
|
||||
2025-02-15 11:21:17,911 - INFO - * Detected change in 'C:\\Users\\ADMIN\\PycharmProjects\\ManagementApplicationt\\main.py', reloading
|
||||
2025-02-15 11:21:17,911 - INFO - * Detected change in 'C:\\Users\\ADMIN\\PycharmProjects\\ManagementApplicationt\\main.py', reloading
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -2,14 +2,13 @@ from flask import Blueprint, render_template, request, redirect, url_for, jsonif
|
||||
from flask_login import login_required
|
||||
|
||||
import config
|
||||
import mysql.connector
|
||||
|
||||
from model.Block import Block
|
||||
from model.Utilities import HtmlHelper
|
||||
|
||||
block_bp = Blueprint('block', __name__)
|
||||
|
||||
|
||||
#
|
||||
@block_bp.route('/add_block', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
def add_block():
|
||||
|
||||
@@ -1,28 +1,16 @@
|
||||
import os
|
||||
import config
|
||||
import ast
|
||||
import re
|
||||
from flask_login import login_required
|
||||
import openpyxl
|
||||
from flask import Blueprint, request, render_template, redirect, url_for, jsonify, current_app
|
||||
from flask_login import current_user
|
||||
from flask_login import login_required
|
||||
from flask import Blueprint, request, render_template, redirect, url_for, jsonify
|
||||
|
||||
from model.Log import LogHelper
|
||||
import config
|
||||
from model.FolderAndFile import FolderAndFile
|
||||
|
||||
excel_bp = Blueprint('excel', __name__)
|
||||
|
||||
# Default folder in case config not set
|
||||
# DEFAULT_UPLOAD_FOLDER = 'uploads'
|
||||
|
||||
|
||||
# def get_upload_folder():
|
||||
# """Returns the upload folder from Flask config or default, ensures it exists."""
|
||||
# folder = current_app.config.get('UPLOAD_FOLDER', DEFAULT_UPLOAD_FOLDER)
|
||||
# if not os.path.exists(folder):
|
||||
# os.makedirs(folder)
|
||||
# return folder
|
||||
|
||||
|
||||
# ---------------- Upload Excel File ----------------
|
||||
@excel_bp.route('/upload_excel_file', methods=['GET', 'POST'])
|
||||
@login_required
|
||||
@@ -30,9 +18,6 @@ def upload():
|
||||
if request.method == 'POST':
|
||||
file = request.files.get('file')
|
||||
if file and file.filename.endswith('.xlsx'):
|
||||
# upload_folder = get_upload_folder()
|
||||
# filepath = os.path.join(upload_folder, file.filename)
|
||||
|
||||
filepath =FolderAndFile.get_upload_path(file.filename)
|
||||
|
||||
file.save(filepath)
|
||||
@@ -42,6 +27,9 @@ def upload():
|
||||
f"User {current_user.id} Upload Excel File '{file.filename}'"
|
||||
)
|
||||
return redirect(url_for('excel.show_table', filename=file.filename))
|
||||
else:
|
||||
return redirect(url_for('upload_excel_file'))
|
||||
|
||||
return render_template('uploadExcelFile.html')
|
||||
|
||||
|
||||
@@ -51,7 +39,6 @@ def show_table(filename):
|
||||
global data
|
||||
data = []
|
||||
|
||||
# filepath = os.path.join(get_upload_folder(), filename)
|
||||
filepath = FolderAndFile.get_upload_path(filename)
|
||||
wb = openpyxl.load_workbook(filepath, data_only=True)
|
||||
sheet = wb.active
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
from flask import Blueprint, render_template, send_from_directory
|
||||
from flask_login import login_required, current_user
|
||||
from flask_login import login_required
|
||||
|
||||
from model.PmcReport import PmcReport
|
||||
|
||||
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):
|
||||
@@ -23,6 +25,7 @@ def pmc_report(pmc_no):
|
||||
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):
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
from flask import Blueprint, render_template, request, jsonify, send_file
|
||||
from flask import Blueprint, render_template, request, jsonify
|
||||
from flask_login import login_required, current_user
|
||||
|
||||
from model.Report import ReportHelper
|
||||
from model.Log import LogHelper
|
||||
import config
|
||||
import os
|
||||
import openpyxl
|
||||
from openpyxl.styles import Font
|
||||
from model.ContractorInfo import ContractorInfo
|
||||
from model.FolderAndFile import FolderAndFile
|
||||
|
||||
|
||||
report_bp = Blueprint("report", __name__)
|
||||
@@ -36,7 +31,7 @@ def search_contractor():
|
||||
|
||||
return jsonify(data)
|
||||
|
||||
# ---------------- Contractor Report ----------------
|
||||
# ---------------- Contractor Report by contractor id ----------------
|
||||
@report_bp.route('/contractor_report/<int:contractor_id>')
|
||||
@login_required
|
||||
def contractor_report(contractor_id):
|
||||
@@ -49,145 +44,10 @@ def contractor_report(contractor_id):
|
||||
**data
|
||||
)
|
||||
|
||||
# ---------------- Contractor Download Report by contractor id ----------------
|
||||
@report_bp.route('/download_report/<int:contractor_id>')
|
||||
@login_required
|
||||
def download_report(contractor_id):
|
||||
|
||||
return ReportHelper().download_report(contractor_id=contractor_id)
|
||||
|
||||
|
||||
|
||||
|
||||
# @report_bp.route('/download_report/<int:contractor_id>')
|
||||
# @login_required
|
||||
# def download_report(contractor_id):
|
||||
# try:
|
||||
# connection = config.get_db_connection()
|
||||
# cursor = connection.cursor(dictionary=True)
|
||||
|
||||
# # -------- Contractor Info --------
|
||||
# contractor = ContractorInfo(contractor_id)
|
||||
# contInfo = contractor.contInfo
|
||||
|
||||
# if not contInfo:
|
||||
# return "No contractor found", 404
|
||||
|
||||
# # -------- Invoice Data --------
|
||||
# cursor.callproc('FetchInvoicesByContractor', [contractor_id])
|
||||
|
||||
# invoices = []
|
||||
# for result in cursor.stored_results():
|
||||
# invoices.extend(result.fetchall())
|
||||
|
||||
# if not invoices:
|
||||
# return "No invoice data found"
|
||||
|
||||
# # -------- Create Workbook --------
|
||||
# workbook = openpyxl.Workbook()
|
||||
# sheet = workbook.active
|
||||
# sheet.title = "Contractor Report"
|
||||
|
||||
# # ================= CONTRACTOR DETAILS =================
|
||||
# sheet.append(["SUB CONTRACTOR DETAILS"])
|
||||
# sheet.cell(row=sheet.max_row, column=1).font = Font(bold=True)
|
||||
# sheet.append([])
|
||||
|
||||
# sheet.append(["Name", contInfo.get("Contractor_Name") or ""])
|
||||
# sheet.append(["Mobile No", contInfo.get("Mobile_No") or ""])
|
||||
# sheet.append(["Email", contInfo.get("Email") or ""])
|
||||
# sheet.append(["Village", contInfo.get("Village_Name") or ""])
|
||||
# sheet.append(["Block", contInfo.get("Block_Name") or ""])
|
||||
# sheet.append(["District", contInfo.get("District_Name") or ""])
|
||||
# sheet.append(["State", contInfo.get("State_Name") or ""])
|
||||
# sheet.append(["Address", contInfo.get("Address") or ""])
|
||||
# sheet.append(["GST No", contInfo.get("GST_No") or ""])
|
||||
# sheet.append(["PAN No", contInfo.get("PAN_No") or ""])
|
||||
# sheet.append([])
|
||||
# sheet.append([])
|
||||
|
||||
# # ================= TABLE HEADERS =================
|
||||
# headers = [
|
||||
# "PMC No", "Village", "Invoice No", "Invoice Date", "Work Type","Invoice_Details",
|
||||
# "Basic Amount", "Debit Amount", "After Debit Amount",
|
||||
# "Amount", "GST Amount", "TDS Amount", "SD Amount",
|
||||
# "On Commission", "Hydro Testing", "Hold Amount",
|
||||
# "GST SD Amount", "Final Amount",
|
||||
# "Payment Amount", "TDS Payment",
|
||||
# "Total Amount", "UTR"
|
||||
# ]
|
||||
# sheet.append(headers)
|
||||
# for col in range(1, len(headers) + 1):
|
||||
# sheet.cell(row=sheet.max_row, column=col).font = Font(bold=True)
|
||||
|
||||
# # ================= DATA =================
|
||||
# total_final = 0
|
||||
# total_payment = 0
|
||||
# total_amount = 0
|
||||
|
||||
# for inv in invoices:
|
||||
# row = [
|
||||
# inv.get("PMC_No"),
|
||||
# inv.get("Village_Name"),
|
||||
# inv.get("invoice_no"),
|
||||
# inv.get("Invoice_Date"),
|
||||
# inv.get("Work_Type"),
|
||||
# inv.get("Invoice_Details"),
|
||||
# inv.get("Basic_Amount"),
|
||||
# inv.get("Debit_Amount"),
|
||||
# inv.get("After_Debit_Amount"),
|
||||
# inv.get("Amount"),
|
||||
# inv.get("GST_Amount"),
|
||||
# inv.get("TDS_Amount"),
|
||||
# inv.get("SD_Amount"),
|
||||
# inv.get("On_Commission"),
|
||||
# inv.get("Hydro_Testing"),
|
||||
# inv.get("Hold_Amount"),
|
||||
# inv.get("GST_SD_Amount"),
|
||||
# inv.get("Final_Amount"),
|
||||
# inv.get("Payment_Amount"),
|
||||
# inv.get("TDS_Payment_Amount"),
|
||||
# inv.get("Total_Amount"),
|
||||
# inv.get("UTR")
|
||||
# ]
|
||||
|
||||
# total_final += float(inv.get("Final_Amount") or 0)
|
||||
# total_payment += float(inv.get("Payment_Amount") or 0)
|
||||
# total_amount += float(inv.get("Total_Amount") or 0)
|
||||
|
||||
# sheet.append(row)
|
||||
|
||||
# # ================= TOTAL ROW =================
|
||||
# sheet.append([])
|
||||
# sheet.append([
|
||||
# "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
|
||||
# "TOTAL",
|
||||
# total_final,
|
||||
# total_payment,
|
||||
# "",
|
||||
# total_amount,
|
||||
# ""
|
||||
# ])
|
||||
|
||||
# # ================= AUTO WIDTH =================
|
||||
# for column in sheet.columns:
|
||||
# max_length = 0
|
||||
# column_letter = column[0].column_letter
|
||||
# for cell in column:
|
||||
# if cell.value:
|
||||
# max_length = max(max_length, len(str(cell.value)))
|
||||
# sheet.column_dimensions[column_letter].width = max_length + 2
|
||||
|
||||
# # ================= SAVE FILE =================
|
||||
# # output_folder = "downloads"
|
||||
# # os.makedirs(output_folder, exist_ok=True)
|
||||
# # filename = f"Contractor_Report_{contInfo.get('Contractor_Name')}.xlsx"
|
||||
# # output_file = os.path.join(output_folder, filename)
|
||||
|
||||
# filename = f"Contractor_Report_{contInfo.get('Contractor_Name')}.xlsx"
|
||||
# output_file = FolderAndFile.get_download_path(filename)
|
||||
# workbook.save(output_file)
|
||||
|
||||
# return send_file(output_file, as_attachment=True)
|
||||
|
||||
# except Exception as e:
|
||||
# return str(e)
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user