Compare commits
10 Commits
20220609-0
...
20220630-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
94c8c64ced | ||
|
|
79f6c3df6d | ||
|
|
6a28aeaa16 | ||
|
|
42f32873ea | ||
|
|
e4137d4780 | ||
|
|
b10b14c420 | ||
|
|
0a1cbd31b8 | ||
|
|
dc7ace0446 | ||
|
|
6a46da5a89 | ||
|
|
e8d1bf7696 |
@@ -33,11 +33,11 @@ class cls_debitors:
|
|||||||
|
|
||||||
def add_items(self, code, name):
|
def add_items(self, code, name):
|
||||||
for deb in self.items:
|
for deb in self.items:
|
||||||
if deb.code == code:
|
if deb.code == int(code):
|
||||||
deb.add_name(name)
|
deb.add_name(name)
|
||||||
return
|
return
|
||||||
deb = cls_debitor()
|
deb = cls_debitor()
|
||||||
deb.code = code
|
deb.code = int(code)
|
||||||
deb.add_name(name)
|
deb.add_name(name)
|
||||||
self.items.append(deb)
|
self.items.append(deb)
|
||||||
|
|
||||||
|
|||||||
131
custom_popup.py
131
custom_popup.py
@@ -1,17 +1,18 @@
|
|||||||
from tkinter import *
|
from tkinter import *
|
||||||
from tkinter import font
|
from tkinter import font
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
|
from tkinter import messagebox
|
||||||
|
|
||||||
class Check_addresses_popup(Toplevel):
|
class Check_addresses_popup(Toplevel):
|
||||||
x_row = 0
|
x_row = 0
|
||||||
no_selection_possible = False
|
no_selection_possible = False
|
||||||
def __init__(self, parent, item_1=None, item_2=None, debitor=None):
|
def __init__(self, parent, item_1=None, item_2=None, debitor=None, factureID=""):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
|
||||||
self.geometry(f"700x300+{parent.winfo_x() + 25 }+{parent.winfo_y() +25 }")
|
self.geometry(f"700x300+{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']}. Code débiteur: {debitor['code']}")
|
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(0, weight=1)
|
||||||
self.columnconfigure(1, weight=1)
|
self.columnconfigure(1, weight=1)
|
||||||
@@ -121,3 +122,129 @@ class Check_addresses_popup(Toplevel):
|
|||||||
self.wait_window(self)
|
self.wait_window(self)
|
||||||
return self.selection
|
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"850x300+{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)
|
||||||
|
|
||||||
|
lbf_new = LabelFrame(self, text="Données Attrib")
|
||||||
|
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="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é", 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="Nom possible")
|
||||||
|
lbf_old.grid(row=0, 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
|
||||||
|
|
||||||
|
self.btn = Button(lbf_old, text="Ajouter", command=self.add)
|
||||||
|
self.btn.grid(row=2, column=0, columnspan= 2, pady=10, padx=10, sticky='NSEW')
|
||||||
|
|
||||||
|
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")
|
||||||
|
Entry(lbf_new, textvariable=self.inp_value, width=100).grid(row=0, column=1, sticky="W", pady=10)
|
||||||
|
|
||||||
|
|
||||||
|
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()
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
20220609-0006
|
20220630-1013
|
||||||
83
main.py
83
main.py
@@ -245,7 +245,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=';')
|
||||||
@@ -262,7 +262,7 @@ class ClercAttrib2Biz():
|
|||||||
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:
|
||||||
@@ -322,6 +322,37 @@ 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 parseFile(self, data, filename):
|
def parseFile(self, data, filename):
|
||||||
self.index_counter += 1
|
self.index_counter += 1
|
||||||
@@ -343,15 +374,19 @@ class ClercAttrib2Biz():
|
|||||||
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 str(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"] = int(inp_popup.show())
|
||||||
else:
|
|
||||||
data.Debtor["code"] = str(data.Debtor["code"]).replace('.', '')
|
if data.Debtor["code"] == 1:
|
||||||
|
if not self.check_code_validity(data.Debtor["code"],data):
|
||||||
|
return False
|
||||||
|
|
||||||
|
|
||||||
if int(data.Debtor["code"]) != "1" and data.Debtor["code"] != None and int(data.Debtor["code"]) < 100:
|
if int(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"]:
|
||||||
@@ -384,8 +419,9 @@ class ClercAttrib2Biz():
|
|||||||
|
|
||||||
if int(data.Debtor["code"]) >= 100:
|
if int(data.Debtor["code"]) >= 100:
|
||||||
if not self.o_debs.is_in_debitor_name(code=data.Debtor["code"],search_name=data.Debtor["name"]):
|
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'])}")
|
#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"] = int(debitor_popup.show())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -401,7 +437,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:
|
if addresses_exist is not None:
|
||||||
popup = Check_addresses_popup(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:
|
else:
|
||||||
@@ -428,12 +464,18 @@ 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:
|
||||||
@@ -491,8 +533,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"
|
||||||
@@ -531,7 +577,11 @@ class ClercAttrib2Biz():
|
|||||||
else:
|
else:
|
||||||
csv_col.data[21] = ''
|
csv_col.data[21] = ''
|
||||||
|
|
||||||
csv_col.data[40] = datetime.strptime(data.Patient["birthdate"], "%Y-%m-%d").strftime("%d.%m.%Y")
|
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
|
||||||
|
|
||||||
|
|
||||||
@@ -648,8 +698,9 @@ class ClercAttrib2Biz():
|
|||||||
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 str(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 = "20220609-0006"
|
VERSION = "20220630-1013"
|
||||||
Reference in New Issue
Block a user