Compare commits
5 Commits
20230620-1
...
20231201-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
32c8a5ca3f | ||
|
|
f2422762d2 | ||
|
|
e8b52bcd17 | ||
|
|
90bb7e53b0 | ||
|
|
56c23ae53c |
@@ -1,5 +1,6 @@
|
||||
from version import *
|
||||
import urllib.request
|
||||
import urllib.error
|
||||
import ssl
|
||||
import io
|
||||
|
||||
@@ -22,15 +23,22 @@ class auto_updater:
|
||||
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)
|
||||
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
|
||||
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:
|
||||
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")
|
||||
except:
|
||||
print("ERREUR de téléchargement mise à jours")
|
||||
url = f"https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/releases/download/{self.clean(self.dl_version)}/Clercattrib2Biz_setup.exe"
|
||||
urllib.request.urlretrieve(url=url, filename=f"{self.temp_dir}clerc_update.exe")
|
||||
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"
|
||||
ret = True
|
||||
return ret
|
||||
|
||||
@@ -30,7 +30,7 @@ class cls_debitors:
|
||||
default = []
|
||||
if int(code) < 100:
|
||||
return default
|
||||
for deb in self.items:
|
||||
for deb in self.items: # items contient l’ensemble des objects détiteur provenant d’un export BDD
|
||||
if deb.code == int(code):
|
||||
return deb.names
|
||||
return default
|
||||
|
||||
@@ -183,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")
|
||||
text_name = Text(lbf_new, fg="red", height=3,width= 30)
|
||||
text_name.grid(row=1, column=1, sticky="W")
|
||||
if 'name' not in debitor:
|
||||
debitor['name'] = ""
|
||||
text_name.insert(END,debitor['name'])
|
||||
text_name.configure(state='disabled')
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
20230620-1559
|
||||
20231201-1716
|
||||
54
main.py
54
main.py
@@ -269,7 +269,7 @@ class ClercAttrib2Biz():
|
||||
if update_available == True:
|
||||
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 !", ):
|
||||
subprocess.call(temp_dir + "\\update.exe")
|
||||
subprocess.call(temp_dir + "\\clerc_update.exe")
|
||||
self.fenetre.destroy()
|
||||
elif update_available == "ERROR":
|
||||
messagebox.showerror(title="ERREUR téléchargement", message="Erreur lors du téléchargement de la nouvelle mise à jour")
|
||||
@@ -379,22 +379,21 @@ class ClercAttrib2Biz():
|
||||
data.Debtor["name"] = data.Debtor["name"].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
|
||||
def check_required_field_by_code(self, code, data):
|
||||
required_fields = {
|
||||
1: ["firstname", "lastname", "street"], # facturation au patient code = 1
|
||||
}
|
||||
|
||||
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
|
||||
|
||||
return True
|
||||
|
||||
def compare_old_and_new_adresses(self, new, old, code):
|
||||
print(f"compare_old_and_new_adresses ")
|
||||
@@ -444,8 +443,10 @@ class ClercAttrib2Biz():
|
||||
|
||||
cur_invoice_index = 0
|
||||
|
||||
|
||||
total_facture_total = 0
|
||||
total_facture_amount = 0
|
||||
for ele in data["invoices"]:
|
||||
|
||||
cur_invoice_index += 1
|
||||
self.progress_bar["value"] = cur_invoice_index / self.count_facture * 100
|
||||
b_address_update = True
|
||||
@@ -467,7 +468,7 @@ class ClercAttrib2Biz():
|
||||
return False
|
||||
|
||||
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",
|
||||
message=f"Les informations de la factures [{data.data['id']}] comportes trop d'erreur arrêt du processus ")
|
||||
return False
|
||||
@@ -564,7 +565,7 @@ class ClercAttrib2Biz():
|
||||
b_address_update = popup.show()
|
||||
mode_selected = "Attrib" if b_address_update else "Winbiz"
|
||||
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}")
|
||||
else:
|
||||
b_address_update = True
|
||||
@@ -574,7 +575,11 @@ class ClercAttrib2Biz():
|
||||
|
||||
b_HRF = False
|
||||
sHRF = ""
|
||||
|
||||
facture_total = 0
|
||||
for article in data.Articles:
|
||||
if 'price' in article:
|
||||
facture_total += float(article['price'])
|
||||
|
||||
if "code" in article.keys():
|
||||
if article["code"] == "HRF":
|
||||
@@ -582,9 +587,12 @@ class ClercAttrib2Biz():
|
||||
sHRF = article["line_1"].replace("h", ":")
|
||||
print(f"pass HRF => {data.Patient['fip_number']} = {b_HRF}")
|
||||
#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:
|
||||
self.bs_counter += 1
|
||||
@@ -762,7 +770,7 @@ class ClercAttrib2Biz():
|
||||
csv_col.data[116] = self.ifNotNull(data.Patient["category"]) + " - " + self.ifNotNull(data.Intervention["type"])
|
||||
csv_col.data[118] = data.Intervention["kilometers"]
|
||||
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
|
||||
else:
|
||||
csv_col.data[136] = 3 #code présentation de facture
|
||||
@@ -772,6 +780,8 @@ class ClercAttrib2Biz():
|
||||
|
||||
lines.append(csv_col.data)
|
||||
csv_col = None
|
||||
|
||||
print(f"total_facture_total = {total_facture_total} <> {total_facture_amount}")
|
||||
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:
|
||||
wr = csv.writer(csv_file, delimiter=';')
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
VERSION = "20230620-1559"
|
||||
VERSION = "20231201-1716"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user