Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- from widget_factory import *
- from mapped_acc_calculations import *
- from json_file_io import JsonFileIo
- from Opiti.from_excel.classes.global_inc import registry
- class DnaFormImport(Tk):
- def __init__(self):
- Tk.__init__(self)
- self.account_tree = AccountTree()
- self.widget_factory = WidgetsFactory()
- self.excel_acc_data = ExcelAccData()
- self.mapped_calculations = MappedCalculations()
- self.excel_acc_data.convert_json_data()
- self.acc_data_bycode = self.excel_acc_data.get_acc_data_bycode()
- self.min_top_group_digits = self.excel_acc_data.get_min_top_group_digits()
- self.max_top_group_digits = self.excel_acc_data.get_max_top_group_digits()
- self.max_groups = self.excel_acc_data.get_max_groups()
- json_file_io = JsonFileIo(file_name=registry["mapped_account_file_name"])
- acc_data_mapped = json_file_io.read_content() # {"121": ["СК"], "121-13": ["СК"], "121-14": ["СК"],
- if acc_data_mapped is None:
- print("?? acc_data_mapped is NONE!!!")
- self.acc_data_mapped_da = {} # Речник с маркираните сметки с вид 'ДА'
- for acc_code in self.acc_data_bycode:
- self.account_tree.add_code(acc_code) # Захранваме наследственото дърво
- self.acc_data = []
- self.max_depth_da = 0
- for acc_code in acc_data_mapped:
- acc_types = acc_data_mapped[acc_code]
- if 'ДА' in acc_types and len(acc_types) == 1:
- self.acc_data_mapped_da[acc_code] = acc_data_mapped[acc_code]
- depth = self.account_tree.get_depth(acc_code)
- if depth > self.max_depth_da:
- self.max_depth_da = depth
- for acc_code in self.acc_data_bycode:
- if acc_code in self.acc_data_mapped_da:
- acc_row = self.acc_data_bycode[acc_code]
- self.acc_data.append(acc_row)
- # -----------------------
- self.acc_rec_dma = {
- 'pdr': {'ns': 0, 'ns_amo': 0, 'assets': [], 'amort': [], 'assets_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0},
- 'amort_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0}},
- 'z': {'ns': 0, 'ns_amo': 0, 'assets': [], 'amort': [], 'assets_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0},
- 'amort_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0}},
- 'pz': {'ns': 0, 'ns_amo': 0, 'assets': [], 'amort': [], 'assets_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0},
- 'amort_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0}},
- 's': {'ns': 0, 'ns_amo': 0, 'assets': [], 'amort': [], 'assets_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0},
- 'amort_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0}},
- 'm': {'ns': 0, 'ns_amo': 0, 'assets': [], 'amort': [], 'assets_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0},
- 'amort_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0}},
- 'sdr': {'ns': 0, 'ns_amo': 0, 'assets': [], 'amort': [], 'assets_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0},
- 'amort_re': {'inc': 0.0, 'dec': .00, 'diff': 0}},
- 'ts': {'ns': 0, 'ns_amo': 0, 'assets': [], 'amort': [], 'assets_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0},
- 'amort_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0}},
- 'rpma': {'ns': 0, 'ns_amo': 0, 'assets': [], 'amort': [], 'assets_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0},
- 'amort_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0}},
- 'adv': {'ns': 0, 'ns_amo': 0, 'assets': [], 'amort': [], 'assets_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0},
- 'amort_re': {'inc': 0.0, 'dec': 0.0, 'diff': 0}}}
- # -------------------------
- self.check_assets = IntVar() # Radiobutton tab - преоценка активи
- self.check_amort = IntVar() # Radiobutton tab - преоценка амортизации
- self.last_entry = Entry() # Четене на Entry code
- self.acc_data = []
- self.scr_bar = None
- self.tab_names = {
- "act": "Активи",
- "amort": "Амортизации",
- "act_p": "Преоценка активи",
- "amort_p": "Преоценка амортизации",
- }
- self.current_tab = ''
- self.open = 'str_open_d'
- self.close = 'str_close_d'
- self.term_dc = 'debit'
- self.term = None
- self.all_accounts = []
- self.list_unadded_accs = []
- self.unadded_spin = ''
- self.selected_accs = [] # Данните, които трябва да се запишат във файл за да се маркират сметките в Treeview
- self.selected_accs_amo = [] # Маркирани сметки в Treeview АМортизации
- self.dict_entries = {} # Списък с Ентритата на Активите
- self.dict_entries_amo = {} # Списък с Ентрита на Амортизации
- self.get_sums = {}
- self.get_sums_amo = {}
- self.get_total = {'total': {'od': 0.0, 'oc': 0.0, 'td': 0.0, 'tc': 0.0, 'cd': 0.0, 'cc': 0.0}}
- self.get_total_amo = {'total': {'od': 0.0, 'oc': 0.0, 'td': 0.0, 'tc': 0.0, 'cd': 0.0, 'cc': 0.0}}
- self.user_ns = {'pdr': 0, 'z': 0, 'pz': 0, 's': 0, 'm': 0, 'sdr': 0, 'ts': 0, 'rpma': 0, 'adv': 0}
- self.user_ns_amo = {'pdr': 0, 'pz': 0, 's': 0, 'm': 0, 'sdr': 0, 'ts': 0}
- self.assets_re = {'pdr': {'inc': 0.0, 'dec': 0.0}, 'z': {'inc': 0.0, 'dec': 0.0}, 'pz': {'inc': 0.0, 'dec': 0.0}, 's': {'inc': 0.0, 'dec': 0.0}, 'm': {'inc': 0.0, 'dec': 0.0}, 'sdr': {'inc': 0.0, 'dec': 0.0}, 'ts': {'inc': 0.0, 'dec': 0.0}}
- self.amort_re = {'pdr': {'inc': 0.0, 'dec': 0.0}, 'pz': {'inc': 0.0, 'dec': 0.0}, 's': {'inc': 0.0, 'dec': 0.0}, 'm': {'inc': 0.0, 'dec': 0.0}, 'sdr': {'inc': 0.0, 'dec': 0.0}, 'ts': {'inc': 0.0, 'dec': 0.0}}
- self.pop_message_answer = ''
- # TODO -> Главен прозорец
- self.title('Материални дълготрайни активи') # TODO -> Главен прозорец
- self.geometry('1300x600+200+150') # 480
- self.resizable(True, False)
- self.attributes('-topmost', 'true')
- # TODO -> Notebook
- self.tabs = ttk.Notebook(self) # TODO -> Табове
- self.tabs.pack(pady=(1, 56), anchor='w') # class_, cursor, padding, relief, style, takefocus
- self.tab1 = Frame(self.tabs, width=550, height=480, relief=GROOVE, borderwidth=5)
- self.tab1.pack() # fill=”X” specifies, fill=”Y”
- self.tabs.add(self.tab1, text=self.tab_names['act'], padding=(2, 10)) #
- self.tab2 = Frame(self.tabs, width=550, height=480, relief=GROOVE, borderwidth=5, bg='white')
- self.tab2.pack(fill='both', expand=1)
- self.tabs.add(self.tab2, text=self.tab_names['amort'], padding=(2, 10))
- self.tab3 = Frame(self.tabs, width=550, height=480, relief=GROOVE, borderwidth=5,
- bg='mint cream') # bg='lightgrey'
- self.tab3.pack(fill='both', expand=1)
- self.tabs.add(self.tab3, text=self.tab_names['act_p'],
- state='hidden') # compound must be none, text, image, center, top, bottom, left, or right
- self.tab4 = Frame(self.tabs, width=550, height=480, relief=GROOVE, borderwidth=5,
- bg='lemon chiffon') # bg='lightgrey'
- self.tab4.pack(fill='both', expand=1)
- self.tabs.add(self.tab4, text=self.tab_names['amort_p'],
- state='hidden') #
- self.tabs.bind('<<NotebookTabChanged>>', self.get_tab)
- # TODO -> LABELS
- self.widget_factory.get_label_un(self.tab1, 'с/ка: АКТИВИ', 20, 20, 'w', 26, 'blue', bg_border='red')
- self.widget_factory.get_label_un(self.tab1, 'Група II.: Дълг. матер. активи', 20, 50, 'w', 26, bg_border='red')
- self.widget_factory.get_label_un(self.tab1, 'НС\n(хил.лв)', 275, 40, 'w', 6, 'black', bg_border='red',
- j='center')
- self.widget_factory.get_label_un(self.tab1, 'НС\n(лева)', 340, 40, 'center', 11, 'black', bg_border='red',
- j='center')
- self.widget_factory.get_label_un(self.tab1, 'с/ка:\n(код)', 460, 40, 'center', 4, 'black', bg_border='green')
- self.widget_factory.get_label_un(self.tab1, '1. Права върху имоти и други', 20, 90, 'w', 26, bg_border='green')
- self.widget_factory.get_label_un(self.tab1, ' - земи', 20, 120, 'w', 24, bg_border='green', j='left')
- self.widget_factory.get_label_un(self.tab1, ' - подобрения върху земите', 20, 150, 'w', 24, bg_border='green')
- self.widget_factory.get_label_un(self.tab1, ' - сгради', 20, 180, 'w', 24, bg_border='green')
- self.widget_factory.get_label_un(self.tab1, '2. Машини, производствено\nоборудване и апаратура', 20, 210, 'w', 24, bg_border='green')
- self.widget_factory.get_label_un(self.tab1, '3. Съоръжения и други', 20, 260, 'w', 24, bg_border='green')
- self.widget_factory.get_label_un(self.tab1, ' - транспортни средства', 20, 290, 'w', 24, bg_border='green')
- self.widget_factory.get_label_un(self.tab1, '4. Дълг. материални активи в\n процес на изграждане', 20, 320, 'w', 26, bg_border='green', j='left')
- self.widget_factory.get_label_un(self.tab1, ' - предоставени аванси', 20, 370, 'w', 26, bg_border='green')
- # TODO -> Entries
- self.user_pdr = self.widget_factory.get_entry(self.tab1, 280, 90, 5, 'right', name='user_pdr')
- self.user_pdr.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_pdr, "pdr", "od"))
- self.l_open_pdr = self.widget_factory.get_label_un(self.tab1, '0', 340, 90, 'e', 11, 'black', bg_border='green', j='left', name='pdr')
- self.e_pdr = self.widget_factory.get_entry(self.tab1, 450, 90, 9, 'left', name='pdr')
- self.e_pdr.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_pdr))
- self.e_pdr.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_pdr))
- self.user_z = self.widget_factory.get_entry(self.tab1, 280, 120, 5, 'right', name='user_z')
- self.user_z.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_z, "z", "od"))
- self.l_open_z = self.widget_factory.get_label_un(self.tab1, '0', 340, 120, 'e', 11, 'black', bg_border='green', j='left')
- self.e_z = self.widget_factory.get_entry(self.tab1, 450, 120, 9, name='z')
- self.e_z.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_z))
- self.e_z.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_z))
- self.user_pz = self.widget_factory.get_entry(self.tab1, 280, 150, 5, 'right', name='user_pz')
- self.user_pz.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_pz, "pz", "od"))
- self.l_open_pz = self.widget_factory.get_label_un(self.tab1, '0', 340, 150, 'e', 11, 'black', bg_border='green', j='left')
- self.e_pz = self.widget_factory.get_entry(self.tab1, 450, 150, 9, name='pz')
- self.e_pz.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_pz))
- self.e_pz.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_pz))
- self.user_s = self.widget_factory.get_entry(self.tab1, 280, 180, 5, 'right', name='user_s')
- self.user_s.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_s, "s", "od"))
- self.l_open_s = self.widget_factory.get_label_un(self.tab1, '0', 340, 180, 'e', 11, 'black', bg_border='green', j='left')
- self.e_s = self.widget_factory.get_entry(self.tab1, 450, 180, 9, name='s')
- self.e_s.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_s))
- self.e_s.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_s))
- self.user_m = self.widget_factory.get_entry(self.tab1, 280, 220, 5, 'right', name='user_m')
- self.user_m.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_m, "m", "od"))
- self.l_open_m = self.widget_factory.get_label_un(self.tab1, '0', 340, 220, 'e', 11, 'black', bg_border='green', j='left')
- self.e_m = self.widget_factory.get_entry(self.tab1, 450, 220, 9, name='m')
- self.e_m.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_m))
- self.e_m.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_m))
- self.user_sdr = self.widget_factory.get_entry(self.tab1, 280, 260, 5, 'right', name='user_sdr')
- self.user_sdr.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_sdr, "sdr", "od"))
- self.l_open_sdr = self.widget_factory.get_label_un(self.tab1, '0', 340, 260, 'e', 11, 'black', bg_border='green', j='left')
- self.e_sdr = self.widget_factory.get_entry(self.tab1, 450, 260, 9, name='sdr')
- self.e_sdr.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_sdr))
- self.e_sdr.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_sdr))
- self.user_ts = self.widget_factory.get_entry(self.tab1, 280, 290, 5, 'right', name='user_ts')
- self.user_ts.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_ts, "ts", "od"))
- self.l_open_ts = self.widget_factory.get_label_un(self.tab1, '0', 340, 290, 'e', 11, 'black', bg_border='green', j='left')
- self.e_ts = self.widget_factory.get_entry(self.tab1, 450, 290, 9, name='ts')
- self.e_ts.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_ts))
- self.e_ts.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_ts))
- self.user_rpma = self.widget_factory.get_entry(self.tab1, 280, 330, 5, 'right', name='user_rpma')
- self.user_rpma.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_rpma, "rpma", "od"))
- self.l_open_rpma = self.widget_factory.get_label_un(self.tab1, '0', 340, 330, 'e', 11, 'black', bg_border='green', j='left')
- self.e_rpma = self.widget_factory.get_entry(self.tab1, 450, 330, 9, name='rpma')
- self.e_rpma.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_rpma))
- self.e_rpma.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_rpma))
- self.user_adv = self.widget_factory.get_entry(self.tab1, 280, 370, 5, 'right', name='user_adv')
- self.user_adv.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_adv, "adv", "od"))
- self.l_open_adv = self.widget_factory.get_label_un(self.tab1, '0', 340, 370, 'e', 11, 'black', bg_border='green', j='left')
- self.e_adv = self.widget_factory.get_entry(self.tab1, 450, 370, 9, name='adv')
- self.e_adv.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_adv))
- self.e_adv.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_adv))
- # TODO -> DOWN LABELS
- self.widget_factory.get_label(self.tab1, 90, 430, 'В началното', 12, 'e', font=10)
- self.widget_factory.get_label(self.tab1, 195, 430, 'Увеличение', 12, 'e', font=10)
- self.widget_factory.get_label(self.tab1, 300, 430, 'Намаление', 12, 'e', font=10)
- self.widget_factory.get_label(self.tab1, 410, 430, 'В края', 12, 'e', font=10)
- self.widget_factory.get_label(self.tab1, 20, 450, 'Група II.:', 10, 'w', font=10)
- self.l_open_total = self.widget_factory.get_label(self.tab1, 90, 450, 0.0, 12, 'e', color='black',
- font=10)
- self.l_turn_d_total = self.widget_factory.get_label(self.tab1, 195, 450, 0.0, 12, 'e', color='black',
- font=10)
- self.l_turn_c_total = self.widget_factory.get_label(self.tab1, 300, 450, 0.0, 12, 'e', color='black',
- font=10)
- self.l_close_total = self.widget_factory.get_label(self.tab1, 410, 450, 0.0, 12, 'e', color='black',
- font=10)
- self.widget_factory.get_label_un(self, 'Налични сметки:', 720, 1, 'w', 20, 'blue', bg_color=None,
- bg_border='red')
- # TODO -> CHECKBUTTON
- self.check_asset = Checkbutton(self.tab1, text="преоценка", variable=self.check_assets,
- command=lambda: self.act_c1())
- self.check_asset.place(x=275, y=20)
- # TODO TREEVIEW
- self.tv_frame = Frame(self)
- self.tv_frame.place(x=560, y=30)
- self.dict_columns = {"code_i": 'код', "acc_name": 'Сметка', 'open_di': 'НС Дебит', 'turn_di': 'Оборот Дт',
- 'turn_ci': 'Оборот Кт', "close_di": 'КС Дебит'}
- self.treeview_acc = self.widget_factory.get_treeview(self.tv_frame, **self.dict_columns)
- self.treeview_acc.config(selectmode='browse')
- # TODO SCROLLBAR
- self.scr_bar = Scrollbar(self.tv_frame, orient=VERTICAL)
- self.scr_bar.pack(side=RIGHT, fill=Y)
- self.treeview_acc.config(yscrollcommand=self.scr_bar.set)
- self.scr_bar.config(command=self.treeview_acc.yview, bg="red", activebackground="orange")
- self.treeview_acc.bind('<ButtonRelease-1>', lambda e: self.on_selected_acc(self.treeview_acc))
- self.treeview_acc.pack(side=LEFT)
- # TODO Spinboxes
- self.min_spin_2 = self.min_top_group_digits
- self.max_spin_2 = self.max_top_group_digits + self.max_groups
- self.var_spin_1 = StringVar(self)
- self.list_spin_1 = ['всички', 'недобавени']
- self.spin_1 = self.widget_factory.get_list_spinbox(self, self.list_spin_1, 12, 'center',
- self.var_spin_1, 560, 4)
- self.spin_1.configure(command=lambda: self.fill_treeview(term_dc=self.term_dc))
- print("self.min_spin_2", self.min_spin_2, "self.max_depth_da", self.max_depth_da)
- self.var_spin_2 = StringVar(self, value=str(self.max_depth_da))
- self.spin_2 = self.widget_factory.get_spinbox(self, self.min_spin_2, str(self.max_depth_da), 4,
- 'center', self.var_spin_2, 660, 4)
- self.spin_2.configure(command=lambda: self.fill_treeview(term_dc=self.term_dc))
- # TODO Buttons
- # Button Добави
- self.b_add = self.widget_factory.get_save_button(self, 466, 550, text='ДОБАВИ') # 460, 435
- self.b_add.bind('<ButtonRelease-1>', lambda e: self.on_add())
- # Button Корекции
- self.b_note = self.widget_factory.get_correction_button(self, 360, 550)
- self.b_note.bind('<ButtonRelease-1>', lambda e: self.on_correction())
- # Button Помощ
- self.b_help = self.widget_factory.get_help_button(self, 20, 550)
- self.b_help.bind('<ButtonRelease-1>')
- # Button Save
- self.b_save = self.widget_factory.get_ok_button(self, 830, 550)
- self.b_save.bind('<ButtonRelease-1>', lambda e: self.on_save())
- # Button Отказ
- self.b_exit = self.widget_factory.get_correction_esc(self, 930, 550)
- self.b_exit.config(command=self.destroy)
- # TODO AMORTIZATION Амортизации
- self.widget_factory.get_label_un(self.tab2, 'с/ка: АМОРТИЗАЦИИ', 20, 20, 'w', 26, 'red', bg_color='white', bg_border='blue')
- self.widget_factory.get_label_un(self.tab2, 'Група II.: Дълг. матер. активи', 20, 50, 'w', 26, bg_color='white', bg_border='blue')
- self.widget_factory.get_label_un(self.tab2, 'НС\n(хил.лв)', 275, 40, 'w', 6, 'black', bg_color='white', bg_border='blue', j='center')
- self.widget_factory.get_label_un(self.tab2, 'НС\n(лева)', 340, 40, 'center', 11, 'black', bg_color='white', bg_border='blue', j='center')
- self.widget_factory.get_label_un(self.tab2, 'с/ка:\n(код)', 460, 40, 'center', 4, 'black', bg_color='white', bg_border='green')
- self.widget_factory.get_label_un(self.tab2, '1. Права върху имоти и други', 20, 90, 'w', 26, bg_color='white', bg_border='green')
- self.widget_factory.get_label_un(self.tab2, ' - подобрения върху земите', 20, 150, 'w', 24, bg_color='white', bg_border='green')
- self.widget_factory.get_label_un(self.tab2, ' - сгради', 20, 180, 'w', 24, bg_color='white', bg_border='green')
- self.widget_factory.get_label_un(self.tab2, '2. Машини, производствено\nоборудване и апаратура', 20, 210, 'w', 24, bg_color='white', bg_border='green')
- self.widget_factory.get_label_un(self.tab2, '3. Съоръжения и други', 20, 260, 'w', 24, bg_color='white', bg_border='green')
- self.widget_factory.get_label_un(self.tab2, ' - транспортни средства', 20, 290, 'w', 24, bg_color='white', bg_border='green')
- # TODO -> Entries
- self.user_amo_pdr = self.widget_factory.get_entry(self.tab2, 280, 90, 5, 'right', name='user_amo_pdr')
- self.user_amo_pdr.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_amo_pdr, "pdr", "oc"))
- self.l_open_amo_pdr = self.widget_factory.get_label_un(self.tab2, '0', 340, 90, 'e', 11, 'black',bg_color='white', bg_border='green', j='left', name='amo_pdr')
- self.e_amo_pdr = self.widget_factory.get_entry(self.tab2, 450, 90, 9, 'left', name='pdr')
- self.e_amo_pdr.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_amo_pdr))
- self.e_amo_pdr.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_amo_pdr))
- self.user_amo_pz = self.widget_factory.get_entry(self.tab2, 280, 150, 5, 'right', name='user_amo_pz')
- self.user_amo_pz.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_amo_pz, "pz", "oc"))
- self.l_open_amo_pz = self.widget_factory.get_label_un(self.tab2, '0', 340, 150, 'e', 11, 'black',bg_color='white', bg_border='green', j='left')
- self.e_amo_pz = self.widget_factory.get_entry(self.tab2, 450, 150, 9, name='pz')
- self.e_amo_pz.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_amo_pz))
- self.e_amo_pz.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_amo_pz))
- self.user_amo_s = self.widget_factory.get_entry(self.tab2, 280, 180, 5, 'right', name='user_amo_s')
- self.user_amo_s.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_amo_s, "s", "oc"))
- self.l_open_amo_s = self.widget_factory.get_label_un(self.tab2, '0', 340, 180, 'e', 11, 'black',bg_color='white', bg_border='green', j='left')
- self.e_amo_s = self.widget_factory.get_entry(self.tab2, 450, 180, 9, name='s')
- self.e_amo_s.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_amo_s))
- self.e_amo_s.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_amo_s))
- self.user_amo_m = self.widget_factory.get_entry(self.tab2, 280, 220, 5, 'right', name='user_amo_m')
- self.user_amo_m.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_amo_m, "m", "oc"))
- self.l_open_amo_m = self.widget_factory.get_label_un(self.tab2, '0', 340, 220, 'e', 11, 'black',bg_color='white', bg_border='green', j='left')
- self.e_amo_m = self.widget_factory.get_entry(self.tab2, 450, 220, 9, name='m')
- self.e_amo_m.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_amo_m))
- self.e_amo_m.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_amo_m))
- self.user_amo_sdr = self.widget_factory.get_entry(self.tab2, 280, 260, 5, 'right', name='user_amo_sdr')
- self.user_amo_sdr.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_amo_sdr, "sdr", "oc"))
- self.l_open_amo_sdr = self.widget_factory.get_label_un(self.tab2, '0', 340, 260, 'e', 11, 'black',bg_color='white', bg_border='green', j='left')
- self.e_amo_sdr = self.widget_factory.get_entry(self.tab2, 450, 260, 9, name='sdr')
- self.e_amo_sdr.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_amo_sdr))
- self.e_amo_sdr.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_amo_sdr))
- self.user_amo_ts = self.widget_factory.get_entry(self.tab2, 280, 290, 5, 'right', name='user_amo_ts')
- self.user_amo_ts.bind("<KeyRelease>", lambda e: self.update_state_open_bal(self.user_amo_ts, "ts", "oc"))
- self.l_open_amo_ts = self.widget_factory.get_label_un(self.tab2, '0', 340, 290, 'e', 11, 'black',bg_color='white', bg_border='green', j='left')
- self.e_amo_ts = self.widget_factory.get_entry(self.tab2, 450, 290, 9, name='ts')
- self.e_amo_ts.bind("<KeyRelease>", lambda e: self.on_entry_key_release(self.e_amo_ts))
- self.e_amo_ts.bind("<FocusIn>", lambda e: self.entry_on_focus(self.e_amo_ts))
- # TODO Check button Amort
- self.check_b2 = Checkbutton(self.tab2, text="преоценка", bg='white', variable=self.check_amort,
- command=lambda: self.act_c2())
- self.check_b2.place(x=275, y=20)
- # TODO -> DOWN LABELS
- self.widget_factory.get_label(self.tab2, 90, 430, 'В началното', 12, 'e', font=10, bg_color='white')
- self.widget_factory.get_label(self.tab2, 195, 430, 'Увеличение', 12, 'e', font=10, bg_color='white')
- self.widget_factory.get_label(self.tab2, 300, 430, 'Намаление', 12, 'e', font=10, bg_color='white')
- self.widget_factory.get_label(self.tab2, 410, 430, 'В края', 12, 'e', font=10, bg_color='white')
- self.widget_factory.get_label(self.tab2, 20, 450, 'Група II.:', 10, 'w', font=10, bg_color='white')
- self.l_amo_open_total = self.widget_factory.get_label(self.tab2, 90, 450, 0.0, 12, 'e', color='black',
- font=10, bg_color='white')
- self.l_amo_turn_d_total = self.widget_factory.get_label(self.tab2, 195, 450, 0.0, 12, 'e', color='black',
- font=10, bg_color='white')
- self.l_amo_turn_c_total = self.widget_factory.get_label(self.tab2, 300, 450, 0.0, 12, 'e', color='black',
- font=10, bg_color='white')
- self.l_amo_close_total = self.widget_factory.get_label(self.tab2, 410, 450, 0.0, 12, 'e', color='black',
- font=10, bg_color='white')
- # TODO Преоценка Активи
- self.widget_factory.get_label_un(self.tab3, 'С/ка: АКТИВИ', 20, 20, 'w', 26, 'black', bg_color='mint cream', bg_border='red')
- self.widget_factory.get_label_un(self.tab3, 'Група II.: ПРЕОЦЕНКА !', 20, 50, 'w', 26, 'black', bg_color='mint cream', bg_border='red')
- self.widget_factory.get_label_un(self.tab3, 'Увеличение\n(лева)', 280, 40, 'w', 10, 'black', bg_color='mint cream', bg_border='red', j='center')
- self.widget_factory.get_label_un(self.tab3, 'Намаление\n(лева)', 370, 40, 'w', 10, 'black', bg_color='mint cream', bg_border='red', j='center')
- self.widget_factory.get_label_un(self.tab3, 'Салдо\n(разлика)', 470, 40, 'w', 7, 'black', bg_color='mint cream', bg_border='green')
- self.widget_factory.get_label_un(self.tab3, '1. Права върху имоти и други', 20, 90, 'w', 26, bg_color='mint cream', bg_border='red')
- self.widget_factory.get_label_un(self.tab3, ' - земи', 20, 120, 'w', 24, bg_color='mint cream', bg_border='red', j='left')
- self.widget_factory.get_label_un(self.tab3, ' - подобрения върху земите', 20, 150, 'w', 24, bg_color='mint cream', bg_border='red')
- self.widget_factory.get_label_un(self.tab3, ' - сгради', 20, 180, 'w', 24, bg_color='mint cream', bg_border='red')
- self.widget_factory.get_label_un(self.tab3, '2. Машини, производствено\nоборудване и апаратура', 20, 210, 'w', 24, bg_color='mint cream', bg_border='red')
- self.widget_factory.get_label_un(self.tab3, '3. Съоръжения и други', 20, 260, 'w', 24, bg_color='mint cream', bg_border='red')
- self.widget_factory.get_label_un(self.tab3, ' - транспортни средства', 20, 290, 'w', 24, bg_color='mint cream', bg_border='red')
- self.widget_factory.get_label_un(self.tab3, '4. Дълг. материални активи в\n процес на изграждане', 20, 320, 'w', 26, bg_color='mint cream', bg_border='red', j='left')
- self.widget_factory.get_label_un(self.tab3, ' - предоставени аванси', 20, 370, 'w', 26, bg_color='mint cream', bg_border='red')
- # TODO -> Entries
- self.turn_d_pdr = self.widget_factory.get_entry(self.tab3, 280, 90, 12, 'right', name='d_pdr')
- self.turn_d_pdr.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_pdr, "pdr", "inc"))
- self.turn_c_pdr = self.widget_factory.get_entry(self.tab3, 370, 90, 12, 'right', name='c_pdr')
- self.turn_c_pdr.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_pdr, "pdr", "dec"))
- self.pdr = self.widget_factory.get_label(self.tab3, 490, 90, '0', 3, 'e', color='red', font=10, bg_color='mint cream')
- self.turn_d_z = self.widget_factory.get_entry(self.tab3, 280, 120, 12, 'right', name='d_z')
- self.turn_d_z.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_z, "z", "inc"))
- self.turn_c_z = self.widget_factory.get_entry(self.tab3, 370, 120, 12, 'right', name='c_z')
- self.turn_c_z.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_z, "z", "dec"))
- self.z = self.widget_factory.get_label(self.tab3, 490, 120, '0', 3, 'e', color='red', font=10, bg_color='mint cream')
- self.turn_d_pz = self.widget_factory.get_entry(self.tab3, 280, 150, 12, 'right', name='d_pz')
- self.turn_d_pz.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_pz, "pz", "inc"))
- self.turn_c_pz = self.widget_factory.get_entry(self.tab3, 370, 150, 12, 'right', name='c_pz')
- self.turn_c_pz.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_pz, "pz", "dec"))
- self.pz = self.widget_factory.get_label(self.tab3, 490, 150, '0', 3, 'e', color='red', font=10, bg_color='mint cream')
- self.turn_d_s = self.widget_factory.get_entry(self.tab3, 280, 180, 12, 'right', name='d_s')
- self.turn_d_s.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_s, "s", "inc"))
- self.turn_c_s = self.widget_factory.get_entry(self.tab3, 370, 180, 12, 'right', name='c_s')
- self.turn_c_s.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_s, "s", "dec"))
- self.s = self.widget_factory.get_label(self.tab3, 490, 180, '0', 3, 'e', color='red', font=10, bg_color='mint cream')
- self.turn_d_m = self.widget_factory.get_entry(self.tab3, 280, 220, 12, 'right', name='d_m')
- self.turn_d_m.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_m, "m", "inc"))
- self.turn_c_m = self.widget_factory.get_entry(self.tab3, 370, 220, 12, 'right', name='c_m')
- self.turn_c_m.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_m, "m", "dec"))
- self.m = self.widget_factory.get_label(self.tab3, 490, 220, '0', 3, 'e', color='red', font=10, bg_color='mint cream')
- self.turn_d_sdr = self.widget_factory.get_entry(self.tab3, 280, 260, 12, 'right', name='d_sdr')
- self.turn_d_sdr.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_sdr, "sdr", "inc"))
- self.turn_c_sdr = self.widget_factory.get_entry(self.tab3, 370, 260, 12, 'right', name='c_sdr')
- self.turn_c_sdr.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_sdr, "sdr", "dec"))
- self.sdr = self.widget_factory.get_label(self.tab3, 490, 260, '0', 3, 'e', color='red', font=10, bg_color='mint cream')
- self.turn_d_ts = self.widget_factory.get_entry(self.tab3, 280, 290, 12, 'right', name='d_ts')
- self.turn_d_ts.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_pz, "ts", "inc"))
- self.turn_c_ts = self.widget_factory.get_entry(self.tab3, 370, 290, 12, 'right', name='c_ts')
- self.turn_c_ts.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_pz, "ts", "dec"))
- self.ts = self.widget_factory.get_label(self.tab3, 490, 290, '0', 3, 'e', color='red', font=10, bg_color='mint cream')
- self.rpma = self.widget_factory.get_label(self.tab3, 490, 320, '0', 3, 'e', color='red', font=10, bg_color='mint cream')
- self.adv = self.widget_factory.get_label(self.tab3, 490, 370, '0', 3, 'e', color='red', font=10, bg_color='mint cream')
- # TODO Преоценка Амортизации
- self.widget_factory.get_label_un(self.tab4, 'с/ка: АМОРТИЗАЦИИ', 20, 20, 'w', 26, 'black', bg_color='lemon chiffon', bg_border='red')
- self.widget_factory.get_label_un(self.tab4, 'Група I.: ПРЕОЦЕНКА !', 20, 50, 'w', 26, 'black', bg_color='lemon chiffon', bg_border='red')
- self.widget_factory.get_label_un(self.tab4, 'Увеличение\n(лева)', 280, 40, 'w', 10, 'black', bg_color='lemon chiffon', bg_border='red', j='center')
- self.widget_factory.get_label_un(self.tab4, 'Намаление\n(лева)', 370, 40, 'w', 10, 'black', bg_color='lemon chiffon', bg_border='red', j='center')
- self.widget_factory.get_label_un(self.tab4, 'Салдо\n(разлика)', 470, 40, 'w', 7, 'black', bg_color='lemon chiffon', bg_border='green')
- self.widget_factory.get_label_un(self.tab4, '1. Права върху имоти и други', 20, 90, 'w', 26, bg_color='lemon chiffon', bg_border='green')
- self.widget_factory.get_label_un(self.tab4, ' - подобрения върху земите', 20, 150, 'w', 24, bg_color='lemon chiffon', bg_border='green')
- self.widget_factory.get_label_un(self.tab4, ' - сгради', 20, 180, 'w', 24, bg_color='lemon chiffon', bg_border='green')
- self.widget_factory.get_label_un(self.tab4, '2. Машини, производствено\nоборудване и апаратура', 20, 210, 'w', 24, bg_color='lemon chiffon', bg_border='green')
- self.widget_factory.get_label_un(self.tab4, '3. Съоръжения и други', 20, 260, 'w', 24, bg_color='lemon chiffon', bg_border='green')
- self.widget_factory.get_label_un(self.tab4, ' - транспортни средства', 20, 290, 'w', 24, bg_color='lemon chiffon', bg_border='green')
- # TODO -> Entries
- self.turn_d_amo_pdr = self.widget_factory.get_entry(self.tab4, 280, 90, 12, 'right')
- self.turn_d_amo_pdr.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_amo_pdr, "pdr", "inc"))
- self.turn_c_amo_pdr = self.widget_factory.get_entry(self.tab4, 370, 90, 12, 'right')
- self.turn_c_amo_pdr.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_amo_pdr, "pdr", "dec"))
- self.amo_pdr = self.widget_factory.get_label(self.tab4, 490, 90, '0', 3, 'e', color='red', font=10, bg_color='lemon chiffon')
- self.turn_d_amo_pz = self.widget_factory.get_entry(self.tab4, 280, 150, 12, 'right', name='d_amo_pz')
- self.turn_d_amo_pz.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_amo_pz, "pz", "inc"))
- self.turn_c_amo_pz = self.widget_factory.get_entry(self.tab4, 370, 150, 12, 'right', name='c_pz')
- self.turn_c_amo_pz.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_amo_pz, "pz", "dec"))
- self.amo_pz = self.widget_factory.get_label(self.tab4, 490, 150, '0', 3, 'e', color='red', font=10, bg_color='lemon chiffon')
- self.turn_d_amo_s = self.widget_factory.get_entry(self.tab4, 280, 180, 12, 'right', name='d_amo_s')
- self.turn_d_amo_s.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_amo_s, "s", "inc"))
- self.turn_c_amo_s = self.widget_factory.get_entry(self.tab4, 370, 180, 12, 'right', name='c_s')
- self.turn_c_amo_s.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_amo_s, "s", "dec"))
- self.amo_s = self.widget_factory.get_label(self.tab4, 490, 180, '0', 3, 'e', color='red', font=10, bg_color='lemon chiffon')
- self.turn_d_amo_m = self.widget_factory.get_entry(self.tab4, 280, 220, 12, 'right', name='d_amo_m')
- self.turn_d_amo_m.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_amo_m, "m", "inc"))
- self.turn_c_amo_m = self.widget_factory.get_entry(self.tab4, 370, 220, 12, 'right', name='c_m')
- self.turn_c_amo_m.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_amo_m, "m", "dec"))
- self.amo_m = self.widget_factory.get_label(self.tab4, 490, 220, '0', 3, 'e', color='red', font=10, bg_color='lemon chiffon')
- self.turn_d_amo_sdr = self.widget_factory.get_entry(self.tab4, 280, 260, 12, 'right', name='d_amo_sdr')
- self.turn_d_amo_sdr.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_amo_sdr, "sdr", "inc"))
- self.turn_c_amo_sdr = self.widget_factory.get_entry(self.tab4, 370, 260, 12, 'right', name='c_sdr')
- self.turn_c_amo_sdr.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_amo_sdr, "sdr", "dec"))
- self.amo_sdr = self.widget_factory.get_label(self.tab4, 490, 260, '0', 3, 'e', color='red', font=10, bg_color='lemon chiffon')
- self.turn_d_amo_ts = self.widget_factory.get_entry(self.tab4, 280, 290, 12, 'right', name='d_amo_ts')
- self.turn_d_amo_ts.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_d_amo_pz, "ts", "inc"))
- self.turn_c_amo_ts = self.widget_factory.get_entry(self.tab4, 370, 290, 12, 'right', name='c_ts')
- self.turn_c_amo_ts.bind("<KeyRelease>", lambda e: self.revaluations(self.turn_c_amo_pz, "ts", "dec"))
- self.amo_ts = self.widget_factory.get_label(self.tab4, 490, 290, '0', 3, 'e', color='red', font=10, bg_color='lemon chiffon')
- def get_tab(self, *args):
- self.current_tab = self.tabs.tab(self.tabs.select(), "text")
- if self.current_tab == 'Активи' or self.current_tab == 'Преоценка активи':
- self.open, self.close = 'str_open_d', 'str_close_d'
- self.treeview_acc.heading('#3', text='НС Дебит ')
- self.treeview_acc.heading('#6', text='КС Дебит ')
- self.term_dc = 'debit'
- if self.current_tab == 'Активи':
- self.treeview_acc.configure(selectmode='browse')
- self.e_pdr.focus_set()
- self.b_add['state'] = 'normal'
- self.b_note['state'] = 'normal'
- else:
- self.treeview_acc.configure(selectmode='none')
- self.b_note['state'] = 'disabled'
- else:
- self.open, self.close = 'str_open_c', 'str_close_c'
- self.treeview_acc.heading('#3', text='НС Кредит ')
- self.treeview_acc.heading('#6', text='КС Кредит ')
- self.term_dc = 'credit'
- if self.current_tab == "Амортизации":
- self.treeview_acc.configure(selectmode='browse')
- self.e_amo_pdr.focus_set()
- self.b_note['state'] = 'normal'
- else:
- self.treeview_acc.configure(selectmode='none')
- self.b_note['state'] = 'disabled'
- self.fill_treeview(term_dc=self.term_dc)
- self.fill_labels()
- def set_pop_message_answer(self, answer):
- self.pop_message_answer = answer
- def on_save(self):
- # TODO -> Попълваме Началното салдо, въведено от потребителя:
- for entry in self.user_ns:
- self.acc_rec_dma[entry]['ns'] = self.user_ns[entry]
- for entry in self.user_ns_amo:
- self.acc_rec_dma[entry]['ns_amo'] = self.user_ns_amo[entry]
- # TODO -> Попълваме сметките, по Ентрита на активи и амортизации
- if not self.dict_entries: # Речника е празен
- for entry in self.acc_rec_dma:
- self.acc_rec_dma[entry]['assets'].clear()
- if not self.dict_entries_amo: # Речника е празен
- for entry in self.acc_rec_dma:
- self.acc_rec_dma[entry]['amort'].clear()
- for entry in self.dict_entries:
- if self.dict_entries[entry] is None:
- self.dict_entries[entry] = []
- self.acc_rec_dma[entry]['assets'] = self.dict_entries[entry]
- for entry in self.dict_entries_amo:
- if self.dict_entries_amo[entry] is None:
- self.dict_entries_amo[entry] = []
- self.acc_rec_dma[entry]['amort'] = self.dict_entries_amo[entry]
- # TODO -> попълване на сумите на преоценката
- for entry in self.assets_re:
- for dir in self.assets_re[entry]:
- self.acc_rec_dma[entry]['assets_re'][dir] = self.assets_re[entry][dir]
- for entry in self.amort_re:
- for dir in self.amort_re[entry]:
- self.acc_rec_dma[entry]['amort_re'][dir] = self.amort_re[entry][dir]
- print('self.acc_rec_dma: ', self.acc_rec_dma)
- json_file_io = JsonFileIo(file_name=registry['dma_import_form_acc_rec_dma_file_name'])
- json_file_io.write_content(self.acc_rec_dma)
- # TODO -> Проверка за недобавена сметка и съобщение !!!!!
- if len(self.list_unadded_accs) > 0:
- # TODO -> Показва pop_message "Има недобавени сметки !
- pop_message = self.widget_factory.get_pop_message(self, lambda answer: self.set_pop_message_answer(answer),
- "Има недобавени сметки !", 1, 'red')
- self.wait_window(pop_message.pop)
- # TODO -> Ако "ДА"
- self.destroy()
- return
- else:
- pop_message = self.widget_factory.get_pop_message(self, lambda answer: self.set_pop_message_answer(answer),
- "Всички сметки са добавени !", 1, 'green')
- self.wait_window(pop_message.pop)
- # TODO -> Ако "ДА"
- self.destroy()
- return
- def on_correction(self):
- if self.b_note['state'] == 'disabled':
- return
- if self.current_tab == 'Активи':
- # TODO -> Махаме маркировката на Treeview и забраната за селекция
- for code in self.selected_accs:
- self.treeview_acc.tag_configure(code, background='lightgrey')
- self.selected_accs.clear()
- # TODO -> Изтриваме стойностите на речника, на ентритата и лейбълите
- self.dict_entries.clear()
- self.get_total = {'total': {'od': 0.0, 'oc': 0.0, 'td': 0.0, 'tc': 0.0, 'cd': 0.0, 'cc': 0.0}}
- self.l_open_pdr['text'] = 0
- self.l_open_z['text'] = 0
- self.l_open_pz['text'] = 0
- self.l_open_s['text'] = 0
- self.l_open_m['text'] = 0
- self.l_open_sdr['text'] = 0
- self.l_open_ts['text'] = 0
- self.l_open_rpma['text'] = 0
- self.l_open_adv['text'] = 0
- # TODO -> На преоценките лейбъли ???
- self.pdr['text'] = 0
- self.z['text'] = 0
- self.pz['text'] = 0
- self.s['text'] = 0
- self.m['text'] = 0
- self.sdr['text'] = 0
- self.ts['text'] = 0
- self.rpma['text'] = 0
- self.adv['text'] = 0
- elif self.current_tab == 'Амортизации':
- # TODO -> Махаме маркировката на Treeview и забраната за селекция
- for code in self.selected_accs_amo:
- self.treeview_acc.tag_configure(code, background='lightgrey')
- self.selected_accs_amo.clear()
- # TODO -> Изтриваме стойностите на речника, на ентритата и лейбълите
- self.dict_entries_amo.clear()
- self.get_total_amo = {'total': {'od': 0.0, 'oc': 0.0, 'td': 0.0, 'tc': 0.0, 'cd': 0.0, 'cc': 0.0}}
- self.l_open_amo_pdr['text'] = 0
- self.l_open_amo_pz['text'] = 0
- self.l_open_amo_s['text'] = 0
- self.l_open_amo_m['text'] = 0
- self.l_open_amo_sdr['text'] = 0
- self.l_open_amo_ts['text'] = 0
- # TODO ?????
- self.amo_pdr['text'] = 0
- self.amo_pz['text'] = 0
- self.amo_s['text'] = 0
- self.amo_m['text'] = 0
- self.amo_sdr['text'] = 0
- self.amo_ts['text'] = 0
- self.fill_labels()
- self.fill_treeview(term_dc=self.term_dc)
- # TODO -> Преоценка
- def revaluations(self, re_val: Entry, key1: str, key2: str):
- revaluation = re_val.get()
- if ' ' in revaluation:
- re_val.delete(0, END)
- re_val.insert(0, revaluation)
- is_good = True
- if revaluation == '':
- revaluation = 0.0
- else:
- try:
- float(revaluation)
- except:
- is_good = False
- revaluation = 0.0
- if is_good:
- re_val.configure(bg='white')
- else:
- re_val.configure(bg='red')
- if self.current_tab == 'Преоценка активи':
- self.assets_re[key1][key2] = float(revaluation)
- elif self.current_tab == 'Преоценка амортизации':
- self.amort_re[key1][key2] = float(revaluation)
- # TODO -> ЗА разлики между НС от потребителя и НС от сметките
- def update_state_open_bal(self, open_bal: Entry, key1: str, key2: str): # self.user_s, s, od
- name_entry = open_bal.winfo_name() # user_s
- user_1000 = open_bal.get() # 55
- try:
- user_1000 = int(user_1000)
- except:
- user_1000 = 0
- calc = self.get_sum_string(key1, key2) # s od
- calc_1000 = int(round(calc / 1000))
- if user_1000 == calc_1000:
- # TODO оцвети нещо
- open_bal.configure(bg='white')
- else:
- open_bal.configure(bg='red')
- # TODO -> Да се попълни речник с НС, въведени от потребителя !
- if self.current_tab == 'Активи':
- self.user_ns[key1] = user_1000
- elif self.current_tab == 'Амортизации':
- self.user_ns_amo[key1] = user_1000
- if name_entry == 'user_pdr':
- self.pdr['text'] = user_1000 - calc_1000
- print("self.acc_rec_dma", self.acc_rec_dma)
- self.acc_rec_dma['pdr']['assets_re']['diff'] = user_1000 - calc_1000
- elif name_entry == 'user_z':
- self.z['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['z']['assets_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_pz':
- self.pz['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['pz']['assets_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_s':
- self.s['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['s']['assets_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_m':
- self.m['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['m']['assets_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_sdr':
- self.sdr['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['sdr']['assets_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_ts':
- self.ts['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['ts']['assets_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_rpma':
- self.rpma['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['rpma']['assets_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_adv':
- self.adv['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['adv']['assets_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_amo_pdr':
- self.amo_pdr['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['pdr']['amort_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_amo_pz':
- self.amo_pz['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['pz']['amort_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_amo_s':
- self.amo_s['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['s']['amort_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_amo_m':
- self.amo_m['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['m']['amort_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_amo_sdr':
- self.amo_sdr['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['sdr']['amort_re']['diff'] = int(user_1000 - calc_1000)
- elif name_entry == 'user_amo_ts':
- self.amo_ts['text'] = int(user_1000 - calc_1000)
- self.acc_rec_dma['ts']['amort_re']['diff'] = int(user_1000 - calc_1000)
- def get_sum_string(self, key1, key2):
- if self.current_tab == 'Активи':
- if key1 in self.get_sums:
- return self.get_sums[key1][key2]
- elif self.current_tab == 'Амортизации':
- if key1 in self.get_sums_amo:
- return self.get_sums_amo[key1][key2]
- return 0
- def fill_labels(self):
- for entry in self.dict_entries_amo:
- if self.dict_entries_amo[entry] is None:
- self.dict_entries_amo[entry] = []
- for entry in self.dict_entries:
- if self.dict_entries[entry] is None:
- self.dict_entries[entry] = []
- if self.current_tab == 'Активи':
- if len(self.dict_entries) > 0:
- self.get_sums, self.get_total = self.mapped_calculations.get_sum_list_accounts(self.dict_entries)
- for entr in self.get_sums:
- if entr == 'pdr':
- self.l_open_pdr['text'] = f"{self.get_sums['pdr']['od']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_pdr, "pdr", "od")
- elif entr == 'z':
- self.l_open_z['text'] = f"{self.get_sums['z']['od']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_z, "z", "od")
- elif entr == 'pz':
- self.l_open_pz['text'] = f"{self.get_sums['pz']['od']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_pz, "pz", "od")
- elif entr == 's':
- self.l_open_s['text'] = f"{self.get_sums['s']['od']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_s, "s", "od")
- elif entr == 'm':
- self.l_open_m['text'] = f"{self.get_sums['m']['od']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_m, "m", "od")
- elif entr == 'sdr':
- self.l_open_sdr['text'] = f"{self.get_sums['sdr']['od']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_sdr, "sdr", "od")
- elif entr == 'ts':
- self.l_open_ts['text'] = f"{self.get_sums['ts']['od']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_ts, "ts", "od")
- elif entr == 'rpma':
- self.l_open_rpma['text'] = f"{self.get_sums['rpma']['od']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_rpma, "rpma", "od")
- elif entr == 'adv':
- self.l_open_adv['text'] = f"{self.get_sums['adv']['od']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_adv, "adv", "od")
- self.l_open_total['text'] = f"{self.get_total['total']['od']:,.2f}".replace(',', ' ')
- self.l_turn_d_total['text'] = f"{self.get_total['total']['td']:,.2f}".replace(',', ' ')
- self.l_turn_c_total['text'] = f"{self.get_total['total']['tc']:,.2f}".replace(',', ' ')
- self.l_close_total['text'] = f"{self.get_total['total']['cd']:,.2f}".replace(',', ' ')
- elif self.current_tab == 'Амортизации':
- if len(self.dict_entries_amo) > 0:
- self.get_sums_amo, self.get_total_amo =\
- self.mapped_calculations.get_sum_list_accounts(self.dict_entries_amo)
- for entr in self.get_sums_amo:
- if entr == 'pdr':
- self.l_open_amo_pdr['text'] = f"{self.get_sums_amo['pdr']['oc']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_amo_pdr, "pdr", "oc")
- elif entr == 'pz':
- self.l_open_amo_pz['text'] = f"{self.get_sums_amo['pz']['oc']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_amo_pz, "pz", "oc")
- elif entr == 's':
- self.l_open_amo_s['text'] = f"{self.get_sums_amo['s']['oc']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_amo_s, "s", "oc")
- elif entr == 'm':
- self.l_open_amo_m['text'] = f"{self.get_sums_amo['m']['oc']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_amo_m, "m", "oc")
- elif entr == 'sdr':
- self.l_open_amo_sdr['text'] = f"{self.get_sums_amo['sdr']['oc']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_amo_sdr, "sdr", "oc")
- elif entr == 'ts':
- self.l_open_amo_ts['text'] = f"{self.get_sums_amo['ts']['oc']:,.2f}".replace(',', ' ')
- self.update_state_open_bal(self.user_amo_ts, "ts", "oc")
- self.l_amo_open_total['text'] = f"{self.get_total_amo['total']['oc']:,.2f}".replace(',', ' ')
- self.l_amo_turn_d_total['text'] = f"{self.get_total_amo['total']['td']:,.2f}".replace(',', ' ')
- self.l_amo_turn_c_total['text'] = f"{self.get_total_amo['total']['tc']:,.2f}".replace(',', ' ')
- self.l_amo_close_total['text'] = f"{self.get_total_amo['total']['cc']:,.2f}".replace(',', ' ')
- def on_add(self):
- if self.current_tab == 'Активи':
- acc_code = self.last_entry.get() # '203'
- if acc_code is None or acc_code == '':
- return
- self.selected_accs.append(list(self.treeview_acc.selection())) # current_selection: ('200',)
- # TODO -> На името на Entry да добавим сметката
- name_entry = self.last_entry.winfo_name()
- if name_entry not in self.dict_entries:
- self.dict_entries[name_entry] = ()
- self.dict_entries[name_entry] += self.treeview_acc.selection() # Добавям маркираната сметка
- # TODO -> Добавяне на децата и родителите на добавената сметка
- all_children = self.account_tree.get_all_children(acc_code) # all_children: ['200', '203', '205']
- all_parents = self.account_tree.get_all_parents(acc_code) # acc_code = 223
- self.selected_accs.extend(all_children)
- self.selected_accs.extend(all_parents)
- # TODO -> След добавяне да се изпразват всички ентрита, а не само добавеното !!!!!
- if self.e_pdr.get() != '': self.e_pdr.delete(0, 'end')
- if self.e_z.get() != '': self.e_z.delete(0, 'end')
- if self.e_pz.get() != '': self.e_pz.delete(0, 'end')
- if self.e_s.get() != '': self.e_s.delete(0, 'end')
- if self.e_m.get() != '': self.e_m.delete(0, 'end')
- if self.e_sdr.get() != '': self.e_sdr.delete(0, 'end')
- if self.e_ts.get() != '': self.e_ts.delete(0, 'end')
- if self.e_rpma.get() != '': self.e_rpma.delete(0, 'end')
- if self.e_adv.get() != '': self.e_adv.delete(0, 'end')
- elif self.current_tab == 'Амортизации':
- acc_code = self.last_entry.get() # '203'
- if acc_code is None or acc_code == '':
- return
- self.selected_accs_amo.append(list(self.treeview_acc.selection()))
- # TODO -> На името на Entry да добавим сметката
- name_entry = self.last_entry.winfo_name()
- if name_entry not in self.dict_entries_amo:
- self.dict_entries_amo[name_entry] = ()
- self.dict_entries_amo[name_entry] += self.treeview_acc.selection()
- # TODO -> Добавяне на децата и родителите на добавената сметка
- all_children = self.account_tree.get_all_children(acc_code) # all_children: ['200', '203']
- all_parents = self.account_tree.get_all_parents(acc_code) # acc_code = 223
- self.selected_accs_amo.extend(all_children)
- self.selected_accs_amo.extend(all_parents)
- # TODO -> След добавяне да се изпразват всички ентрита, а не само добавеното !!!!!
- if self.e_amo_pdr.get() != '': self.e_amo_pdr.delete(0, 'end')
- if self.e_amo_pz.get() != '': self.e_amo_pz.delete(0, 'end')
- if self.e_amo_s.get() != '': self.e_amo_s.delete(0, 'end')
- if self.e_amo_m.get() != '': self.e_amo_m.delete(0, 'end')
- if self.e_amo_sdr.get() != '': self.e_amo_sdr.delete(0, 'end')
- if self.e_amo_ts.get() != '': self.e_amo_ts.delete(0, 'end')
- self.fill_labels()
- # TODO -> Попълваме Treeview
- self.fill_treeview(term_dc=self.term_dc)
- def act_c1(self):
- if self.check_assets.get() == 1: # state: must be normal, disabled, or hidden
- self.tabs.tab(self.tab3, state='normal')
- elif self.check_assets.get() == 0:
- self.tabs.tab(self.tab3, state='hidden')
- def act_c2(self):
- if self.check_amort.get() == 1: # state: must be normal, disabled, or hidden
- self.tabs.tab(self.tab4, state='normal')
- elif self.check_amort.get() == 0:
- self.tabs.tab(self.tab4, state='hidden')
- def verify_selection(self): # Забрана за маркиране
- for code in self.selected_accs:
- if self.treeview_acc.exists(code):
- self.treeview_acc.selection_remove(code)
- for code in self.selected_accs_amo:
- if self.treeview_acc.exists(code):
- self.treeview_acc.selection_remove(code)
- def on_selected_acc(self, source_treeview):
- self.verify_selection()
- current_item = source_treeview.focus()
- if current_item in self.selected_accs or current_item in self.selected_accs_amo: # <class 'tuple'>
- return
- values = source_treeview.item(current_item)["values"]
- if not isinstance(values, list):
- return
- code = values[0]
- self.last_entry.delete(0, END)
- self.last_entry.insert(0, code)
- def entry_on_focus(self, entry):
- self.last_entry = entry
- def on_entry_key_release(self, entry):
- self.last_entry = entry
- entry_text = entry.get()
- if len(entry_text) < 2:
- self.fill_treeview(term_dc=self.term_dc)
- return
- term = entry_text
- self.fill_treeview(term=term, term_dc=self.term_dc)
- def dna(self):
- try:
- json_file_io = JsonFileIo(file_name=registry["dma_import_form_acc_rec_dma_file_name"])
- tmp_acc_rec_dma = json_file_io.read_content()
- if tmp_acc_rec_dma is not None:
- self.acc_rec_dma = tmp_acc_rec_dma
- self.refill_form()
- self.get_tab() # Рефрешва таба, попълва self.current_tab
- except:
- pass
- self.fill_treeview(term_dc=self.term_dc)
- self.mainloop()
- def refill_form(self):
- # TODO -> Попълваме Treeview с маркирани и забранени за селектиране сметки
- for entry in self.acc_rec_dma:
- self.dict_entries[entry] = self.acc_rec_dma[entry]['assets']
- for entry in self.acc_rec_dma:
- self.dict_entries_amo[entry] = self.acc_rec_dma[entry]['amort']
- # TODO -> Попълваме сметките, децата и родителите на сметките в self.selected_accs, self.selected_accs_amo
- for entry_name in self.dict_entries:
- for acc_code in self.dict_entries[entry_name]:
- if acc_code not in self.selected_accs:
- self.selected_accs.append(acc_code)
- all_children = self.account_tree.get_all_children(acc_code) # all_children:['200', '203'']
- all_parents = self.account_tree.get_all_parents(acc_code) # acc_code = 223 all_parents:['22',]
- self.selected_accs.extend([a for a in all_children if a not in self.selected_accs])
- self.selected_accs.extend([a for a in all_parents if a not in self.selected_accs])
- for entry_name in self.dict_entries_amo:
- for acc_code in self.dict_entries_amo[entry_name]:
- if acc_code not in self.selected_accs_amo:
- self.selected_accs_amo.append(acc_code)
- all_children = self.account_tree.get_all_children(acc_code) # all_children:['200', '203',]
- all_parents = self.account_tree.get_all_parents(acc_code)
- self.selected_accs_amo.extend([a for a in all_children if a not in self.selected_accs_amo])
- self.selected_accs_amo.extend([a for a in all_parents if a not in self.selected_accs_amo])
- # TODO -> Попълваме Ентритата с НС user_ns и user_ns_amo
- for entry_name in self.user_ns:
- self.user_ns[entry_name] = self.acc_rec_dma[entry_name]['ns']
- if self.user_ns['pdr'] > 0:
- self.user_pdr.insert(0, self.user_ns['pdr'])
- if self.user_ns['z'] > 0:
- self.user_z.insert(0, self.user_ns['z'])
- if self.user_ns['pz'] > 0:
- self.user_pz.insert(0, self.user_ns['pz'])
- if self.user_ns['s'] > 0:
- self.user_s.insert(0, self.user_ns['s'])
- if self.user_ns['m'] > 0:
- self.user_m.insert(0, self.user_ns['m'])
- if self.user_ns['sdr'] > 0:
- self.user_sdr.insert(0, self.user_ns['sdr'])
- if self.user_ns['ts'] > 0:
- self.user_ts.insert(0, self.user_ns['ts'])
- if self.user_ns['rpma'] > 0:
- self.user_rpma.insert(0, self.user_ns['rpma'])
- if self.user_ns['adv'] > 0:
- self.user_adv.insert(0, self.user_ns['adv'])
- for entry_name in self.user_ns_amo:
- self.user_ns_amo[entry_name] = self.acc_rec_dma[entry_name]['ns_amo']
- if self.user_ns_amo['pdr'] > 0:
- self.user_amo_pdr.insert(0, self.user_ns_amo['pdr'])
- if self.user_ns_amo['pz'] > 0:
- self.user_amo_pz.insert(0, self.user_ns_amo['pz'])
- if self.user_ns_amo['s'] > 0:
- self.user_amo_s.insert(0, self.user_ns_amo['s'])
- if self.user_ns_amo['m'] > 0:
- self.user_amo_m.insert(0, self.user_ns_amo['m'])
- if self.user_ns_amo['sdr'] > 0:
- self.user_amo_sdr.insert(0, self.user_ns_amo['sdr'])
- if self.user_ns_amo['ts'] > 0:
- self.user_amo_ts.insert(0, self.user_ns_amo['ts'])
- # TODO -> Попълваме Ентритата с Преоценките
- print('self.assets_re: ', self.assets_re)
- for entry in self.assets_re:
- for dir in self.assets_re[entry]:
- self.assets_re[entry][dir] = self.acc_rec_dma[entry]['assets_re'][dir]
- print('self.assets_re след refill: ', self.assets_re)
- if self.assets_re['pdr']['inc'] > 0:
- self.turn_d_pdr.insert(0, self.assets_re['pdr']['inc'])
- if self.assets_re['pdr']['dec'] > 0:
- self.turn_c_pdr.insert(0, self.assets_re['pdr']['dec'])
- if self.assets_re['z']['inc'] > 0:
- self.turn_d_z.insert(0, self.assets_re['z']['inc'])
- if self.assets_re['z']['dec'] > 0:
- self.turn_c_z.insert(0, self.assets_re['z']['dec'])
- if self.assets_re['pz']['inc'] > 0:
- self.turn_d_pz.insert(0, self.assets_re['pz']['inc'])
- if self.assets_re['pz']['dec'] > 0:
- self.turn_c_pz.insert(0, self.assets_re['pz']['dec'])
- if self.assets_re['s']['inc'] > 0:
- self.turn_d_s.insert(0, self.assets_re['s']['inc'])
- if self.assets_re['s']['dec'] > 0:
- self.turn_c_s.insert(0, self.assets_re['s']['dec'])
- if self.assets_re['m']['inc'] > 0:
- self.turn_d_m.insert(0, self.assets_re['m']['inc'])
- if self.assets_re['m']['dec'] > 0:
- self.turn_c_m.insert(0, self.assets_re['m']['dec'])
- if self.assets_re['sdr']['inc'] > 0:
- self.turn_d_sdr.insert(0, self.assets_re['sdr']['inc'])
- if self.assets_re['sdr']['dec'] > 0:
- self.turn_c_sdr.insert(0, self.assets_re['sdr']['dec'])
- if self.assets_re['ts']['inc'] > 0:
- self.turn_d_ts.insert(0, self.assets_re['ts']['inc'])
- if self.assets_re['ts']['dec'] > 0:
- self.turn_c_ts.insert(0, self.assets_re['ts']['dec'])
- for entry in self.amort_re:
- for dir in self.amort_re[entry]:
- self.amort_re[entry][dir] = self.acc_rec_dma[entry]['amort_re'][dir]
- print('self.amort_re след refill: ', self.amort_re)
- if self.amort_re['pdr']['inc'] > 0:
- self.turn_d_amo_pdr.insert(0, self.amort_re['pdr']['inc'])
- if self.amort_re['pdr']['dec'] > 0:
- self.turn_c_amo_pdr.insert(0, self.amort_re['pdr']['dec'])
- if self.amort_re['pz']['inc'] > 0:
- self.turn_d_amo_pz.insert(0, self.amort_re['pz']['inc'])
- if self.amort_re['pz']['dec'] > 0:
- self.turn_c_amo_pz.insert(0, self.amort_re['pz']['dec'])
- if self.amort_re['s']['inc'] > 0:
- self.turn_d_amo_s.insert(0, self.amort_re['s']['inc'])
- if self.amort_re['s']['dec'] > 0:
- self.turn_c_amo_s.insert(0, self.amort_re['s']['dec'])
- if self.amort_re['m']['inc'] > 0:
- self.turn_d_amo_m.insert(0, self.amort_re['m']['inc'])
- if self.amort_re['m']['dec'] > 0:
- self.turn_c_amo_m.insert(0, self.amort_re['m']['dec'])
- if self.amort_re['sdr']['inc'] > 0:
- self.turn_d_amo_sdr.insert(0, self.amort_re['sdr']['inc'])
- if self.amort_re['sdr']['dec'] > 0:
- self.turn_c_amo_sdr.insert(0, self.amort_re['sdr']['dec'])
- if self.amort_re['ts']['inc'] > 0:
- self.turn_d_amo_ts.insert(0, self.amort_re['ts']['inc'])
- if self.amort_re['ts']['dec'] > 0:
- self.turn_c_amo_ts.insert(0, self.amort_re['ts']['dec'])
- def fill_treeview(self, term=None, term_dc='debit'):
- self.treeview_acc.delete(*self.treeview_acc.get_children()) # Вградена функция за изтриване на Treeview
- # TODO -> Spinboxes
- self.unadded_spin = self.var_spin_1.get() # Взима стойността на спинбокса за недобавени
- spin_2 = int(self.var_spin_2.get())
- self.all_accounts.extend(self.selected_accs)
- self.all_accounts.extend(self.selected_accs_amo)
- self.list_unadded_accs = self.account_tree.get_unadded_acc(self.all_accounts, self.acc_data_mapped_da)
- count_rows = 0
- for acc_code in self.acc_data_bycode:
- if acc_code not in self.acc_data_mapped_da:
- continue
- if term_dc is not None and term_dc == 'debit':
- if self.acc_data_bycode[acc_code]['open_c'] > 0 or self.acc_data_bycode[acc_code]['close_c'] > 0:
- continue
- elif term_dc is not None and term_dc == 'credit':
- if self.acc_data_bycode[acc_code]['open_d'] > 0 or self.acc_data_bycode[acc_code]['close_d'] > 0:
- continue
- if term is not None: # Искаме само сметките дето кода им започва с term
- term_len = len(term)
- code_piece = self.acc_data_bycode[acc_code]['code'][0:term_len]
- # Ако сметката не започва с term
- if term != code_piece:
- continue # прескачаме тая сметка, не отговаря на търсеното
- # TODO -> Ако spin_1 = 'недобавени' -> извежда само недобавените сметки в ентритата
- if self.unadded_spin == 'недобавени':
- if acc_code not in self.list_unadded_accs:
- continue
- # TODO -> spin_2 type of spin_2: <class 'int'>
- groups_in_acc_code = re.findall('[0-9]+', acc_code) # Връща list със групите на сметката
- top_group = groups_in_acc_code[0]
- depth = self.account_tree.get_depth(acc_code)
- if len(top_group) > spin_2 or depth > spin_2:
- continue
- count_rows += 1
- row = [self.acc_data_bycode[acc_code]['code'],
- self.acc_data_bycode[acc_code]['name'],
- self.acc_data_bycode[acc_code][self.open],
- self.acc_data_bycode[acc_code]['str_turn_d'],
- self.acc_data_bycode[acc_code]['str_turn_c'],
- self.acc_data_bycode[acc_code][self.close]]
- tags = acc_code
- iid = acc_code
- self.treeview_acc.insert('', END, values=row, tags=tags, iid=iid) # ????
- self.treeview_acc.config(height=count_rows)
- if count_rows > 19:
- self.treeview_acc.configure(height=19)
- for code in self.selected_accs: # Оцветяване на добавените сметки
- if self.treeview_acc.exists(code):
- self.treeview_acc.tag_configure(code, background='powderblue')
- for code in self.selected_accs_amo: # Оцветяване на добавените сметки
- if self.treeview_acc.exists(code):
- self.treeview_acc.tag_configure(code, background='powderblue')
- if __name__ == '__main__':
- dna = DnaFormImport()
- dna.dna()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement