diff --git a/bin/cron-instructions b/bin/cron-instructions new file mode 100755 index 0000000..2661ccc --- /dev/null +++ b/bin/cron-instructions @@ -0,0 +1,6 @@ +#!/bin/bash +DIR=~/projets/infographie-compta-bsc +source "$DIR/.venv/bin/activate" +python main.py +deactivate + diff --git a/config b/config index 29b540b..a13aef1 100644 --- a/config +++ b/config @@ -1,4 +1,4 @@ [path] -wp-config=wp-config.php +wp-config=/var/www/bricolesocialclub.org/wp-config.php budget=budget.csv -save_directory=. +save_directory=/var/www/bsc.pbblanc.fr/wp-content/uploads/compta diff --git a/config.ori b/config.ori new file mode 100644 index 0000000..a13aef1 --- /dev/null +++ b/config.ori @@ -0,0 +1,4 @@ +[path] +wp-config=/var/www/bricolesocialclub.org/wp-config.php +budget=budget.csv +save_directory=/var/www/bsc.pbblanc.fr/wp-content/uploads/compta diff --git a/main.py b/main.py index 8ad527d..42f78c3 100644 --- a/main.py +++ b/main.py @@ -47,13 +47,13 @@ def main(path_b:str, budget = sort_des_budget(budget, 0) #create_budget_sankey(budget,save_dir) db_infos = get_db_infos(path_wp) - #cursor = connect_mariadb(db_infos) - #create_accounting_sankey(cursor, save_dir) + cursor = connect_mariadb(db_infos) + create_accounting_sankey(cursor, save_dir) - #finances, last_update = import_finances(cursor) - finances = import_csv(path_b) - finances = test_finance(finances) - last_update = rf'2025-01-01' + finances, last_update = import_finances(cursor) + #finances = import_csv(path_b) + #finances = test_finance(finances) + #last_update = rf'2025-01-01' finances = sort_des_budget(finances, 0) tot_rev = get_total_revenues(finances) tot_ch = get_total_charges(finances) @@ -456,8 +456,8 @@ def get_sum_of_operations(cursor, date:str, account:Account): for piece_num, numero_compte, label_compte, doc_date, code_journal, debit, credit in cursor : tot_cred += credit tot_deb += debit - if doc_date > last_entrie : - last_entrie = doc_date + if str(doc_date) > last_entrie : + last_entrie = str(doc_date) if VERBOSE : print(f'pour le compte {account.number} : credit = {tot_cred} / debit = {tot_deb} à partir du {date}') return int(tot_deb), int(tot_cred), last_entrie