Compare commits
40 Commits
20220606-1
...
20220907-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2f9d8c1da8 | ||
|
|
191821d81d | ||
|
|
99a89585b5 | ||
|
|
e60ed4b5fa | ||
|
|
4c75a6167b | ||
|
|
842ae5fb69 | ||
|
|
355d17810f | ||
|
|
510587d3eb | ||
|
|
ff22572e56 | ||
|
|
54873a2715 | ||
|
|
1ce77f4e08 | ||
|
|
7be1f15c63 | ||
|
|
cdc7205ab7 | ||
|
|
5b0f7a1119 | ||
|
|
5c7f9c1f4e | ||
|
|
975595b592 | ||
|
|
1907632dca | ||
|
|
6d9b991c04 | ||
|
|
e35a24030d | ||
|
|
1a7d649651 | ||
|
|
0d499cd0f6 | ||
|
|
94c8c64ced | ||
|
|
79f6c3df6d | ||
|
|
6a28aeaa16 | ||
|
|
42f32873ea | ||
|
|
e4137d4780 | ||
|
|
b10b14c420 | ||
|
|
0a1cbd31b8 | ||
|
|
dc7ace0446 | ||
|
|
6a46da5a89 | ||
|
|
e8d1bf7696 | ||
|
|
d918e5b7aa | ||
|
|
d2c132bc24 | ||
|
|
934ed40937 | ||
|
|
ff789f409c | ||
|
|
c8e1d42af0 | ||
|
|
b6ba37b3c9 | ||
|
|
714f6101ff | ||
|
|
075ab7cee7 | ||
|
|
16cb31d859 |
@@ -18,5 +18,6 @@ class cls_addresse:
|
|||||||
firstName = None
|
firstName = None
|
||||||
birth = None
|
birth = None
|
||||||
street = None
|
street = None
|
||||||
|
street_cpl = None
|
||||||
npa = None
|
npa = None
|
||||||
city = None
|
city = None
|
||||||
153
class_debitors.py
Normal file
153
class_debitors.py
Normal file
@@ -0,0 +1,153 @@
|
|||||||
|
import pickle
|
||||||
|
import os
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
class cls_debitors:
|
||||||
|
items = []
|
||||||
|
file_path = ""
|
||||||
|
|
||||||
|
def __init__(self, filepath=".temp"):
|
||||||
|
self.items = []
|
||||||
|
self.file_path = filepath
|
||||||
|
|
||||||
|
if not os.path.exists(self.file_path):
|
||||||
|
os.makedirs(os.path.abspath(self.file_path))
|
||||||
|
|
||||||
|
if not os.path.isfile(os.path.join(self.file_path, f"debitors.bin")):
|
||||||
|
shutil.copy("debitors_src.bin", os.path.join(self.file_path, f"debitors.bin"))
|
||||||
|
self.load_debitors()
|
||||||
|
|
||||||
|
def print_all_debs(self):
|
||||||
|
for elem in self.items:
|
||||||
|
print(f"Débiteur:{elem.code} {elem.names}")
|
||||||
|
def get_deb_by_code(self, code):
|
||||||
|
for deb in self.items:
|
||||||
|
if deb.code == int(code):
|
||||||
|
return deb
|
||||||
|
return None
|
||||||
|
|
||||||
|
def get_names_by_code(self, code):
|
||||||
|
for deb in self.items:
|
||||||
|
if deb.code == int(code):
|
||||||
|
return deb.names
|
||||||
|
return None
|
||||||
|
|
||||||
|
def is_in_debitor_name(self, code, search_name):
|
||||||
|
names = self.get_names_by_code(code)
|
||||||
|
if search_name in names:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
|
def add_items(self, code, name):
|
||||||
|
for deb in self.items:
|
||||||
|
if deb.code == int(code):
|
||||||
|
deb.add_name(name)
|
||||||
|
return
|
||||||
|
deb = cls_debitor()
|
||||||
|
deb.code = int(code)
|
||||||
|
deb.add_name(name)
|
||||||
|
self.items.append(deb)
|
||||||
|
|
||||||
|
def save_debitors(self):
|
||||||
|
if len(self.items) > 0:
|
||||||
|
with open(os.path.join(self.file_path, f"debitors.bin"), "wb") as file:
|
||||||
|
pickle.dump(self.items, file)
|
||||||
|
|
||||||
|
def load_debitors(self):
|
||||||
|
try:
|
||||||
|
with open(os.path.join(self.file_path, f"debitors.bin"), "rb") as file:
|
||||||
|
self.items = pickle.load(file)
|
||||||
|
except:
|
||||||
|
print("Erreur lecture fichier débiteur")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class cls_debitor:
|
||||||
|
code = ""
|
||||||
|
names = []
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.code = ""
|
||||||
|
self.names = []
|
||||||
|
|
||||||
|
def add_name(self, name):
|
||||||
|
self.names.append(name)
|
||||||
|
|
||||||
|
|
||||||
|
o_debs = cls_debitors(filepath=os.getenv('APPDATA') + '\Attrib2Biz\.temp')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
|
|
||||||
|
o_deb = cls_debitor()
|
||||||
|
o_deb.code = 100
|
||||||
|
o_deb.add_name("HRC Rennaz")
|
||||||
|
o_deb.add_name("Hôpital riviera chablais Rennaz")
|
||||||
|
|
||||||
|
o_debs.items.append(o_deb)
|
||||||
|
|
||||||
|
o_deb = cls_debitor()
|
||||||
|
o_deb.code = 101
|
||||||
|
o_deb.add_name("HVS")
|
||||||
|
|
||||||
|
o_debs.items.append(o_deb)
|
||||||
|
|
||||||
|
o_debs.add_items(102,"Clinique Bernoise Montana - Secrétariat médical")
|
||||||
|
o_debs.add_items(102,"Clinique Bernoise Montana")
|
||||||
|
|
||||||
|
o_debs.add_items(100,'Hôpital Riviera-Chablais Vaud-Valais - Fournisseurs ')
|
||||||
|
o_debs.add_items(101,'Hôpital du Valais - Direction des Finances/Service des fournisseurs ')
|
||||||
|
o_debs.add_items(102,'Clinique Bernoise Montana - Secrétariat médical ')
|
||||||
|
o_debs.add_items(103,'Clinique Genevoise de Montana - Comptabilité ')
|
||||||
|
o_debs.add_items(104,'Clinique SUVA - Comptabilité ')
|
||||||
|
o_debs.add_items(105,'Fondation de Nant - Comptabilité ')
|
||||||
|
o_debs.add_items(106,"Service de l'action sociale - Office de l'asile - Administration RAValais")
|
||||||
|
o_debs.add_items(107,'OCVS - Comptabilité')
|
||||||
|
o_debs.add_items(108,'Suva Aarau - Service Center')
|
||||||
|
o_debs.add_items(109,'Suva Basel - Service Center')
|
||||||
|
o_debs.add_items(110,'Suva Bellinzona - Assicurazione militare - Service Center')
|
||||||
|
o_debs.add_items(111,'Suva Bellinzona - Service Center')
|
||||||
|
o_debs.add_items(112,'Suva Bern - Militärversicherung - Service Center')
|
||||||
|
o_debs.add_items(113,'Suva Chur - Service Center')
|
||||||
|
o_debs.add_items(114,'Suva Delémont - Service Center')
|
||||||
|
o_debs.add_items(115,'Suva Fribourg - Service Center')
|
||||||
|
o_debs.add_items(116,'Suva Genève - Assurance militaire - Service Center')
|
||||||
|
o_debs.add_items(117,'Suva Genève - Service Center')
|
||||||
|
o_debs.add_items(118,'Suva La Chaux-de-Fonds - Service Center')
|
||||||
|
o_debs.add_items(119,'Suva Lausanne - Service Center')
|
||||||
|
o_debs.add_items(120,'Suva Luzern - Service Center')
|
||||||
|
o_debs.add_items(121,'Suva Sion - Service Center')
|
||||||
|
o_debs.add_items(122,'Suva Solothurn - Service Center')
|
||||||
|
o_debs.add_items(123,'Suva St-Gallen - Militärversicherung - Service Center')
|
||||||
|
o_debs.add_items(124,'Suva Zurich - Service Center')
|
||||||
|
o_debs.add_items(125,'Antaé - Allianz Worldwide Care')
|
||||||
|
o_debs.add_items(126,'Terre des Hommes - Soins aux Enfants ')
|
||||||
|
o_debs.add_items(127,'REGA')
|
||||||
|
o_debs.add_items(128,'CNAS Assistance')
|
||||||
|
o_debs.add_items(129,'Clinique Lucernoise Montana - Comptabilité ')
|
||||||
|
o_debs.add_items(130,'AAA Alpine Air Ambulance AG')
|
||||||
|
o_debs.add_items(131,'CHUV')
|
||||||
|
o_debs.add_items(132,'Clinique CIC Collombey SA - c/o Clinique CIC Suisse SA ')
|
||||||
|
o_debs.add_items(133,'Clinique CIC Montreux SA ')
|
||||||
|
o_debs.add_items(134,'Clinique CIC Saxon SA - c/o Clinique CIC Saxon SA ')
|
||||||
|
o_debs.add_items(135,'Clinique CIC Suisse SA ')
|
||||||
|
o_debs.add_items(136,'MedSTAR - Swiss Mobile Healthcare Alliance Sàrl')
|
||||||
|
o_debs.add_items(137,'RFSM - Réseau fribourgeois de santé mentale ')
|
||||||
|
o_debs.add_items(138,'Swiss Medical Network - GSMN Suisse SA - Clinique de Genolier')
|
||||||
|
o_debs.add_items(139,'Swiss Medical Network - GSMN Suisse SA - Clinique de Montchoisi')
|
||||||
|
o_debs.add_items(140,'Swiss Medical Network - GSMN Suisse SA - Clinique Valmont')
|
||||||
|
o_debs.add_items(141,'Swiss Medical Network - Swiss Medical Network Hospitals SA - Hôpital de la Providence')
|
||||||
|
o_debs.add_items(142,'Swiss Medical Network - Swiss Medical Network Hospitals SA - Clinique Montbrillant')
|
||||||
|
o_debs.add_items(143,'Swiss Medical Network - Swiss Medical Network Hospitals SA - Clinique Générale Ste-Anne')
|
||||||
|
o_debs.add_items(144,'Swiss Medical Network - Swiss Medical Network Hospitals SA - Clinique de Valère')
|
||||||
|
o_debs.add_items(146,'Leukerbad Clinic - Comptabilité')
|
||||||
|
o_debs.add_items(147,'Hôpital psychiatrique de Belle-Idée')
|
||||||
|
o_debs.add_items(148,'Direction générale de la Santé VD')
|
||||||
|
o_debs.add_items(149,'Swiss Risk & Care')
|
||||||
|
o_debs.save_debitors()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
'''
|
||||||
265
custom_popup.py
Normal file
265
custom_popup.py
Normal file
@@ -0,0 +1,265 @@
|
|||||||
|
from tkinter import *
|
||||||
|
from tkinter import font
|
||||||
|
from datetime import datetime
|
||||||
|
from tkinter import messagebox
|
||||||
|
|
||||||
|
class Check_addresses_popup(Toplevel):
|
||||||
|
x_row = 0
|
||||||
|
no_selection_possible = False
|
||||||
|
def __init__(self, parent, item_1=None, item_2=None, debitor=None, factureID=""):
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
if(item_1["complement"] is None):
|
||||||
|
item_1["complement"] = ""
|
||||||
|
|
||||||
|
self.geometry(f"700x300+{parent.winfo_x() + 25 }+{parent.winfo_y() +25 }")
|
||||||
|
self.resizable(True,True)
|
||||||
|
self.iconbitmap("./logo_clerc_03X_icon.ico")
|
||||||
|
self.title(f"Choix de l'adresse à conserver {item_1['fip_number']} / {factureID}. Code débiteur: {debitor['code']}")
|
||||||
|
|
||||||
|
self.columnconfigure(0, weight=1)
|
||||||
|
self.columnconfigure(1, weight=1)
|
||||||
|
|
||||||
|
lbf_new = LabelFrame(self, text="Données Attrib")
|
||||||
|
lbf_new.grid(row=0, column=0, sticky='WE', padx=5, pady=5)
|
||||||
|
|
||||||
|
lbf_old = LabelFrame(self, text="Données Winbiz")
|
||||||
|
lbf_old.grid(row=0, column=1, sticky='NSEW', padx=5, pady=5)
|
||||||
|
|
||||||
|
str_address_1 = ""
|
||||||
|
|
||||||
|
fonts = []
|
||||||
|
|
||||||
|
self.x_row = 0
|
||||||
|
self.add_compares_element(new_frame=lbf_new,old_frame=lbf_old,label="N° AVS de l'adresse:",str1=item_1['insurance_policy_number'].replace('.',''), str2=item_2.AVS)
|
||||||
|
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Nom:", str1=item_1['lastname'], str2=item_2.lastName)
|
||||||
|
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Prénom:", str1=item_1['firstname'], str2=item_2.firstName)
|
||||||
|
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Date de naissance:", str1=datetime.strptime(item_1['birthdate'], "%Y-%m-%d").strftime("%d.%m.%Y"), str2=item_2.birth)
|
||||||
|
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Adresse:", str1=f"{item_1['street']} {item_1['street_number']}", str2=item_2.street)
|
||||||
|
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Complément:", str1=f"{item_1['complement']}", str2=item_2.street_cpl)
|
||||||
|
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="NPA/Localité:", str1=f"{item_1['postal_code']} {item_1['city']}", str2=f"{item_2.npa} {item_2.city}")
|
||||||
|
|
||||||
|
|
||||||
|
str_address_1 += item_1['insurance_policy_number'].replace('.', '')
|
||||||
|
str_address_1 += item_1['lastname'].strip()
|
||||||
|
str_address_1 += item_1['firstname'].strip()
|
||||||
|
str_address_1 += datetime.strptime(item_1['birthdate'], "%Y-%m-%d").strftime("%d.%m.%Y")
|
||||||
|
str_address_1 += f"{item_1['street']} {item_1['street_number']}"
|
||||||
|
str_address_1 += f"{item_1['complement']}"
|
||||||
|
str_address_1 += f"{item_1['postal_code']} {item_1['city']}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
str_address_2 = ""
|
||||||
|
|
||||||
|
str_address_2 += item_2.AVS
|
||||||
|
str_address_2 += item_2.lastName
|
||||||
|
str_address_2 += item_2.firstName
|
||||||
|
str_address_2 += item_2.birth
|
||||||
|
str_address_2 += f"{item_2.street.strip()}"
|
||||||
|
str_address_2 += f"{item_2.street_cpl.strip()}"
|
||||||
|
str_address_2 += f"{item_2.npa} {item_2.city}"
|
||||||
|
|
||||||
|
self.listbox = Listbox(self, height=3, width=35)
|
||||||
|
self.listbox.grid(row=1,column=0, columnspan= 2, pady=15,padx=15, sticky='NSEW')
|
||||||
|
|
||||||
|
self.btn = Button(self, text="Valider", command=self.select)
|
||||||
|
self.btn.grid(row=2,columnspan=2 , pady=10,padx=10, sticky='NSEW')
|
||||||
|
|
||||||
|
for (idd, info) in ((0, "Winbiz"), (1, "Attrib")) :
|
||||||
|
self.listbox.insert(END, info)
|
||||||
|
|
||||||
|
if int(debitor["code"]) >= 100:
|
||||||
|
self.listbox.delete(0,END)
|
||||||
|
self.listbox.delete(0, END)
|
||||||
|
|
||||||
|
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})")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def add_compares_element(self,new_frame, old_frame,str1, str2, label):
|
||||||
|
label_font = font.Font(weight='bold', size=9)
|
||||||
|
|
||||||
|
value_color = "black"
|
||||||
|
con = ""
|
||||||
|
if str1 != str2:
|
||||||
|
value_color = "red"
|
||||||
|
con = "*"
|
||||||
|
|
||||||
|
Label(new_frame, text=label, font=label_font).grid(row=self.x_row, column=0, sticky="W")
|
||||||
|
Label(new_frame, text=con + str1 + con, fg=value_color).grid(row=self.x_row, column=1, sticky="W")
|
||||||
|
Label(old_frame, text=label, font=label_font).grid(row=self.x_row, column=0, sticky="W")
|
||||||
|
Label(old_frame, text=con + str2 + con, fg=value_color).grid(row=self.x_row, column=1, sticky="W")
|
||||||
|
|
||||||
|
self.x_row += 1
|
||||||
|
|
||||||
|
self.selection = None
|
||||||
|
def destroy(self):
|
||||||
|
if self.selection is None:
|
||||||
|
self.selection = True
|
||||||
|
super().destroy()
|
||||||
|
|
||||||
|
def select(self):
|
||||||
|
selection = self.listbox.curselection()
|
||||||
|
if selection:
|
||||||
|
self.selection = self.listbox.get(selection[0])
|
||||||
|
self.selection = True if self.selection == "Attrib" else False
|
||||||
|
self.destroy()
|
||||||
|
if self.no_selection_possible:
|
||||||
|
self.destroy()
|
||||||
|
|
||||||
|
def show(self):
|
||||||
|
self.deiconify()
|
||||||
|
self.wm_protocol("WM_DELETE_WINDOW", self.destroy)
|
||||||
|
self.wait_window(self)
|
||||||
|
return self.selection
|
||||||
|
|
||||||
|
class Check_debitor_popup(Toplevel):
|
||||||
|
x_row = 0
|
||||||
|
no_selection_possible = False
|
||||||
|
def __init__(self, parent, debitor=None, lists_available_names=None, factureID=None,fip=None,object=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
self.object = object
|
||||||
|
self.debitor = debitor
|
||||||
|
|
||||||
|
self.inp_code = StringVar()
|
||||||
|
self.inp_code.set(debitor['code'])
|
||||||
|
|
||||||
|
self.geometry(f"900x275+{parent.winfo_x() + 25 }+{parent.winfo_y() +25 }")
|
||||||
|
self.resizable(True,True)
|
||||||
|
self.iconbitmap("./logo_clerc_03X_icon.ico")
|
||||||
|
self.title(f"Incohérence sur les débiteurs {fip} / {factureID}. Code débiteur: {debitor['code']}")
|
||||||
|
|
||||||
|
self.columnconfigure(0, weight=1)
|
||||||
|
self.columnconfigure(1, weight=1)
|
||||||
|
|
||||||
|
Label(self,text="Une incohérence a été trouvée entre le code débiteur saisi dans Attrib et le code débiteur saisi dans Attrib. \nIls ne correspondent pas.Le code débiteur présent dans le champs Code Saisi sera utiliser pour la facture winbiz \nMerci de vérifier et modifier le code débiteur puis cliquer sur Valider.", wraplength= 950, justify=LEFT).grid(row=0,column=0, columnspan=2, sticky="W")
|
||||||
|
|
||||||
|
lbf_new = LabelFrame(self, text="Données Attrib")
|
||||||
|
lbf_new.grid(row=1, column=0, sticky='WE', padx=5, pady=5)
|
||||||
|
|
||||||
|
label_font = font.Font(weight='bold', size=9)
|
||||||
|
Label(lbf_new, text="Code saisi", font=label_font).grid(row=0, column=0, sticky="W")
|
||||||
|
Entry(lbf_new, textvariable=self.inp_code, width= 10).grid(row=0, column=1, sticky="W", pady= 10)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Label(lbf_new, text="Débiteur sélectionné dans Attrib", font=label_font).grid(row=1, column=0, sticky="W")
|
||||||
|
text_name = Text(lbf_new, fg="red", height=3,width= 30)
|
||||||
|
text_name.grid(row=1, column=1, sticky="W")
|
||||||
|
text_name.insert(END,debitor['name'])
|
||||||
|
text_name.configure(state='disabled')
|
||||||
|
|
||||||
|
|
||||||
|
lbf_old = LabelFrame(self, text="Noms possibles")
|
||||||
|
lbf_old.grid(row=1, column=1, sticky='NSEW', padx=5, pady=5)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
self.listbox = Text(lbf_old, height=5, width=50)
|
||||||
|
self.listbox.grid(row=1,column=0, columnspan= 2, pady=15,padx=15, sticky='NSEW')
|
||||||
|
|
||||||
|
for info in lists_available_names :
|
||||||
|
self.listbox.insert(END, f"{info}\n")
|
||||||
|
|
||||||
|
self.listbox.configure(state='disabled')
|
||||||
|
self.no_selection_possible = True
|
||||||
|
|
||||||
|
menu_bar = Menu(self)
|
||||||
|
menu_param = Menu(menu_bar, tearoff=0)
|
||||||
|
menu_param.add_command(label="Ajouter à la liste", command=self.add)
|
||||||
|
menu_bar.add_cascade(label="Paramètre", menu=menu_param)
|
||||||
|
|
||||||
|
self.config(menu=menu_bar)
|
||||||
|
|
||||||
|
self.btn = Button(self, text="Valider", command=self.destroy)
|
||||||
|
self.btn.grid(row=2,column=0, columnspan= 2, pady=10,padx=10, sticky='NSEW')
|
||||||
|
|
||||||
|
|
||||||
|
def add(self):
|
||||||
|
self.destroy()
|
||||||
|
if self.object is not None:
|
||||||
|
self.object.add_items(code=self.inp_code.get(), name=self.debitor["name"])
|
||||||
|
self.object.save_debitors()
|
||||||
|
def destroy(self):
|
||||||
|
super().destroy()
|
||||||
|
|
||||||
|
def show(self):
|
||||||
|
self.deiconify()
|
||||||
|
self.wm_protocol("WM_DELETE_WINDOW", self.destroy)
|
||||||
|
self.wait_window(self)
|
||||||
|
print("nouveau code = "+ self.inp_code.get())
|
||||||
|
return self.inp_code.get()
|
||||||
|
|
||||||
|
|
||||||
|
class Input_popup(Toplevel):
|
||||||
|
x_row = 0
|
||||||
|
no_selection_possible = False
|
||||||
|
|
||||||
|
def __init__(self, parent, text="Veuillez saisir la nouvelle valeur.", default="" ,factureID=None, fip=None, object=None):
|
||||||
|
super().__init__(parent)
|
||||||
|
|
||||||
|
self.object = object
|
||||||
|
|
||||||
|
|
||||||
|
self.inp_value = StringVar()
|
||||||
|
if default is not None:
|
||||||
|
self.inp_value.set(default)
|
||||||
|
|
||||||
|
|
||||||
|
self.geometry(f"650x120+{parent.winfo_x() + 25}+{parent.winfo_y() + 25}")
|
||||||
|
self.resizable(True, True)
|
||||||
|
self.iconbitmap("./logo_clerc_03X_icon.ico")
|
||||||
|
self.title(f"Saisir une valeur {fip} / {factureID}.")
|
||||||
|
|
||||||
|
self.columnconfigure(0, weight=1)
|
||||||
|
self.columnconfigure(1, weight=1)
|
||||||
|
|
||||||
|
lbf_new = LabelFrame(self, text=text)
|
||||||
|
lbf_new.grid(row=0, column=0, sticky='WE', padx=5, pady=5)
|
||||||
|
|
||||||
|
label_font = font.Font(weight='bold', size=9)
|
||||||
|
Label(lbf_new, text="", font=label_font).grid(row=0, column=0, sticky="W")
|
||||||
|
input_entry = Entry(lbf_new, textvariable=self.inp_value, width=100)
|
||||||
|
input_entry.grid(row=0, column=1, sticky="W", pady=10)
|
||||||
|
input_entry.focus()
|
||||||
|
self.after(0,input_entry.focus)
|
||||||
|
|
||||||
|
|
||||||
|
self.btn = Button(self, text="Valider", command=self.destroy)
|
||||||
|
self.btn.grid(row=2, column=0, pady=10, padx=10, sticky='NSEW')
|
||||||
|
|
||||||
|
def add(self):
|
||||||
|
self.destroy()
|
||||||
|
if self.object is not None:
|
||||||
|
self.object.add_items(code=self.inp_code.get(), name=self.debitor["name"])
|
||||||
|
self.object.save_debitors()
|
||||||
|
|
||||||
|
def destroy(self):
|
||||||
|
if self.inp_value.get() is None or self.inp_value.get() == "":
|
||||||
|
messagebox.showerror(title="ERREUR", message="Veuillez saisir une valeur !")
|
||||||
|
self.focus()
|
||||||
|
else:
|
||||||
|
super().destroy()
|
||||||
|
|
||||||
|
def show(self):
|
||||||
|
self.deiconify()
|
||||||
|
self.wm_protocol("WM_DELETE_WINDOW", self.destroy)
|
||||||
|
self.wait_window(self)
|
||||||
|
print("nouvelle valeur = " + self.inp_value.get())
|
||||||
|
return self.inp_value.get()
|
||||||
BIN
debitors_src.bin
Normal file
BIN
debitors_src.bin
Normal file
Binary file not shown.
@@ -1 +1 @@
|
|||||||
20220606-1735
|
20220907-1112
|
||||||
337
main.py
337
main.py
@@ -8,7 +8,7 @@ import textwrap
|
|||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
import tkinter
|
import tkinter
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
|
||||||
import tkinter.filedialog
|
import tkinter.filedialog
|
||||||
from tkinter import *
|
from tkinter import *
|
||||||
@@ -21,9 +21,11 @@ from threading import *
|
|||||||
from class_invoices import *
|
from class_invoices import *
|
||||||
from class_addresses import *
|
from class_addresses import *
|
||||||
from auto_update import *
|
from auto_update import *
|
||||||
|
from class_debitors import *
|
||||||
|
|
||||||
from version import *
|
from version import *
|
||||||
#test master 2
|
from custom_popup import *
|
||||||
|
|
||||||
|
|
||||||
src_dir = os.getenv('APPDATA') + "\Attrib2Biz\src"
|
src_dir = os.getenv('APPDATA') + "\Attrib2Biz\src"
|
||||||
dest_dir = os.getenv('APPDATA') + "\Attrib2Biz\output"
|
dest_dir = os.getenv('APPDATA') + "\Attrib2Biz\output"
|
||||||
@@ -45,122 +47,6 @@ if not os.path.exists(temp_dir):
|
|||||||
os.makedirs(temp_dir)
|
os.makedirs(temp_dir)
|
||||||
|
|
||||||
|
|
||||||
class SuggestionPopup(Toplevel):
|
|
||||||
x_row = 0
|
|
||||||
def __init__(self, parent, item_1=None, item_2=None, debitor=None):
|
|
||||||
super().__init__(parent)
|
|
||||||
|
|
||||||
self.geometry(f"700x300+{parent.winfo_x() + 25 }+{parent.winfo_y() +25 }")
|
|
||||||
self.resizable(True,True)
|
|
||||||
self.iconbitmap("./logo_clerc_03X_icon.ico")
|
|
||||||
self.title(f"Choix de l'adresse à conserver {item_1['fip_number']}. Code débiteur: {debitor['code']}")
|
|
||||||
|
|
||||||
self.columnconfigure(0, weight=1)
|
|
||||||
self.columnconfigure(1, weight=1)
|
|
||||||
|
|
||||||
lbf_new = LabelFrame(self, text="Nouveau patient")
|
|
||||||
lbf_new.grid(row=0, column=0, sticky='WE', padx=5, pady=5)
|
|
||||||
|
|
||||||
Label(lbf_new, text=f"N° AVS de l'adresse \t {item_1['insurance_policy_number'].replace('.','')}").grid(row=0, column=0)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lbf_old = LabelFrame(self, text="Ancien patient")
|
|
||||||
lbf_old.grid(row=0, column=1, sticky='NSEW', padx=5, pady=5)
|
|
||||||
|
|
||||||
str_address_1 = ""
|
|
||||||
|
|
||||||
fonts = []
|
|
||||||
|
|
||||||
self.x_row = 0
|
|
||||||
self.add_compares_element(new_frame=lbf_new,old_frame=lbf_old,label="N° AVS de l'adresse:",str1=item_1['insurance_policy_number'].replace('.',''), str2=item_2.AVS)
|
|
||||||
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Nom:", str1=item_1['lastname'], str2=item_2.lastName)
|
|
||||||
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Prénom:", str1=item_1['firstname'], str2=item_2.firstName)
|
|
||||||
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Date de naissance:", str1=datetime.strptime(item_1['birthdate'], "%Y-%m-%d").strftime("%d.%m.%Y"), str2=item_2.birth)
|
|
||||||
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Adresse:", str1=f"{item_1['street']} {item_1['street_number']}", str2=item_2.street)
|
|
||||||
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="NPA/Localité:", str1=f"{item_1['postal_code']} {item_1['city']}", str2=f"{item_2.npa} {item_2.city}")
|
|
||||||
|
|
||||||
|
|
||||||
str_address_1 += item_1['insurance_policy_number'].replace('.', '')
|
|
||||||
str_address_1 += item_1['lastname'].strip()
|
|
||||||
str_address_1 += item_1['firstname'].strip()
|
|
||||||
str_address_1 += datetime.strptime(item_1['birthdate'], "%Y-%m-%d").strftime("%d.%m.%Y")
|
|
||||||
str_address_1 += f"{item_1['street']} {item_1['street_number']}"
|
|
||||||
str_address_1 += f"{item_1['postal_code']} {item_1['city']}"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
str_address_2 = ""
|
|
||||||
|
|
||||||
str_address_2 += item_2.AVS
|
|
||||||
str_address_2 += item_2.lastName
|
|
||||||
str_address_2 += item_2.firstName
|
|
||||||
str_address_2 += item_2.birth
|
|
||||||
str_address_2 += f"{item_2.street.strip()}"
|
|
||||||
str_address_2 += f"{item_2.npa} {item_2.city}"
|
|
||||||
|
|
||||||
self.listbox = Listbox(self, height=3, width=35)
|
|
||||||
self.listbox.grid(row=1,column=0, columnspan= 2, pady=15,padx=15, sticky='NSEW')
|
|
||||||
|
|
||||||
self.btn = Button(self, text="Valider", command=self.select)
|
|
||||||
self.btn.grid(row=2,columnspan=2 , pady=10,padx=10, sticky='NSEW')
|
|
||||||
|
|
||||||
for (idd, info) in ((0, "Ancienne"), (1, "Nouvelle")) :
|
|
||||||
self.listbox.insert(END, info)
|
|
||||||
|
|
||||||
if int(debitor["code"]) >= 100:
|
|
||||||
self.listbox.delete(0,END)
|
|
||||||
self.listbox.delete(0, END)
|
|
||||||
|
|
||||||
self.listbox.insert(END, f"Aucun changement possible, code débiteur {debitor['code']}")
|
|
||||||
self.listbox.configure(state='disabled')
|
|
||||||
|
|
||||||
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})")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def add_compares_element(self,new_frame, old_frame,str1, str2, label):
|
|
||||||
label_font = font.Font(weight='bold', size=9)
|
|
||||||
|
|
||||||
value_color = "black"
|
|
||||||
con = ""
|
|
||||||
if str1 != str2:
|
|
||||||
value_color = "red"
|
|
||||||
con = "*"
|
|
||||||
|
|
||||||
Label(new_frame, text=label, font=label_font).grid(row=self.x_row, column=0, sticky="W")
|
|
||||||
Label(new_frame, text=con + str1 + con, fg=value_color).grid(row=self.x_row, column=1, sticky="W")
|
|
||||||
Label(old_frame, text=label, font=label_font).grid(row=self.x_row, column=0, sticky="W")
|
|
||||||
Label(old_frame, text=con + str2 + con, fg=value_color).grid(row=self.x_row, column=1, sticky="W")
|
|
||||||
|
|
||||||
self.x_row += 1
|
|
||||||
|
|
||||||
self.selection = None
|
|
||||||
def destroy(self):
|
|
||||||
if self.selection is None:
|
|
||||||
self.selection = 0
|
|
||||||
super().destroy()
|
|
||||||
|
|
||||||
def select(self):
|
|
||||||
selection = self.listbox.curselection()
|
|
||||||
if selection:
|
|
||||||
self.selection = self.listbox.get(selection[0])
|
|
||||||
self.selection = True if self.selection == "Nouvelle" else False
|
|
||||||
self.destroy()
|
|
||||||
|
|
||||||
def show(self):
|
|
||||||
self.deiconify()
|
|
||||||
self.wm_protocol("WM_DELETE_WINDOW", self.destroy)
|
|
||||||
self.wait_window(self)
|
|
||||||
return self.selection
|
|
||||||
|
|
||||||
|
|
||||||
class TextHandler(logging.Handler):
|
class TextHandler(logging.Handler):
|
||||||
"""This class allows you to log to a Tkinter Text or ScrolledText widget"""
|
"""This class allows you to log to a Tkinter Text or ScrolledText widget"""
|
||||||
@@ -188,6 +74,7 @@ class ClercAttrib2Biz():
|
|||||||
self.count_facture = 0
|
self.count_facture = 0
|
||||||
self.a_index = {"invoice": [], "intervention": [], "patient": [], "debtor": [], "articles": [], "global": []}
|
self.a_index = {"invoice": [], "intervention": [], "patient": [], "debtor": [], "articles": [], "global": []}
|
||||||
self.addresses = cls_Addresses()
|
self.addresses = cls_Addresses()
|
||||||
|
self.o_debs = cls_debitors(filepath=temp_dir)
|
||||||
|
|
||||||
self.index_counter = 0
|
self.index_counter = 0
|
||||||
self.bs_counter = 70
|
self.bs_counter = 70
|
||||||
@@ -200,11 +87,13 @@ class ClercAttrib2Biz():
|
|||||||
self.prompt = None
|
self.prompt = None
|
||||||
self.b_prompt_open = False
|
self.b_prompt_open = False
|
||||||
|
|
||||||
|
self.check_addresses = BooleanVar(self.fenetre)
|
||||||
self.delete_after_parse = BooleanVar(self.fenetre)
|
self.delete_after_parse = BooleanVar(self.fenetre)
|
||||||
self.export_format_biz = BooleanVar(self.fenetre)
|
self.export_format_biz = BooleanVar(self.fenetre)
|
||||||
self.export_one_file = BooleanVar(self.fenetre)
|
self.export_one_file = BooleanVar(self.fenetre)
|
||||||
self.run_excel_after_export = BooleanVar(self.fenetre)
|
self.run_excel_after_export = BooleanVar(self.fenetre)
|
||||||
|
|
||||||
|
self.check_addresses.set(True)
|
||||||
self.export_one_file.set(True)
|
self.export_one_file.set(True)
|
||||||
self.run_excel_after_export.set(False)
|
self.run_excel_after_export.set(False)
|
||||||
self.export_format_biz.set(True)
|
self.export_format_biz.set(True)
|
||||||
@@ -213,6 +102,9 @@ class ClercAttrib2Biz():
|
|||||||
self.refresh_ui()
|
self.refresh_ui()
|
||||||
self.read_addresses()
|
self.read_addresses()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
self.timer = self.fenetre.after(1000, self.main_timer_fn)
|
self.timer = self.fenetre.after(1000, self.main_timer_fn)
|
||||||
|
|
||||||
self.fenetre.mainloop()
|
self.fenetre.mainloop()
|
||||||
@@ -222,8 +114,11 @@ class ClercAttrib2Biz():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def main_timer_fn(self):
|
def main_timer_fn(self):
|
||||||
print("Pass tick timer main app")
|
#print("Pass tick timer main app")
|
||||||
self.timer = self.fenetre.after(5000, self.main_timer_fn)
|
self.timer = self.fenetre.after(5000, self.main_timer_fn)
|
||||||
|
|
||||||
self.nb_facture_var.set(self.count_facture)
|
self.nb_facture_var.set(self.count_facture)
|
||||||
@@ -308,11 +203,20 @@ class ClercAttrib2Biz():
|
|||||||
lbf_3 = LabelFrame(self.fenetre, text="Options")
|
lbf_3 = LabelFrame(self.fenetre, text="Options")
|
||||||
lbf_3.grid(row=0, column=1, rowspan=2, sticky='NSEW', padx=5, pady=5)
|
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="Vérifier les Adresses", variable=self.check_addresses, 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="Supprimer fichiers après conversion", variable= self.delete_after_parse, onvalue=True, offvalue=False).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="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 = 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')
|
||||||
|
|
||||||
|
menu_bar = Menu(self.fenetre)
|
||||||
|
menu_param = Menu(menu_bar, tearoff=0)
|
||||||
|
menu_param.add_command(label="Affichage des débiteurs", command=self.o_debs.print_all_debs)
|
||||||
|
menu_bar.add_cascade(label="Paramètre", menu=menu_param)
|
||||||
|
|
||||||
|
self.fenetre.config(menu=menu_bar)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -338,7 +242,7 @@ class ClercAttrib2Biz():
|
|||||||
self.b_prompt_open = False
|
self.b_prompt_open = False
|
||||||
|
|
||||||
def refresh_ui(self):
|
def refresh_ui(self):
|
||||||
print("pass refresh UI")
|
#print("pass refresh UI")
|
||||||
if self.export_one_file.get() and not self.export_format_biz.get():
|
if self.export_one_file.get() and not self.export_format_biz.get():
|
||||||
self.cb_run['state'] = "active"
|
self.cb_run['state'] = "active"
|
||||||
else:
|
else:
|
||||||
@@ -350,7 +254,7 @@ class ClercAttrib2Biz():
|
|||||||
|
|
||||||
|
|
||||||
def read_addresses(self):
|
def read_addresses(self):
|
||||||
file_addresses_path = os.path.join(dest_dir, f"adresses.csv")
|
file_addresses_path = os.path.join(dest_dir, f"adresses.txt")
|
||||||
if os.path.exists(file_addresses_path):
|
if os.path.exists(file_addresses_path):
|
||||||
file = open(file_addresses_path)
|
file = open(file_addresses_path)
|
||||||
csvreader = csv.reader(file, delimiter=';')
|
csvreader = csv.reader(file, delimiter=';')
|
||||||
@@ -362,12 +266,13 @@ class ClercAttrib2Biz():
|
|||||||
o_addresse.lastName = row[9]
|
o_addresse.lastName = row[9]
|
||||||
o_addresse.firstName = row[10]
|
o_addresse.firstName = row[10]
|
||||||
o_addresse.birth = row[38]
|
o_addresse.birth = row[38]
|
||||||
o_addresse.street = row[12]
|
o_addresse.street = row[11]
|
||||||
|
o_addresse.street_cpl = row[12]
|
||||||
o_addresse.npa = row[13]
|
o_addresse.npa = row[13]
|
||||||
o_addresse.city = row[15]
|
o_addresse.city = row[15]
|
||||||
self.addresses.add_addresse(o_addresse)
|
self.addresses.add_addresse(o_addresse)
|
||||||
|
|
||||||
print(self.addresses.items)
|
|
||||||
file.close()
|
file.close()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -380,7 +285,7 @@ class ClercAttrib2Biz():
|
|||||||
self.count_facture = 0
|
self.count_facture = 0
|
||||||
x = 0
|
x = 0
|
||||||
|
|
||||||
self.export_filename = f"bizexdoc_export_Attrib_v{datetime.now().year}{datetime.now().month}{datetime.now().month}{datetime.now().hour}{datetime.now().minute}.csv"
|
self.export_filename = f"bizexdoc_export_Attrib_v{datetime.now().year}{datetime.now().month}{datetime.now().day}{datetime.now().hour}{datetime.now().minute}.csv"
|
||||||
|
|
||||||
if self.export_format_biz:
|
if self.export_format_biz:
|
||||||
if self.export_one_file.get() and os.path.exists(os.path.join(dest_dir, self.export_filename)):
|
if self.export_one_file.get() and os.path.exists(os.path.join(dest_dir, self.export_filename)):
|
||||||
@@ -401,7 +306,7 @@ class ClercAttrib2Biz():
|
|||||||
|
|
||||||
print(f"remove src.csv => {os.path.join(dest_dir, 'src.csv')}")
|
print(f"remove src.csv => {os.path.join(dest_dir, 'src.csv')}")
|
||||||
|
|
||||||
|
self.progress_bar["value"] = 0
|
||||||
for filename in os.listdir(dir):
|
for filename in os.listdir(dir):
|
||||||
x += 1
|
x += 1
|
||||||
if ".json" in filename:
|
if ".json" in filename:
|
||||||
@@ -410,11 +315,17 @@ class ClercAttrib2Biz():
|
|||||||
data = json.load(f)
|
data = json.load(f)
|
||||||
|
|
||||||
if self.export_format_biz.get():
|
if self.export_format_biz.get():
|
||||||
self.parseFile(data, filename)
|
bRet = self.parseFile(data, filename)
|
||||||
|
if bRet:
|
||||||
|
messagebox.showinfo(title="Fin de conversion",
|
||||||
|
message="La conversion s'est terminée avec succès")
|
||||||
|
return False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
self.convertFile(data, filename)
|
self.convertFile(data, filename)
|
||||||
if self.delete_after_parse.get():
|
if self.delete_after_parse.get():
|
||||||
os.remove(dir + "/" + filename)
|
os.remove(dir + "/" + filename)
|
||||||
|
|
||||||
self.progress_bar["value"] = x / len(os.listdir(dir)) * 100
|
self.progress_bar["value"] = x / len(os.listdir(dir)) * 100
|
||||||
self.fenetre.update_idletasks()
|
self.fenetre.update_idletasks()
|
||||||
self.nb_facture_var.set(self.count_facture)
|
self.nb_facture_var.set(self.count_facture)
|
||||||
@@ -427,8 +338,57 @@ class ClercAttrib2Biz():
|
|||||||
return ret
|
return ret
|
||||||
return value.strip()
|
return value.strip()
|
||||||
|
|
||||||
|
def trim_all_data(self, data):
|
||||||
|
if data.Patient["lastname"] is not None:
|
||||||
|
data.Patient["lastname"] = data.Patient["lastname"].strip()
|
||||||
|
if data.Patient["firstname"] is not None:
|
||||||
|
data.Patient["firstname"] = data.Patient["firstname"].strip()
|
||||||
|
if data.Patient["street"] is not None:
|
||||||
|
data.Patient["street"] = data.Patient["street"].strip()
|
||||||
|
if data.Debtor["lastname"] is not None:
|
||||||
|
data.Debtor["lastname"] = data.Debtor["lastname"].strip()
|
||||||
|
if data.Debtor["firstname"] is not None:
|
||||||
|
data.Debtor["firstname"] = data.Debtor["firstname"].strip()
|
||||||
|
if data.Debtor["street"] is not None:
|
||||||
|
data.Debtor["street"] = data.Debtor["street"].strip()
|
||||||
|
|
||||||
|
def check_code_validity(self, code,data):
|
||||||
|
ret = True
|
||||||
|
check_patients = ["firstname", "lastname", "street"]
|
||||||
|
check_Debtor = ["firstname", "lastname", "street"]
|
||||||
|
if code == 1:
|
||||||
|
for check in check_patients:
|
||||||
|
if data.Patient[check] is None:
|
||||||
|
ret = False
|
||||||
|
for check in check_Debtor:
|
||||||
|
if data.Debtor[check] is None:
|
||||||
|
ret = False
|
||||||
|
if not ret:
|
||||||
|
messagebox.showerror(title="Erreur Critique", message=f"Les informations de la factures [{data.data['id']}] comportes trop d'erreur arrêt du processus ")
|
||||||
|
return False
|
||||||
|
|
||||||
|
return ret
|
||||||
|
|
||||||
|
def compare_old_and_new_adresses(self, new, old):
|
||||||
|
|
||||||
|
if new['insurance_policy_number'].replace('.','') != old.AVS:
|
||||||
|
return False
|
||||||
|
if new['lastname'].replace('.','') != old.lastName:
|
||||||
|
return False
|
||||||
|
if new['firstname'].replace('.','') != old.firstName:
|
||||||
|
return False
|
||||||
|
if datetime.strptime(new['birthdate'], "%Y-%m-%d").strftime("%d.%m.%Y") != old.birth:
|
||||||
|
return False
|
||||||
|
if f"{new['street']} {new['street_number']}" != old.street:
|
||||||
|
return False
|
||||||
|
if f"{new['postal_code']} {new['city']}" != f"{old.npa} {old.city}":
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
def parseFile(self, data, filename):
|
def parseFile(self, data, filename):
|
||||||
|
self.progress_bar["value"] = 0
|
||||||
self.index_counter += 1
|
self.index_counter += 1
|
||||||
lines = []
|
lines = []
|
||||||
self.count_facture += len(data["invoices"])
|
self.count_facture += len(data["invoices"])
|
||||||
@@ -440,23 +400,35 @@ class ClercAttrib2Biz():
|
|||||||
csv_col.data[5] = f""
|
csv_col.data[5] = f""
|
||||||
lines.append(csv_col.data)
|
lines.append(csv_col.data)
|
||||||
|
|
||||||
|
cur_invoice_index = 0
|
||||||
|
|
||||||
x = 70
|
|
||||||
|
|
||||||
for ele in data["invoices"]:
|
for ele in data["invoices"]:
|
||||||
|
cur_invoice_index += 1
|
||||||
|
self.progress_bar["value"] = cur_invoice_index / self.count_facture * 100
|
||||||
b_address_update = True
|
b_address_update = True
|
||||||
data = cls_Invoice()
|
data = cls_Invoice()
|
||||||
data.parse_item(ele)
|
data.parse_item(ele)
|
||||||
|
|
||||||
|
self.trim_all_data(data)
|
||||||
|
|
||||||
print(f"Code débiteur => {data.data['id']}: {data.Debtor['code']}")
|
print(f"Code débiteur => {data.data['id']}: {data.Debtor['code']}")
|
||||||
if data.Debtor["code"] is None or '.' in str(data.Debtor["code"]):
|
if data.Debtor["code"] is None or '.' in data.Debtor["code"]:
|
||||||
print("ERROR code débiteur")
|
print("ERROR code débiteur #1")
|
||||||
messagebox.showerror(title="Erreur code débiteur erroné", message=f"Le code débiteur de la facture {data.data['id']} est faux: [{data.Debtor['code']}], merci de le corriger ")
|
messagebox.showerror(title="Erreur code débiteur", message=f"Le code débiteur de la facture {data.data['id']} est faux: [{data.Debtor['code']}], merci de le corriger ")
|
||||||
if data.Debtor["code"] is None:
|
inp_popup = Input_popup(self.fenetre, default=data.Debtor["code"], factureID=data.data['id'], fip=data.Patient['fip_number'])
|
||||||
data.Debtor["code"] = 1
|
data.Debtor["code"] = str(inp_popup.show())
|
||||||
else:
|
if data.Debtor["code"] is None or '.' in data.Debtor["code"]:
|
||||||
data.Debtor["code"] = str(data.Debtor["code"]).replace('.', '')
|
messagebox.showerror(title="Erreur Critique",
|
||||||
|
message=f"Les informations de la factures [{data.data['id']}] comportes trop d'erreur arrêt du processus ")
|
||||||
|
return False
|
||||||
|
|
||||||
|
if int(data.Debtor["code"]) == 1:
|
||||||
|
if not self.check_code_validity(data.Debtor["code"],data):
|
||||||
|
messagebox.showerror(title="Erreur Critique",
|
||||||
|
message=f"Les informations de la factures [{data.data['id']}] comportes trop d'erreur arrêt du processus ")
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
if data.Debtor["code"] != "1" and data.Debtor["code"] != None and int(data.Debtor["code"]) < 100:
|
if data.Debtor["code"] != "1" and data.Debtor["code"] != None and int(data.Debtor["code"]) < 100:
|
||||||
if data.Patient["fip_number"] not in self.a_listings["to_check"]:
|
if data.Patient["fip_number"] not in self.a_listings["to_check"]:
|
||||||
@@ -482,11 +454,28 @@ class ClercAttrib2Biz():
|
|||||||
self.logger.warn(f"Débiteur établissement facture N°: {data.data['id']} / {data.Patient['fip_number']} {data.Debtor['name']}")
|
self.logger.warn(f"Débiteur établissement facture N°: {data.data['id']} / {data.Patient['fip_number']} {data.Debtor['name']}")
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if data.Debtor["code"] == 1 and data.Patient["lastname"] + data.Patient["firstname"] != data.Debtor["lastname"] + data.Debtor["firstname"]:
|
if int(data.Debtor["code"]) == 1 and data.Patient["lastname"] + data.Patient["firstname"] != data.Debtor["lastname"] + data.Debtor["firstname"]:
|
||||||
self.a_listings["to_check"].append(data.Patient["fip_number"])
|
self.a_listings["to_check"].append(data.Patient["fip_number"])
|
||||||
print(data.Patient["complement"])
|
print(data.Patient["complement"])
|
||||||
self.logger.warning(f"Débiteur différents: facture N°: {data.data['id']} / {data.Patient['fip_number']}")
|
self.logger.warning(f"Débiteur différents: facture N°: {data.data['id']} / {data.Patient['fip_number']}")
|
||||||
|
|
||||||
|
if int(data.Debtor["code"]) >= 100:
|
||||||
|
if not self.o_debs.is_in_debitor_name(code=data.Debtor["code"],search_name=data.Debtor["name"]):
|
||||||
|
#messagebox.showerror(title="Erreur code débiteur erroné", message=f"Information débiteur incohérente: facture N°: {data.data['id']} / {data.Patient['fip_number']}.\nCode débiteur: {data.Debtor['code']}\nNom du débiteur: {data.Debtor['name']}. \nAurait dû être: {self.o_debs.get_names_by_code(data.Debtor['code'])}")
|
||||||
|
debitor_popup = Check_debitor_popup(self.fenetre,data.Debtor,self.o_debs.get_names_by_code(data.Debtor['code']),data.data['id'],data.Patient['fip_number'], object=self.o_debs)
|
||||||
|
data.Debtor["code"] = debitor_popup.show()
|
||||||
|
|
||||||
|
if data.Debtor["code"] is None or '.' in data.Debtor["code"]:
|
||||||
|
messagebox.showerror(title="Erreur Critique",
|
||||||
|
message=f"Les informations de la factures [{data.data['id']}] comportes trop d'erreur arrêt du processus ")
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if data.Patient["complement"] != None:
|
if data.Patient["complement"] != None:
|
||||||
self.a_listings["to_check"].append(data.Patient["fip_number"])
|
self.a_listings["to_check"].append(data.Patient["fip_number"])
|
||||||
print(data.Patient["complement"])
|
print(data.Patient["complement"])
|
||||||
@@ -496,12 +485,14 @@ class ClercAttrib2Biz():
|
|||||||
if data.Patient['insurance_policy_number'] == None:
|
if data.Patient['insurance_policy_number'] == None:
|
||||||
data.Patient['insurance_policy_number'] = f"{uuid.uuid4()}"[:15]
|
data.Patient['insurance_policy_number'] = f"{uuid.uuid4()}"[:15]
|
||||||
|
|
||||||
addresses_exist = self.addresses.get_item_by_AVS(data.Patient['insurance_policy_number'].replace(".", ""))
|
if self.check_addresses.get():
|
||||||
if addresses_exist is not None:
|
addresses_exist = self.addresses.get_item_by_AVS(data.Patient['insurance_policy_number'].replace(".", ""))
|
||||||
|
if addresses_exist is not None and not self.compare_old_and_new_adresses(new=data.Patient, old=addresses_exist):
|
||||||
popup = SuggestionPopup(self.fenetre, item_1=data.Patient, item_2=addresses_exist,debitor=data.Debtor )
|
popup = Check_addresses_popup(self.fenetre, item_1=data.Patient, item_2=addresses_exist, debitor=data.Debtor, factureID=data.data['id'])
|
||||||
b_address_update = popup.show()
|
b_address_update = popup.show()
|
||||||
print(f"Result Popup: {b_address_update}")
|
print(f"Result Popup: {b_address_update}")
|
||||||
|
else:
|
||||||
|
b_address_update = True
|
||||||
|
|
||||||
#self.draw_test(item_1=data.Patient, item_2=addresses_exist)
|
#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 ")
|
#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 ")
|
||||||
@@ -524,12 +515,19 @@ class ClercAttrib2Biz():
|
|||||||
self.bs_counter += 1
|
self.bs_counter += 1
|
||||||
csv_col = cls_Col(True)
|
csv_col = cls_Col(True)
|
||||||
|
|
||||||
|
print(article)
|
||||||
|
if "code" in article.keys() and article["code"] == "HRF":
|
||||||
|
break
|
||||||
|
|
||||||
|
|
||||||
##Donnée globales
|
##Donnée globales
|
||||||
csv_col.data[0] = data.data["id"] # N° document
|
csv_col.data[0] = data.data["id"] # N° document
|
||||||
csv_col.data[1] = 20 # Type of document 20 = facture débiteur
|
csv_col.data[1] = 20 # Type of document 20 = facture débiteur
|
||||||
csv_col.data[2] = datetime.strptime(data.data["date"], "%Y-%m-%d").strftime("%d.%m.%Y") # Date du document
|
csv_col.data[2] = datetime.strptime(data.data["date"], "%Y-%m-%d").strftime("%d.%m.%Y") # Date du document
|
||||||
csv_col.data[4] = data.Patient["fip_number"] # Référence
|
csv_col.data[4] = data.Patient["fip_number"] # Référence
|
||||||
csv_col.data[10] = "<AUTO>" # Compte collectif du tiers = <AUTO>
|
csv_col.data[10] = "<AUTO>" # Compte collectif du tiers = <AUTO>
|
||||||
|
csv_col.data[139] = "COND-30" # Conditions de payement à 30, COND-30 selon config dans winbiz
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if "without_transportation" in data.Intervention.keys() and data.Intervention["without_transportation"] == True:
|
if "without_transportation" in data.Intervention.keys() and data.Intervention["without_transportation"] == True:
|
||||||
@@ -587,8 +585,12 @@ class ClercAttrib2Biz():
|
|||||||
con = ""
|
con = ""
|
||||||
concat_str = ""
|
concat_str = ""
|
||||||
if "name" in data.Debtor.keys():
|
if "name" in data.Debtor.keys():
|
||||||
concat_str += con + data.Debtor["name"]
|
if data.Debtor["name"] is not None:
|
||||||
con = "#chr(13)##chr(10)#"
|
concat_str += con + data.Debtor["name"]
|
||||||
|
con = "#chr(13)##chr(10)#"
|
||||||
|
else:
|
||||||
|
messagebox.showerror(title="Erreur nom débiteur", message=f"Le nom débiteur de la facture {data.data['id']} est faux: [{data.Debtor['name']}], merci de le corriger ")
|
||||||
|
|
||||||
|
|
||||||
if data.Debtor["gender"] is not None:
|
if data.Debtor["gender"] is not None:
|
||||||
concat_str += con + "Monsieur" if data.Debtor["gender"] == "Masculin" else con + "Madame"
|
concat_str += con + "Monsieur" if data.Debtor["gender"] == "Masculin" else con + "Madame"
|
||||||
@@ -596,15 +598,19 @@ class ClercAttrib2Biz():
|
|||||||
if data.Debtor["lastname"] is not None:
|
if data.Debtor["lastname"] is not None:
|
||||||
concat_str += con + self.ifNotNull(data.Debtor["lastname"]) + " " + self.ifNotNull(data.Debtor["firstname"])
|
concat_str += con + self.ifNotNull(data.Debtor["lastname"]) + " " + self.ifNotNull(data.Debtor["firstname"])
|
||||||
con = "#chr(13)##chr(10)#"
|
con = "#chr(13)##chr(10)#"
|
||||||
if data.Debtor["street"] is not None:
|
|
||||||
concat_str += con + self.ifNotNull(data.Debtor["street"]) + " " + self.ifNotNull(data.Debtor["street_number"])
|
|
||||||
con = "#chr(13)##chr(10)#"
|
|
||||||
if data.Debtor["complement"] is not None:
|
if data.Debtor["complement"] is not None:
|
||||||
concat_str += con + data.Debtor["complement"]
|
concat_str += con + data.Debtor["complement"]
|
||||||
con = "#chr(13)##chr(10)#"
|
con = "#chr(13)##chr(10)#"
|
||||||
|
if data.Debtor["street"] is not None:
|
||||||
|
concat_str += con + self.ifNotNull(data.Debtor["street"]) + " " + self.ifNotNull(data.Debtor["street_number"])
|
||||||
|
con = "#chr(13)##chr(10)#"
|
||||||
if data.Debtor["city"] is not None:
|
if data.Debtor["city"] is not None:
|
||||||
concat_str += con + self.ifNotNull(data.Debtor["postal_code"]) + " " + self.ifNotNull(data.Debtor["city"])
|
concat_str += con + self.ifNotNull(data.Debtor["postal_code"]) + " " + self.ifNotNull(data.Debtor["city"])
|
||||||
con = "#chr(13)##chr(10)#"
|
con = "#chr(13)##chr(10)#"
|
||||||
|
if data.Debtor["country_name"] != "Suisse":
|
||||||
|
concat_str += con + data.Debtor["country_name"]
|
||||||
|
con = "#chr(13)##chr(10)#"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -627,7 +633,11 @@ class ClercAttrib2Biz():
|
|||||||
else:
|
else:
|
||||||
csv_col.data[21] = ''
|
csv_col.data[21] = ''
|
||||||
|
|
||||||
csv_col.data[40] = data.Patient["birthdate"]
|
if data.Patient["birthdate"] is not None:
|
||||||
|
csv_col.data[40] = datetime.strptime(data.Patient["birthdate"], "%Y-%m-%d").strftime("%d.%m.%Y")
|
||||||
|
else:
|
||||||
|
csv_col.data[40] = ""
|
||||||
|
messagebox.showerror(title="Erreur date de naissance", message=f"La date de naissance de la facture {data.data['id']} est faux: [{data.Patient['birthdate']}], merci de le corriger ")
|
||||||
csv_col.data[48] = 0
|
csv_col.data[48] = 0
|
||||||
|
|
||||||
|
|
||||||
@@ -678,15 +688,18 @@ class ClercAttrib2Biz():
|
|||||||
csv_col.data[72] = "BU - 73 - aff"
|
csv_col.data[72] = "BU - 73 - aff"
|
||||||
csv_col.data[73] = 0
|
csv_col.data[73] = 0
|
||||||
|
|
||||||
csv_col.data[115] = self.ifNotNull(data.Patient["lastname"]) + " " + self.ifNotNull(data.Patient["firstname"])
|
#Objet facture
|
||||||
csv_col.data[108] = data.Patient["complement"]
|
csv_col.data[108] = self.ifNotNull(data.Patient["lastname"]) + " " + self.ifNotNull(data.Patient["firstname"])
|
||||||
|
csv_col.data[115] = data.Patient["complement"]
|
||||||
csv_col.data[109] = datetime.strptime(data.Patient["birthdate"], "%Y-%m-%d").strftime("%d.%m.%Y") if data.Patient["birthdate"] is not None else ""
|
csv_col.data[109] = datetime.strptime(data.Patient["birthdate"], "%Y-%m-%d").strftime("%d.%m.%Y") if data.Patient["birthdate"] is not None else ""
|
||||||
if data.Patient["insurance_policy_number"] is not None and '-' not in data.Patient["insurance_policy_number"]:
|
if data.Patient["insurance_policy_number"] is not None and '-' not in data.Patient["insurance_policy_number"]:
|
||||||
csv_col.data[109] += ", " + data.Patient["insurance_policy_number"]
|
csv_col.data[109] += ", " + data.Patient["insurance_policy_number"]
|
||||||
|
|
||||||
csv_col.data[110] = data.Patient["insurance_name"]
|
csv_col.data[110] = data.Patient["insurance_name"]
|
||||||
csv_col.data[111] = datetime.strptime(data.Intervention["start_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
date_PEC = datetime.strptime(data.Intervention["start_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
||||||
"%d.%m.%Y") # Date PEC
|
"%d.%m.%Y")
|
||||||
|
csv_col.data[51] = date_PEC # Date de ligne articles
|
||||||
|
csv_col.data[111] =date_PEC # Date PEC
|
||||||
csv_col.data[111] += " - " + datetime.strptime(data.Intervention["start_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
csv_col.data[111] += " - " + datetime.strptime(data.Intervention["start_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
||||||
"%H:%M") # Heure START PEC
|
"%H:%M") # Heure START PEC
|
||||||
|
|
||||||
@@ -706,8 +719,8 @@ class ClercAttrib2Biz():
|
|||||||
csv_col.data[116] = self.ifNotNull(data.Patient["category"]) + " - " + self.ifNotNull(data.Intervention["type"])
|
csv_col.data[116] = self.ifNotNull(data.Patient["category"]) + " - " + self.ifNotNull(data.Intervention["type"])
|
||||||
csv_col.data[118] = data.Intervention["kilometers"]
|
csv_col.data[118] = data.Intervention["kilometers"]
|
||||||
csv_col.data[135] = data.Intervention["base_name"]
|
csv_col.data[135] = data.Intervention["base_name"]
|
||||||
csv_col.data[136] = 2 if data.Intervention["base_name"] == "Uvrier" else 3
|
csv_col.data[136] = 3 if data.Debtor["code"] != "101" else "EBILL" #code présentation de facture
|
||||||
csv_col.data[146] = csv_col.data[136]
|
csv_col.data[146] = 3 #Code méthode de payement définit à 3
|
||||||
csv_col.data[168] = 1 if data.Intervention["team_name"] == "Planification" else 2
|
csv_col.data[168] = 1 if data.Intervention["team_name"] == "Planification" else 2
|
||||||
csv_col.data[169] = data.Patient['insurance_policy_number']
|
csv_col.data[169] = data.Patient['insurance_policy_number']
|
||||||
|
|
||||||
@@ -720,6 +733,7 @@ class ClercAttrib2Biz():
|
|||||||
wr.writerow(cdr)
|
wr.writerow(cdr)
|
||||||
else:
|
else:
|
||||||
self.save_file(lines,fileName=self.export_filename)
|
self.save_file(lines,fileName=self.export_filename)
|
||||||
|
|
||||||
def addToIndexs(self,obj,data,cat, key):
|
def addToIndexs(self,obj,data,cat, key):
|
||||||
#self.a_index[cat].append({"key":key,"index":len(obj.data)})
|
#self.a_index[cat].append({"key":key,"index":len(obj.data)})
|
||||||
if key not in self.a_index[cat]:
|
if key not in self.a_index[cat]:
|
||||||
@@ -727,7 +741,7 @@ class ClercAttrib2Biz():
|
|||||||
self.a_index["global"].append(key)
|
self.a_index["global"].append(key)
|
||||||
obj.data.append(data)
|
obj.data.append(data)
|
||||||
|
|
||||||
def convertFile(self, data, filename):
|
def convertFile(self, data, filename): #à utiliser pour un export avec fichier excel de Thomas
|
||||||
self.count_facture += len(data["invoices"])
|
self.count_facture += len(data["invoices"])
|
||||||
self.a_listings["to_check"] = []
|
self.a_listings["to_check"] = []
|
||||||
|
|
||||||
@@ -742,10 +756,11 @@ class ClercAttrib2Biz():
|
|||||||
b_update_debitor = True
|
b_update_debitor = True
|
||||||
|
|
||||||
print(f"Code débiteur => {data.data['id']}: {data.Debtor['code']}" )
|
print(f"Code débiteur => {data.data['id']}: {data.Debtor['code']}" )
|
||||||
if data.Debtor["code"] == "None" or '.' in str(data.Debtor["code"]):
|
if data.Debtor["code"] == "None" or '.' in data.Debtor["code"]:
|
||||||
print("ERROR code débiteur")
|
print("ERROR code débiteur")
|
||||||
messagebox.showerror(title="Erreur code débiteur erroné", message=f"Le code débiteur de la facture {data.data['id']} est faux: [{data.Debtor['code']}], merci de le corriger ")
|
messagebox.showerror(title="Erreur code débiteur", message=f"Le code débiteur de la facture {data.data['id']} est faux: [{data.Debtor['code']}], merci de le corriger ")
|
||||||
data.Debtor["code"] = str(data.Debtor["code"]).replace('.', '')
|
inp_popup = Input_popup(self.fenetre,default=data.Debtor["code"],factureID=data.data['id'], fip=data.Patient['fip_number'])
|
||||||
|
data.Debtor["code"] = str(inp_popup.show())
|
||||||
|
|
||||||
|
|
||||||
if data.Debtor["code"] != "1" and data.Debtor["code"] != None and int(data.Debtor["code"]) < 100:
|
if data.Debtor["code"] != "1" and data.Debtor["code"] != None and int(data.Debtor["code"]) < 100:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
VERSION = "20220606-1729"
|
VERSION = "20220907-1112"
|
||||||
Reference in New Issue
Block a user