diff options
-rw-r--r-- | .gitignore | 136 | ||||
-rw-r--r-- | app.py | 1 | ||||
-rw-r--r-- | justice_main.py | 135 | ||||
-rw-r--r-- | main.py | 2 | ||||
-rw-r--r-- | models.py | 12 | ||||
-rw-r--r-- | templates/extract-actual.html | 39 | ||||
-rw-r--r-- | templates/extract.html | 82 |
7 files changed, 345 insertions, 62 deletions
@@ -255,3 +255,139 @@ Scripts/wheel3.exe Scripts/winsound.pyd Scripts/xlwings32-0.20.7.dll Scripts/xlwings64-0.20.7.dll +data/as-full-brno-2021.xml +data/as-full-ceske_budejovice-2021.xml +data/as-full-hradec_kralove-2021.xml +data/as-full-ostrava-2021.xml +data/as-full-plzen-2021.xml +data/as-full-praha-2021.xml +data/as-full-usti_nad_labem-2021.xml +data/dr-full-brno-2021.xml +data/dr-full-ceske_budejovice-2021.xml +data/dr-full-hradec_kralove-2021.xml +data/dr-full-ostrava-2021.xml +data/dr-full-plzen-2021.xml +data/dr-full-praha-2021.xml +data/dr-full-usti_nad_labem-2021.xml +data/evrdrspol-full-ostrava-2021.xml +data/evrdrspol-full-praha-2021.xml +data/evrhzs-full-hradec_kralove-2021.xml +data/evrhzs-full-ostrava-2021.xml +data/evrhzs-full-praha-2021.xml +data/evrhzs-full-usti_nad_labem-2021.xml +data/evrspol-full-brno-2021.xml +data/evrspol-full-ceske_budejovice-2021.xml +data/evrspol-full-hradec_kralove-2021.xml +data/evrspol-full-ostrava-2021.xml +data/evrspol-full-plzen-2021.xml +data/evrspol-full-praha-2021.xml +data/evrspol-full-usti_nad_labem-2021.xml +data/ks-full-brno-2021.xml +data/ks-full-ceske_budejovice-2021.xml +data/ks-full-hradec_kralove-2021.xml +data/ks-full-ostrava-2021.xml +data/ks-full-plzen-2021.xml +data/ks-full-praha-2021.xml +data/ks-full-usti_nad_labem-2021.xml +data/nad-full-brno-2021.xml +data/nad-full-ceske_budejovice-2021.xml +data/nad-full-hradec_kralove-2021.xml +data/nad-full-ostrava-2021.xml +data/nad-full-plzen-2021.xml +data/nad-full-praha-2021.xml +data/nad-full-usti_nad_labem-2021.xml +data/nadf-full-brno-2021.xml +data/nadf-full-ceske_budejovice-2021.xml +data/nadf-full-hradec_kralove-2021.xml +data/nadf-full-ostrava-2021.xml +data/nadf-full-plzen-2021.xml +data/nadf-full-praha-2021.xml +data/nadf-full-usti_nad_labem-2021.xml +data/odbororg-full-brno-2021.xml +data/odbororg-full-ceske_budejovice-2021.xml +data/odbororg-full-hradec_kralove-2021.xml +data/odbororg-full-ostrava-2021.xml +data/odbororg-full-plzen-2021.xml +data/odbororg-full-praha-2021.xml +data/odbororg-full-usti_nad_labem-2021.xml +data/orgzam-full-brno-2021.xml +data/orgzam-full-ceske_budejovice-2021.xml +data/orgzam-full-hradec_kralove-2021.xml +data/orgzam-full-ostrava-2021.xml +data/orgzam-full-plzen-2021.xml +data/orgzam-full-praha-2021.xml +data/orgzam-full-usti_nad_labem-2021.xml +data/osznad-full-praha-2021.xml +data/osznad-full-usti_nad_labem-2021.xml +data/osznadf-full-plzen-2021.xml +data/osznadf-full-praha-2021.xml +data/oszpo-full-brno-2021.xml +data/oszpo-full-ceske_budejovice-2021.xml +data/oszpo-full-hradec_kralove-2021.xml +data/oszpo-full-ostrava-2021.xml +data/oszpo-full-plzen-2021.xml +data/oszpo-full-praha-2021.xml +data/oszpo-full-usti_nad_labem-2021.xml +data/pobspolek-full-brno-2021.xml +data/pobspolek-full-ceske_budejovice-2021.xml +data/pobspolek-full-hradec_kralove-2021.xml +data/pobspolek-full-ostrava-2021.xml +data/pobspolek-full-plzen-2021.xml +data/pobspolek-full-praha-2021.xml +data/pobspolek-full-usti_nad_labem-2021.xml +data/prisp-full-brno-2021.xml +data/prisp-full-ceske_budejovice-2021.xml +data/prisp-full-hradec_kralove-2021.xml +data/prisp-full-ostrava-2021.xml +data/prisp-full-plzen-2021.xml +data/prisp-full-praha-2021.xml +data/prisp-full-usti_nad_labem-2021.xml +data/spolek-full-brno-2021.xml +data/spolek-full-ceske_budejovice-2021.xml +data/spolek-full-hradec_kralove-2021.xml +data/spolek-full-ostrava-2021.xml +data/spolek-full-plzen-2021.xml +data/spolek-full-praha-2021.xml +data/spolek-full-usti_nad_labem-2021.xml +data/sro-full-brno-2021.xml +data/sro-full-ceske_budejovice-2021.xml +data/sro-full-hradec_kralove-2021.xml +data/sro-full-ostrava-2021.xml +data/sro-full-plzen-2021.xml +data/sro-full-praha-2021.xml +data/sro-full-usti_nad_labem-2021.xml +data/svj-full-brno-2021.xml +data/svj-full-ceske_budejovice-2021.xml +data/svj-full-hradec_kralove-2021.xml +data/svj-full-ostrava-2021.xml +data/svj-full-plzen-2021.xml +data/svj-full-praha-2021.xml +data/svj-full-usti_nad_labem-2021.xml +data/ustav-full-brno-2021.xml +data/ustav-full-ceske_budejovice-2021.xml +data/ustav-full-hradec_kralove-2021.xml +data/ustav-full-ostrava-2021.xml +data/ustav-full-plzen-2021.xml +data/ustav-full-praha-2021.xml +data/ustav-full-usti_nad_labem-2021.xml +data/vos-full-brno-2021.xml +data/vos-full-ceske_budejovice-2021.xml +data/vos-full-hradec_kralove-2021.xml +data/vos-full-ostrava-2021.xml +data/vos-full-plzen-2021.xml +data/vos-full-praha-2021.xml +data/vos-full-usti_nad_labem-2021.xml +data/zahrfos-full-brno-2021.xml +data/zahrfos-full-ceske_budejovice-2021.xml +data/zahrfos-full-ostrava-2021.xml +data/zahrfos-full-plzen-2021.xml +data/zahrfos-full-praha-2021.xml +data/zahrfos-full-usti_nad_labem-2021.xml +data/zajzdrpo-full-brno-2021.xml +data/zajzdrpo-full-ceske_budejovice-2021.xml +data/zajzdrpo-full-hradec_kralove-2021.xml +data/zajzdrpo-full-ostrava-2021.xml +data/zajzdrpo-full-plzen-2021.xml +data/zajzdrpo-full-praha-2021.xml +data/zajzdrpo-full-usti_nad_labem-2021.xml +as-full-ostrava-2021.xml @@ -12,5 +12,6 @@ from flask_sqlalchemy import SQLAlchemy app = Flask(__name__) app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///justice.db' +app.config["SQLALCHEMY_ECHO"] = True app.secret_key = "123456" db = SQLAlchemy(app)
\ No newline at end of file diff --git a/justice_main.py b/justice_main.py index f8699bd..93eed03 100644 --- a/justice_main.py +++ b/justice_main.py @@ -13,7 +13,7 @@ def parse_to_DB(file): conn = sqlite3.connect('justice.db')
c = conn.cursor()
for event, element in etree.iterparse(file, tag="Subjekt"):
- # Bugfix for companies which have been deleted but appear in the list of existing companies
+ # Bugfix for companies which have been deleted but appear in the list of existing companies
if ([element.find('vymazDatum')][0]) != None:
continue
else:
@@ -24,10 +24,10 @@ def parse_to_DB(file): # Vlozit jednolive parametry
insert_primary_company_figures(c, ICO, element, conn)
insert_company_relations(c, ICO, element, conn, primary_sql_key)
- # insert_obec_relation(c, conn, ICO, element, primary_sql_key)
+ # insert_obec_relation(c, conn, ICO, element, primary_sql_key)
find_other_properties(c, ICO, element, conn, primary_sql_key)
element.clear()
-
+
# subjekt_udaje.clear()
# purge_DB(c)
@@ -50,6 +50,7 @@ def purge_DB(c): c.execute("DELETE FROM predmety_podnikani_relation")
c.execute("DELETE FROM predmety_cinnosti")
c.execute("DELETE FROM predmety_cinnosti_relation")
+ c.execute("DELETE FROM zakladni_kapital")
def find_other_properties(c, ICO, element, conn, primary_sql_key):
try:
@@ -67,6 +68,8 @@ def find_other_properties(c, ICO, element, conn, primary_sql_key): find_predmet_podnikani(c, ICO, elem2, conn, primary_sql_key, element)
elif str(get_prop(elem2, ".//udajTyp/kod")) == "PREDMET_CINNOSTI_SEKCE":
find_predmet_cinnosti(c, ICO, elem2, conn, primary_sql_key, element)
+ elif str(get_prop(elem2, ".//udajTyp/kod")) == "ZAKLADNI_KAPITAL":
+ find_zakladni_kapital(c, ICO, elem2, conn, primary_sql_key, element)
except:
pass
@@ -84,7 +87,7 @@ def find_predmet_podnikani(c, ICO, predmet_podnikani_elem, conn, primary_sql_key inserted_figure = str(get_prop(elem2, ".//hodnotaText"))
insert_into_ancillary_table(c, elem, inserted_figure)
ancillary_table_key = get_anciallary_table_key(c, elem, inserted_figure)
- insert_relation_information_v2(c, elem, primary_sql_key, ancillary_table_key, zapis_datum, vymaz_datum)
+ insert_relation_information_v2(c, elem, primary_sql_key, ancillary_table_key, zapis_datum, vymaz_datum)
except Exception as f:
pass
@@ -102,11 +105,21 @@ def find_predmet_cinnosti(c, ICO, predmet_podnikani_elem, conn, primary_sql_key, inserted_figure = str(get_prop(elem2, ".//hodnotaText"))
insert_into_ancillary_table(c, elem, inserted_figure)
ancillary_table_key = get_anciallary_table_key(c, elem, inserted_figure)
- insert_relation_information_v2(c, elem, primary_sql_key, ancillary_table_key, zapis_datum, vymaz_datum)
+ insert_relation_information_v2(c, elem, primary_sql_key, ancillary_table_key, zapis_datum, vymaz_datum)
except Exception as f:
pass
-
+def find_zakladni_kapital(c, ICO, elem2, conn, primary_sql_key, element):
+ try:
+ zapis_datum = str(get_prop(elem2, ".//zapisDatum"))
+ vymaz_datum = str(get_prop(elem2, ".//vymazDatum"))
+ vklad_typ = str(get_prop(elem2, ".//hodnotaUdaje/vklad/typ"))
+ vklad_hodnota = str(get_prop(elem2, ".//hodnotaUdaje/vklad/textValue"))
+ splaceni_typ = str(get_prop(elem2, ".//hodnotaUdaje/splaceni/typ"))
+ splaceni_hodnota = str(get_prop(elem2, ".//hodnotaUdaje/splaceni/textValue"))
+ c.execute("INSERT INTO zakladni_kapital (company_id, zapis_datum, vymaz_datum, vklad_typ, vklad_hodnota, splaceni_typ, splaceni_hodnota) VALUES(?, ?, ?, ?, ?, ?, ?)", (primary_sql_key, zapis_datum, vymaz_datum, vklad_typ, vklad_hodnota, splaceni_typ, splaceni_hodnota,))
+ except Exception as f:
+ print(f)
def insert_individual_relations_v2(c, ICO, conn, primary_sql_key, zapis_datum, vymaz_datum, hodnota_text):
insert_into_ancillary_table(c, elem, inserted_figure)
@@ -146,7 +159,7 @@ def get_primary_sql_key(c, ICO): return primary_key[0]
except:
return 0
-
+
return
def insert_primary_company_figures(c, ICO, element, conn):
@@ -175,9 +188,9 @@ def insert_individual_relations(c, ICO, element, conn, primary_sql_key, elem): def insert_into_ancillary_table(c, elem, inserted_figure):
try:
c.execute("INSERT INTO " + elem[1] + "(" + elem[2] + ") VALUES(?)", (inserted_figure,))
- except:
+ except:
pass
-
+
def get_anciallary_table_key(c, elem, inserted_figure):
try:
anciallary_table_key = c.execute("SELECT id FROM " + elem[1] + " WHERE " + elem[2] + " = (?)", (inserted_figure,))
@@ -206,7 +219,7 @@ def insert_obec_relation(c, conn, ICO, element, primary_sql_key): try:
c.execute("INSERT INTO obce (obec_jmeno) VALUES(?)", (obec,))
except:
- pass
+ pass
# Get municipality sql_id
try:
municipality_key = c.execute("SELECT id FROM obce WHERE obec_jmeno = (?)", (obec,))
@@ -218,7 +231,7 @@ def insert_obec_relation(c, conn, ICO, element, primary_sql_key): c.execute("INSERT INTO obec_relation VALUES(?, ?)", (primary_sql_key, municipality_key,))
except:
pass
-
+
return
def zkusit_najit_vsechny_osoby(element):
@@ -257,26 +270,26 @@ def insert_obec(c, obec, conn, ICO, sql_id): c.execute("INSERT INTO obce (obec_jmeno) VALUES(?)", (obec,))
except:
pass
-
+
def insert_adresa(c, adresa, conn, ICO, sql_id):
try:
c.execute("INSERT INTO adresy (adresa_jmeno) VALUES(?)", (adresa,))
except:
- pass
+ pass
def insert_osoba(c, osoba, conn, ICO, sql_id):
try:
c.execute("INSERT INTO osoby (osoba_jmeno) VALUES(?)", (osoba,))
except:
- pass
+ pass
def insert_ulice(c, ulice, conn, ICO, sql_id):
try:
c.execute("INSERT INTO ulice (ulice_jmeno) VALUES(?)", (ulice,))
except:
- pass
-
+ pass
+
def insert_prop_v2(c, prop, conn, ICO, column, table, sql_id):
# print(column, prop, ICO)
# c.execute("UPDATE companies SET (" + column + ") = (?) WHERE ico = (?)", (prop, ICO,))
@@ -289,13 +302,13 @@ def insert_prop_v2(c, prop, conn, ICO, column, table, sql_id): # Function to attempt to insert a placeholder for a new company based on ICO
def insert_new_ICO(c, ICO, conn):
-
+
try:
c.execute("INSERT INTO companies (ico) VALUES (?);", (ICO,))
return c.lastrowid
# c.execute("INSERT INTO companies VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", (ICO, "", "", "", "", "", "", "", "", "", ""))
-
+
# # conn.commit()
except:
pass
@@ -309,10 +322,10 @@ def get_ICO(element): def get_prop(element, prop):
try:
- return element.find(prop).text
+ return element.find(prop).text
except:
return "0"
-
+
# return [element.find(prop)][0].text
def insert_prop(c, prop, conn, ICO, column):
@@ -331,7 +344,7 @@ def insert_prop(c, prop, conn, ICO, column): # except:
# pass
-def get_SIDLO_v2(element):
+def get_SIDLO_v2(element):
address_field = []
address_field.append(get_prop(element, ".//udaje/Udaj/adresa/statNazev"))
address_field.append(get_prop(element, ".//udaje/Udaj/adresa/obec"))
@@ -351,7 +364,7 @@ def get_SIDLO_v2(element): address_field[i] = None
return address_field
-def get_SIDLO_v3(element):
+def get_SIDLO_v3(element):
address_field = []
address_field.append(get_prop(element, ".//statNazev"))
address_field.append(get_prop(element, ".//obec"))
@@ -370,7 +383,7 @@ def get_SIDLO_v3(element): if address_field[i] == "0":
address_field[i] = None
return address_field
-
+
class adresa(object):
def __init__(self, adresa):
@@ -385,7 +398,7 @@ class adresa(object): self.komplet_adresa = adresa[8]
self.cisloEv = adresa[9]
self.cisloText = adresa[10]
-
+
def __str__ (self):
try:
# if self.obec == "-":
@@ -409,13 +422,13 @@ class adresa(object): else:
return str(self.obec + " - " + self.castObce + ", " + self.ulice + " " + self.cisloText)
if self.okres == None and self.castObce == None and self.psc != None:
- return str(self.obec + ", " + self.ulice + " " + self.cisloText + ", PSČ " + self.psc)
+ return str(self.obec + ", " + self.ulice + " " + self.cisloText + ", PSČ " + self.psc)
if self.castObce == None and self.psc == None:
return str(self.obec + ", " + self.ulice + " " + self.cisloText)
else:
- if self.psc != None:
+ if self.psc != None and self.ulice == None:
return str(self.obec + " " + self.cisloText + " " + "okres " + self.okres + ", PSČ " + self.psc)
- else:
+ elif self.ulice == None:
return str(self.obec + " " + self.cisloText + " " + "okres " + self.okres)
if self.ulice != None :
if self.cisloOr != None:
@@ -432,56 +445,56 @@ class adresa(object): else:
return str(self.obec + ", " + self.ulice + "" + srovnat_obec_cast(self.obec, self.castObce) + ", " + self.stat)
else:
- return str(self.ulice + " č.ev. " + self.cisloEv + srovnat_obec_cast(self.obec, self.castObce) + ", " + self.psc + " " + self.obec + ", " + self.stat)
+ return str(self.ulice + " č.ev. " + self.cisloEv + srovnat_obec_cast(self.obec, self.castObce) + ", " + self.psc + " " + self.obec + ", " + self.stat)
else:
if self.psc != None:
- return str(self.ulice + " " + self.cisloPo + "" + srovnat_obec_cast(self.obec, self.castObce) + ", " + self.psc + " " + self.obec + ", " + self.stat)
+ return str(self.ulice + " " + self.cisloPo + "" + srovnat_obec_cast(self.obec, self.castObce) + ", " + self.psc + " " + self.obec + ", " + self.stat)
else:
- return str(self.ulice + " " + self.cisloPo + "" + srovnat_obec_cast(self.obec, self.castObce) + ", " + self.obec + ", " + self.stat)
-
+ return str(self.ulice + " " + self.cisloPo + "" + srovnat_obec_cast(self.obec, self.castObce) + ", " + self.obec + ", " + self.stat)
+
if self.cisloPo == None and self.cisloEv != None:
return str(self.obec + " č.ev. " + self.cisloEv + ", " + self.psc + srovnat_obec_cast(self.obec, self.castObce) + ", " + self.obec + ", " + self.stat)
-
+
if self.cisloPo != None:
return str("č.p. " + self.cisloPo + ", " + self.psc + srovnat_obec_cast(self.obec, self.castObce) + ", " + self.obec + ", " + self.stat)
-
+
if self.cisloPo == None and self.cisloEv == None and self.ulice == None:
return (self.obec + " " + self.stat)
-
+
except TypeError:
temp_adr = []
if self.ulice != None:
temp_adr.append(self.ulice)
-
+
if self.obec != None:
temp_adr.append(self.obec)
-
+
if self.castObce != None:
temp_adr.append(self.castObce)
-
+
if self.cisloPo != None:
- temp_adr.append(self.cisloPo)
-
+ temp_adr.append(self.cisloPo)
+
if self.cisloOr != None:
- temp_adr.append(self.cisloOr)
-
+ temp_adr.append(self.cisloOr)
+
if self.psc != None:
temp_adr.append(self.psc)
-
+
if self.okres != None:
- temp_adr.append(self.okres)
-
+ temp_adr.append(self.okres)
+
if self.cisloEv != None:
temp_adr.append(self.cisloEv)
-
+
if self.cisloText != None:
temp_adr.append(self.cisloText)
-
+
if self.stat != None:
temp_adr.append(self.stat)
-
- listToStr = ' '.join([str(elem) for elem in temp_adr])
-
+
+ listToStr = ' '.join([str(elem) for elem in temp_adr])
+
return listToStr
def srovnat_obec_cast(obec, cast_obce):
@@ -493,20 +506,20 @@ def srovnat_obec_cast(obec, cast_obce): return str(", " + cast_obce)
def general_update(method):
- typy_po = ["as", "sro", "vos", "ks", "dr", "zajzdrpo", "zahrfos", "ustav", "svj", "spolek", "prisp", "pobspolek",
+ typy_po = ["as", "sro", "vos", "ks", "dr", "zajzdrpo", "zahrfos", "ustav", "svj", "spolek", "prisp", "pobspolek",
"oszpo", "osznadf", "osznad", "orgzam", "odbororg", "nadf", "nad", "evrspol", "evrhzs", "evrdrspol"]
soudy = ["praha", "plzen", "brno", "ceske_budejovice", "hradec_kralove", "ostrava", "usti_nad_labem"]
# typy_po = ["as"]
# soudy = ["ostrava"]
-
+
rok = str(datetime.now().year)
for osoba in typy_po:
for soud in soudy:
if method == "down":
- update_data(osoba + "-actual-" + soud + "-" + rok + ".xml.gz")
+ update_data(osoba + "-full-" + soud + "-" + rok + ".xml.gz")
elif method == "db_update":
try:
- parse_to_DB(os.path.join(str(os.getcwd()), "data", osoba) + "-actual-" + soud + "-" + rok + ".xml")
+ parse_to_DB(os.path.join(str(os.getcwd()), "data", osoba) + "-full-" + soud + "-" + rok + ".xml")
except:
pass
@@ -528,7 +541,7 @@ def update_data(filename): delete_archive(temp_file[:-3])
-def downloadOR(source):
+def downloadOR(source):
download = requests.get(source, stream = True)
try:
print("Downloading file ", source)
@@ -565,24 +578,24 @@ def delete_temp_file(temp_file): def unzip_file(filename, temp_file):
with gzip.open(temp_file, 'rb') as f_in:
- with open(os.path.join(str(os.getcwd()), "data", "temp-" + filename), "wb") as f_out:
+ with open(os.path.join(str(os.getcwd()), "data", "temp-" + filename), "wb") as f_out:
# with open(str(os.getcwd()) + "\\data\\temp-" + filename, 'wb') as f_out:
shutil.copyfileobj(f_in, f_out)
-
+
def delete_archive(file):
send2trash.send2trash(file)
-# parse_to_DB("as-actual-ostrava-2021.xml")
+# parse_to_DB("as-full-ostrava-2021.xml")
# parse_to_DB("ks-actual-ostrava-2021.xml")
# parse_to_DB("sro-actual-praha-2020.xml")
-# def do_both():
-# general_update("down")
-# general_update("db_update")
+def do_both():
+ # general_update("down")
+ general_update("db_update")#
-# do_both()
+do_both()
# cProfile.run('do_both()')
@@ -4,7 +4,7 @@ from db_setup import init_db, db_session from forms import JusticeSearchForm, CompanyForm from flask import flash, render_template, request, redirect # from models import Company, Soud -from models import Company, Obce, Ulice, Pravni_Forma, Insolvency_Events, Predmet_Podnikani, Predmety_Podnikani_Association, Predmet_Cinnosti, Predmety_Cinnosti_Association +from models import Company, Obce, Ulice, Pravni_Forma, Insolvency_Events, Predmet_Podnikani, Predmety_Podnikani_Association, Predmet_Cinnosti, Predmety_Cinnosti_Association, Zakladni_Kapital from tables import Results init_db() @@ -131,6 +131,7 @@ class Company(db.Model): insolvence = db.relationship("Insolvency_Events", backref="companies") predmet_podnikani = db.relationship("Predmety_Podnikani_Association", back_populates="company") predmet_cinnosti = db.relationship("Predmety_Cinnosti_Association", back_populates="company") + zakladni_kapital = db.relationship("Zakladni_Kapital", backref="companies") class Obce(db.Model): @@ -158,6 +159,17 @@ class Insolvency_Events(db.Model): company = db.relationship("Company", backref="insolvency_events") insolvency_event = db.Column(db.String) +class Zakladni_Kapital(db.Model): + __tablename__ = "zakladni_kapital" + id = db.Column(db.Integer, primary_key=True) + company_id = db.Column(db.String, db.ForeignKey("companies.id")) + zapis_datum = db.Column(MyType) + vymaz_datum = db.Column(MyType) + vklad_typ = db.Column(db.String) + vklad_hodnota = db.Column(db.String) + splaceni_typ = db.Column(db.String) + splaceni_hodnota = db.Column(db.String) + class Predmet_Podnikani(db.Model): __tablename__ = "predmety_podnikani" id = db.Column(db.Integer, primary_key=True) diff --git a/templates/extract-actual.html b/templates/extract-actual.html index 231e1bc..91b2469 100644 --- a/templates/extract-actual.html +++ b/templates/extract-actual.html @@ -21,6 +21,13 @@ {% endif %} {% endfor %} +{% set zakladni_kapital_notes = [] %} +{% for i in range (row.zakladni_kapital|length) %} + {% if row.zakladni_kapital[i].vymaz_datum == 0 %} + {% set zakladni_kapital_notes = zakladni_kapital_notes.append(row.zakladni_kapital[i]) %} + {% endif %} +{% endfor %} + {% set zapis_split = row.zapis.split("-") %} {% if zapis_split[1] == "01" %} {% set mesic = "ledna" %} @@ -118,6 +125,38 @@ <td>{{ row.pravni_forma[0].pravni_forma }}</td> </tr> + {% if zakladni_kapital_notes|length > 0 %} + <tr> + {% if zakladni_kapital_notes[0].vklad_typ == "KORUNY" %} + {% set vklad_typ_symbol = "Kč" %} + {% set vklad_typ_description = zakladni_kapital_notes[0].vklad_hodnota %} + {% elif zakladni_kapital_notes[0].vklad_typ == "EURA" %} + {% set vklad_typ_symbol = "euro" %} + {% set vklad_typ_description = zakladni_kapital_notes[0].vklad_hodnota %} + {% else %} + {% set vklad_typ_symbol = "" %} + {% set vklad_typ_description = zakladni_kapital_notes[0].vklad_hodnota %} + {% endif %} + + {% if zakladni_kapital_notes[0].splaceni_typ == "KORUNY" %} + {% set splaceni_typ_symbol = "Kč" %} + {% set splaceni_typ_description = zakladni_kapital_notes[0].splaceni_hodnota %} + {% elif zakladni_kapital_notes[0].splaceni_typ == "PROCENTA" %} + {% set splaceni_typ_symbol = "%" %} + {% set splaceni_typ_description = zakladni_kapital_notes[0].splaceni_hodnota %} + {% elif zakladni_kapital_notes[0].splaceni_typ == "EURA" %} + {% set splaceni_typ_symbol = "euro" %} + {% set splaceni_typ_description = zakladni_kapital_notes[0].splaceni_hodnota %} + {% else %} + {% set splaceni_typ_symbol = "" %} + {% set splaceni_typ_description = zakladni_kapital_notes[0].splaceni_hodnota %} + {% endif %} + + <td>Základní kapitál:</td> + <td>{{ underlne_style_open|safe }} {{ vklad_typ_description }} {{ vklad_typ_symbol }} {% if splaceni_typ_description != "0" %} <br> Splaceno: {{ splaceni_typ_description }} {{ splaceni_typ_symbol }} {% endif %} {{ underlne_style_close|safe }}</td> + </tr> + {% endif %} + {% if predmety_podnikani_notes|length > 0 %} <tr> <td>Předmět podnikání:</td> diff --git a/templates/extract.html b/templates/extract.html index 63c362c..8665349 100644 --- a/templates/extract.html +++ b/templates/extract.html @@ -113,6 +113,88 @@ <td></td> </tr> + {% if row.zakladni_kapital|length > 0 %} + <tr> + <td>Základní kapitál:</td> + {% if row.zakladni_kapital[0].vymaz_datum != 0 %} + {% set underlne_style_open = undedrline_open_deleted %} + {% set underlne_style_close = undedrline_closed_deleted %} + {% else %} + {% set underlne_style_open = "" %} + {% set underlne_style_close = "" %} + {% endif %} + + {% if row.zakladni_kapital[0].vklad_typ == "KORUNY" %} + {% set vklad_typ_symbol = "Kč" %} + {% set vklad_typ_description = row.zakladni_kapital[0].vklad_hodnota %} + {% elif row.zakladni_kapital[0].vklad_typ == "EURA" %} + {% set vklad_typ_symbol = "euro" %} + {% set vklad_typ_description = row.zakladni_kapital[0].vklad_hodnota %} + {% else %} + {% set vklad_typ_symbol = "" %} + {% set vklad_typ_description = row.zakladni_kapital[0].vklad_hodnota %} + {% endif %} + + {% if row.zakladni_kapital[0].splaceni_typ == "KORUNY" %} + {% set splaceni_typ_symbol = "Kč" %} + {% set splaceni_typ_description = row.zakladni_kapital[0].splaceni_hodnota %} + {% elif row.zakladni_kapital[0].splaceni_typ == "PROCENTA" %} + {% set splaceni_typ_symbol = "%" %} + {% set splaceni_typ_description = row.zakladni_kapital[0].splaceni_hodnota %} + {% elif row.zakladni_kapital[0].splaceni_typ == "EURA" %} + {% set splaceni_typ_symbol = "euro" %} + {% set splaceni_typ_description = row.zakladni_kapital[0].splaceni_hodnota %} + {% else %} + {% set splaceni_typ_symbol = "" %} + {% set splaceni_typ_description = row.zakladni_kapital[0].splaceni_hodnota %} + {% endif %} + + <td>{{ underlne_style_open|safe }} {{ vklad_typ_description }} {{ vklad_typ_symbol }} {% if splaceni_typ_description != "0" %} <br> Splaceno: {{ splaceni_typ_description }} {{ splaceni_typ_symbol }} {% endif %} {{ underlne_style_close|safe }}</td> + <td>{{ underlne_style_open|safe }} Zapsáno: {{ row.zakladni_kapital[0].zapis_datum }} {% if row.zakladni_kapital[0].vymaz_datum != 0 %} <br> Vymazáno: {{ row.zakladni_kapital[0].vymaz_datum }} {% endif %} {{ underlne_style_close|safe }}</td> + </tr> + {% for i in range (1, row.zakladni_kapital|length) %} + <tr> + <td></td> + {% if row.zakladni_kapital[i].vymaz_datum != 0 %} + {% set underlne_style_open = undedrline_open_deleted %} + {% set underlne_style_close = undedrline_closed_deleted %} + {% else %} + {% set underlne_style_open = "" %} + {% set underlne_style_close = "" %} + {% endif %} + + {% if row.zakladni_kapital[i].vklad_typ == "KORUNY" %} + {% set vklad_typ_symbol = "Kč" %} + {% set vklad_typ_description = row.zakladni_kapital[i].vklad_hodnota %} + {% elif row.zakladni_kapital[i].vklad_typ == "EURA" %} + {% set vklad_typ_symbol = "euro" %} + {% set vklad_typ_description = row.zakladni_kapital[i].vklad_hodnota %} + {% else %} + {% set vklad_typ_symbol = "" %} + {% set vklad_typ_description = row.zakladni_kapital[i].vklad_hodnota %} + {% endif %} + + {% if row.zakladni_kapital[i].splaceni_typ == "KORUNY" %} + {% set splaceni_typ_symbol = "Kč" %} + {% set splaceni_typ_description = row.zakladni_kapital[i].splaceni_hodnota %} + {% elif row.zakladni_kapital[i].splaceni_typ == "PROCENTA" %} + {% set splaceni_typ_symbol = "%" %} + {% set splaceni_typ_description = row.zakladni_kapital[i].splaceni_hodnota %} + {% elif row.zakladni_kapital[i].splaceni_typ == "EURA" %} + {% set splaceni_typ_symbol = "euro" %} + {% set splaceni_typ_description = row.zakladni_kapital[i].splaceni_hodnota %} + {% else %} + {% set splaceni_typ_symbol = "" %} + {% set splaceni_typ_description = row.zakladni_kapital[i].splaceni_hodnota %} + {% endif %} + + <td>{{ underlne_style_open|safe }} {{ vklad_typ_description }} {{ vklad_typ_symbol }} {% if splaceni_typ_description != "0" %} <br> Splaceno: {{ splaceni_typ_description }} {{ splaceni_typ_symbol }} {% endif %} {{ underlne_style_close|safe }}</td> + <td>{{ underlne_style_open|safe }} Zapsáno: {{ row.zakladni_kapital[i].zapis_datum }} {% if row.zakladni_kapital[i].vymaz_datum != 0 %} <br> Vymazáno: {{ row.zakladni_kapital[i].vymaz_datum }} {% endif %} {{ underlne_style_close|safe }}</td> + </tr> + {% endfor %} + {% endif %} + + {% if row.predmet_podnikani|length > 0 %} <tr> <td>Předmět podnikání:</td> |