Compare commits

...

13 Commits

Author SHA1 Message Date
Ambulance Clerc
32c8a5ca3f débug auto-update 2023-12-01 17:21:08 +01:00
Ambulance Clerc
f2422762d2 comment line 2023-12-01 17:20:39 +01:00
Ambulance Clerc
e8b52bcd17 Ajout du code débiteur 158 HRF Fribourg comme EBILL 2023-11-28 16:39:58 +01:00
Ambulance Clerc
90bb7e53b0 Débug custom_popup.py if name not exist in Debitor 2023-11-28 15:00:11 +01:00
Ambulance Clerc
56c23ae53c débug comparaison HRF et suppression du break au moment du HRF 2023-10-31 11:43:30 +01:00
Ambulance Clerc
5998bf48cb débug comparaison de l'adresse de livraison 2023-06-20 15:59:48 +02:00
Ambulance Clerc
5311208184 débug comparaison de l'adresse de livraison 2023-06-20 15:44:29 +02:00
Ambulance Clerc
86a2b99f39 débug comparaison de l'adresse de livraison 2023-06-20 15:44:04 +02:00
Ambulance Clerc
eb0e4b4429 débug comparaison de l'adresse de livraison 2023-06-20 15:02:52 +02:00
Ambulance Clerc
4387a1d00b débug comparaison de l'adresse de livraison 2023-06-20 14:53:20 +02:00
Ambulance Clerc
c722af1091 débug comparaison de l'adresse de livraison 2023-06-20 14:23:34 +02:00
Ambulance Clerc
92b3a76733 débug comparaison de l'adresse de livraison 2023-06-20 11:10:18 +02:00
Ambulance Clerc
5adbc77555 Débug de la feature adresse_livraison 2023-06-16 19:43:34 +02:00
8 changed files with 129 additions and 79 deletions

View File

@@ -1,5 +1,6 @@
from version import * from version import *
import urllib.request import urllib.request
import urllib.error
import ssl import ssl
import io import io
@@ -22,15 +23,22 @@ class auto_updater:
ctx.verify_mode = ssl.CERT_NONE ctx.verify_mode = ssl.CERT_NONE
data = urllib.request.urlopen("https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/raw/branch/master/dl_version", context=ctx) data = urllib.request.urlopen("https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/raw/branch/master/dl_version", context=ctx)
self.dl_version = str(data.read()).replace('b', '').replace("'", "") self.dl_version = str(data.read()).replace('b', '').replace("'", "").replace("\n","").replace('n',"")
ssl._create_default_https_context = ssl._create_unverified_context ssl._create_default_https_context = ssl._create_unverified_context
if self.dl_version != VERSION: if self.dl_version != VERSION:
print(f"Version différente trouvée {self.dl_version} téléchargement en cours => {self.temp_dir}update.exe") print(f"Version différente trouvée {self.dl_version} téléchargement en cours => {self.temp_dir}clerc_update.exe")
try: try:
urllib.request.urlretrieve(url=f"https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/releases/download/{self.clean(self.dl_version)}/Clercattrib2Biz_setup.exe", filename=f"{self.temp_dir}update.exe") url = f"https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/releases/download/{self.clean(self.dl_version)}/Clercattrib2Biz_setup.exe"
except: urllib.request.urlretrieve(url=url, filename=f"{self.temp_dir}clerc_update.exe")
print("ERREUR de téléchargement mise à jours") except urllib.error.URLError as e:
print(f"ERREUR de téléchargement mise à jour : {e.reason} \n {url}")
return "ERROR"
except urllib.error.HTTPError as e:
print(f"ERREUR HTTP lors du téléchargement : {e.code} {e.reason} \n {url}")
return "ERROR"
except Exception as e:
print(f"Erreur inattendue : {e} \n {url}")
return "ERROR" return "ERROR"
ret = True ret = True
return ret return ret

View File

@@ -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

View File

@@ -30,7 +30,7 @@ class cls_debitors:
default = [] default = []
if int(code) < 100: if int(code) < 100:
return default return default
for deb in self.items: for deb in self.items: # items contient lensemble des objects détiteur provenant dun export BDD
if deb.code == int(code): if deb.code == int(code):
return deb.names return deb.names
return default return default

View File

