#fiexport - An easy way to export financial reports #Copyright (C) 2024 19atlas #This program is free software: you can redistribute it and/or modify #it under the terms of the GNU General Public License as published by #the Free Software Foundation, either version 3 of the License, or #(at your option) any later version. #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #GNU General Public License for more details. #You should have received a copy of the GNU General Public License #along with this program. If not, see . from datetime import date import os # get date today = date.today() dt_string = today.strftime("%Y-%m") print("Some questions for that file\npls month should be like 01 or 12\n") print("What is date for file? (Y-m format) [", dt_string,"] ") dt_string = str(input()) if (dt_string == ""): dt_string = today.strftime("%Y-%m") month_int = dt_string.split("-",1)[1].replace(" ", "") if (month_int == ""): print("error month") exit() year_int = dt_string.split("-",1)[0].replace(" ", "") if (year_int == ""): print("error year") exit() print("set for file => date is",dt_string, "year is", year_int, "month is", month_int) # for writing get number of month change to text # for example 1 -> January month_name_eng = { "01": "January", "02": "February", "03": "March", "04": "April", "05": "May", "06": "June", "07": "July", "08": "August", "09": "September", "10": "October", "11": "November", "12": "December" } short_month_name = { "01": "jan", "02": "feb", "03": "mar", "04": "apr", "05": "may", "06": "jun", "07": "jul", "08": "aug", "09": "sep", "10": "oct", "11": "nov", "12": "dec" } month_name_tur = { "01": "Ocak", "02": "Şubat", "03": "Mart", "04": "Nisan", "05": "Mayıs", "06": "Haziran", "07": "Temmuz", "08": "Ağustos", "09": "Eylül", "10": "Ekim", "11": "Kasım", "12": "Aralık" } month_name_por_BR = { "01": "Janeiro", "02": "Fevereiro", "03": "Março", "04": "Abril", "05": "Maio", "06": "Junho", "07": "Julho", "08": "Agosto", "09": "Setembro", "10": "Outubro", "11": "Novembro", "12": "Dezembro" } # writing dates writing_date_eng = month_name_eng[month_int] + " " + year_int writing_date_tur = month_name_tur[month_int] + " " + year_int writing_date_por_BR = month_name_por_BR[month_int] + " " + year_int # for html id html_id_n = short_month_name[month_int] + year_int[-2::] + "finreport" # make dir that eng/ tur/ por_BR/ langfolder_names = ["tur", "eng", "por_BR"] for folder in langfolder_names: os.makedirs(folder, exist_ok=True) print("Dirs was created\nnow please answer financial questions (maybe boring) (dont use currency only number) ") LibP_total_str = str(input("LiberaPay total [0] = ")) XMR_total_str = str(input("Monero (XMR) total [0] = ")) servers_usage_str = str(input("all servers usage (don't forget that is text) = ")) totally_used_s = str(input("all money used [0] = ")) what_we_have = str(input("what we have? [0] = ")) XMR_wehave = str(input("XMR conversion rate? [0] = ")) XMR_conv_date = str(input("XMR cheking date? (Dth MMM YYYY) = ")) extramoneyis_dividedto_team = str(input("Was extra money shared among team? [The extra money has not been yet divided among the team] = ")) # if is that NULL if (LibP_total_str == ""): LibP_total_str = "0" if (XMR_total_str == ""): XMR_total_str = "0" if (servers_usage_str == ""): servers_usage_str = "dont used any server" if (totally_used_s == ""): totally_used_s = "0" if (what_we_have == ""): what_we_have = "0" if (XMR_wehave == ""): XMR_wehave = "0" if (extramoneyis_dividedto_team == ""): extramoneyis_dividedto_team = "The extra money has not been yet divided among the team." remaining = str(float(what_we_have) + float(XMR_wehave)) #maybe that is make performance issue if (remaining == ""): print("remaining is NULL please check again...") # output html's # English eng_f = open(os.path.join("eng", dt_string + ".html"), "w") eng_f.write("\n") eng_f.write('\n') eng_f.write("\n") eng_f.write(' \n') eng_f.write(' \n') eng_f.write(' \n') eng_f.write(' \n') eng_f.write(' \n') eng_f.write(' \n') eng_f.write(" " + writing_date_eng + " | ~vern\n") eng_f.write("\n") eng_f.write("\n") eng_f.write(' \n') eng_f.write('

' + writing_date_eng + ' Financial Report of ~vern

\n') eng_f.write('
LiberaPay (Fiat) Donations:
\n') eng_f.write("

