diff --git a/.gitignore b/.gitignore index 695edac..aabeb30 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ build/ venv/ dist/ -IL_InputFiles/ +InputFiles/ __pycache__/ *.spec diff --git a/assets/checkedCircle.svg b/assets/checkedCircle.svg deleted file mode 100644 index e3afbdc..0000000 --- a/assets/checkedCircle.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/copy.svg b/assets/copy.svg deleted file mode 100644 index f23e8f2..0000000 --- a/assets/copy.svg +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/assets/excel.svg b/assets/excel.svg deleted file mode 100644 index 99c6cd6..0000000 --- a/assets/excel.svg +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/assets/extract.ico b/assets/extract.ico deleted file mode 100644 index faab094..0000000 Binary files a/assets/extract.ico and /dev/null differ diff --git a/assets/extract.svg b/assets/extract.svg deleted file mode 100644 index c392432..0000000 --- a/assets/extract.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/fileSearch.svg b/assets/fileSearch.svg deleted file mode 100644 index 6e04a1c..0000000 --- a/assets/fileSearch.svg +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/assets/folder.svg b/assets/folder.svg deleted file mode 100644 index 5488499..0000000 --- a/assets/folder.svg +++ /dev/null @@ -1,2 +0,0 @@ - - diff --git a/assets/maximize.svg b/assets/maximize.svg deleted file mode 100644 index 1d60cee..0000000 --- a/assets/maximize.svg +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/assets/process.svg b/assets/process.svg deleted file mode 100644 index e20b6ba..0000000 --- a/assets/process.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/settings.svg b/assets/settings.svg deleted file mode 100644 index 4debab2..0000000 --- a/assets/settings.svg +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/settings.json b/settings.json new file mode 100644 index 0000000..7a24d73 --- /dev/null +++ b/settings.json @@ -0,0 +1 @@ +{"debug": true, "consolidatedBasePath": ".", "defaultLocations": {"ach": "Z:/Business Solutions/Griff/Code/InfoLeaseExtract/InputFiles", "disp": "", "gl": "", "lb": "Z:/Business Solutions/Griff/Code/InfoLeaseExtract/InputFiles", "minv": "", "niv": "", "ren": "", "pymt": "Z:/Business Solutions/Griff/Code/InfoLeaseExtract/InputFiles", "uap": "", "pastdue": ""}} \ No newline at end of file diff --git a/src/__init__.py b/src/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/src/il_extract.py b/src/il_extract.py index 23a746f..2dae845 100644 --- a/src/il_extract.py +++ b/src/il_extract.py @@ -11,8 +11,8 @@ from logging import debug, DEBUG, basicConfig with open("settings.json") as s: settings = json.loads(s.read()) - if settings["debug"]: - basicConfig(filename='debug.log', encoding='utf-8', level=DEBUG) + #if settings["debug"]: + basicConfig(filename='debug.log', mode='w', encoding='utf-8', level=DEBUG) debug("\n\n\n########################### VERSION = 3.10 ###########################\n\n\n") debug("Running main.py...") @@ -290,14 +290,16 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): debug(f"report_type_change | inputFile: {self.inputFile}") debug(f"report_type_change | outputFile: {self.outputFile}") self.check_ready_to_process() - -# Defines the app -app = QtWidgets.QApplication(sys.argv) -# Sets the style -app.setStyle("Fusion") -# Builds the main window -window = MainWindow() -window.setWindowTitle("IL Extract") -window.show() -# Starts the app -app.exec() + + +if __name__ == "__main__": + # Defines the app + app = QtWidgets.QApplication(sys.argv) + # Sets the style + app.setStyle("Fusion") + # Builds the main window + window = MainWindow() + window.setWindowTitle("IL Extract") + window.show() + # Starts the app + app.exec() diff --git a/src/il_reports.py b/src/il_reports.py index fb93196..5867d1f 100644 --- a/src/il_reports.py +++ b/src/il_reports.py @@ -8,7 +8,7 @@ import numpy as np from glob import glob from logging import debug, DEBUG, basicConfig, warn, error -# V3.1 | 01/19/23 +# V3.2 | 04/21/23 with open("settings.json") as s: settings = json.loads(s.read()) @@ -70,10 +70,14 @@ class ILReport: sheet_name = "CREDIT CARDS" elif re.search("(?i)lockbox", self.location) != None: sheet_name = "LOCKBOX" + elif re.search("(?i)PBP_EPAY_RETURNS_BER", self.location) != None: + sheet_name = "RETURNS ACH" elif re.search("(?i)epay", self.location) != None: sheet_name = "PAY BY PHONE" elif re.search("(?i)wires", self.location) != None: sheet_name = "WIRES" + elif re.search("(?i)RETURNS_BER", self.location) != None: + sheet_name = "RETURNS Portal" else: return None @@ -102,18 +106,25 @@ class ILReport: # We need to read the dataframe in the current monthly report # Check that we are not adding matching data # Save the new report - current_data: DataFrame = pd.read_excel(month_summary_file[0], sheet_name=sheet_name) - new_data_len = len(dataframe_to_append) - cur_first_col = current_data.iloc[len(current_data)-new_data_len:,0].to_list() - new_first_col = dataframe_to_append.iloc[:,0].to_list() - if cur_first_col == new_first_col: - debug(f"Consolidated Report | Data is same as previous! Skipping!") - return None + #FIXME: This is so hacky it's embaressing + add_headers = False + try: + current_data: DataFrame = pd.read_excel(month_summary_file[0], sheet_name=sheet_name) + new_data_len = len(dataframe_to_append) + cur_first_col = current_data.iloc[len(current_data)-new_data_len:,0].to_list() + new_first_col = dataframe_to_append.iloc[:,0].to_list() + if cur_first_col == new_first_col: + debug(f"Consolidated Report | Data is same as previous! Skipping!") + return None + except ValueError as ve: + ve == ValueError(f"Worksheet named '{sheet_name} not found") + current_data = [] + add_headers = True # We need to find the start cols (where the new data should go) try: with pd.ExcelWriter(save_path, engine='openpyxl', mode='a',if_sheet_exists="overlay") as writer: debug(f"Consolidated Report | {sheet_name}: Saving data as: {report_name}") - dataframe_to_append.to_excel(writer, index=False, sheet_name=sheet_name,startrow=len(current_data),header=False) + dataframe_to_append.to_excel(writer, index=False, sheet_name=sheet_name,startrow=len(current_data),header=add_headers) except Exception as e: error(f"[E] Failed to append to consolidated report! {sheet_name}:\n{e}") diff --git a/src/settings.json b/src/settings.json deleted file mode 100644 index a0bfaa5..0000000 --- a/src/settings.json +++ /dev/null @@ -1 +0,0 @@ -{"debug": false, "consolidatedBasePath": "leafnow.com/shared/cashapps", "defaultLocations": {"ach": "", "disp": "", "gl": "", "lb": "", "minv": "", "niv": "", "ren": "", "pymt": "", "uap": "", "pastdue": ""}} \ No newline at end of file diff --git a/todo.md b/todo.md index 1c382b1..6ba7a89 100644 --- a/todo.md +++ b/todo.md @@ -2,19 +2,24 @@ ## Priority - [ ] Bring back in consolidated reports - - [ ] ACH - - [ ] CHECKS_LIVE - - [ ] CREDIT - - [ ] LOCKBOX - - [ ] PAY BY PHONE - - [ ] WIRES + - [X] ACH + - [X] CHECKS_LIVE + - [X] CREDIT + - [X] LOCKBOX + - [X] PAY BY PHONE + - [X] WIRES - [ ] RETURNS ACH - [ ] RETURNS Portal *(new addition)* - [ ] Adjust pyinstaller spec for new file structure +- [ ] Function to recap year +- [ ] Fix Logging + ## Feature Goals - [ ] Year Walkthrough report +- [ ] 'In Progress' notification/spinner +- Speed up ACH/All Generate monthly consolidated reports for each month in a year - Must generate IL Extract report where nesseary