@@ -25,36 +25,44 @@ class cls_Invoice:
if debitor["name"] is not None: if debitor["name"] is not None:
concat_str += con + debitor["name"] concat_str += con + debitor["name"]
# con = "#chr(13)##chr(10)#" # con = "#chr(13)##chr(10)#"
con = "\r\n" con = "\n"
if debitor["gender"] is not None: if debitor["gender"] is not None:
concat_str += con + "Monsieur" if debitor["gender"] == "Masculin" else con + "Madame" concat_str += con + "Monsieur" if debitor["gender"] == "Masculin" else con + "Madame"
# con = "#chr(13)##chr(10)#" # con = "#chr(13)##chr(10)#"
con = "\r\n" con = "\n"
if debitor["lastname"] is not None: if debitor["lastname"] is not None:
concat_str += con + self.ifNotNull(debitor["lastname"]) + " " + self.ifNotNull( concat_str += con + self.ifNotNull(debitor["lastname"]) + " " + self.ifNotNull(
debitor["firstname"]) debitor["firstname"])
# con = "#chr(13)##chr(10)#" # con = "#chr(13)##chr(10)#"
con = "\r\n" con = "\n"
if debitor["complement"] is not None: if debitor["complement"] is not None:
concat_str += con + debitor["complement"] concat_str += con + debitor["complement"]
# con = "#chr(13)##chr(10)#" # con = "#chr(13)##chr(10)#"
con = "\r\n" con = "\n"
if debitor["street"] is not None: if debitor["street"] is not None:
concat_str += con + self.ifNotNull(debitor["street"]) + " " + self.ifNotNull( concat_str += con + self.ifNotNull(debitor["street"]) + " " + self.ifNotNull(
debitor["street_number"]) debitor["street_number"])
# con = "#chr(13)##chr(10)#" # con = "#chr(13)##chr(10)#"
con = "\r\n" con = "\n"
if debitor["city"] is not None: if debitor["city"] is not None:
concat_str += con + self.ifNotNull(debitor["postal_code"]) + " " + self.ifNotNull( concat_str += con + self.ifNotNull(debitor["postal_code"]) + " " + self.ifNotNull(
debitor["city"]) debitor["city"])
# con = "#chr(13)##chr(10)#" # con = "#chr(13)##chr(10)#"
con = "\r\n" con = "\n"
if debitor["country_name"] != "Suisse": if debitor["country_name"] != "Suisse":
concat_str += con + debitor["country_name"] concat_str += con + debitor["country_name"]
# con = "#chr(13)##chr(10)#" # con = "#chr(13)##chr(10)#"
con = "\r\n" con = "\n"
self.Patient["addr_2"] = concat_str 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=""): def ifNotNull(self, value, ret=""):
if value == None or value == "None": if value == None or value == "None":
return ret return ret

View File

@@ -37,27 +37,31 @@ class Check_addresses_popup(Toplevel):
fonts = [] fonts = []
self.x_row = 0 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="N° AVS de l'adresse:",str1=self.ifNotNull(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="Nom:", str1=self.ifNotNull(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="Prénom:", str1=self.ifNotNull(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="Date de naissance:", str1=datetime.strptime(self.ifNotNull(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'].strip()} {item_1['street_number'].strip()}", str2=item_2.street.strip()) self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Adresse:", str1=f"{self.ifNotNull(item_1['street']).strip()} {self.ifNotNull(item_1['street_number']).strip()}", str2=item_2.street.strip())
self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Complément:", str1=f"{item_1['complement'].strip()}", str2=item_2.street_cpl.strip()) self.add_compares_element(new_frame=lbf_new, old_frame=lbf_old, label="Complément:", str1=f"{self.ifNotNull(item_1['complement']).strip()}", str2=item_2.street_cpl.strip())
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"{self.ifNotNull(item_1['postal_code'])} {self.ifNotNull(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"], if item_1["selfish"]:
str2=self.ifNotNull(item_2.addr_2)) 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"],
str2=self.ifNotNull(item_2.addr_2),force_color_1=force_color)
str_address_1 += item_1['insurance_policy_number'].replace('.', '') str_address_1 += self.ifNotNull(item_1['insurance_policy_number']).replace('.', '')
str_address_1 += item_1['lastname'].strip() str_address_1 += self.ifNotNull(item_1['lastname']).strip()
str_address_1 += item_1['firstname'].strip() str_address_1 +=self.ifNotNull( item_1['firstname']).strip()
str_address_1 += datetime.strptime(item_1['birthdate'], "%Y-%m-%d").strftime("%d.%m.%Y") str_address_1 += datetime.strptime(item_1['birthdate'], "%Y-%m-%d").strftime("%d.%m.%Y")
str_address_1 += f"{item_1['street'].strip()} {item_1['street_number'].strip()}" str_address_1 += f"{self.ifNotNull(item_1['street']).strip()} {self.ifNotNull(item_1['street_number']).strip()}"
str_address_1 += f"{item_1['complement'].strip()}" str_address_1 += f"{self.ifNotNull(item_1['complement']).strip()}"
str_address_1 += f"{item_1['postal_code']} {item_1['city']}" str_address_1 += f"{self.ifNotNull(item_1['postal_code'])} {self.ifNotNull(item_1['city'])}"
@@ -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).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).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
@@ -175,6 +183,8 @@ class Check_debitor_popup(Toplevel):
Label(lbf_new, text="Débiteur sélectionné dans Attrib", font=label_font).grid(row=1, column=0, sticky="W") 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 = Text(lbf_new, fg="red", height=3,width= 30)
text_name.grid(row=1, column=1, sticky="W") text_name.grid(row=1, column=1, sticky="W")
if 'name' not in debitor:
debitor['name'] = ""
text_name.insert(END,debitor['name']) text_name.insert(END,debitor['name'])
text_name.configure(state='disabled') text_name.configure(state='disabled')

