Compare commits
8 Commits
20230426-1
...
20230620-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
eb0e4b4429 | ||
|
|
4387a1d00b | ||
|
|
c722af1091 | ||
|
|
92b3a76733 | ||
|
|
5adbc77555 | ||
|
|
1146ff01c7 | ||
|
|
e4c075f6ef | ||
|
|
f05a56bc5a |
@@ -21,3 +21,4 @@ class cls_addresse:
|
|||||||
street_cpl = None
|
street_cpl = None
|
||||||
npa = None
|
npa = None
|
||||||
city = None
|
city = None
|
||||||
|
addr_2 = None
|
||||||
@@ -16,6 +16,57 @@ class cls_Invoice:
|
|||||||
self.data = obj
|
self.data = obj
|
||||||
self.a_index = {"invoice": [], "intervention": [], "patient": [], "debtor": [], "articles": []}
|
self.a_index = {"invoice": [], "intervention": [], "patient": [], "debtor": [], "articles": []}
|
||||||
self.index_counter = 0
|
self.index_counter = 0
|
||||||
|
self.format_debitor_addr_2()
|
||||||
|
def format_debitor_addr_2(self):
|
||||||
|
debitor = self.Debtor
|
||||||
|
con = ""
|
||||||
|
concat_str = ""
|
||||||
|
if "name" in debitor.keys():
|
||||||
|
if debitor["name"] is not None:
|
||||||
|
concat_str += con + debitor["name"]
|
||||||
|
# con = "#chr(13)##chr(10)#"
|
||||||
|
con = "\n"
|
||||||
|
|
||||||
|
if debitor["gender"] is not None:
|
||||||
|
concat_str += con + "Monsieur" if debitor["gender"] == "Masculin" else con + "Madame"
|
||||||
|
# con = "#chr(13)##chr(10)#"
|
||||||
|
con = "\n"
|
||||||
|
if debitor["lastname"] is not None:
|
||||||
|
concat_str += con + self.ifNotNull(debitor["lastname"]) + " " + self.ifNotNull(
|
||||||
|
debitor["firstname"])
|
||||||
|
# con = "#chr(13)##chr(10)#"
|
||||||
|
con = "\n"
|
||||||
|
if debitor["complement"] is not None:
|
||||||
|
concat_str += con + debitor["complement"]
|
||||||
|
# con = "#chr(13)##chr(10)#"
|
||||||
|
con = "\n"
|
||||||
|
if debitor["street"] is not None:
|
||||||
|
concat_str += con + self.ifNotNull(debitor["street"]) + " " + self.ifNotNull(
|
||||||
|
debitor["street_number"])
|
||||||
|
# con = "#chr(13)##chr(10)#"
|
||||||
|
con = "\n"
|
||||||
|
if debitor["city"] is not None:
|
||||||
|
concat_str += con + self.ifNotNull(debitor["postal_code"]) + " " + self.ifNotNull(
|
||||||
|
debitor["city"])
|
||||||
|
# con = "#chr(13)##chr(10)#"
|
||||||
|
con = "\n"
|
||||||
|
if debitor["country_name"] != "Suisse":
|
||||||
|
concat_str += con + debitor["country_name"]
|
||||||
|
# con = "#chr(13)##chr(10)#"
|
||||||
|
con = "\n"
|
||||||
|
self.Patient["addr_2"] = concat_str
|
||||||
|
self.Patient["selfish"] = self.is_addr_2_selfish(self.Patient)
|
||||||
|
def is_addr_2_selfish(self, patient):
|
||||||
|
print(patient)
|
||||||
|
temp_addr_2 = str(patient["addr_2"]).replace("Monsieur","").replace("Madame","").replace("\n","").replace(" ","")
|
||||||
|
str_compare = self.ifNotNull(patient['lastname']).replace('.','') + self.ifNotNull(patient['firstname']).replace('.','') + self.ifNotNull(patient['complement']).strip()+ self.ifNotNull(patient['street']).strip() + self.ifNotNull(patient['street_number']).strip() + self.ifNotNull(patient['postal_code']).strip() +self.ifNotNull(patient['city']).strip()
|
||||||
|
str_compare = str_compare.replace(" ","")
|
||||||
|
print(f"is_addr_2_selfish ? {str_compare} <> {temp_addr_2} = {str_compare == temp_addr_2}")
|
||||||
|
return str_compare == temp_addr_2
|
||||||
|
def ifNotNull(self, value, ret=""):
|
||||||
|
if value == None or value == "None":
|
||||||
|
return ret
|
||||||
|
return value.strip()
|
||||||
|
|
||||||
class cls_Col:
|
class cls_Col:
|
||||||
data = []
|
data = []
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class Check_addresses_popup(Toplevel):
|
|||||||
if(item_1["complement"] is None):
|
if(item_1["complement"] is None):
|
||||||
item_1["complement"] = ""
|
item_1["complement"] = ""
|
||||||
|
|
||||||
self.geometry(f"700x300+{parent.winfo_x() + 25 }+{parent.winfo_y() +25 }")
|
self.geometry(f"700x450+{parent.winfo_x() + 25 }+{parent.winfo_y() +25 }")
|
||||||
self.resizable(True,True)
|
self.resizable(True,True)
|
||||||
self.iconbitmap("./logo_clerc_03X_icon.ico")
|
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.title(f"Choix de l'adresse à conserver {item_1['fip_number']} / {factureID}. Code débiteur: {debitor['code']}")
|
||||||
@@ -26,6 +26,12 @@ class Check_addresses_popup(Toplevel):
|
|||||||
lbf_old = LabelFrame(self, text="Données Winbiz")
|
lbf_old = LabelFrame(self, text="Données Winbiz")
|
||||||
lbf_old.grid(row=0, column=1, sticky='NSEW', padx=5, pady=5)
|
lbf_old.grid(row=0, column=1, sticky='NSEW', padx=5, pady=5)
|
||||||
|
|
||||||
|
lbf_addr_2_new = LabelFrame(self, text="Livraison Attrib")
|
||||||
|
lbf_addr_2_new.grid(row=1, column=0, sticky='WE', padx=5, pady=5)
|
||||||
|
|
||||||
|
lbf_addr_2_old = LabelFrame(self, text="Livraison Winbiz")
|
||||||
|
lbf_addr_2_old.grid(row=1, column=1, sticky='NSEW', padx=5, pady=5)
|
||||||
|
|
||||||
str_address_1 = ""
|
str_address_1 = ""
|
||||||
|
|
||||||
fonts = []
|
fonts = []
|
||||||
@@ -40,6 +46,11 @@ class Check_addresses_popup(Toplevel):
|
|||||||
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}")
|
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}")
|
||||||
|
|
||||||
|
|
||||||
|
if int(debitor["code"]) < 100:
|
||||||
|
self.add_compares_element(new_frame=lbf_addr_2_new, old_frame=lbf_addr_2_old, label="Adresse livraison:", str1=item_1["addr_2"],
|
||||||
|
str2=self.ifNotNull(item_2.addr_2))
|
||||||
|
|
||||||
|
|
||||||
str_address_1 += item_1['insurance_policy_number'].replace('.', '')
|
str_address_1 += item_1['insurance_policy_number'].replace('.', '')
|
||||||
str_address_1 += item_1['lastname'].strip()
|
str_address_1 += item_1['lastname'].strip()
|
||||||
str_address_1 += item_1['firstname'].strip()
|
str_address_1 += item_1['firstname'].strip()
|
||||||
@@ -63,10 +74,10 @@ class Check_addresses_popup(Toplevel):
|
|||||||
str_address_2 += f"{item_2.npa} {item_2.city}"
|
str_address_2 += f"{item_2.npa} {item_2.city}"
|
||||||
|
|
||||||
self.listbox = Listbox(self, height=3, width=35)
|
self.listbox = Listbox(self, height=3, width=35)
|
||||||
self.listbox.grid(row=1,column=0, columnspan= 2, pady=15,padx=15, sticky='NSEW')
|
self.listbox.grid(row=2,column=0, columnspan= 2, pady=15,padx=15, sticky='NSEW')
|
||||||
|
|
||||||
self.btn = Button(self, text="Valider", command=self.select)
|
self.btn = Button(self, text="Valider", command=self.select)
|
||||||
self.btn.grid(row=2,columnspan=2 , pady=10,padx=10, sticky='NSEW')
|
self.btn.grid(row=3,columnspan=2 , pady=10,padx=10, sticky='NSEW')
|
||||||
|
|
||||||
for (idd, info) in ((0, "Winbiz"), (1, "Attrib")) :
|
for (idd, info) in ((0, "Winbiz"), (1, "Attrib")) :
|
||||||
self.listbox.insert(END, info)
|
self.listbox.insert(END, info)
|
||||||
@@ -88,8 +99,10 @@ class Check_addresses_popup(Toplevel):
|
|||||||
self.listbox.selection_set(1)
|
self.listbox.selection_set(1)
|
||||||
print(f"adresse différente [{str_address_1}] ({str_address_2})")
|
print(f"adresse différente [{str_address_1}] ({str_address_2})")
|
||||||
|
|
||||||
|
def ifNotNull(self, value, ret=""):
|
||||||
|
if value == None or value == "None":
|
||||||
|
return ret
|
||||||
|
return value.strip()
|
||||||
|
|
||||||
def add_compares_element(self,new_frame, old_frame,str1, str2, label):
|
def add_compares_element(self,new_frame, old_frame,str1, str2, label):
|
||||||
label_font = font.Font(weight='bold', size=9)
|
label_font = font.Font(weight='bold', size=9)
|
||||||
@@ -101,9 +114,9 @@ class Check_addresses_popup(Toplevel):
|
|||||||
con = "*"
|
con = "*"
|
||||||
|
|
||||||
Label(new_frame, text=str(label), font=label_font).grid(row=self.x_row, column=0, sticky="W")
|
Label(new_frame, text=str(label), font=label_font).grid(row=self.x_row, column=0, sticky="W")
|
||||||
Label(new_frame, text=con + str(str1) + con, fg=value_color).grid(row=self.x_row, column=1, sticky="W")
|
Label(new_frame, text=con + str(str1) + con, fg=value_color, anchor="w", justify=LEFT).grid(row=self.x_row, column=1, sticky="W")
|
||||||
Label(old_frame, text=str(label), font=label_font).grid(row=self.x_row, column=0, sticky="W")
|
Label(old_frame, text=str(label), font=label_font).grid(row=self.x_row, column=0, sticky="W")
|
||||||
Label(old_frame, text=con + str(str2) + con, fg=value_color).grid(row=self.x_row, column=1, sticky="W")
|
Label(old_frame, text=con + str(str2) + con, fg=value_color, anchor="w", justify=LEFT).grid(row=self.x_row, column=1, sticky="W")
|
||||||
|
|
||||||
self.x_row += 1
|
self.x_row += 1
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
20230426-1114
|
20230620-1502
|
||||||
74
main.py
74
main.py
@@ -140,6 +140,10 @@ class ClercAttrib2Biz():
|
|||||||
self.delete_after_parse.set(self.read_config_element("cfg_delete_after_parse", False))
|
self.delete_after_parse.set(self.read_config_element("cfg_delete_after_parse", False))
|
||||||
self.export_one_file.set(self.read_config_element("cfg_export_one_file", True))
|
self.export_one_file.set(self.read_config_element("cfg_export_one_file", True))
|
||||||
self.winbiz_folder_path.set(self.read_config_element("winbiz_folder_path", temp_dir))
|
self.winbiz_folder_path.set(self.read_config_element("winbiz_folder_path", temp_dir))
|
||||||
|
def add_statistique(self, stat_name, stat_value):
|
||||||
|
a_stats = None
|
||||||
|
if "a_stats" in self.config:
|
||||||
|
a_stats = self.config[""]
|
||||||
|
|
||||||
def read_config_element(self,name, default):
|
def read_config_element(self,name, default):
|
||||||
val = self.config.get(name)
|
val = self.config.get(name)
|
||||||
@@ -284,7 +288,8 @@ class ClercAttrib2Biz():
|
|||||||
|
|
||||||
file_addresses_path = os.path.join(temp_dir, f"adresses.dbf")
|
file_addresses_path = os.path.join(temp_dir, f"adresses.dbf")
|
||||||
if os.path.exists(file_addresses_path):
|
if os.path.exists(file_addresses_path):
|
||||||
for record in DBF(file_addresses_path):
|
for record in DBF(file_addresses_path, load=True):
|
||||||
|
|
||||||
o_addresse = cls_addresse()
|
o_addresse = cls_addresse()
|
||||||
o_addresse.AVS = str(record["AD_CODE"])
|
o_addresse.AVS = str(record["AD_CODE"])
|
||||||
o_addresse.lastName =str( record["AD_NOM"])
|
o_addresse.lastName =str( record["AD_NOM"])
|
||||||
@@ -298,6 +303,7 @@ class ClercAttrib2Biz():
|
|||||||
o_addresse.street_cpl =str( record["AD_RUE_1"])
|
o_addresse.street_cpl =str( record["AD_RUE_1"])
|
||||||
o_addresse.npa =str( record["AD_NPA"])
|
o_addresse.npa =str( record["AD_NPA"])
|
||||||
o_addresse.city = str(record["AD_VILLE"])
|
o_addresse.city = str(record["AD_VILLE"])
|
||||||
|
o_addresse.addr_2 = str(record["AD_ADR2"]).replace("\r\n","\n")
|
||||||
self.addresses.add_addresse(o_addresse)
|
self.addresses.add_addresse(o_addresse)
|
||||||
logging.warning(f"Chargement du fichier adresses.dbf terminé ! {len(self.addresses.items)} adresses trouvées ")
|
logging.warning(f"Chargement du fichier adresses.dbf terminé ! {len(self.addresses.items)} adresses trouvées ")
|
||||||
else:
|
else:
|
||||||
@@ -391,25 +397,37 @@ class ClercAttrib2Biz():
|
|||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def compare_old_and_new_adresses(self, new, old):
|
def compare_old_and_new_adresses(self, new, old, code):
|
||||||
|
|
||||||
if new['insurance_policy_number'].replace('.','') != old.AVS:
|
if self.ifNotNull(new['insurance_policy_number']).replace('.','') != old.AVS:
|
||||||
|
print("compare adresse exit avs")
|
||||||
return False
|
return False
|
||||||
if new['lastname'].replace('.','') != old.lastName:
|
if self.ifNotNull(new['lastname']).replace('.','') != old.lastName:
|
||||||
|
print("compare adresse exit lastname")
|
||||||
return False
|
return False
|
||||||
if new['firstname'].replace('.','') != old.firstName:
|
if self.ifNotNull(new['firstname']).replace('.','') != old.firstName:
|
||||||
|
print("compare adresse exit firstname")
|
||||||
return False
|
return False
|
||||||
if datetime.strptime(new['birthdate'], "%Y-%m-%d").strftime("%d.%m.%Y") != old.birth:
|
if datetime.strptime(self.ifNotNull(new['birthdate']), "%Y-%m-%d").strftime("%d.%m.%Y") != old.birth:
|
||||||
|
print("compare adresse exit date")
|
||||||
return False
|
return False
|
||||||
if f"{new['street'].strip()} {new['street_number'].strip()}" != f"{old.street.strip()}":
|
if f"{self.ifNotNull(new['street']).strip()} {self.ifNotNull(new['street_number']).strip()}" != f"{self.ifNotNull(old.street).strip()}":
|
||||||
print(f"({new['street'].strip()} {new['street_number'].strip()}) != [" + old.street.strip()+"]")
|
print(f"compare adresse exit ({self.ifNotNull(new['street']).strip()} {self.ifNotNull(new['street_number']).strip()}) != [" + self.ifNotNull(old.street).strip()+"]")
|
||||||
return False
|
return False
|
||||||
if f"{new['postal_code']} {new['city']}" != f"{old.npa} {old.city}":
|
if f"{self.ifNotNull(new['postal_code'])} {self.ifNotNull(new['city'])}" != f"{self.ifNotNull(old.npa)} {self.ifNotNull(old.city)}":
|
||||||
|
print("compare adresse exit city")
|
||||||
|
return False
|
||||||
|
if new["addr_2"] != old.addr_2 and int(code) < 100:
|
||||||
|
if not new["selfish"]:
|
||||||
|
print(f"Exit selfish")
|
||||||
|
return False
|
||||||
|
elif old.addr_2 == None:
|
||||||
|
print(f"Exit addr_2 = {old.addr_2}/{new['selfish']}")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def parseFile(self, data, filename):
|
def parseFile(self, data, filename):
|
||||||
self.progress_bar["value"] = 0
|
self.progress_bar["value"] = 0
|
||||||
self.index_counter += 1
|
self.index_counter += 1
|
||||||
@@ -539,7 +557,7 @@ class ClercAttrib2Biz():
|
|||||||
|
|
||||||
if self.check_addresses.get():
|
if self.check_addresses.get():
|
||||||
addresses_exist = self.addresses.get_item_by_AVS(data.Patient['insurance_policy_number'].replace(".", ""))
|
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):
|
if addresses_exist is not None and not self.compare_old_and_new_adresses(new=data.Patient, old=addresses_exist, code=data.Debtor['code']):
|
||||||
|
|
||||||
popup = Check_addresses_popup(self.fenetre, item_1=data.Patient, item_2=addresses_exist, debitor=data.Debtor, factureID=data.data['id'])
|
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()
|
||||||
@@ -638,39 +656,7 @@ class ClercAttrib2Biz():
|
|||||||
print("NON mise à jour de l'adresse")
|
print("NON mise à jour de l'adresse")
|
||||||
|
|
||||||
if int(data.Debtor["code"]) > 1:
|
if int(data.Debtor["code"]) > 1:
|
||||||
con = ""
|
csv_col.data[42] = data.Patient["addr_2"].replace("\n", "#chr(13)##chr(10)#") #Adresse de livraison
|
||||||
concat_str = ""
|
|
||||||
if "name" in data.Debtor.keys():
|
|
||||||
if data.Debtor["name"] is not None:
|
|
||||||
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:
|
|
||||||
concat_str += con + "Monsieur" if data.Debtor["gender"] == "Masculin" else con + "Madame"
|
|
||||||
con = "#chr(13)##chr(10)#"
|
|
||||||
if data.Debtor["lastname"] is not None:
|
|
||||||
concat_str += con + self.ifNotNull(data.Debtor["lastname"]) + " " + self.ifNotNull(data.Debtor["firstname"])
|
|
||||||
con = "#chr(13)##chr(10)#"
|
|
||||||
if data.Debtor["complement"] is not None:
|
|
||||||
concat_str += con + data.Debtor["complement"]
|
|
||||||
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:
|
|
||||||
concat_str += con + self.ifNotNull(data.Debtor["postal_code"]) + " " + self.ifNotNull(data.Debtor["city"])
|
|
||||||
con = "#chr(13)##chr(10)#"
|
|
||||||
if data.Debtor["country_name"] != "Suisse":
|
|
||||||
concat_str += con + data.Debtor["country_name"]
|
|
||||||
con = "#chr(13)##chr(10)#"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
csv_col.data[42] = concat_str #Adresse de livraison
|
|
||||||
else:
|
else:
|
||||||
csv_col.data[19] = data.Debtor["code"] # Code adresse à récupérer dans recherche d'adresse automatisée
|
csv_col.data[19] = data.Debtor["code"] # Code adresse à récupérer dans recherche d'adresse automatisée
|
||||||
csv_col.data[22] = data.Debtor["lastname"]
|
csv_col.data[22] = data.Debtor["lastname"]
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
VERSION = "20230426-1114"
|
VERSION = "20230620-1502"
|
||||||
Reference in New Issue
Block a user