diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..22e92419edf7e3fb69dcadc6500a9ed74bfb3271
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+#config.json
diff --git a/API-V2-elab.py b/API-V2-elab.py
index e1375b0fe7f7f9e60ccaaa237ec2470827af83e5..96718884a7ab5cde2b3501bd9e15d5dc34eb8fa6 100644
--- a/API-V2-elab.py
+++ b/API-V2-elab.py
@@ -12,6 +12,7 @@ import datetime
 import elabapi_python
 from elabapi_python.rest import ApiException
 import requests
+import argparse
 import json
 import couchdb 
 import numpy as np
@@ -22,6 +23,25 @@ from urllib3 import disable_warnings
 couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
 db = couch['vl_db'] # existing
 
+config_file = "config.json"
+with open(config_file) as fp:
+	config = json.load(fp)
+
+cmd_parser = argparse.ArgumentParser(description= "Schreibt erstellen kalibrierschein (TeX und PDF) in die CouchDB")
+cmd_parser.add_argument("cal_no", type= int, metavar= "<Kalibrierschein-Nummer>", nargs= "*")
+cmd_parser.add_argument("-e", "--elab", type= int, metavar= "<eLab ID>")
+args = cmd_parser.parse_args()
+
+if args.elab is not None:
+	elab_id = str(args.elab)
+
+cers = [""] * len(args.cal_no)
+#print(args.cal_no)
+
+for pos in range(len(args.cal_no)):
+	cers[pos] = str(args.cal_no[pos])
+print(cers)
+
 #########################
 #         CONFIG        #
 #########################
@@ -59,11 +79,11 @@ today = datetime.date.today()
 
 ########  
 
-elab_id=643
-cers = ["75552_0001","75553_0001"]    #  Beispiel: cers = ["75511_0001","75512_0001"] 
+#elab_id=648
+#cers = ["75586_0001"]    #  Beispiel: cers = ["75511_0001","75512_0001"] 
 TL1_2= "TLA"  #### FM1 oder TLA
 
-year = "2024"
+year = str(config["KS-Daten"]["Jahr"])
 kk= "KK" 
 commentar = ''
 