View File

@@ -1 +1 @@
20230616-1729 20231201-1716

108
main.py
View File

@@ -269,7 +269,7 @@ class ClercAttrib2Biz():
if update_available == True: if update_available == True:
self.logger.warning(f"Nouvelle version du script disponible. {auto_update.dl_version}") self.logger.warning(f"Nouvelle version du script disponible. {auto_update.dl_version}")
if messagebox.askyesno(title="Nouvelle version trouvée", message=f"Une nouvelle version a été trouvée, vous pouvez l'installer dès maintenant !", ): if messagebox.askyesno(title="Nouvelle version trouvée", message=f"Une nouvelle version a été trouvée, vous pouvez l'installer dès maintenant !", ):
subprocess.call(temp_dir + "\\update.exe") subprocess.call(temp_dir + "\\clerc_update.exe")
self.fenetre.destroy() self.fenetre.destroy()
elif update_available == "ERROR": elif update_available == "ERROR":
messagebox.showerror(title="ERREUR téléchargement", message="Erreur lors du téléchargement de la nouvelle mise à jour") messagebox.showerror(title="ERREUR téléchargement", message="Erreur lors du téléchargement de la nouvelle mise à jour")
@@ -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"])
@@ -303,7 +302,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"]) 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:
@@ -380,42 +379,54 @@ class ClercAttrib2Biz():
data.Debtor["name"] = data.Debtor["name"].strip() data.Debtor["name"] = data.Debtor["name"].strip()
def check_code_validity(self, code,data): def check_required_field_by_code(self, code, data):
ret = True required_fields = {
check_patients = ["firstname", "lastname", "street"] 1: ["firstname", "lastname", "street"], # facturation au patient code = 1
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 if code in required_fields:
for field in required_fields[code]:
if data.Patient[field] is None or data.Debtor[field] is None:
messagebox.showerror(
title="Erreur Critique",
message=f"Les informations de la facture [{data.data['id']}] comportent trop d'erreurs. Arrêt du processus.",
)
return False
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'].strip()} {new['street_number'].strip()}" != f"{old.street.strip()}":
print(f"({new['street'].strip()} {new['street_number'].strip()}) != [" + old.street.strip()+"]")
return False
if f"{new['postal_code']} {new['city']}" != f"{old.npa} {old.city}":
return False
if new["addr_2"] != old.addr_2:
return False
return True return True
def compare_old_and_new_adresses(self, new, old, code):
print(f"compare_old_and_new_adresses ")
if self.ifNotNull(new['insurance_policy_number']).replace('.','') != old.AVS:
print("compare adresse exit avs")
return False
if self.ifNotNull(new['lastname']).replace('.','') != old.lastName:
print("compare adresse exit lastname")
return False
if self.ifNotNull(new['firstname']).replace('.','') != old.firstName:
print("compare adresse exit firstname")
return False
if datetime.strptime(self.ifNotNull(new['birthdate']), "%Y-%m-%d").strftime("%d.%m.%Y") != old.birth:
print("compare adresse exit date")
return False
if f"{self.ifNotNull(new['street']).strip()} {self.ifNotNull(new['street_number']).strip()}" != f"{self.ifNotNull(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
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
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
def parseFile(self, data, filename): def parseFile(self, data, filename):
self.progress_bar["value"] = 0 self.progress_bar["value"] = 0
@@ -432,8 +443,10 @@ class ClercAttrib2Biz():
cur_invoice_index = 0 cur_invoice_index = 0
total_facture_total = 0
total_facture_amount = 0
for ele in data["invoices"]: for ele in data["invoices"]:
cur_invoice_index += 1 cur_invoice_index += 1
self.progress_bar["value"] = cur_invoice_index / self.count_facture * 100 self.progress_bar["value"] = cur_invoice_index / self.count_facture * 100
b_address_update = True b_address_update = True
@@ -455,7 +468,7 @@ class ClercAttrib2Biz():
return False return False
if int(data.Debtor["code"]) == 1: if int(data.Debtor["code"]) == 1:
if not self.check_code_validity(data.Debtor["code"],data): if not self.check_required_field_by_code(data.Debtor["code"], data):
messagebox.showerror(title="Erreur Critique", messagebox.showerror(title="Erreur Critique",
message=f"Les informations de la factures [{data.data['id']}] comportes trop d'erreur arrêt du processus ") message=f"Les informations de la factures [{data.data['id']}] comportes trop d'erreur arrêt du processus ")
return False return False
@@ -546,13 +559,13 @@ 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()
mode_selected = "Attrib" if b_address_update else "Winbiz" mode_selected = "Attrib" if b_address_update else "Winbiz"
self.logger.warning( self.logger.warning(
f"Adresse connue donnée [{mode_selected}] conservé: : {data.data['id']} / {data.Patient['fip_number']} {data.Debtor['code']} {data.Debtor['lastname']} {data.Debtor['firstname']}") f"Adresse connue données {mode_selected} conservées: {data.data['id']} / {data.Patient['fip_number']} {data.Debtor['code']} {data.Debtor['lastname']} {data.Debtor['firstname']}")
print(f"Result Popup: {b_address_update}") print(f"Result Popup: {b_address_update}")
else: else:
b_address_update = True b_address_update = True
@@ -562,7 +575,11 @@ class ClercAttrib2Biz():
b_HRF = False b_HRF = False
sHRF = "" sHRF = ""
facture_total = 0
for article in data.Articles: for article in data.Articles:
if 'price' in article:
facture_total += float(article['price'])
if "code" in article.keys(): if "code" in article.keys():
if article["code"] == "HRF": if article["code"] == "HRF":
@@ -570,9 +587,12 @@ class ClercAttrib2Biz():
sHRF = article["line_1"].replace("h", ":") sHRF = article["line_1"].replace("h", ":")
print(f"pass HRF => {data.Patient['fip_number']} = {b_HRF}") print(f"pass HRF => {data.Patient['fip_number']} = {b_HRF}")
#self.logger.warning(f"HRF: {data.data['id']}") #self.logger.warning(f"HRF: {data.data['id']}")
break
print(f"Lecture de la facture #{cur_invoice_index} {ele['id']} montant total = {ele['total_price']} <> {facture_total}")
if float(ele['total_price']) != facture_total:
print(f"ERROR NOT SAME PRICE")
total_facture_total += facture_total
total_facture_amount += float(ele['total_price'])
for article in data.Articles: for article in data.Articles:
self.bs_counter += 1 self.bs_counter += 1
@@ -645,7 +665,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:
csv_col.data[42] = data.Patient["addr_2"].replace("\r\n", "#chr(13)##chr(10)#") #Adresse de livraison csv_col.data[42] = data.Patient["addr_2"].replace("\n", "#chr(13)##chr(10)#") #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"]
@@ -750,7 +770,7 @@ 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"]
if data.Debtor["code"] == "100" or data.Debtor["code"] == "101": if data.Debtor["code"] == "100" or data.Debtor["code"] == "101" or data.Debtor["code"] == "158":
csv_col.data[136] = "EBILL" #code présentation de facture csv_col.data[136] = "EBILL" #code présentation de facture
else: else:
csv_col.data[136] = 3 #code présentation de facture csv_col.data[136] = 3 #code présentation de facture
@@ -760,6 +780,8 @@ class ClercAttrib2Biz():
lines.append(csv_col.data) lines.append(csv_col.data)
csv_col = None csv_col = None
print(f"total_facture_total = {total_facture_total} <> {total_facture_amount}")
if not self.export_one_file.get(): if not self.export_one_file.get():
with open(os.path.join(dest_dir, f"bizexdoc_" + filename.replace(".json", "") + ".csv"), "w+", errors='replace', newline='') as csv_file: with open(os.path.join(dest_dir, f"bizexdoc_" + filename.replace(".json", "") + ".csv"), "w+", errors='replace', newline='') as csv_file:
wr = csv.writer(csv_file, delimiter=';') wr = csv.writer(csv_file, delimiter=';')

View File

@@ -1 +1,2 @@
VERSION = "20230616-1729" VERSION = "20231201-1716"