Version 2 full autonome
This commit is contained in:
327
main.py
327
main.py
@@ -233,6 +233,7 @@ class ClercAttrib2Biz():
|
||||
self.index_counter = 0
|
||||
|
||||
self.a_listings = {}
|
||||
self.export_filename = "export.csv"
|
||||
|
||||
|
||||
self.fenetre = Tk()
|
||||
@@ -243,9 +244,11 @@ class ClercAttrib2Biz():
|
||||
self.run_excel_after_export = BooleanVar(self.fenetre)
|
||||
|
||||
self.export_one_file.set(True)
|
||||
self.run_excel_after_export.set(True)
|
||||
self.run_excel_after_export.set(False)
|
||||
self.export_format_biz.set(True)
|
||||
|
||||
self.draw_mainWindows()
|
||||
self.refresh_ui()
|
||||
|
||||
self.timer = self.fenetre.after(1000, self.main_timer_fn)
|
||||
|
||||
@@ -340,7 +343,7 @@ class ClercAttrib2Biz():
|
||||
lbf_3.grid(row=0, column=1, rowspan=2, sticky='NSEW', padx=5, pady=5)
|
||||
|
||||
Checkbutton(lbf_3, text="Supprimer fichiers après conversion", variable= self.delete_after_parse, onvalue=True, offvalue=False).grid(row=0, sticky='W')
|
||||
Checkbutton(lbf_3, text="Export au format .biz", variable= self.export_format_biz, onvalue=True, offvalue=False).grid(row=1, sticky='W')
|
||||
Checkbutton(lbf_3, text="Export au format .biz", variable= self.export_format_biz, onvalue=True, offvalue=False, command=self.refresh_ui).grid(row=1, sticky='W')
|
||||
Checkbutton(lbf_3, text="Export en 1 seul fichier", variable= self.export_one_file, onvalue=True, offvalue=False, command=self.refresh_ui).grid(row=2, sticky='W')
|
||||
self.cb_run = Checkbutton(lbf_3, text="Lancer la conversion excel", variable=self.run_excel_after_export, onvalue=True, offvalue=False)
|
||||
self.cb_run.grid(row=3, sticky='W')
|
||||
@@ -355,11 +358,14 @@ class ClercAttrib2Biz():
|
||||
|
||||
def refresh_ui(self):
|
||||
print("pass refresh UI")
|
||||
if self.export_one_file.get():
|
||||
if self.export_one_file.get() and not self.export_format_biz.get():
|
||||
self.cb_run['state'] = "active"
|
||||
else:
|
||||
self.cb_run['state'] = "disabled"
|
||||
self.run_excel_after_export.set(False)
|
||||
if self.export_format_biz.get():
|
||||
self.cb_run['state'] = "disabled"
|
||||
self.run_excel_after_export.set(False)
|
||||
|
||||
|
||||
|
||||
@@ -369,14 +375,26 @@ class ClercAttrib2Biz():
|
||||
self.count_facture = 0
|
||||
x = 0
|
||||
|
||||
if self.export_one_file.get() and os.path.exists(os.path.join(dest_dir, f"src.csv")):
|
||||
try:
|
||||
os.remove(os.path.join(dest_dir, f"src.csv"))
|
||||
except:
|
||||
messagebox.showerror(title="Erreur fichier déjà ouvert", message=f"Le fichier src.csv est déjà ouvert. Veuillez le fermer et recommencer")
|
||||
return
|
||||
self.export_filename = f"bizexdoc_export_Attrib_v{datetime.now().year}{datetime.now().month}{datetime.now().month}{datetime.now().hour}{datetime.now().minute}.csv"
|
||||
|
||||
print(f"remove src.csv => {os.path.join(dest_dir, 'src.csv')}")
|
||||
if self.export_format_biz:
|
||||
if self.export_one_file.get() and os.path.exists(os.path.join(dest_dir, self.export_filename)):
|
||||
try:
|
||||
os.remove(os.path.join(dest_dir, self.export_filename))
|
||||
except:
|
||||
messagebox.showerror(title="Erreur fichier déjà ouvert", message=f"Le fichier {self.export_filename} est déjà ouvert. Veuillez le fermer et recommencer")
|
||||
return
|
||||
|
||||
print(f"remove {self.export_filename} => {os.path.join(dest_dir, self.export_filename)}")
|
||||
else:
|
||||
if self.export_one_file.get() and os.path.exists(os.path.join(dest_dir, f"src.csv")):
|
||||
try:
|
||||
os.remove(os.path.join(dest_dir, f"src.csv"))
|
||||
except:
|
||||
messagebox.showerror(title="Erreur fichier déjà ouvert", message=f"Le fichier src.csv est déjà ouvert. Veuillez le fermer et recommencer")
|
||||
return
|
||||
|
||||
print(f"remove src.csv => {os.path.join(dest_dir, 'src.csv')}")
|
||||
|
||||
|
||||
for filename in os.listdir(dir):
|
||||
@@ -399,109 +417,274 @@ class ClercAttrib2Biz():
|
||||
if self.run_excel_after_export.get():
|
||||
self.open_export_file()
|
||||
|
||||
def ifNotNull(self,value, ret=""):
|
||||
if value == None:
|
||||
return ret
|
||||
return value.strip()
|
||||
|
||||
|
||||
def parseFile(self, data, filename):
|
||||
self.index_counter += 1
|
||||
lines = []
|
||||
self.count_facture += len(data["invoices"])
|
||||
self.a_listings["to_check"] = []
|
||||
|
||||
if self.index_counter == 1:
|
||||
csv_col = cls_Col(True)
|
||||
csv_col.data[0] = "V:" + VERSION
|
||||
csv_col.data[5] = f""
|
||||
lines.append(csv_col.data)
|
||||
|
||||
|
||||
x = 70
|
||||
|
||||
for ele in data["invoices"]:
|
||||
data = cls_Invoice()
|
||||
data.parse_item(ele)
|
||||
|
||||
|
||||
print(f"Code débiteur => {data.data['id']}: {data.Debtor['code']}")
|
||||
if data.Debtor["code"] is None or '.' in str(data.Debtor["code"]):
|
||||
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 ")
|
||||
if data.Debtor["code"] is None:
|
||||
data.Debtor["code"] = 1
|
||||
else:
|
||||
data.Debtor["code"] = str(data.Debtor["code"]).replace('.', '')
|
||||
|
||||
if 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"]:
|
||||
self.a_listings["to_check"].append(data.Patient["fip_number"])
|
||||
self.logger.warning(f"Vérifier facture N°: {data.data['id']} / {data.Patient['fip_number']} {data.Debtor['code']} {data.Debtor['lastname']} {data.Debtor['firstname']}")
|
||||
|
||||
for elem in data.Debtor:
|
||||
pass
|
||||
''' TODO activer ce code quand les débiteur auront un bon numéro
|
||||
try:
|
||||
|
||||
if int(data.Debtor["code"]) > 100:
|
||||
print("code débiteur > 100 => no update data")
|
||||
b_update_debitor = False
|
||||
except:
|
||||
messagebox.showerror(title="Erreur de code débiteur", message=f"il y a une erreur dans le code débiteur, il faut le vérifier. \n(n'est pas un chiffre) {data.Patient['fip_number']}")
|
||||
exit()
|
||||
'''
|
||||
'''
|
||||
if data.Debtor["type"] == "Établissement":
|
||||
self.a_listings["to_check"].append(data.Patient["fip_number"])
|
||||
print(data.Patient["complement"])
|
||||
self.logger.warn(f"Débiteur établissement facture N°: {data.data['id']} / {data.Patient['fip_number']} {data.Debtor['name']}")
|
||||
'''
|
||||
|
||||
if data.Debtor["code"] == 1 and data.Patient["lastname"] + data.Patient["firstname"] != data.Debtor["lastname"] + data.Debtor["firstname"]:
|
||||
self.a_listings["to_check"].append(data.Patient["fip_number"])
|
||||
print(data.Patient["complement"])
|
||||
self.logger.warning(f"Débiteur différents: facture N°: {data.data['id']} / {data.Patient['fip_number']}")
|
||||
|
||||
if data.Patient["complement"] != None:
|
||||
self.a_listings["to_check"].append(data.Patient["fip_number"])
|
||||
print(data.Patient["complement"])
|
||||
self.logger.warning(f"Complément patient: facture N°: {data.data['id']} / {data.Patient['fip_number']}")
|
||||
|
||||
if data.Patient['insurance_policy_number'] == None:
|
||||
data.Patient['insurance_policy_number'] = f"{uuid.uuid4()}"[:15]
|
||||
|
||||
b_HRF = False
|
||||
sHRF = ""
|
||||
|
||||
|
||||
for article in data.Articles:
|
||||
if "code" in article.keys():
|
||||
if article["code"] == "HRF":
|
||||
b_HRF = True
|
||||
sHRF = article["line_1"].replace("h", ":")
|
||||
print(f"pass HRF => {data.Patient['fip_number']}")
|
||||
break
|
||||
x += 1
|
||||
csv_col = cls_Col(True)
|
||||
|
||||
##Donnée globales
|
||||
csv_col.data[0] = data.data["id"] # N° document
|
||||
csv_col.data[129] = data.Intervention["type"] # Priorité
|
||||
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[4] = data.Patient["fip_number"] # Référence
|
||||
csv_col.data[10] = "<AUTO>" # Compte collectif du tiers = <AUTO>
|
||||
if data.Patient["gender"] == "Féminin":
|
||||
csv_col.data[12] = "F" # Langue du document, utilisé comme sexe
|
||||
elif data.Patient["gender"] == "Masculin":
|
||||
csv_col.data[12] = "M" # Langue du document, utilisé comme sexe
|
||||
csv_col.data[19] = data.Debtor["code"] # Code adresse à récupérer dans recherche d'adresse automatisée
|
||||
|
||||
## Donnée Patients
|
||||
csv_col.data[22] = data.Patient["lastname"] # Nom de famille du patient
|
||||
csv_col.data[23] = data.Patient["firstname"] # Prénom du patient
|
||||
csv_col.data[24] = data.Patient["street"] # Rue du patient
|
||||
csv_col.data[25] = data.Patient["complement"] # Complément rue
|
||||
csv_col.data[26] = data.Patient["postal_code"] # NPA du patient
|
||||
csv_col.data[27] = data.Patient["city"] # Localité du patient
|
||||
csv_col.data[107] = data.Patient["birthdate"] # Date de naissance du patient
|
||||
csv_col.data[108] = "" # Profession
|
||||
csv_col.data[109] = data.Patient["insurance_name"] # Assurance
|
||||
csv_col.data[110] = "Filiation" # Filiation
|
||||
csv_col.data[112] = data.Intervention["site_street"] # Rue PEC
|
||||
csv_col.data[113] = data.Intervention["site_street_number"] # Rue PEC
|
||||
csv_col.data[114] = data.Intervention["site_postal_code"] + " " + data.Intervention["site_city"] # Rue PEC
|
||||
if "destination_name" not in data.Intervention.keys():
|
||||
csv_col.data[115] = "Sans transport"
|
||||
|
||||
if "destination_name" not in data.Intervention.keys() or data.Intervention["destination_name"] == None:
|
||||
csv_col.data[15] = "Sans transport"
|
||||
else:
|
||||
csv_col.data[115] = data.Intervention["destination_name"]
|
||||
csv_col.data[111] = datetime.strptime(data.Intervention["start_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
||||
"%d.%m.%Y") # Date PEC
|
||||
csv_col.data[118] = datetime.strptime(data.Intervention["start_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
||||
"%H:%M") # Heure PEC
|
||||
csv_col.data[119] = datetime.strptime(data.Intervention["end_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
||||
"%H:%M") # Heure PEC
|
||||
con = ""
|
||||
concat_str = ""
|
||||
if data.Intervention["destination_name"] is not None:
|
||||
concat_str += con + data.Intervention["destination_name"]
|
||||
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"]
|
||||
csv_col.data[15] = concat_str # Adresse DEST
|
||||
|
||||
# Donnée débiteur
|
||||
con = ""
|
||||
concat_str = ""
|
||||
if data.Intervention["site_name"] is not None:
|
||||
concat_str += con + data.Intervention["site_name"]
|
||||
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"])
|
||||
csv_col.data[18] = concat_str # Adresse PEC
|
||||
print(f'debug id:{data.data["id"]} code: {data.Debtor["code"]}')
|
||||
if int(data.Debtor["code"]) < 100:
|
||||
csv_col.data[19] = data.Patient['insurance_policy_number'].replace(".","")
|
||||
csv_col.data[22] = data.Patient["lastname"]
|
||||
csv_col.data[23] = data.Patient["firstname"]
|
||||
csv_col.data[24] = data.Patient["complement"]
|
||||
csv_col.data[25] = self.ifNotNull(data.Patient["street"]) + " " + self.ifNotNull(data.Patient["street_number"])
|
||||
csv_col.data[26] = data.Patient["postal_code"]
|
||||
csv_col.data[27] = data.Patient["city"]
|
||||
if data.Patient["country_name"] != "Suisse":
|
||||
csv_col.data[29] = data.Patient["country_name"]
|
||||
|
||||
csv_col.data[120] = data.Debtor["lastname"] # Débiteur nom
|
||||
csv_col.data[121] = data.Debtor["firstname"] # Débiteur prénom
|
||||
if data.Debtor["street"] is not None:
|
||||
csv_col.data[122] = data.Debtor["street"] + " " + data.Debtor["street_number"] # Débiteur nom
|
||||
csv_col.data[127] = data.Debtor["street"] + " " + data.Debtor["street_number"] # Débiteur nom
|
||||
csv_col.data[123] = data.Debtor["postal_code"] + " " + data.Debtor["city"] # Débiteur
|
||||
csv_col.data[128] = data.Debtor["postal_code"] + " " + data.Debtor["city"] # Débiteur
|
||||
csv_col.data[41] = "Monsieur" if data.Patient["gender"] == "Masculin" else "Madame"
|
||||
csv_col.data[44] = csv_col.data[41]
|
||||
|
||||
csv_col.data[124] = "11111111" # Débiteur nom
|
||||
if data.Debtor["gender"] == "Féminin":
|
||||
csv_col.data[125] = "Madame" # Langue du document, utilisé comme sexe
|
||||
elif data.Debtor["gender"] == "Masculin":
|
||||
csv_col.data[125] = "Monsieur" # Langue du document, utilisé comme sexe
|
||||
csv_col.data[46] = 0 # Maj adresse
|
||||
|
||||
if int(data.Debtor["code"]) > 1:
|
||||
con = ""
|
||||
concat_str = ""
|
||||
if "name" in data.Debtor.keys():
|
||||
concat_str += con + data.Debtor["name"]
|
||||
con = "#chr(13)##chr(10)#"
|
||||
|
||||
if data.Debtor["gender"] is not None:
|
||||
concat_str += con + "Monsieur" if data.Debtor["gender"] == "Masculin" else con + "Madame"
|
||||
con = "#chr(13)##chr(10)#"
|
||||
if data.Debtor["lastname"] is not None:
|
||||
concat_str += con + self.ifNotNull(data.Debtor["lastname"]) + " " + self.ifNotNull(data.Debtor["firstname"])
|
||||
con = "#chr(13)##chr(10)#"
|
||||
if data.Debtor["street"] is not None:
|
||||
concat_str += con + self.ifNotNull(data.Debtor["street"]) + " " + self.ifNotNull(data.Debtor["street_number"])
|
||||
con = "#chr(13)##chr(10)#"
|
||||
if data.Debtor["complement"] is not None:
|
||||
concat_str += con + data.Debtor["complement"]
|
||||
con = "#chr(13)##chr(10)#"
|
||||
if data.Debtor["city"] is not None:
|
||||
concat_str += con + self.ifNotNull(data.Debtor["postal_code"]) + " " + self.ifNotNull(data.Debtor["city"])
|
||||
con = "#chr(13)##chr(10)#"
|
||||
|
||||
|
||||
|
||||
csv_col.data[42] = concat_str #Adresse de livraison
|
||||
else:
|
||||
csv_col.data[125] = "" # Langue du document, utilisé comme sexe
|
||||
if data.Debtor["type"] == "Personne":
|
||||
csv_col.data[126] = data.Debtor["firstname"] + " " + data.Debtor["lastname"] # Débiteur nom
|
||||
elif data.Debtor["type"] == "Établissement":
|
||||
temp_data = []
|
||||
temp_data.append(data.Debtor["name"])
|
||||
temp_data.append(data.Debtor["firstname"])
|
||||
temp_data.append(data.Debtor["lastname"])
|
||||
csv_col.data[126] = ' '.join(filter(None, temp_data)) # Débiteur nom
|
||||
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[23] = data.Debtor["firstname"]
|
||||
csv_col.data[24] = data.Debtor["complement"]
|
||||
csv_col.data[25] = self.ifNotNull(data.Debtor["street"]) + " " + self.ifNotNull(data.Debtor["street_number"])
|
||||
csv_col.data[26] = data.Debtor["postal_code"]
|
||||
csv_col.data[27] = data.Debtor["city"]
|
||||
if data.Debtor["country_name"] != "Suisse":
|
||||
csv_col.data[29] = data.Debtor["country_name"]
|
||||
|
||||
csv_col.data[46] =1 # Maj adresse
|
||||
|
||||
if "name" in data.Debtor.keys():
|
||||
csv_col.data[21] = self.ifNotNull(data.Debtor["name"])
|
||||
else:
|
||||
csv_col.data[21] = ''
|
||||
|
||||
csv_col.data[40] = data.Patient["birthdate"]
|
||||
csv_col.data[48] = 0
|
||||
|
||||
|
||||
## Données prestations
|
||||
if "code" in article.keys():
|
||||
csv_col.data[49] = article["code"] # Code de prestations
|
||||
csv_col.data[50] = article["line_1"]
|
||||
if article["line_2"] != None:
|
||||
csv_col.data[50] = article["line_1"] + " / " + article["line_2"] # Descriptions prestations
|
||||
csv_col.data[50] = article["line_1"] + "#chr(13)##chr(10)#" + article["line_2"] # Descriptions prestations
|
||||
csv_col.data[52] = article["quantity"] # Quantité
|
||||
csv_col.data[53] = article["unit_price"] # prix unitaire
|
||||
csv_col.data[54] = article["unit"] # unité
|
||||
csv_col.data[54] = self.ifNotNull(article["unit"]) # unité
|
||||
csv_col.data[56] = article["price"] # prix total
|
||||
csv_col.data[59] = "<AUTO>" # Compte chiffre d'affaire = <AUTO>
|
||||
|
||||
else:
|
||||
csv_col.data[49] = "txt"
|
||||
csv_col.data[49] = "0"
|
||||
csv_col.data[50] = article["line_1"]
|
||||
if article["line_2"] != None:
|
||||
csv_col.data[50] = article["line_1"] + " / " + article["line_2"] # Descriptions prestations
|
||||
csv_col.data[52] = 0
|
||||
csv_col.data[53] = 0
|
||||
csv_col.data[56] = 0 # prix total
|
||||
csv_col.data[59] = "<AUTO>" # Compte chiffre d'affaire = <AUTO>
|
||||
|
||||
compte_number = None
|
||||
if data.Intervention["base_name"] == "Uvrier":
|
||||
compte_number = 3018
|
||||
else:
|
||||
if data.Intervention["type"] == "P1":
|
||||
compte_number = 3001 if data.Intervention["team_name"] == "Planification" else 3011
|
||||
if data.Intervention["type"] == "P2":
|
||||
compte_number = 3002 if data.Intervention["team_name"] == "Planification" else 3012
|
||||
if data.Intervention["type"] == "P3":
|
||||
compte_number = 3003 if data.Intervention["team_name"] == "Planification" else 3013
|
||||
if data.Intervention["type"] == "S1":
|
||||
compte_number = 3004 if data.Intervention["team_name"] == "Planification" else 3014
|
||||
if data.Intervention["type"] == "S2":
|
||||
compte_number = 3005 if data.Intervention["team_name"] == "Planification" else 3015
|
||||
if data.Intervention["type"] == "S3":
|
||||
compte_number = 3005 if data.Intervention["team_name"] == "Planification" else 3015
|
||||
csv_col.data[59] = compte_number
|
||||
|
||||
csv_col.data[60] = 0
|
||||
csv_col.data[61] = 0
|
||||
csv_col.data[63] = 0
|
||||
|
||||
csv_col.data[69] = "Libre"
|
||||
csv_col.data[70] = "BS - " + str(x)
|
||||
csv_col.data[72] = "BU - 73 - aff"
|
||||
csv_col.data[73] = 0
|
||||
|
||||
csv_col.data[107] = self.ifNotNull(data.Patient["lastname"]) + " " + self.ifNotNull(data.Patient["firstname"])
|
||||
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"
|
||||
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[110] = data.Patient["insurance_name"]
|
||||
csv_col.data[111] = datetime.strptime(data.Intervention["start_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
||||
"%d.%m.%Y") # Date PEC
|
||||
csv_col.data[111] += " - " + datetime.strptime(data.Intervention["start_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
||||
"%H:%M") # Heure START PEC
|
||||
if b_HRF:
|
||||
csv_col.data[111] += "-" + sHRF
|
||||
else:
|
||||
csv_col.data[111] += "-" + datetime.strptime(data.Intervention["end_time"], "%Y-%m-%dT%H:%M:%S%z").strftime(
|
||||
"%H:%M") # Heure END PEC
|
||||
|
||||
csv_col.data[112] = self.ifNotNull(data.Patient["street"]) + " " + self.ifNotNull(data.Patient["street_number"])
|
||||
csv_col.data[113] = self.ifNotNull(data.Patient["postal_code"]) + " " + self.ifNotNull(data.Patient["city"])
|
||||
if data.Patient["country_name"] != "Suisse":
|
||||
csv_col.data[113] += ", " + data.Patient["country_name"]
|
||||
|
||||
csv_col.data[115] = data.Patient["fip_number"]
|
||||
csv_col.data[115] += " - " + 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[135] = data.Intervention["base_name"]
|
||||
csv_col.data[136] = 2 if data.Intervention["base_name"] == "Uvrier" else 3
|
||||
csv_col.data[146] = csv_col.data[136]
|
||||
csv_col.data[168] = 1 if data.Intervention["team_name"] == "Planification" else 2
|
||||
csv_col.data[169] = data.Patient['insurance_policy_number']
|
||||
|
||||
lines.append(csv_col.data)
|
||||
csv_col = None
|
||||
with open(f"{dest_dir}/bizexdoc_" + filename.replace(".json", "") + ".csv", "w+",errors='replace', newline='') as csv_file:
|
||||
wr = csv.writer(csv_file, delimiter=';')
|
||||
for cdr in lines:
|
||||
wr.writerow(cdr)
|
||||
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=';')
|
||||
for cdr in lines:
|
||||
wr.writerow(cdr)
|
||||
else:
|
||||
self.save_file(lines,fileName=self.export_filename)
|
||||
def addToIndexs(self,obj,data,cat, key):
|
||||
#self.a_index[cat].append({"key":key,"index":len(obj.data)})
|
||||
if key not in self.a_index[cat]:
|
||||
@@ -708,8 +891,8 @@ class ClercAttrib2Biz():
|
||||
else:
|
||||
self.save_file(lines)
|
||||
|
||||
def save_file(self,lines):
|
||||
with open(os.path.join(dest_dir, f"src.csv"), "a+", errors='replace',newline='') as csv_file:
|
||||
def save_file(self,lines, fileName = "src.csv"):
|
||||
with open(os.path.join(dest_dir, fileName), "a+", errors='replace',newline='') as csv_file:
|
||||
wr = csv.writer(csv_file, delimiter=';')
|
||||
for cdr in lines:
|
||||
wr.writerow(cdr)
|
||||
|
Reference in New Issue
Block a user