Skip to content

Commit

Permalink
fix row and import new travel data
Browse files Browse the repository at this point in the history
  • Loading branch information
mrzaizai2k committed Oct 11, 2024
1 parent cffbb5d commit 8cd9da3
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion config/data2.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"fixed_lines": [
{
"title": "Hotel",
"amount": 412.5,
"amount": 0,
"payment_method": "self paid",
"with_breakfast": true,
"can_book_again": true
Expand Down
2 changes: 1 addition & 1 deletion config/data3.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"invoice_info": {
"name": "Stiboy Dirk",
"name": "Tümmler Dirk",
"project_number": "V240045",
"customer": "Magua",
"city": "Krakau",
Expand Down
2 changes: 1 addition & 1 deletion config/data4.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"invoice_info": {
"name": "Stiboy Dirk",
"name": "Tümmler Dirk",
"project_number": "V240045",
"is_in_egw": true,
"currency": "EUR",
Expand Down
Binary file modified config/travel_expenses-2024.xlsx
Binary file not shown.
5 changes: 3 additions & 2 deletions src/export_excel/importData.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def handle_add_service(json_data, excel_des_path, sheet_name):

# Handle with hotel
for fixed_line in json_data['fixed_lines']:
if fixed_line['title'] == 'Hotel':
if fixed_line['title'] == 'Hotel' and float(fixed_line['amount']) != 0.0:
if fixed_line['payment_method'] == 'self paid':
value_to_write = fixed_line['amount']
cell = f'E{line}'
Expand Down Expand Up @@ -376,12 +376,13 @@ def fix_date_with_hotel(excel_des_path, sheet_name, line):
'''
Fixed date if hotel enable
'''
row = line
last_line = get_last_row(excel_des_path, sheet_name, 'A', line)

value_to_write = 24
cell = f'C{line}'
write_data(excel_des_path, sheet_name, cell, value_to_write)

for row in range(line + 1, last_line - 1):
value_to_write = 0
cell = f'B{row}'
Expand Down
1 change: 1 addition & 0 deletions src/export_excel/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def export_json_to_excel(invoice_pairs: list[tuple[dict, dict]], logger=None):

# print(invoice_1['invoice_info'])
# print(invoice_2['invoice_info'])

for i in range(2):
employee_expense_report_path, output_2_excel = export_json_to_excel(invoice_pairs =[(invoice_1, invoice_2), (invoice_1_b, invoice_2_b)],)
print("employee_expense_report_path, output_2_excel", employee_expense_report_path, output_2_excel)
Expand Down
20 changes: 10 additions & 10 deletions src/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ def _attach_files(self, message, attachment_paths):
config = read_config(path=config_path)
email_sender = EmailSender(config=config, logger=None)

# email_sender.send_email(
# email_type="modify_invoice_remind",
# receivers=None,
# # attachment_paths=["output/Stdi_08_24.xlsx", "output/1.4437_10578_A3DS GmbH_04_2024 .xlsm"], # List of file paths
# )

email_sender.send_email(
email_type="send_excel",
receivers=["[email protected]"],
attachment_paths=["output/Stdi_08_24.xlsx", "output/1.4437_10578_A3DS GmbH_04_2024 .xlsm", "notfoundfile.txt", "output/Tüdi_08_24.xlsx"], # List of file paths
)
email_type="modify_invoice_remind",
receivers=None,
# attachment_paths=["output/Stdi_08_24.xlsx", "output/1.4437_10578_A3DS GmbH_04_2024 .xlsm"], # List of file paths
)

# email_sender.send_email(
# email_type="send_excel",
# receivers=["[email protected]"],
# attachment_paths=["output/Stdi_08_24.xlsx", "output/1.4437_10578_A3DS GmbH_04_2024 .xlsm", "notfoundfile.txt", "output/Tüdi_08_24.xlsx"], # List of file paths
# )

0 comments on commit 8cd9da3

Please sign in to comment.