diff --git a/budget.svg b/budget.svg index a9053f2..a8279b9 100644 --- a/budget.svg +++ b/budget.svg @@ -6,7 +6,7 @@ - 2025-06-21T20:31:55.648539 + 2025-06-21T21:06:45.992348 image/svg+xml @@ -35,7 +35,7 @@ L 307.150694 140.046626 L 307.150694 111.6 L 288.409091 111.6 z -" clip-path="url(#p3a0fb5d9d6)" style="fill: #1f77b4"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> +" clip-path="url(#pfb945f976e)" style="fill: #007e97; fill-opacity: 0.6"/> @@ -1036,7 +1036,7 @@ z - + + diff --git a/compta.svg b/compta.svg index 4a140ba..c36f6be 100644 --- a/compta.svg +++ b/compta.svg @@ -1,12 +1,12 @@ - + - 2025-06-21T20:31:55.979272 + 2025-06-21T21:06:46.225677 image/svg+xml @@ -22,280 +22,296 @@ - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> - +" clip-path="url(#p3eb6e461e1)" style="fill: #007e97; fill-opacity: 0.6"/> + + + + + + - + - + - + - + - + - + - + - + - + - + - + - + - + @@ -1616,7 +1632,7 @@ z - + - + - + @@ -1743,7 +1759,7 @@ z - + - + - + + diff --git a/config b/config index 5d56a87..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=. \ No newline at end of file +save_directory=/var/www/bsc.pbblanc.fr/wp-content/uploads/compta diff --git a/main.py b/main.py index 1738711..5338421 100644 --- a/main.py +++ b/main.py @@ -65,7 +65,7 @@ def create_accounting_sankey(cursor, save_dir): ro_name = 'reserves au début de l\'année' ra_name = 'reserves aujourd\'hui' t_name = 'Total' - NR.append((ro_name, reserves, {'label_pos':'left'})) + NR.append((ro_name, reserves, {'label_pos':'left', 'color':'#007e97'})) flows.append((ro_name, t_name, reserves)) # lister les comptes de charges et produit @@ -84,15 +84,15 @@ def create_accounting_sankey(cursor, save_dir): if tmp_tot > 0 : NC.append((a.label, tmp_tot, {'label_pos':'right', 'color':'#007e97' })) flows.append((t_name, a.label, tmp_tot)) - else : + else : tmp_tot = tot_cred-tot_deb if tmp_tot > 0 : tot += tmp_tot NR.append((a.label, tmp_tot, {'label_pos':'left', 'color':'#007e97' })) flows.append((a.label, t_name, tmp_tot)) - - NC.insert(0, (ra_name, tmp_res, {'label_pos':'right'})) - flows.append((t_name, ra_name, tmp_res)) + + NC.insert(0, (ra_name, tmp_res, {'label_pos':'right', 'color':'#007e97'})) + flows.insert(0, (t_name, ra_name, tmp_res)) nodes = [ NR, [('Total', tot, {'label_pos':'top', 'color':'#007e97'})], @@ -111,7 +111,8 @@ def create_accounting_sankey(cursor, save_dir): plt.close() def get_income_and_expense_accounts(cursor): - print("get_income_and_expense_accounts") + VERBOSE = False + if VERBOSE : print("get_income_and_expense_accounts") cursor.execute( "SELECT account_number, label FROM llx_accounting_account WHERE fk_pcg_version = 'PCG-BSC' AND active = 1;" ) @@ -121,12 +122,13 @@ def get_income_and_expense_accounts(cursor): if (tmp == '6' or tmp == '7') and int(account_number) > 10: accounts.append(Account(label, account_number, int(tmp))) - [print(f'account {a.number} / {a.label}') for a in accounts] + if VERBOSE : [print(f'account {a.number} / {a.label}') for a in accounts] return accounts def get_bank_reserves(cursor, date:str): - print('get_bank_reserves') + VERBOSE = False + if VERBOSE : print('get_bank_reserves') total = 0 cursor.execute( "SELECT piece_num, numero_compte, label_compte, doc_date, code_journal, debit, credit FROM llx_accounting_bookkeeping WHERE (numero_compte = ? OR numero_compte = ?) AND doc_date = ? AND code_journal = ?;", @@ -134,9 +136,9 @@ def get_bank_reserves(cursor, date:str): ) for piece_num, numero_compte, label_compte, doc_date, code_journal, debit, credit in cursor: #print(piece_num, numero_compte, label_compte, doc_date, code_journal, debit, credit, sep=" | ") - print(f'ajout de : {debit} provenant du compte {label_compte} au total') + if VERBOSE : print(f'ajout de : {debit} provenant du compte {label_compte} au total') total += debit - print(f'total = {total}') + if VERBOSE : print(f'total = {total}') return total @@ -176,7 +178,6 @@ def import_csv(csv:str): def extract_value(content:str, param:str): tmp = re.search(rf'define...{param}.+', content) - print('test') if tmp is not None: return tmp.group().split(',')[1].split('\'')[1] else: @@ -184,6 +185,7 @@ def extract_value(content:str, param:str): def get_sum_of_operations(cursor, date:str, account:Account): + VERBOSE = False tot_cred = tot_deb = 0 cursor.execute( "SELECT piece_num, numero_compte, label_compte, doc_date, code_journal, debit, credit FROM llx_accounting_bookkeeping WHERE numero_compte = ? AND doc_date >= ?", @@ -193,7 +195,7 @@ def get_sum_of_operations(cursor, date:str, account:Account): tot_cred += credit tot_deb += debit - 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) @@ -256,6 +258,7 @@ def create_budget_sankey( if __name__ == "__main__": + VERBOSE = False conf = cp.ConfigParser() conf.read('config') @@ -278,5 +281,6 @@ if __name__ == "__main__": print(msg) print(f'wp-config = {path_wp_config}') - respo = input('Appuyer sur entrée pour terminer') + if VERBOSE : + respo = input('Appuyer sur entrée pour terminer')