We received a total of " + LibP_total_str + " USD on LiberaPay this month.

\n") eng_f.write('
Monero (XMR) Donations:
\n') eng_f.write("

We received a total of "+ XMR_total_str +" XMR this month. It has not been converted to fiat. This money is kept for times when we have a lack of funds to use or to cash out when XMR peaks.

\n") eng_f.write('
Usage:
\n') eng_f.write("

"+ servers_usage_str +"

\n") eng_f.write('

Totally '+ totally_used_s +' USD was used up this month. We have '+ what_we_have +' USD + around '+ XMR_wehave +' USD (XMR conversion rate as of '+ XMR_conv_date +') = '+ remaining +' USD remaining.

\n') eng_f.write('

'+ extramoneyis_dividedto_team +'

\n') eng_f.write(' \n') eng_f.write('\n') eng_f.write('') eng_f.close() print("\e[1;31m!!!!Please send the remaining files(por_BR and tur) to our translators!!!!\e[0m") # Turkish tur_f = open(os.path.join("tur", dt_string + ".html"), "w") tur_f.write("\n") tur_f.write('\n') tur_f.write("\n") tur_f.write(' \n') tur_f.write(' \n') tur_f.write(' \n') tur_f.write(' \n') tur_f.write(' \n') tur_f.write(' \n') tur_f.write(" " + writing_date_tur + " Finansal Raporu | ~vern\n") tur_f.write("\n") tur_f.write("\n") tur_f.write(' \n') tur_f.write('

~vern ' + writing_date_tur + ' Finansal Raporu

\n') tur_f.write('
LiberaPay (Fiat) Bağışları:
\n') tur_f.write("

Bu ayda LiberaPay'den toplam olarak "+ LibP_total_str +" USD aldık.

") tur_f.write('
Monero (XMR) Bağışları:
\n') tur_f.write("

Bu ay toplam olarak "+ XMR_total_str +" XMR aldık. Fiat'a dönüştürülmedi. Bu para, XMR zirveye ulaştığında kullanacak veya nakde çevirecek paramızın olmadığı zamanlar için tutuluyor.

\n") tur_f.write('
Kullanım:
\n') tur_f.write("

"+ servers_usage_str +"

\n") tur_f.write('

Toplam '+ totally_used_s +' USD bu ay kullanıldı. bizde olan '+ what_we_have +' USD + yaklaşık '+ XMR_wehave +' USD ('+ XMR_conv_date +' itibarıyla XMR dönüşüm oranı) = '+ remaining +' USD kalan.

\n') tur_f.write('

'+ extramoneyis_dividedto_team +'

\n') tur_f.write(' \n') tur_f.write('\n') tur_f.write('') tur_f.close() # Portaguse por_BR_f = open(os.path.join("por_BR", dt_string + ".html"), "w") por_BR_f.write("\n") por_BR_f.write('\n') por_BR_f.write("\n") por_BR_f.write(' \n') por_BR_f.write(' \n') por_BR_f.write(' \n') por_BR_f.write(' \n') por_BR_f.write(' \n') por_BR_f.write(' \n') por_BR_f.write(" Reporte Financeiro de " + writing_date_por_BR + " | ~vern\n") por_BR_f.write("\n") por_BR_f.write("\n") por_BR_f.write(' ') por_BR_f.write('

Reporte Financeiro de '+ writing_date_por_BR +' do ~vern

\n') por_BR_f.write('
LiberaPay (dinheiro):
\n') por_BR_f.write("

Recebemos um total de "+ LibP_total_str +" USD no LiberaPay neste mês.

\n") por_BR_f.write('
Monero (XMR):
\n') por_BR_f.write("

Recebemos um total de "+ XMR_total_str +" XMR este mês. Não foi convertido para dinheiro. Este dinheiro é guardado para quando nós temos uma emergência e para conversão quando XMR subir.

\n") por_BR_f.write('
Utilização:
\n') por_BR_f.write("

"+ servers_usage_str +"

\n") por_BR_f.write('

No total, '+ totally_used_s +' USD foi utilizado neste mês. Nós temos '+ what_we_have +' USD + por volta de '+ XMR_wehave +' USD (taxa de conversão de XMR na data de '+ XMR_conv_date +') = '+ remaining +' USD restantes.

\n') por_BR_f.write('

'+ extramoneyis_dividedto_team +'

\n') por_BR_f.write(' \n') por_BR_f.write('\n') por_BR_f.write('') por_BR_f.close()