Compare commits
19 Commits
addresses
...
20220606-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
80fa01633e | ||
|
|
d8fea135a9 | ||
|
|
ccb2b73d51 | ||
|
|
393e9c844d | ||
|
|
dbc0bab3e2 | ||
|
|
66da1c212a | ||
|
|
22a0ed46f6 | ||
|
|
2a0ab15e7d | ||
|
|
e92d92deec | ||
|
|
0f5fbe6778 | ||
|
|
b678c85400 | ||
|
|
521db9851e | ||
|
|
9acdf7a0f5 | ||
|
|
2a42096dcb | ||
|
|
8ee93aefb0 | ||
|
|
f5755c77f0 | ||
|
|
f569dee4c2 | ||
|
|
71f736fd83 | ||
|
|
3567b6942f |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/update.exe
|
||||||
34
auto_update.py
Normal file
34
auto_update.py
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
from version import *
|
||||||
|
import urllib.request
|
||||||
|
import ssl
|
||||||
|
import io
|
||||||
|
|
||||||
|
class auto_updater:
|
||||||
|
dl_version = 0
|
||||||
|
|
||||||
|
def clean(self, str):
|
||||||
|
str = str.replace('/','')
|
||||||
|
str = str.replace(':', '')
|
||||||
|
str = str.replace('{', '')
|
||||||
|
str = str.replace('(', '')
|
||||||
|
str = str.replace("\\", '')
|
||||||
|
return str
|
||||||
|
|
||||||
|
def new_update_available(self):
|
||||||
|
ret = False
|
||||||
|
ctx = ssl.create_default_context()
|
||||||
|
ctx.check_hostname = False
|
||||||
|
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("'", "")
|
||||||
|
|
||||||
|
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")
|
||||||
|
urllib.request.urlretrieve(url=f"https://gitea.prod.resk-u.ch/CLERC/AttribWinbiz/releases/download/{self.clean(self.dl_version)}/Clercattrib2Biz_setup.exe", filename="update.exe")
|
||||||
|
ret = True
|
||||||
|
return ret
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
1
dl_version
Normal file
1
dl_version
Normal file
@@ -0,0 +1 @@
|
|||||||
|
20220606-1715
|
||||||
51
main.py
51
main.py
@@ -3,6 +3,7 @@ import json
|
|||||||
import os
|
import os
|
||||||
import logging
|
import logging
|
||||||
import shutil
|
import shutil
|
||||||
|
import subprocess
|
||||||
import textwrap
|
import textwrap
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
@@ -19,8 +20,9 @@ from threading import *
|
|||||||
|
|
||||||
from class_invoices import *
|
from class_invoices import *
|
||||||
from class_addresses import *
|
from class_addresses import *
|
||||||
|
from auto_update import *
|
||||||
|
|
||||||
VERSION = "202200522 - 1848"
|
from version import *
|
||||||
#test master 2
|
#test master 2
|
||||||
|
|
||||||
src_dir = os.getenv('APPDATA') + "\Attrib2Biz\src"
|
src_dir = os.getenv('APPDATA') + "\Attrib2Biz\src"
|
||||||
@@ -55,6 +57,10 @@ class SuggestionPopup(Toplevel):
|
|||||||
lbf_new = LabelFrame(self, text="Nouveau patient")
|
lbf_new = LabelFrame(self, text="Nouveau patient")
|
||||||
lbf_new.grid(row=0, column=0, sticky='WE', padx=5, pady=5)
|
lbf_new.grid(row=0, column=0, sticky='WE', padx=5, pady=5)
|
||||||
|
|
||||||
|
Label(lbf_new, text=f"N° AVS de l'adresse \t {item_1['insurance_policy_number'].replace('.','')}").grid(row=0, column=0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
lbf_old = LabelFrame(self, text="Ancien patient")
|
lbf_old = LabelFrame(self, text="Ancien patient")
|
||||||
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)
|
||||||
|
|
||||||
@@ -312,6 +318,13 @@ class ClercAttrib2Biz():
|
|||||||
|
|
||||||
self.thread = Thread(target=self.start_parsing)
|
self.thread = Thread(target=self.start_parsing)
|
||||||
|
|
||||||
|
auto_update = auto_updater()
|
||||||
|
if auto_update.new_update_available():
|
||||||
|
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("update.exe")
|
||||||
|
self.fenetre.destroy()
|
||||||
|
|
||||||
def disable_prompt(self):
|
def disable_prompt(self):
|
||||||
self.prompt.destroy()
|
self.prompt.destroy()
|
||||||
self.b_prompt_open = False
|
self.b_prompt_open = False
|
||||||
@@ -481,22 +494,25 @@ class ClercAttrib2Biz():
|
|||||||
popup = SuggestionPopup(self.fenetre, item_1=data.Patient, item_2=addresses_exist,debitor=data.Debtor )
|
popup = SuggestionPopup(self.fenetre, item_1=data.Patient, item_2=addresses_exist,debitor=data.Debtor )
|
||||||
b_address_update = popup.show()
|
b_address_update = popup.show()
|
||||||
print(f"Result Popup: {b_address_update}")
|
print(f"Result Popup: {b_address_update}")
|
||||||
|
|
||||||
#self.draw_test(item_1=data.Patient, item_2=addresses_exist)
|
#self.draw_test(item_1=data.Patient, item_2=addresses_exist)
|
||||||
#messagebox.showerror(title="AVS Trouvé", message=f"Le code AVS de l'adresse {data.Patient['insurance_policy_number']} est déjà existant: [{data.Debtor['code']}], merci de le corriger ")
|
#messagebox.showerror(title="AVS Trouvé", message=f"Le code AVS de l'adresse {data.Patient['insurance_policy_number']} est déjà existant: [{data.Debtor['code']}], merci de le corriger ")
|
||||||
|
|
||||||
|
|
||||||
b_HRF = False
|
b_HRF = False
|
||||||
sHRF = ""
|
sHRF = ""
|
||||||
|
|
||||||
|
|
||||||
for article in data.Articles:
|
for article in data.Articles:
|
||||||
|
|
||||||
if "code" in article.keys():
|
if "code" in article.keys():
|
||||||
if article["code"] == "HRF":
|
if article["code"] == "HRF":
|
||||||
b_HRF = True
|
b_HRF = True
|
||||||
sHRF = article["line_1"].replace("h", ":")
|
sHRF = article["line_1"].replace("h", ":")
|
||||||
print(f"pass HRF => {data.Patient['fip_number']}")
|
print(f"pass HRF => {data.Patient['fip_number']} = {b_HRF}")
|
||||||
|
#self.logger.warning(f"HRF: {data.data['id']}")
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
for article in data.Articles:
|
||||||
self.bs_counter += 1
|
self.bs_counter += 1
|
||||||
csv_col = cls_Col(True)
|
csv_col = cls_Col(True)
|
||||||
|
|
||||||
@@ -508,16 +524,21 @@ class ClercAttrib2Biz():
|
|||||||
csv_col.data[10] = "<AUTO>" # Compte collectif du tiers = <AUTO>
|
csv_col.data[10] = "<AUTO>" # Compte collectif du tiers = <AUTO>
|
||||||
|
|
||||||
|
|
||||||
if "destination_name" not in data.Intervention.keys() or data.Intervention["destination_name"] == None:
|
if "without_transportation" in data.Intervention.keys() and data.Intervention["without_transportation"] == True:
|
||||||
csv_col.data[15] = "Sans transport"
|
csv_col.data[15] = "Sans transport"
|
||||||
|
print(f"->NO DEST** {data.data['id']}")
|
||||||
|
elif data.Intervention["destination_name"] == None and data.Intervention["destination_street"] == None and data.Intervention["destination_city"] == None:
|
||||||
|
csv_col.data[15] = "Sans destination"
|
||||||
|
print(f"->NO DEST sans destination transmis à autruit** {data.data['id']}")
|
||||||
else:
|
else:
|
||||||
con = ""
|
con = ""
|
||||||
concat_str = ""
|
concat_str = ""
|
||||||
if data.Intervention["destination_name"] is not None:
|
if data.Intervention["destination_name"] is not None:
|
||||||
concat_str += con + data.Intervention["destination_name"]
|
concat_str += con + data.Intervention["destination_name"]
|
||||||
con = ", "
|
con = ", "
|
||||||
concat_str += con + data.Intervention["destination_street"] + " " + self.ifNotNull(data.Intervention["destination_street_number"])
|
if data.Intervention["destination_street"] is not None:
|
||||||
con = ", "
|
concat_str += con + data.Intervention["destination_street"] + " " + self.ifNotNull(data.Intervention["destination_street_number"])
|
||||||
|
con = ", "
|
||||||
concat_str += con + data.Intervention["destination_postal_code"] + " " + data.Intervention["destination_city"]
|
concat_str += con + data.Intervention["destination_postal_code"] + " " + data.Intervention["destination_city"]
|
||||||
csv_col.data[15] = concat_str # Adresse DEST
|
csv_col.data[15] = concat_str # Adresse DEST
|
||||||
|
|
||||||
@@ -526,8 +547,9 @@ class ClercAttrib2Biz():
|
|||||||
if data.Intervention["site_name"] is not None:
|
if data.Intervention["site_name"] is not None:
|
||||||
concat_str += con + data.Intervention["site_name"]
|
concat_str += con + data.Intervention["site_name"]
|
||||||
con = ", "
|
con = ", "
|
||||||
concat_str += con + self.ifNotNull(data.Intervention["site_street"]) + " " + self.ifNotNull(data.Intervention["site_street_number"])
|
if data.Intervention["site_street"] is not None:
|
||||||
con = ", "
|
concat_str += con + self.ifNotNull(data.Intervention["site_street"]) + " " + self.ifNotNull(data.Intervention["site_street_number"])
|
||||||
|
con = ", "
|
||||||
concat_str += con + self.ifNotNull(data.Intervention["site_postal_code"]) + " " + self.ifNotNull(data.Intervention["site_city"])
|
concat_str += con + self.ifNotNull(data.Intervention["site_postal_code"]) + " " + self.ifNotNull(data.Intervention["site_city"])
|
||||||
csv_col.data[18] = concat_str # Adresse PEC
|
csv_col.data[18] = concat_str # Adresse PEC
|
||||||
print(f'debug FIP:{data.Patient["fip_number"]} id:{data.data["id"]} code: {data.Debtor["code"]}')
|
print(f'debug FIP:{data.Patient["fip_number"]} id:{data.data["id"]} code: {data.Debtor["code"]}')
|
||||||
@@ -650,7 +672,7 @@ class ClercAttrib2Biz():
|
|||||||
|
|
||||||
csv_col.data[115] = self.ifNotNull(data.Patient["lastname"]) + " " + self.ifNotNull(data.Patient["firstname"])
|
csv_col.data[115] = self.ifNotNull(data.Patient["lastname"]) + " " + self.ifNotNull(data.Patient["firstname"])
|
||||||
csv_col.data[108] = data.Patient["complement"]
|
csv_col.data[108] = data.Patient["complement"]
|
||||||
csv_col.data[109] = datetime.strptime(data.Patient["birthdate"], "%Y-%m-%d").strftime("%d.%m.%Y") if data.Patient["birthdate"] is not None else "date naissance inconnue"
|
csv_col.data[109] = datetime.strptime(data.Patient["birthdate"], "%Y-%m-%d").strftime("%d.%m.%Y") if data.Patient["birthdate"] is not None else ""
|
||||||
if data.Patient["insurance_policy_number"] is not None and '-' not in data.Patient["insurance_policy_number"]:
|
if data.Patient["insurance_policy_number"] is not None and '-' not in data.Patient["insurance_policy_number"]:
|
||||||
csv_col.data[109] += ", " + data.Patient["insurance_policy_number"]
|
csv_col.data[109] += ", " + data.Patient["insurance_policy_number"]
|
||||||
|
|
||||||
@@ -659,6 +681,7 @@ class ClercAttrib2Biz():
|
|||||||
"%d.%m.%Y") # Date PEC
|
"%d.%m.%Y") # Date PEC
|
||||||
csv_col.data[111] += " - " + datetime.strptime(data.Intervention["start_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
csv_col.data[111] += " - " + datetime.strptime(data.Intervention["start_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
||||||
"%H:%M") # Heure START PEC
|
"%H:%M") # Heure START PEC
|
||||||
|
|
||||||
if b_HRF:
|
if b_HRF:
|
||||||
csv_col.data[111] += "-" + sHRF
|
csv_col.data[111] += "-" + sHRF
|
||||||
else:
|
else:
|
||||||
@@ -673,6 +696,7 @@ class ClercAttrib2Biz():
|
|||||||
csv_col.data[107] = data.Patient["fip_number"]
|
csv_col.data[107] = data.Patient["fip_number"]
|
||||||
csv_col.data[107] += " - " + data.data["comments"] if data.data["comments"] is not None else ""
|
csv_col.data[107] += " - " + data.data["comments"] if data.data["comments"] is not None else ""
|
||||||
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[135] = data.Intervention["base_name"]
|
csv_col.data[135] = data.Intervention["base_name"]
|
||||||
csv_col.data[136] = 2 if data.Intervention["base_name"] == "Uvrier" else 3
|
csv_col.data[136] = 2 if data.Intervention["base_name"] == "Uvrier" else 3
|
||||||
csv_col.data[146] = csv_col.data[136]
|
csv_col.data[146] = csv_col.data[136]
|
||||||
@@ -750,7 +774,7 @@ class ClercAttrib2Biz():
|
|||||||
if data.Patient["complement"] != None :
|
if data.Patient["complement"] != None :
|
||||||
self.a_listings["to_check"].append(data.Patient["fip_number"])
|
self.a_listings["to_check"].append(data.Patient["fip_number"])
|
||||||
print(data.Patient["complement"])
|
print(data.Patient["complement"])
|
||||||
self.logger.warning(f"Complément patient: facture N°: {data.data['id']} / {data.Patient['fip_number']}")
|
self.logger.warning(f"Complément 22 patient: facture N°: {data.data['id']} / {data.Patient['fip_number']}")
|
||||||
|
|
||||||
|
|
||||||
if data.Patient['insurance_policy_number'] == None:
|
if data.Patient['insurance_policy_number'] == None:
|
||||||
@@ -766,6 +790,7 @@ class ClercAttrib2Biz():
|
|||||||
b_HRF = True
|
b_HRF = True
|
||||||
sHRF = article["line_1"].replace("h",":")
|
sHRF = article["line_1"].replace("h",":")
|
||||||
print(f"pass HRF => {data.Patient['fip_number']}")
|
print(f"pass HRF => {data.Patient['fip_number']}")
|
||||||
|
|
||||||
break
|
break
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
1
version.py
Normal file
1
version.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
VERSION = "20220606-1715"
|
||||||
Reference in New Issue
Block a user