Compare commits
4 Commits
20230620-1
...
20230620-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5311208184 | ||
|
|
86a2b99f39 | ||
|
|
eb0e4b4429 | ||
|
|
4387a1d00b |
@@ -7,6 +7,7 @@ class cls_Addresses:
|
|||||||
self.items.append(items)
|
self.items.append(items)
|
||||||
def get_item_by_AVS(self, seek):
|
def get_item_by_AVS(self, seek):
|
||||||
for item in self.items:
|
for item in self.items:
|
||||||
|
|
||||||
if item.AVS == seek:
|
if item.AVS == seek:
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class cls_Invoice:
|
|||||||
def is_addr_2_selfish(self, patient):
|
def is_addr_2_selfish(self, patient):
|
||||||
print(patient)
|
print(patient)
|
||||||
temp_addr_2 = str(patient["addr_2"]).replace("Monsieur","").replace("Madame","").replace("\n","").replace(" ","")
|
temp_addr_2 = str(patient["addr_2"]).replace("Monsieur","").replace("Madame","").replace("\n","").replace(" ","")
|
||||||
str_compare = patient['lastname'].replace('.','') + 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 = 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(" ","")
|
str_compare = str_compare.replace(" ","")
|
||||||
print(f"is_addr_2_selfish ? {str_compare} <> {temp_addr_2} = {str_compare == temp_addr_2}")
|
print(f"is_addr_2_selfish ? {str_compare} <> {temp_addr_2} = {str_compare == temp_addr_2}")
|
||||||
return str_compare == temp_addr_2
|
return str_compare == temp_addr_2
|
||||||
|
|||||||
@@ -47,8 +47,12 @@ class Check_addresses_popup(Toplevel):
|
|||||||
|
|
||||||
|
|
||||||
if int(debitor["code"]) < 100:
|
if int(debitor["code"]) < 100:
|
||||||
|
if item_1["selfish"]:
|
||||||
|
force_color = "green"
|
||||||
|
else:
|
||||||
|
force_color = None
|
||||||
self.add_compares_element(new_frame=lbf_addr_2_new, old_frame=lbf_addr_2_old, label="Adresse livraison:", str1=item_1["addr_2"],
|
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))
|
str2=self.ifNotNull(item_2.addr_2),force_color_1=force_color)
|
||||||
|
|
||||||
|
|
||||||
str_address_1 += item_1['insurance_policy_number'].replace('.', '')
|
str_address_1 += item_1['insurance_policy_number'].replace('.', '')
|
||||||
@@ -104,19 +108,23 @@ class Check_addresses_popup(Toplevel):
|
|||||||
return ret
|
return ret
|
||||||
return value.strip()
|
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, force_color_1=None):
|
||||||
label_font = font.Font(weight='bold', size=9)
|
label_font = font.Font(weight='bold', size=9)
|
||||||
|
|
||||||
value_color = "black"
|
value_color_1 = "black"
|
||||||
|
value_color_2 = "black"
|
||||||
con = ""
|
con = ""
|
||||||
if str1 != str2:
|
if str1 != str2:
|
||||||
value_color = "red"
|
value_color_1 = "red"
|
||||||
|
value_color_2 = "red"
|
||||||
con = "*"
|
con = "*"
|
||||||
|
if force_color_1 is not None:
|
||||||
|
value_color_1 = force_color_1
|
||||||
|
|
||||||
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, anchor="w", justify=LEFT).grid(row=self.x_row, column=1, sticky="W")
|
Label(new_frame, text=con + str(str1) + con, fg=value_color_1, 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, anchor="w", justify=LEFT).grid(row=self.x_row, column=1, sticky="W")
|
Label(old_frame, text=con + str(str2) + con, fg=value_color_2, anchor="w", justify=LEFT).grid(row=self.x_row, column=1, sticky="W")
|
||||||
|
|
||||||
self.x_row += 1
|
self.x_row += 1
|
||||||
|
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
20230620-1423
|
20230620-1544
|
||||||
35
main.py
35
main.py
@@ -289,7 +289,6 @@ 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, load=True):
|
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"])
|
||||||
@@ -397,23 +396,35 @@ 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):
|
||||||
|
print(f"compare_old_and_new_adresses ")
|
||||||
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
|
return False
|
||||||
if new["addr_2"] != old.addr_2 and not new["selfish"]:
|
if new["addr_2"] != old.addr_2 and int(code) < 100:
|
||||||
|
if not new["selfish"]:
|
||||||
|
print(f"Exit selfish")
|
||||||
return False
|
return False
|
||||||
|
if old.addr_2 != "None":
|
||||||
|
print(f"Exit addr_2 = {old.addr_2}/{new['selfish']}")
|
||||||
|
print(old.addr_2 != "None")
|
||||||
|
return False
|
||||||
|
print("return True (same)")
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@@ -547,7 +558,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()
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
VERSION = "20230620-1423"
|
VERSION = "20230620-1544"
|
||||||
Reference in New Issue
Block a user