diff --git a/attachment_cer.py b/attachment_cer.py
index 49d7d2387f508c512d582e034c3846db67cbfac9..89e4abb40ad6665cb2d6b4d49b857a0c1cd95add 100644
--- a/attachment_cer.py
+++ b/attachment_cer.py
@@ -5,9 +5,11 @@ Created on Fri Jan  6 11:14:44 2023
 @author: becker07
 """
 
-import pathlib
+from pathlib import Path
 import os
-import couchdb 
+import couchdb
+import argparse
+import json
 try:
     from configparser import ConfigParser
 except ImportError:
@@ -36,6 +38,8 @@ RefNo = ini_values.get('bur', 'RefNo')
 
 RefNo='bur-7.5-1V-' + year_str2 + '-' + RefNo  
 
+
+
 print(RefNo)
 
 doc_RefNo = db.get(RefNo)
@@ -46,7 +50,31 @@ cers =doc_RefNo["Bureaucracy"]["Certificate"]
 
 #cers = ["75552","75553"]    #  Beispiel: cers = ["75511_0001","75512_0001"] 
 #cers = ["75562","75563"]    #  Beispiel: cers = ["75511_0001","75512_0001"] 
-
+#config_file = "config.json"
+#with open(config_file) as fp:
+#	config = json.load(fp)
+#
+#cmd_parser = argparse.ArgumentParser(description= "Schreibt erstellen kalibrierschein (TeX und PDF) in die CouchDB")
+#cmd_parser.add_argument("cal_no", type= int, metavar= "<Kalibrierschein-Nummer>", nargs= "*")
+#cmd_parser.add_argument("-y", "--year", type= int, metavar= "<Messjahr>")
+#args = cmd_parser.parse_args()
+#
+#path= Path(config["Pfad"]["Kalibrierschein"])
+#year = str(config["KS-Daten"]["Jahr"])
+#
+#if args.year is not None:
+#	year = str(args.year)
+#
+#cers = [""] * len(args.cal_no)
+##print(args.cal_no)
+#
+#for pos in range(len(args.cal_no)):
+#	cers[pos] = str(args.cal_no[pos])
+#print(cers)
+
+#cers = ["75559"]    #  Beispiel: cers = ["75511_0001","75512_0001"] 
+#cers = ["75562","75563"]    #  Beispiel: cers = ["75511_0001","75512_0001"] 
+#exit()
 ###################  die Kalibrierscheine werden an das cer-json-dokument angehangen ##################
 
 
@@ -59,11 +87,11 @@ for cers_i in cers:
     cer_pdf= "ks-" +cers_i + "-" + year + ".pdf"
     cer_tex= "ks-" +cers_i + "-" + year + ".tex"
     print(cer_pdf, cer_tex)
-    ks_pdf = "C:\\Users\\becker07\\kalibrierschein\\" + cer_pdf
-    ks_tex = "C:\\Users\\becker07\\kalibrierschein\\" + cer_tex
+    ks_pdf = path.joinpath(cer_pdf)
+    ks_tex = path.joinpath(cer_tex)
     print(ks_pdf, ks_tex)
-    content_pdf=pathlib.Path(ks_pdf).read_bytes() 
-    content_tex=pathlib.Path(ks_tex).read_bytes() 
+    content_pdf=ks_pdf.read_bytes() 
+    content_tex=ks_tex.read_bytes() 
     db.put_attachment(doc, content_pdf, cer_pdf , content_type='application/pdf')
     db.put_attachment(doc, content_tex, cer_tex , content_type='text/plain')
         
@@ -71,6 +99,7 @@ for cers_i in cers:
     
    
 ###################  die Kalibrierscheine werden im Ordner Kalibrierscheine gelöscht ################## 
+#exit()
    
 for cers_i in cers:
     cers_i=str(cers_i) 
@@ -83,17 +112,21 @@ for cers_i in cers:
     cer_log= "ks-" + cers_i + "-" + year + ".log"
     cer_gz= "ks-" + cers_i + "-" + year + ".synctex.gz"
     print(cer_pdf, cer_tex)
-    ks_pdf = "C:\\Users\\becker07\\kalibrierschein\\" + cer_pdf
-    ks_tex = "C:\\Users\\becker07\\kalibrierschein\\" + cer_tex
-    ks_aux = "C:\\Users\\becker07\\kalibrierschein\\" + cer_aux
-    ks_log = "C:\\Users\\becker07\\kalibrierschein\\" + cer_log
-    ks_gz = "C:\\Users\\becker07\\kalibrierschein\\" + cer_gz
+    ks_pdf = path.joinpath(cer_pdf)
+    ks_tex = path.joinpath(cer_tex)
+    ks_aux = path.joinpath(cer_aux)
+    ks_log = path.joinpath(cer_log)
+    ks_gz = path.joinpath(cer_gz)
     
     print(ks_pdf, ks_tex)
-    os.remove(ks_pdf)
-    os.remove(ks_tex)
-    os.remove(ks_aux)
-    os.remove(ks_log)
-    os.remove(ks_gz)
+    ks_pdf.unlink(missing_ok= True)
+    ks_tex.unlink(missing_ok= True)
+    ks_aux.unlink(missing_ok= True)
+    ks_log.unlink(missing_ok= True)
+    ks_gz.unlink(missing_ok= True)
         
-    
\ No newline at end of file
+<<<<<<< HEAD
+    
+=======
+    i += 1
+>>>>>>> ebf93a9ace9e40821f2458dbdfad5bd91f7059e8
diff --git a/file-to-couchdb_TLA.py b/file-to-couchdb_TLA.py
index 7a2a3e87847fa8fc358bbb8a4b207ac8ff9e69c5..a2c7f2a63598d588e43ed04bb7f50e9b41d0ff3a 100644
--- a/file-to-couchdb_TLA.py
+++ b/file-to-couchdb_TLA.py
@@ -17,6 +17,7 @@ import json
 import couchdb
 from pathlib import Path
 import os
+import argparse
 #import pathlib
 couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
 db = couch['vl_db'] # existing
@@ -26,21 +27,40 @@ db = couch['vl_db'] # existing
 #    - Jahr der Kalibrierung 
 #    - laufende Nummer der Kalibrierung
 
-
-
-
-cal_cert = "75559"
-
-year = "2024"
-no = "0001"
-
+config_file = "config.json"
+with open(config_file) as fp:
+	config = json.load(fp)
+#for section in config.keys():
+#	print("section:", section)
+#	for entry in config[section].keys():
+#		print(entry, "=", config[section][entry])
+
+cmd_parser = argparse.ArgumentParser(description= "Verarbeitet Messdaten aus TLA und speichert sie als CouchDB-Dokument")
+cmd_parser.add_argument("cal_no", type= int, metavar= "<Kalibrierschein-Nummer>")
+cmd_parser.add_argument("-y", "--year", type= int, metavar= "<Messjahr>")
+cmd_parser.add_argument("-n", "--number", type= int, metavar= "<laufende Nummer>")
+args = cmd_parser.parse_args()
+
+#cal_cert = "75559"
+year = str(config["KS-Daten"]["Jahr"])
+no = str(config["KS-Daten"]["lfd. Nr."]).zfill(4)
+
+#if args.cal_no is not None:
+cal_cert = str(args.cal_no)
+if args.year is not None:
+	year = str(args.year)
+if args.number is not None:
+	no = str(args.number).zfill(4)
+
+#print("year:", year)
+#print("no:", no)
 
 json_file = "cal-" + year + "-tl2-kk-" + cal_cert + "_" + no
 doc = db.get(json_file) 
 
 # Die Daten aus dem File mit der entsprechenden Kalibrierscheinnummer werden eingelesen:
 # datum, time, p_up und alle Temperaturen, 
-path=Path('/home/friske01/O/Vakuum/Messplaetze/TL2/Messwerte')
+path=Path(config["Pfad"]["Messwerte"])
 
 #print(path.exists())
 #datei = path.joinpath(year + ".json")
@@ -54,11 +74,11 @@ print(json_file)
 
 #with smbclient.open_file(datei, mode= 'r') as datei_handle:
 datei_pkt = pd.read_csv(datei,  sep="\t", decimal = ',' )
-print(datei_pkt)
+#print(datei_pkt)
 #with smbclient.open_file(datei_S, mode= 'r') as datei_handle:
 datei_S_pkt = pd.read_csv(datei_S,  sep="\t", decimal = ',' )
-print(datei_S_pkt)
-exit()
+#print(datei_S_pkt)
+#exit()
 datum=datei_pkt["Datum"]
 time=datei_pkt["Zeit"]
 p_up=datei_pkt["Druck"]
diff --git a/writeLaTeX-ks-TLA.py b/writeLaTeX-ks-TLA.py
index 6b03c3ca7112f722d588dcc17d1b7a502cdbec20..927ee0c4633ffc351392b573530486746b7a2777 100644
--- a/writeLaTeX-ks-TLA.py
+++ b/writeLaTeX-ks-TLA.py
@@ -1,12 +1,31 @@
 import time
 import couchdb 
 from datetime import date
+from pathlib import Path
+import argparse
+import json
 couch = couchdb.Server('http://a73434.berlin.ptb.de:5984')
 db = couch['vl_db'] # existing
 
-cal_cert = "75553"
-year = "2024"
-no = "0001"
+config_file = "config.json"
+with open(config_file) as fp:
+	config = json.load(fp)
+
+cmd_parser = argparse.ArgumentParser(description= "Erstellt TeX-Dokument als Zwischenschritt zum PDF-Kalibrierschein")
+cmd_parser.add_argument("cal_no", type= int, metavar= "<Kalibrierschein-Nummer>")
+cmd_parser.add_argument("-y", "--year", type= int, metavar= "<Messjahr>")
+cmd_parser.add_argument("-n", "--number", type= int, metavar= "<laufende Nummer>")
+args = cmd_parser.parse_args()
+
+#cal_cert = "75559"
+year = str(config["KS-Daten"]["Jahr"])
+no = str(config["KS-Daten"]["lfd. Nr."]).zfill(4)
+cal_cert = str(args.cal_no)
+if args.year is not None:
+	year = str(args.year)
+if args.number is not None:
+	no = str(args.number).zfill(4)
+year_cer = year[2:]
 
 
 # Druckanzeige pup_cus_ptb = 0 (PTB/Wika) ; pup_cus_ptb = 1 (customer)
@@ -39,16 +58,18 @@ doc = {'_id': json_file_cer}
 
 if id_cer == 0:
     db.save(doc)
-    print ( "Warten! 30 Sekunden" )
-    time.sleep ( 30 )
+    print ( "Warten! 2 Sekunden" )
+    time.sleep ( 2 )
     print ( json_file_cer," ist in der Couch angelegt" )
     
 else:
     print ( json_file_cer," ist bereits in der Couch angelegt" )
 
+path = Path(config["Pfad"]["Kalibrierschein"])
 
 id_ = "cal-" + year + "-tl2-kk-" + cal_cert + "_" + no
-ks = "C:\\Users\\becker07\\kalibrierschein\\ks-" + cal_cert + "-" + year + ".tex"
+ks_file = "ks-" + cal_cert + "-" + year + ".tex"
+ks = path.joinpath(ks_file)
 cer = "cer-" + year + "-" + cal_cert
 
 json_file_cal = id_
@@ -129,7 +150,7 @@ typ = '\\type{' +  Type + '}\n'
 serialNo = '\\serialNo{' + Serial + '}\n'
 applicant = '\\applicant{{' + Name + '}\n {' + Street + '} \n {' + Zipcode + Town +'}\n {' + Land+'}}\n'
 refNo = '\\refNo{ ' + ReferenceNo + '}\n'
-calibMark = '\\calibMark{ ' +' ' + Certificate + ' PTB 23}\n'
+calibMark = '\\calibMark{ ' +' ' + Certificate + ' PTB ' + year_cer + '}\n'
 calibDate = '\\calibDate{' + MeasurementDate + '}\n'
 examiner = '\\examiner{' + Examiner + '}\n'
 certificateDate = '\\certificateDate{' + CertificateDate + '}\n'
@@ -223,7 +244,7 @@ sectionDiscription_1_en= TextEN ###### Beschreibung aus dem cal-Dokument
 if (sectionDiscription_noyes!= 'yes'):
     
     sectionDiscription_2= " Dies ist die erste von der PTB durchgeführte Kalibrierung."
-    sectionDiscription_2_en= "This is the previous calibration at PTB."
+    sectionDiscription_2_en= " This is the first calibration at PTB."
     print(" 1. durchgeführte Kalibrierung")
 
 else: