diff options
-rw-r--r-- | justice_main.py | 64 | ||||
-rw-r--r-- | main.py | 1 | ||||
-rw-r--r-- | models.py | 38 | ||||
-rw-r--r-- | templates/extract.html | 141 |
4 files changed, 232 insertions, 12 deletions
diff --git a/justice_main.py b/justice_main.py index fad022f..7ce7103 100644 --- a/justice_main.py +++ b/justice_main.py @@ -48,6 +48,7 @@ def purge_DB(): c.execute("DELETE FROM druhy_podilu")
c.execute("DELETE FROM fyzicke_osoby")
c.execute("DELETE FROM insolvency_events")
+ c.execute("DELETE FROM jediny_akcionar")
c.execute("DELETE FROM konkurz_events")
c.execute("DELETE FROM nazvy")
c.execute("DELETE FROM obce")
@@ -63,6 +64,8 @@ def purge_DB(): c.execute("DELETE FROM predmety_cinnosti_relation")
c.execute("DELETE FROM predmety_podnikani")
c.execute("DELETE FROM predmety_podnikani_relation")
+ c.execute("DELETE FROM prokura_common_texts")
+ c.execute("DELETE FROM prokuriste")
c.execute("DELETE FROM sidla")
c.execute("DELETE FROM sidlo_relation")
c.execute("DELETE FROM spolecnici")
@@ -96,14 +99,14 @@ def find_other_properties(c, ICO, element, conn, primary_sql_key): find_registered_office(c, ICO, elem2, conn, primary_sql_key, element)
elif udajTyp_name == "NAZEV":
find_nazev(c, ICO, elem2, conn, primary_sql_key, element)
+ elif udajTyp_name == "SPIS_ZN":
+ find_sp_zn(c, ICO, elem2, conn, primary_sql_key, element)
+ elif udajTyp_name == "PRAVNI_FORMA":
+ find_pravni_forma(c, ICO, elem2, conn, primary_sql_key, element)
elif udajTyp_name == "STATUTARNI_ORGAN":
find_statutar(c, ICO, elem2, conn, primary_sql_key, element)
elif udajTyp_name == "SPOLECNIK":
find_spolecnik(c, ICO, elem2, conn, primary_sql_key, element)
- elif udajTyp_name == "INSOLVENCE_SEKCE":
- find_active_insolvency(c, ICO, elem2, conn, primary_sql_key)
- elif udajTyp_name == "KONKURS_SEKCE":
- find_active_konkurz(c, ICO, elem2, conn, primary_sql_key)
elif udajTyp_name == "PREDMET_PODNIKANI_SEKCE":
find_predmet_podnikani(c, ICO, elem2, conn, primary_sql_key, element)
elif udajTyp_name == "PREDMET_CINNOSTI_SEKCE":
@@ -114,15 +117,60 @@ def find_other_properties(c, ICO, element, conn, primary_sql_key): find_ostatni_skutecnosti(c, ICO, elem2, conn, primary_sql_key, element)
elif udajTyp_name == "AKCIE_SEKCE":
find_akcie(c, ICO, elem2, conn, primary_sql_key, element)
- elif udajTyp_name == "SPIS_ZN":
- find_sp_zn(c, ICO, elem2, conn, primary_sql_key, element)
- elif udajTyp_name == "PRAVNI_FORMA":
- find_pravni_forma(c, ICO, elem2, conn, primary_sql_key, element)
elif udajTyp_name == "DOZORCI_RADA":
find_dozorci_rada(c, ICO, elem2, conn, primary_sql_key, element)
+ elif udajTyp_name == "PROKURA":
+ find_prokura(c, ICO, elem2, conn, primary_sql_key, element)
+ elif udajTyp_name == "AKCIONAR_SEKCE":
+ find_sole_shareholder(c, ICO, elem2, conn, primary_sql_key, element)
+ elif udajTyp_name == "INSOLVENCE_SEKCE":
+ find_active_insolvency(c, ICO, elem2, conn, primary_sql_key)
+ elif udajTyp_name == "KONKURS_SEKCE":
+ find_active_konkurz(c, ICO, elem2, conn, primary_sql_key)
except:
pass
+def find_sole_shareholder(c, ICO, elem2, conn, primary_sql_key, element):
+ try:
+ my_iter = elem2.findall("podudaje/Udaj")
+ for elem in my_iter:
+ zapis_datum = str(get_prop(elem, "zapisDatum"))
+ vymaz_datum = str(get_prop(elem, "vymazDatum"))
+ text_akcionar = str(get_prop(elem, "hodnotaUdaje/textZaOsobu/value"))
+ typ_akcionar = str(get_prop(elem, "hodnotaUdaje/T"))
+ if typ_akcionar == "P":
+ spol_ico = str(get_prop(elem, "osoba/ico"))
+ regCislo = str(get_prop(elem, "osoba/regCislo"))
+ akcionar_po_id = find_pravnicka_osoba(c, elem, spol_ico, regCislo)
+ adresa_id = find_and_store_address(c, elem)
+ c.execute("INSERT into jediny_akcionar (company_id, zapis_datum, vymaz_datum, text_akcionar, akcionar_po_id, adresa_id) VALUES (?, ?, ?, ?, ?, ?)", (primary_sql_key, zapis_datum, vymaz_datum, text_akcionar, akcionar_po_id, adresa_id,))
+ elif typ_akcionar == "F":
+ akcionar_fo_id = find_fyzicka_osoba(c, ICO, elem, conn, primary_sql_key, element)
+ adresa_id = find_and_store_address(c, elem)
+ c.execute("INSERT into jediny_akcionar (company_id, zapis_datum, vymaz_datum, text_akcionar, akcionar_fo_id, adresa_id) VALUES (?, ?, ?, ?, ?, ?)", (primary_sql_key, zapis_datum, vymaz_datum, text_akcionar, akcionar_fo_id, adresa_id,))
+ except Exception as f:
+ print(f)
+
+def find_prokura(c, ICO, elem2, conn, primary_sql_key, element):
+ try:
+ my_iter = elem2.findall("podudaje/Udaj")
+ for elem in my_iter:
+ typ_zapis = str(get_prop(elem, "udajTyp/kod"))
+ if typ_zapis == "PROKURA_OSOBA":
+ zapis_datum = str(get_prop(elem, "zapisDatum"))
+ vymaz_datum = str(get_prop(elem, "vymazDatum"))
+ text_prokurista = str(get_prop(elem, "hodnotaUdaje/textZaOsobu/value"))
+ prokurista_fo_id = find_fyzicka_osoba(c, ICO, elem, conn, primary_sql_key, element)
+ adresa_id = find_and_store_address(c, elem)
+ # print(ICO, zapis_datum, vymaz_datum, text_osoba, prokurista_fo_id, adresa_id)
+ c.execute("INSERT INTO prokuriste (company_id, zapis_datum, vymaz_datum, prokurista_fo_id, adresa_id, text_prokurista) VALUES (?, ?, ?, ?, ?, ?)", (primary_sql_key, zapis_datum, vymaz_datum, prokurista_fo_id, adresa_id, text_prokurista,))
+ else:
+ zapis_datum = str(get_prop(elem, "zapisDatum"))
+ vymaz_datum = str(get_prop(elem, "vymazDatum"))
+ prokura_text = str(get_prop(elem, "hodnotaText"))
+ c.execute("INSERT INTO prokura_common_texts (company_id, zapis_datum, vymaz_datum, prokura_text) VALUES (?, ?, ?, ?)", (primary_sql_key, zapis_datum, vymaz_datum, prokura_text,))
+ except Exception as f:
+ print(f)
def find_spolecnik(c, ICO, elem2, conn, primary_sql_key, element):
try:
@@ -7,6 +7,7 @@ from flask import flash, render_template, request, redirect from models import Company, Obce, Ulice, Insolvency_Events, Predmet_Podnikani, Predmety_Podnikani_Association, Predmet_Cinnosti, Predmety_Cinnosti_Association from models import Zakladni_Kapital, Akcie, Nazvy, Sidlo, Sidlo_Association, Pravni_Forma_Association_v2, Pravni_Formy, Statutarni_Organ_Association, Statutarni_Organy, Pocty_Clenu_Organu from models import Zpusob_Jednani_Association, Zpusob_Jednani, Statutarni_Organ_Clen_Association, Fyzicka_Osoba, Spolecnici_Association, Podily_Association, Druhy_Podilu, Pravnicka_Osoba +from models import Prokurista_Association, Jediny_Akcionar_Association, Prokura_Common_Text_Association from tables import Results init_db() @@ -241,6 +241,40 @@ class Spolecnici_Association(db.Model): oznaceni_po = db.relationship("Pravnicka_Osoba") podily = db.relationship("Podily_Association") +class Prokurista_Association(db.Model): + __tablename__ = "prokuriste" + id = db.Column(db.Integer, primary_key=True) + company_id = db.Column(db.Integer, db.ForeignKey('companies.id')) + zapis_datum = db.Column(MyType) + vymaz_datum = db.Column(MyType) + prokurista_fo_id = db.Column(db.Integer, db.ForeignKey('fyzicke_osoby.id')) + adresa_id = db.Column(db.Integer, db.ForeignKey('adresy.id')) + adresa = db.relationship("Sidlo") + jmeno = db.relationship("Fyzicka_Osoba") + text_prokurista = db.Column(db.String) + +class Prokura_Common_Text_Association(db.Model): + __tablename__ = "prokura_common_texts" + id = db.Column(db.Integer, primary_key=True) + company_id = db.Column(db.Integer, db.ForeignKey('companies.id')) + zapis_datum = db.Column(MyType) + vymaz_datum = db.Column(MyType) + prokura_text = db.Column(db.String) + +class Jediny_Akcionar_Association(db.Model): + __tablename__ = "jediny_akcionar" + id = db.Column(db.Integer, primary_key=True) + company_id = db.Column(db.Integer, db.ForeignKey('companies.id')) + zapis_datum = db.Column(MyType) + vymaz_datum = db.Column(MyType) + text_akcionar = db.Column(db.String) + akcionar_fo_id = db.Column(db.Integer, db.ForeignKey('fyzicke_osoby.id')) + akcionar_po_id = db.Column(db.Integer, db.ForeignKey('pravnicke_osoby.id')) + adresa_id = db.Column(db.Integer, db.ForeignKey('adresy.id')) + adresa = db.relationship("Sidlo") + jmeno = db.relationship("Fyzicka_Osoba") + oznaceni_po = db.relationship("Pravnicka_Osoba") + class Podily_Association(db.Model): __tablename__ = "podily" id = db.Column(db.Integer, primary_key=True) @@ -254,6 +288,7 @@ class Podily_Association(db.Model): souhrn_text = db.Column(db.String) splaceni_typ = db.Column(db.String) splaceni_text = db.Column(db.String) + druh_podilu = db.relationship("Druhy_Podilu") class Zpusob_Jednani_Association(db.Model): __tablename__ = 'zpusoby_jednani_relation' @@ -292,6 +327,9 @@ class Company(db.Model): statutarni_organ_text = db.relationship("Statutarni_Organ_Association", back_populates="company") dozorci_rada_text = db.relationship("Dozorci_Rada_Association") spolecnici = db.relationship("Spolecnici_Association") + prokurista = db.relationship("Prokurista_Association") + prokura_common_text = db.relationship("Prokura_Common_Text_Association") + jediny_akcionar = db.relationship("Jediny_Akcionar_Association") class Obce(db.Model): __tablename__ = "obce" diff --git a/templates/extract.html b/templates/extract.html index 579051c..373641c 100644 --- a/templates/extract.html +++ b/templates/extract.html @@ -758,15 +758,148 @@ <!--SUPERVISORY BOARD END--> +<!-- BEGINNING OF PROKURISTA --> + {% if row.prokurista|length > 0 %} + <tr> + <td>Prokura:</td> + <td></td> + <td></td> + </tr> + {% for i in range (row.prokurista|length) %} + <tr> + <td></td> + {% if row.prokurista[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 %} + <td>{{ underlne_style_open|safe }} {{ row.prokurista[i].jmeno.jmeno }} {{ row.prokurista[i].jmeno.prijmeni }}{% if row.prokurista[i].jmeno.datum_naroz != "" %}, nar. {{ row.prokurista[i].jmeno.datum_naroz }}{% endif %}<br> + {{ row.prokurista[i].adresa.adresa_text }}{% if row.prokurista[i].text_prokurista != "0" %}<br>{{ row.prokurista[i].text_prokurista }}{% endif %}{{ underlne_style_close|safe }}</td> + <td>{{ underlne_style_open|safe }} Zapsáno: {{ row.prokurista[i].zapis_datum }} {% if row.prokurista[i].vymaz_datum != 0 %} <br> Vymazáno: {{ row.prokurista[i].vymaz_datum }} {% endif %} {{ underlne_style_close|safe }}</td> + </tr> + {% endfor %} + <!-- Insert common text for prokura --> + {% for i in range (row.prokura_common_text|length) %} + <tr> + <td></td> + {% if row.prokura_common_text[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 %} + <td>{{ underlne_style_open|safe }} {{ row.prokura_common_text[i].prokura_text }} {{ underlne_style_close|safe }}</td> + <td>{{ underlne_style_open|safe }} Zapsáno: {{ row.prokura_common_text[i].zapis_datum }} {% if row.prokura_common_text[i].vymaz_datum != 0 %} <br> Vymazáno: {{ row.prokura_common_text[i].vymaz_datum }} {% endif %} {{ underlne_style_close|safe }}</td> + </tr> + {% endfor %} + <!-- End of a common text for prokura --> + {% endif %} +<!--PROKURISTA END--> + +<!-- BEGINNING OF JEDINY AKCIONAR --> + {% if row.jediny_akcionar|length > 0 %} + <tr> + <td>Jediný akcionář:</td> + <td></td> + <td></td> + </tr> + {% for i in range (row.jediny_akcionar|length) %} + <tr> + <td></td> + {% if row.jediny_akcionar[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 %} + <td>{{ underlne_style_open|safe }} {% if row.jediny_akcionar[i].akcionar_po_id == None %} {{ row.jediny_akcionar[i].jmeno.jmeno }} {{ row.jediny_akcionar[i].jmeno.prijmeni }}{% if row.jediny_akcionar[i].jmeno.datum_naroz != "" %}, nar. {{ row.jediny_akcionar[i].jmeno.datum_naroz }}{% endif %} {% endif %} + {% if row.jediny_akcionar[i].akcionar_fo_id == None %} {{ row.jediny_akcionar[i].oznaceni_po.nazev }}{% if row.jediny_akcionar[i].oznaceni_po.reg_cislo == 0 %}, IČ {{ row.jediny_akcionar[i].oznaceni_po.ico }}{% endif %}{% if row.jediny_akcionar[i].oznaceni_po.ico == 0 %}, reg č. {{ row.jediny_akcionar[i].oznaceni_po.reg_cislo }}{% endif %} {% endif %} + <br>{{row.jediny_akcionar[i].adresa.adresa_text}} {{ underlne_style_close|safe }}</td> + <td>{{ underlne_style_open|safe }} Zapsáno: {{ row.jediny_akcionar[i].zapis_datum }} {% if row.jediny_akcionar[i].vymaz_datum != 0 %} <br> Vymazáno: {{ row.jediny_akcionar[i].vymaz_datum }} {% endif %} {{ underlne_style_close|safe }}</td> + </tr> + {% endfor %} + {% endif %} + +<!-- JEDINY AKCIONAR END --> + + <!-- BEGINNING OF SPOLECNIK --> {% if row.spolecnici|length > 0 %} + <tr> + <td>Společníci:</td> + <td></td> + <td></td> + </tr> {% for i in range (row.spolecnici|length) %} <tr> - <td>{% if i == 0 %}Společníci:{% endif %}</td> - <td>{% if row.spolecnici[i].spolecnik_po_id == None %} {{ row.spolecnici[i].jmeno.jmeno }} {{ row.spolecnici[i].jmeno.prijmeni }}{% if row.spolecnici[i].jmeno.datum_naroz != "" %}, nar. {{ row.spolecnici[i].jmeno.datum_naroz }}{% endif %} {% endif %} + <td style = padding-left:2em>Společník:</td> + {% if row.spolecnici[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 %} + <td>{{ underlne_style_open|safe }} {% if row.spolecnici[i].spolecnik_po_id == None %} {{ row.spolecnici[i].jmeno.jmeno }} {{ row.spolecnici[i].jmeno.prijmeni }}{% if row.spolecnici[i].jmeno.datum_naroz != "" %}, nar. {{ row.spolecnici[i].jmeno.datum_naroz }}{% endif %} {% endif %} {% if row.spolecnici[i].spolecnik_fo_id == None %} {{ row.spolecnici[i].oznaceni_po.nazev }}{% if row.spolecnici[i].oznaceni_po.reg_cislo == 0 %}, IČ {{ row.spolecnici[i].oznaceni_po.ico }}{% endif %}{% if row.spolecnici[i].oznaceni_po.ico == 0 %}, reg č. {{ row.spolecnici[i].oznaceni_po.reg_cislo }}{% endif %} {% endif %} - <br>{{row.spolecnici[i].adresa.adresa_text}}</td> - <td>Zapsáno: {{ row.spolecnici[i].zapis_datum }} {% if row.spolecnici[i].vymaz_datum != 0 %} <br> Vymazáno: {{ row.spolecnici[i].vymaz_datum }} {% endif %} {{ row.spolecnici[i].podily}}</td> + <br>{{row.spolecnici[i].adresa.adresa_text}} {{ underlne_style_close|safe }}</td> + <td>{{ underlne_style_open|safe }} Zapsáno: {{ row.spolecnici[i].zapis_datum }} {% if row.spolecnici[i].vymaz_datum != 0 %} <br> Vymazáno: {{ row.spolecnici[i].vymaz_datum }} {% endif %} {{ underlne_style_close|safe }}</td> + <!-- Insert individual ownership interests --> + {% if row.spolecnici[i].podily|length > 0 %} + + {% for j in range (row.spolecnici[i].podily|length) %} + <!-- Set type of deposit --> + {% if row.spolecnici[i].podily[j].vklad_typ == "KORUNY" %} + {% set vklad_typ_string = "Kč" %} + {% elif row.spolecnici[i].podily[j].vklad_typ == "EURA" %} + {% set vklad_typ_string = "Euro" %} + {% else %} + {% set vklad_typ_string = "" %} + {% endif %} + + <!-- Set type of repaid contribution --> + {% if row.spolecnici[i].podily[j].splaceni_typ == "KORUNY" %} + {% set splaceni_typ_string = "Kč" %} + {% elif row.spolecnici[i].podily[j].splaceni_typ == "PROCENTA" %} + {% set splaceni_typ_string = "%" %} + {% elif row.spolecnici[i].podily[j].splaceni_typ == "EURA" %} + {% set splaceni_typ_string = "Euro" %} + {% else %} + {% set splaceni_typ_string = "" %} + {% endif %} + + <!-- Set type of share --> + {% if row.spolecnici[i].podily[j].souhrn_typ == "PROCENTA" %} + {% set souhrn_typ_string = "%" %} + {% else %} + {% set souhrn_typ_string = "" %} + {% endif %} + + + <tr> + <td style = padding-left:4em>Podíl:</td> + {% if row.spolecnici[i].podily[j].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 %} + <td>{{ underlne_style_open|safe }}Vklad: {{ row.spolecnici[i].podily[j].vklad_text }} {{ vklad_typ_string }}<br> + Splaceno: {{ row.spolecnici[i].podily[j].splaceni_text }} {{ splaceni_typ_string }}<br> + {% if row.spolecnici[i].podily[j].souhrn_text != "0"%}Podíl: {{ row.spolecnici[i].podily[j].souhrn_text }} {{ souhrn_typ_string }}{% endif %} + {% if row.spolecnici[i].podily[j].druh_podilu.druh_podilu != "0" %}<br>Druh podílu: {{ row.spolecnici[i].podily[j].druh_podilu.druh_podilu }}{% endif %}{{ underlne_style_close|safe }} + </td> + <td>{{ underlne_style_open|safe }}Zapsáno: {{ row.spolecnici[i].podily[j].zapis_datum }} {% if row.spolecnici[i].podily[j].vymaz_datum != 0 %}<br>Vymazáno: {{ row.spolecnici[i].podily[j].vymaz_datum }}{% endif %}{{ underlne_style_close|safe }}</td> + </tr> + {% endfor %} + {% endif %} + <!-- END of individual ownership interests --> + </tr> {% endfor %} {% endif %} |