|
@@ -5,7 +5,10 @@ from pdfminer.pdfpage import PDFPage
|
|
|
from io import StringIO
|
|
from io import StringIO
|
|
|
import re
|
|
import re
|
|
|
import csv
|
|
import csv
|
|
|
-import glob, os
|
|
|
|
|
|
|
+import glob, os, random
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+lines = ["Wenn der Hahn kräht auf dem Mist, wird das Wetter besser oder es bleibt, wie es ist.", "Ich glaub, mein Schwein pfeift!", "Deine Mutter hat angerufen: Sie sagt, du kanns nix!", "Schade, dass am Ende des Geldes noch so viel Monat übrig ist!", "Der frühe Vogel kann mich mal.", "Wer andern eine Bratwurst brät, der hat ein Bratwurstbratgerät.", "So! sprach der Floh und setzte sich aufs Klo!", "Rettet die Bäume! Esst mehr Biber!", "Am Wochenende bin ich ein Mofa. Halb Mensch, halb Sofa.", "Früher war ich unentschlossen, jetzt bin ich mir da nicht mehr so sicher...", "Schon komisch – auf den ältesten Fotos sieht man am jüngsten aus.", "Schon komisch – auf den ältesten Fotos sieht man am jüngsten aus.", "Ich habe keine Lösung, aber ich bewundere das Problem!", "Auch ein Traumjob berechtigt nicht zum Schlaf während der Arbeitszeit.", "Ich bin nicht dumm, die anderen verstehen nur meine Logik nicht.", "Das einzige, was mich hier noch hält, ist die Erdanziehung!", "Arbeit hat noch niemanden umgebracht, aber ich will kein Risiko eingehen.", "Die Eselsbrücke ist die ideale Verbindung zwischen zwei Gedächtnislücken.", "Tipps für einen flachen Bauch: Nur flache Sachen essen! Zum Beispiel Schokoladentafeln und Pizza.", "Ich bin froh, dass ich mein Essen nicht selbst jagen muss. Ich wüsste auch gar nicht, wo Pizzen überhaupt leben.", "Ich faulenze nicht - ich arbeite so schnell, dass ich immer fertig bin.", "Als Nacktschläfer hat man es nicht leicht im Büro.", "Heute Nacht von der Arbeit geträumt. Werde dafür fünf Überstunden abrechnen.", "Kapiervorgang abgebrochen.", "Mein Job ist so geheim, dass nicht mal ich weiß, was ich hier mache", "Kuchen im Büro ist wie Raubtierfütterung im Zoo"]
|
|
|
|
|
|
|
|
def convert_pdf_to_txt(path):
|
|
def convert_pdf_to_txt(path):
|
|
|
rsrcmgr = PDFResourceManager()
|
|
rsrcmgr = PDFResourceManager()
|
|
@@ -34,14 +37,27 @@ regex = r"^Tour Nr:\n\n(\d*)\n\nAbfahrt:.*?(?!(StellPl.|StellPl))\nFahrzeugTyp:\
|
|
|
|
|
|
|
|
|
|
|
|
|
total = 0.0
|
|
total = 0.0
|
|
|
|
|
+total_15 = 0.0
|
|
|
os.chdir("./")
|
|
os.chdir("./")
|
|
|
-print("moin")
|
|
|
|
|
|
|
+print(" _ ")
|
|
|
|
|
+print(" _ __ _ __ _ ___ _____ _ __| |_ ___ _ __ ")
|
|
|
|
|
+print(" | '_ \| '_ \| | | \ \ / / _ \ '__| __/ _ \ '__|")
|
|
|
|
|
+print(" | | | | | | | |_| |\ V / __/ | | || __/ | ")
|
|
|
|
|
+print(" |_| |_|_| |_|\__, | \_/ \___|_| \__\___|_| ")
|
|
|
|
|
+print(" |___/ ")
|
|
|
|
|
+print(" 2023 ")
|
|
|
|
|
+print(" moin")
|
|
|
|
|
+print("")
|
|
|
|
|
+print("Spruch des Tages:")
|
|
|
|
|
+print(random.choice(lines))
|
|
|
|
|
+print("")
|
|
|
with open("ergebnis.csv", 'w', newline='') as csvfile:
|
|
with open("ergebnis.csv", 'w', newline='') as csvfile:
|
|
|
spamwriter = csv.writer(csvfile, delimiter=';',
|
|
spamwriter = csv.writer(csvfile, delimiter=';',
|
|
|
quotechar='|', quoting=csv.QUOTE_MINIMAL)
|
|
quotechar='|', quoting=csv.QUOTE_MINIMAL)
|
|
|
|
|
|
|
|
for file in glob.glob("*.pdf"):
|
|
for file in glob.glob("*.pdf"):
|
|
|
daily = 0.0
|
|
daily = 0.0
|
|
|
|
|
+ daily_15 = 0.0
|
|
|
print("Beginne mit " + file + " alles guddes!")
|
|
print("Beginne mit " + file + " alles guddes!")
|
|
|
spamwriter.writerow([str(file)])
|
|
spamwriter.writerow([str(file)])
|
|
|
out = convert_pdf_to_txt(file)
|
|
out = convert_pdf_to_txt(file)
|
|
@@ -58,13 +74,20 @@ with open("ergebnis.csv", 'w', newline='') as csvfile:
|
|
|
##print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
|
|
##print ("Match {matchNum} was found at {start}-{end}: {match}".format(matchNum = matchNum, start = match.start(), end = match.end(), match = match.group()))
|
|
|
if match.group(3) == "Kran 21 t":
|
|
if match.group(3) == "Kran 21 t":
|
|
|
continue
|
|
continue
|
|
|
- spamwriter.writerow([str("=\"" + match.group(1) + "\"")] + [str(match.group(4)).replace(",",",")] + [str(match.group(3)).replace(",",",")])
|
|
|
|
|
|
|
+ if match.group(3) == "LKW 15 t":
|
|
|
|
|
+ spamwriter.writerow([str("=\"" + match.group(1) + "\"")] + [0] + [str(match.group(4)).replace(",",",")] + [str(match.group(3)).replace(",",",")])
|
|
|
|
|
+ daily_15 = daily_15 + float(match.group(4).replace(",","."))
|
|
|
|
|
+ else:
|
|
|
|
|
+ spamwriter.writerow([str("=\"" + match.group(1) + "\"")] + [str(match.group(4)).replace(",",",")] + [0] + [str(match.group(3)).replace(",",",")])
|
|
|
|
|
+ daily = daily + float(match.group(4).replace(",","."))
|
|
|
print ("Tour " + str(i) + "," + str(match.group(1)) + "," + str(match.group(3)).replace(",","."))
|
|
print ("Tour " + str(i) + "," + str(match.group(1)) + "," + str(match.group(3)).replace(",","."))
|
|
|
- daily = daily + float(match.group(4).replace(",","."))
|
|
|
|
|
i = i+1
|
|
i = i+1
|
|
|
print(daily)
|
|
print(daily)
|
|
|
total = total + daily
|
|
total = total + daily
|
|
|
|
|
+ total_15 = total_15 + daily_15
|
|
|
spamwriter.writerow(["Gesamt (Tag)"] + [str("=\"" + str(round(daily, 2)) + "\"")])
|
|
spamwriter.writerow(["Gesamt (Tag)"] + [str("=\"" + str(round(daily, 2)) + "\"")])
|
|
|
|
|
+ spamwriter.writerow(["Gesamt (15 t) (Tag)"] + [str("=\"" + str(round(daily_15, 2)) + "\"")])
|
|
|
spamwriter.writerow([])
|
|
spamwriter.writerow([])
|
|
|
print("ok")
|
|
print("ok")
|
|
|
spamwriter.writerow(["Gesamt (Monat)"] + [str("=\"" + str(round(total, 2)) + "\"")])
|
|
spamwriter.writerow(["Gesamt (Monat)"] + [str("=\"" + str(round(total, 2)) + "\"")])
|
|
|
|
|
+ spamwriter.writerow(["Gesamt (15 t) (Monat)"] + [str("=\"" + str(round(total_15, 2)) + "\"")])
|