Compare commits

..

2 Commits

Author SHA1 Message Date
= e3625793da
Added sending logs to my remote folder. 3 years ago
= cadf5f4b0b
Changed ILReport to ignore provided consolidatedbase path. Confirms this 3 years ago
  1. 1
      .gitignore
  2. 61
      create_dir_schema.py
  3. 1
      report_config_termplate.toml
  4. 22
      settings.toml
  5. 31
      src/il_extract.py
  6. 6
      src/il_reports.py
  7. 8
      todo.md

1
.gitignore vendored

@ -4,6 +4,7 @@ dist/
InputFiles/
__pycache__/
2023/
ilr_test/
*.lnk
*.spec

@ -0,0 +1,61 @@
from pathlib import Path
from dataclasses import dataclass
import os
from datetime import datetime, timedelta, date
import shutil as sh
class Report:
def __init__(self, sample_file: str, sample_folder: str):
self.sample_file: Path = Path(sample_file)
self.folder_name: Path = Path(sample_folder)
def create_record(self, location: Path) -> Path|None:
# Create the folder
fp = Path(location, self.folder_name)
def main():
folders = [
Report(r"InputFiles\2022.09.02_ACH_C", r"ACH"),
Report(r"InputFiles\2022.09.02_PROGPAY_BER", r"CHECKS LIVE"),
Report(r"InputFiles\2022.09.01_VMCC_BER", r"CREDIT CARDS"),
Report(r"InputFiles\2022.09.02_DISPOSITION_PM_C", r"DISPOSITION REPORTING"),
Report(r"InputFiles\2022.09.02_LOCKBOX_094_C", r"LOCKBOX"),
Report(r"InputFiles\2022.09.02_PBP_EPAY_DPS_BER", r"PAY BY PHONE"),
Report(r"InputFiles\2022.12.30_PBP_EPAY_RETURNS_BER", r"RETURN REPORTING"),
Report(r"InputFiles\2022.09.01_PUB_WIRES_BER", r"WIRES"),
]
folder_date = date(2023,1,1)
while folder_date < date(2024,1,1):
year = folder_date.strftime("%Y")
month = folder_date.strftime("%Y.%m")
day = folder_date.strftime("%Y.%m.%d")
date_path = Path(year, month, day)
for rp in folders:
# Create folder
fold_p = Path(date_path, rp.folder_name)
print(f"Creating filepath: {fold_p}")
os.makedirs(fold_p, exist_ok=True)
file_p = Path(fold_p, rp.sample_file.name)
print(f"Cp {rp.sample_file} into {file_p}")
sh.copyfile(rp.sample_file, file_p )
folder_date += timedelta(days=1)
if __name__ == "__main__":
main()

@ -1 +0,0 @@
name = "Test Name"

@ -1,14 +1,14 @@
debug = true
consolidatedBasePath = '\\leafnow.com\shared\Accounting\CASH APPS\2023'
consolidatedBasePath = ""
[defaultLocations]
ach = ''
disp = ''
gl = ''
lb = ''
minv =''
niv = ''
ren = ''
pymt = ''
uap =''
pastdue = ''
ach = "//leafnow.com/shared/Business Solutions/Griff/Code/InfoLeaseExtract/2023/2023.03/2023.03.01/ACH"
disp = ""
gl = ""
lb = "//leafnow.com/shared/Business Solutions/Griff/Code/InfoLeaseExtract/2023/2023.03/2023.03.01/LOCKBOX"
minv = ""
niv = ""
ren = ""
pymt = ""
uap = ""
pastdue = ""

@ -2,20 +2,25 @@ from ui_ile_main_window import Ui_MainWindow
import sys
import os
import pandas as pd
import json
from PyQt5 import QtWidgets
from datetime import datetime as dt
import il_reports as ilx #TODO redo aliasing
from logging import debug, DEBUG, basicConfig, exception
from logging import debug, DEBUG, basicConfig, exception, warn
from tomllib import load
from tomli_w import dump
from shutil import copyfile
from pathlib import Path
from getpass import getuser
with open("settings.toml", mode='rb') as s:
settings = load(s)
#if settings["debug"]:
basicConfig(filename='debug.log', mode='w', encoding='utf-8', level=DEBUG)
basicConfig(filename='debug.log', mode='w', encoding='utf-8',
level=DEBUG,
format="%(asctime)s %(message)s",
)
debug("\n\n\n########################### VERSION = 3.3 ###########################\n\n\n")
debug("\n\n\n########################### VERSION = 3.4 ###########################\n\n\n")
debug("Running main.py...")
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
"""
@ -307,3 +312,21 @@ if __name__ == "__main__":
app.exec()
except Exception as e:
exception(f"HIGH LEVEL EXECPTION: {e}")
finally:
log_path = Path(os.curdir,'debug.log')
remote_log_folder = Path(
r"\\leafnow.com\public\Business Solutions\Apps\AppSources\Logging\ILE",
)
if not remote_log_folder.exists:
os.mkdir(remote_log_folder)
rlog_file = f"{getuser()}_ile.log"
try:
copyfile(
log_path,
Path(remote_log_folder, rlog_file)
)
except Exception as e:
warn(f"Failed to save remote log: {remote_log_folder}/{rlog_file}!")

@ -11,7 +11,7 @@ from hashlib import md5
import openpyxl as pxl
from tomllib import load
# V332 | 05/24/23
# V3.4 | 06/15/23
with open("settings.toml", mode='rb') as s:
settings = load(s)
@ -76,7 +76,7 @@ class ILReport:
if dataframe.empty:
warn(f"ILReport: resulting dataframe was empty! Exiting with None.")
return dataframe
self._append_to_consolidated_report(dataframe, settings["consolidatedBasePath"])
self._append_to_consolidated_report(dataframe)
return dataframe
def _append_to_consolidated_report(self, dataframe_to_append: DataFrame,
@ -126,7 +126,6 @@ class ILReport:
else:
month_dir = reports_base_path
report_name: Path = Path(f"{report_month} ConsolidatedReport.xlsx")
debug(f"{month_dir=}")
@ -134,7 +133,6 @@ class ILReport:
save_path = Path(month_dir, report_name)
debug(f"Consolidated Report {save_path=}")
consolidated_df = dataframe_to_append.copy(deep=True)
consolidated_df["ExtractDate"] = report_date
consolidated_df.fillna('--', inplace=True)

@ -8,10 +8,10 @@
- [X] LOCKBOX
- [X] PAY BY PHONE
- [X] WIRES
- [ ] RETURNS ACH
- [ ] RETURNS Portal *(new addition)*
- [X] RETURNS ACH
- [X] RETURNS Portal *(new addition)*
- [ ] Adjust pyinstaller spec for new file structure
- [X] Adjust pyinstaller spec for new file structure
- [ ] Function to recap year
- [ ] Fix Logging
@ -33,7 +33,5 @@ Generate monthly consolidated reports for each month in a year
- [ ] Simpify & standardize row/data parsing
## Completed last commit
---
Loading…
Cancel
Save