Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # import tkinter as tk
- # import re
- from trial_balance_import import *
- from new_company import *
- from accountant import *
- from trial_balance import *
- from mapped_acc_calc import *
- def main():
- root = tk.Tk()
- h = 160
- screen_width = root.winfo_screenwidth()
- main_window = Window(root, 'ИЗГОТВЯНЕ НА ФИНАНСОВИ ОТЧЕТИ', f'{screen_width}x{h}+0+0',
- ("-topmost"), resizable_h=False, resizable_w=True)
- return None
- class Window:
- def __init__(self, root, title, geometry, attributes, resizable_h, resizable_w):
- self.window = root
- self.window.title(title)
- self.window.geometry(geometry)
- self.window.resizable(height=resizable_h, width=resizable_w)
- self.window.attributes(attributes, 'true')
- self.screen_width = self.window.winfo_screenwidth()
- self.sk_label_sum = tk.StringVar(self.window, value='n/a')
- self.balance_amount = tk.StringVar(self.window, value='n/a')
- # Calculator
- self.photo1 = tk.PhotoImage(file=r"32x32.png")
- self.bt1 = tk.Button(self.window, image=self.photo1, relief='raised', height=30, width=30, highlightthickness=4, activebackground='red')
- self.bt1.place(x=self.screen_width-80, y=0)
- self.bt1.bind('<ButtonRelease-1>',)
- # ------Take Pictures
- self.butt_pict = tk.Button(self.window, text='Снимка на\nактивния\nпрозорец', font=('Bookman Old Style Bold', 8), fg='green')
- self.butt_pict.place(x=self.screen_width-200, y=0)
- self.butt_pict.bind('<ButtonRelease-1>', self.passport_com)
- # # Buttons - referenceс
- self.butt_balance = tk.Button(self.window, text='БАЛАНС', font=('Bookman Old Style Bold', 8), fg='green', width=10)
- self.butt_balance.place(x=350 , y=0)
- self.butt_balance.bind('<ButtonRelease-1>', None)
- self.butt_income = tk.Button(self.window, text='ОПР', font=('Bookman Old Style Bold', 8), fg='darkred', width=10)
- self.butt_income.place(x=470 , y=0)
- self.butt_income.bind('<ButtonRelease-1>', None)
- self.butt_income = tk.Button(self.window, text='КАПИТАЛ', font=('Bookman Old Style Bold', 8), fg='blue', width=10)
- self.butt_income.place(x=590 , y=0)
- self.butt_income.bind('<ButtonRelease-1>', None)
- self.butt_income = tk.Button(self.window, text='ОПП', font=('Bookman Old Style Bold', 8), fg='darkblue', width=10)
- self.butt_income.place(x=710 , y=0)
- self.butt_income.bind('<ButtonRelease-1>', None)
- self.butt_income = tk.Button(self.window, text='ДА', font=('Bookman Old Style Bold', 8), fg='black', width=10)
- self.butt_income.place(x=830 , y=0)
- self.butt_income.bind('<ButtonRelease-1>', None)
- # -----LABELS
- self.sk_label_sum, self.balance_amount = self.get_sum_labes()
- sum_a = self.sk_label_sum.get()
- # print('sum_a', sum_a)
- self.label_sk = tk.Label(self.window, text='Собствен капитал: ', font=('Times', 8, 'italic'), fg='green', width=16, anchor='w')
- self.label_sk.place(x=350 , y=30)
- self.label_sk_sum = tk.Label(self.window, textvariable=self.sk_label_sum, text=sum_a, font=('Times', 8, 'italic'), fg='black', width=14, anchor='e')
- self.label_sk_sum.place(x=350 , y=45)
- self.label_a = tk.Label(self.window, text='Балансово число: ', font=('Times', 8, 'italic'), fg='green', width=16, anchor='w')
- self.label_a.place(x=350 , y=60)
- self.label_a_sum = tk.Label(self.window, textvariable=self.balance_amount, text='10 000 999.00 ', font=('Times', 8, 'italic'), fg='black', width=14, anchor='e')
- self.label_a_sum.place(x=350 , y=75)
- self.label_inc = tk.Label(self.window, text='Приходи: ', font=('Times', 8, 'italic'), fg='darkred', width=16, anchor='w')
- self.label_inc.place(x=470 , y=30)
- self.label_inc_sum = tk.Label(self.window, text='19 000 999.00 ', font=('Times', 8, 'italic'), fg='black', width=14, anchor='e')
- self.label_inc_sum.place(x=470 , y=45)
- self.label_cap = tk.Label(self.window, text='Дивиденти: ', font=('Times', 8, 'italic'), fg='blue', width=16, anchor='w')
- self.label_cap.place(x=590 , y=30)
- self.label_cap_sum = tk.Label(self.window, text='1 000 999.00 ', font=('Times', 8, 'italic'), fg='black', width=14, anchor='e')
- self.label_cap_sum.place(x=590 , y=45)
- self.label_money = tk.Label(self.window, text='Налични пари: ', font=('Times', 8, 'italic'), fg='darkblue', width=16, anchor='w')
- self.label_money.place(x=710 , y=30)
- self.label_money_sum = tk.Label(root, text='1 000 999.00 ', font=('Times', 8, 'italic'), fg='black', width=14, anchor='e')
- self.label_money_sum.place(x=710 , y=45)
- self.label_long_assets = tk.Label(self.window, text='Нетекущи активи: ', font=('Times', 8, 'italic'), fg='black', width=16, anchor='w')
- self.label_long_assets.place(x=830 , y=30)
- self.label_long_assets_sum = tk.Label(self.window, text='10 000 999.00 ', font=('Times', 8, 'italic'), fg='black', width=14, anchor='e')
- self.label_long_assets_sum.place(x=830 , y=45)
- # ----- MENU
- self.menubar = tk.Menu(self.window, background='yellow', foreground='black', activebackground='green', activeforeground='black')
- root.config(menu=self.menubar)
- # Create a File menu
- file_menu = tk.Menu(self.menubar, tearoff=0, background='white', foreground='blue', font='Times, 12') # tearoff - маха прекъснатата линия
- # add menu item to menubar
- file_menu.add_command(label="Отвори")
- file_menu.add_command(label="Item1")
- file_menu.add_command(label="Item2")
- file_menu.add_command(label="Изход", command=root.destroy)
- self.menubar.add_cascade(label="Файл", menu=file_menu) # add the File_menu to the menubar
- # Import menu
- import_menu = tk.Menu(self.menubar, tearoff=0)
- import_menu.add_command(label="Оборотна ведомост", command=lambda: None)
- import_menu.add_command(label="Парични средтсва")
- import_menu.add_command(label="Приходни сметки")
- self.menubar.add_cascade(label="Импорт", menu=import_menu) # add the File_menu to the menubar
- # Ръчно въвеждане ДА
- act_menu = tk.Menu(self.menubar, tearoff=0)
- act_menu.add_command(label="I. Нематериални активи", command=self.import_dna)
- act_menu.add_command(label="II. Дълготрайни материални активи")
- act_menu.add_command(label="III. Дългосрочни финансови активи")
- act_menu.add_command(label="IV. Отсрочени данъци")
- act_menu.add_command(label="- Платени аванси на доставчици")
- act_menu.add_command(label="- Активи в процес на придобиване")
- act_menu.add_command(label="- Преоценени активи")
- self.menubar.add_cascade(label="Въвеждане", menu=act_menu) # add the File_menu to the menubar
- # Нова фирма
- new_company = tk.Menu(self.menubar, tearoff=0)
- new_company.add_command(label='Ново предприятие', command=lambda: self.passport_com())
- new_company.add_command(label='Съставител на ФО', command=lambda: self.accountancy())
- new_company.add_command(label='Начални салда', command=lambda: None)
- new_company.add_command(label='Видове сметки', command=lambda: self.type_acc())
- self.menubar.add_cascade(label='Нови данни', menu=new_company)
- # Справки
- reference = tk.Menu(self.menubar, tearoff=0)
- reference.add_command(label='Оборотна ведомост', command=lambda: None)
- reference.add_command(label='Кореспонденция на приходите', command=lambda: None)
- reference.add_command(label='Сметки за нетекущи активи', command=lambda: None)
- reference.add_command(label='Движение на парични средства', command=lambda: None)
- self.menubar.add_cascade(label='Справки', menu=reference)
- self.window.mainloop()
- def get_sum_labes(self):
- mapped_calc = MappedCalculations()
- check = mapped_calc.are_all_acc_mapped()
- print('check', check)
- if check:
- # Собствен капитал
- # TODO -> Да получа целия речник sums {} и да направя сметките diff = sums["cc"] - sums["cd"]
- sk = mapped_calc.get_equity()
- sk = f'{sk:,.2f}'.replace(',', ' ')
- self.sk_label_sum.set(sk)
- # Балансово число
- # TODO -> Вече имам: sums["cd"] на СК и трябва само да взема sums["cc"] на Всички сметки
- bal_amount = mapped_calc.get_balance_amount()
- bal_amount = f'{bal_amount:,.2f}'.replace(',', ' ')
- self.balance_amount.set(bal_amount)
- print('bal_amount', bal_amount)
- # print('self.sk_label_sum', self.sk_label_sum)
- return self.sk_label_sum, self.balance_amount
- def passport_com(self):
- imp_win = InputCompany()
- imp_win.open_comp()
- def accountancy(self):
- inp_acc = AccountCompany()
- inp_acc.open_acc()
- def type_acc(self): # TODO Treeview_acc
- trial_balance = TrialBalance()
- trial_balance.main()
- def import_trial(self):
- open_trial_balance()
- def import_dna(self):
- pass
- if __name__ == '__main__':
- main()
Add Comment
Please, Sign In to add comment