Merge pull request #92 from Hestia-Homes/feature/fix_month_end

quick fix for script
This commit is contained in:
Jun-te Kim 2025-10-17 10:28:45 +01:00 committed by GitHub
commit d5bd06e388
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -168,29 +168,31 @@ if not epc_ns.empty:
filtered_dfs.append(epc_ns)
final_df = None
if filtered_dfs:
final_df = pd.concat(filtered_dfs).reset_index(drop=True)
final_df = pd.concat(filtered_dfs).reset_index(drop=True)
if final_df:
final_df["job_type"] = final_df["job_type"].str.lower()
rate_card_df["job_type"] = rate_card_df["job_type"].str.lower()
final_df["job_type"] = final_df["job_type"].str.lower()
rate_card_df["job_type"] = rate_card_df["job_type"].str.lower()
# Now perform the merge
combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left")
import datetime
timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M')
# Now perform the merge
combined_with_rates = final_df.merge(rate_card_df, on="job_type", how="left")
import datetime
timestamp = datetime.datetime.now().strftime('%Y-%m-%d_%H-%M')
# Upload to sharepoint
attribute = ['address', 'client', 'job_type', 'rate']
master_folder_name = "2501 Accent housing"
file_name = f"{master_folder_name}_{timestamp}.xlsx"
combined_with_rates[attribute].to_excel(file_name, index=False)
# Upload to sharepoint
attribute = ['address', 'client', 'job_type', 'rate']
master_folder_name = "2501 Accent housing"
file_name = f"{master_folder_name}_{timestamp}.xlsx"
combined_with_rates[attribute].to_excel(file_name, index=False)
file_path = os.path.abspath(file_name)
file_path = os.path.abspath(file_name)
upload_to_month_end_folder(file_name, file_path, master_folder_name)
upload_to_month_end_folder(file_name, file_path, master_folder_name)
invoice_name = "rate_card.xlsx"
file_path = os.path.abspath(invoice_name)
rate_card_df.to_excel(invoice_name, index=False)
upload_to_month_end_folder(invoice_name, file_path, master_folder_name)
invoice_name = "rate_card.xlsx"
file_path = os.path.abspath(invoice_name)
rate_card_df.to_excel(invoice_name, index=False)
upload_to_month_end_folder(invoice_name, file_path, master_folder_name)