Débug check_adresses

This commit is contained in:
Ambulance Clerc
2022-06-06 18:22:14 +02:00
parent 075ab7cee7
commit 714f6101ff
3 changed files with 31 additions and 19 deletions

View File

@@ -1 +1 @@
20220606-1735
20220606-1821

46
main.py
View File

@@ -47,6 +47,7 @@ if not os.path.exists(temp_dir):
class SuggestionPopup(Toplevel):
x_row = 0
no_selection_possible = False
def __init__(self, parent, item_1=None, item_2=None, debitor=None):
super().__init__(parent)
@@ -112,13 +113,17 @@ class SuggestionPopup(Toplevel):
self.listbox.insert(END, f"Aucun changement possible, code débiteur {debitor['code']}")
self.listbox.configure(state='disabled')
self.no_selection_possible = True
if int(debitor["code"]) == 1:
if str_address_1 == str_address_2:
self.listbox.selection_set(0)
print("adresse identique")
else:
self.listbox.selection_set(1)
print(f"adresse différente [{str_address_1}] ({str_address_2})")
if str_address_1 == str_address_2:
self.listbox.selection_set(0)
print("adresse identique")
else:
self.listbox.selection_set(1)
print(f"adresse différente [{str_address_1}] ({str_address_2})")
@@ -149,7 +154,9 @@ class SuggestionPopup(Toplevel):
if selection:
self.selection = self.listbox.get(selection[0])
self.selection = True if self.selection == "Nouvelle" else False
self.destroy()
self.destroy()
if self.no_selection_possible:
self.destroy()
def show(self):
self.deiconify()
@@ -196,11 +203,13 @@ class ClercAttrib2Biz():
self.prompt = None
self.b_prompt_open = False
self.check_addresses = BooleanVar(self.fenetre)
self.delete_after_parse = BooleanVar(self.fenetre)
self.export_format_biz = BooleanVar(self.fenetre)
self.export_one_file = BooleanVar(self.fenetre)
self.run_excel_after_export = BooleanVar(self.fenetre)
self.check_addresses.set(True)
self.export_one_file.set(True)
self.run_excel_after_export.set(False)
self.export_format_biz.set(True)
@@ -304,11 +313,12 @@ class ClercAttrib2Biz():
lbf_3 = LabelFrame(self.fenetre, text="Options")
lbf_3.grid(row=0, column=1, rowspan=2, sticky='NSEW', padx=5, pady=5)
Checkbutton(lbf_3, text="Supprimer fichiers après conversion", variable= self.delete_after_parse, onvalue=True, offvalue=False).grid(row=0, sticky='W')
Checkbutton(lbf_3, text="Export au format .biz", variable= self.export_format_biz, onvalue=True, offvalue=False, command=self.refresh_ui).grid(row=1, sticky='W')
Checkbutton(lbf_3, text="Export en 1 seul fichier", variable= self.export_one_file, onvalue=True, offvalue=False, command=self.refresh_ui).grid(row=2, sticky='W')
Checkbutton(lbf_3, text="Vérifier les Adresses", variable=self.check_addresses, onvalue=True, offvalue=False).grid(row=0, sticky='W')
Checkbutton(lbf_3, text="Supprimer fichiers après conversion", variable= self.delete_after_parse, onvalue=True, offvalue=False).grid(row=1, sticky='W')
Checkbutton(lbf_3, text="Export au format .biz", variable= self.export_format_biz, onvalue=True, offvalue=False, command=self.refresh_ui).grid(row=2, sticky='W')
Checkbutton(lbf_3, text="Export en 1 seul fichier", variable= self.export_one_file, onvalue=True, offvalue=False, command=self.refresh_ui).grid(row=3, sticky='W')
self.cb_run = Checkbutton(lbf_3, text="Lancer la conversion excel", variable=self.run_excel_after_export, onvalue=True, offvalue=False)
self.cb_run.grid(row=3, sticky='W')
self.cb_run.grid(row=4, sticky='W')
@@ -492,12 +502,14 @@ class ClercAttrib2Biz():
if data.Patient['insurance_policy_number'] == None:
data.Patient['insurance_policy_number'] = f"{uuid.uuid4()}"[:15]
addresses_exist = self.addresses.get_item_by_AVS(data.Patient['insurance_policy_number'].replace(".", ""))
if addresses_exist is not None:
popup = SuggestionPopup(self.fenetre, item_1=data.Patient, item_2=addresses_exist,debitor=data.Debtor )
b_address_update = popup.show()
print(f"Result Popup: {b_address_update}")
if self.check_addresses.get():
addresses_exist = self.addresses.get_item_by_AVS(data.Patient['insurance_policy_number'].replace(".", ""))
if addresses_exist is not None:
popup = SuggestionPopup(self.fenetre, item_1=data.Patient, item_2=addresses_exist, debitor=data.Debtor)
b_address_update = popup.show()
print(f"Result Popup: {b_address_update}")
else:
b_address_update = True
#self.draw_test(item_1=data.Patient, item_2=addresses_exist)
#messagebox.showerror(title="AVS Trouvé", message=f"Le code AVS de l'adresse {data.Patient['insurance_policy_number']} est déjà existant: [{data.Debtor['code']}], merci de le corriger ")

View File

@@ -1 +1 @@
VERSION = "20220606-1735"
VERSION = "20220606-1821"