ajout copie db doli pour test

This commit is contained in:
pb 2025-10-26 21:46:30 +01:00
parent 5d1ac9ad53
commit 279c905d87
4 changed files with 20 additions and 10 deletions

6
bin/cron-instructions Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
DIR=~/projets/infographie-compta-bsc
source "$DIR/.venv/bin/activate"
python main.py
deactivate

4
config
View File

@ -1,4 +1,4 @@
[path] [path]
wp-config=wp-config.php wp-config=/var/www/bricolesocialclub.org/wp-config.php
budget=budget.csv budget=budget.csv
save_directory=. save_directory=/var/www/bsc.pbblanc.fr/wp-content/uploads/compta

4
config.ori Normal file
View File

@ -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

16
main.py
View File

@ -47,13 +47,13 @@ def main(path_b:str,
budget = sort_des_budget(budget, 0) budget = sort_des_budget(budget, 0)
#create_budget_sankey(budget,save_dir) #create_budget_sankey(budget,save_dir)
db_infos = get_db_infos(path_wp) db_infos = get_db_infos(path_wp)
#cursor = connect_mariadb(db_infos) cursor = connect_mariadb(db_infos)
#create_accounting_sankey(cursor, save_dir) create_accounting_sankey(cursor, save_dir)
#finances, last_update = import_finances(cursor) finances, last_update = import_finances(cursor)
finances = import_csv(path_b) #finances = import_csv(path_b)
finances = test_finance(finances) #finances = test_finance(finances)
last_update = rf'2025-01-01' #last_update = rf'2025-01-01'
finances = sort_des_budget(finances, 0) finances = sort_des_budget(finances, 0)
tot_rev = get_total_revenues(finances) tot_rev = get_total_revenues(finances)
tot_ch = get_total_charges(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 : for piece_num, numero_compte, label_compte, doc_date, code_journal, debit, credit in cursor :
tot_cred += credit tot_cred += credit
tot_deb += debit tot_deb += debit
if doc_date > last_entrie : if str(doc_date) > last_entrie :
last_entrie = doc_date last_entrie = str(doc_date)
if VERBOSE : print(f'pour le compte {account.number} : credit = {tot_cred} / debit = {tot_deb} à partir du {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 return int(tot_deb), int(tot_cred), last_entrie