This case explains some coding specific for the BE market but can be used everywhere.
In BE, we’d like to have a dropdown that features an official list of all existing legal company forms. Each legal form has a specific code that can be used for XBRL filing
For example: if you have chosen “Naamloze vennootschap” in the list, then the XBRL file needs to have this as value “014” (just a random example).
How can we create this, if we know that the company form is entered (or synced) in the company details page (see company.company_form)?
Here’s how we do it:
{% comment %}we first create the needed string with all options to display in the dropdown legal types{% endcomment %}
{% capture legal_types %}{% t "Besloten Vennootschap|Besloten vennootschap met beperkte aansprakelijkheid|Besloten vennootschap met beperkte aansprakelijkheid met sociaal oogmerk|Buitenlandse onderneming|Buitenlandse privaatrechtelijke vereniging met vestiging, agentschappen, kantoor of bijhuis in België|Commanditaire vennootschap|Commanditaire vennootschap op aandelen|Commanditaire vennootschap op aandelen met sociaal oogmerk|Coöperatieve vennootschap|Coöperatieve vennootschap met beperkte aansprakelijkheid|Coöperatieve vennootschap met beperkte aansprakelijkheid met sociaal oogmerk|Coöperatieve vennootschap met onbeperkte aansprakelijkheid|Coöperatieve vennootschap met onbeperkte aansprakelijkheid met sociaal oogmerk|Economisch samenwerkingsverband met sociaal oogmerk|Economisch samenwerkingsverband met zetel in België|Europees economisch samenwerkingsverband met zetel in België|Europees economisch samenwerkingsverband zonder zetel met vestiging in België|Europese coöperatieve vennootschap|Europese vennootschap|Gewone commanditaire vennootschap|Gewone commanditaire vennootschap met sociaal oogmerk|Instelling van openbaar nut|Internationale vereniging zonder winstoogmerk|Naamloze vennootschap|Naamloze vennootschap met sociaal oogmerk|Onderlinge verzekeringsmaatschappij|Onderlinge verzekeringsmaatschappij, van publiek recht|Organisme van de financiering van Pensioenen|Private stichting|Stichting van openbaar nut|Vennootschap onder firma|Vennootschap onder firma met sociaal oogmerk|Vereniging zonder winstoogmerk" %}{% endcapture %}
{% comment %}create all corresponding XBRL codes with above dropdown list{% endcomment %}
{% assign xbrl_codes_legal_types = "610|015|510|030|023|612|013|513|706|008|508|006|506|560|060|065|265|001|027|012|512|018|125|014|514|021|121|002|026|029|011|511|017" %}
{% comment %}get the company form from the company drop, by removing spaces, dots and dashes, and UPCASE then the output{% endcomment %}
{% capture company_form %}{{ company.company_form | replace: '.','' | replace: ' ','' | remove:'-' | upcase }}{% endcapture %}
{% case company_form %}
{% when 'NV' or "SA" %}
{% assign NV = true %}
{% when 'CVBA' or 'SCRL' %}
{% assign CVBA = true %}
{% when 'CVOA' or "SCRI" %}
{% assign CVOA = true %}
{% when 'VZW' or "ASBL" %}
{% assign VZW = true %}
{% when 'BVBA' or 'SBVBA' or "SPRL" or "SPRLS" %}
{% assign BVBA = true %}
{% when 'PROJECTVERENIGING' %}
{% assign PV = true %}
{% when 'COMMV' or 'SCOMM' %}
{% assign COMMV = true %}
{% when 'BV' or 'SRL' %}
{% assign BV = true %}
{% when 'CV' or "SC" %}
{% assign CV = true %}
{% when 'MAATSCHAP' or "SOCIETE SIMPLE" %}
{% assign MAATSCHAP = true %}
{% when 'VOF' or "SNC" %}
{% assign VOF = true %}
{% endcase %}
{% comment %}
-------------------------------------------- SHOW CORRECT LEGAL FORM --------------------------------------------
whatever is entered in the company-drop, we will use that value to display a default in our dropdown
the value is what we use for XBRL filing too, meaning code 014 means a "NV" or a "SA"
these values are strings, not numbers!
-----------------------------------------------------------------------------------------------------------------
{% endcomment %}
{% case company_form %}
{% when 'CVOA' or "SCRI" %}
{% assign legal_type = '006' %}
{% when 'CVBA' or "SCRL" %}
{% assign legal_type = '008' %}
{% when 'VOF' or "SNC" %}
{% assign legal_type = '011' %}
{% when "GCV" %}
{% assign legal_type = "012" %}
{% when "COMMVA" %}
{% assign legal_type = "013" %}
{% when 'NV' or "SA" %}
{% assign legal_type = "014" %}
{% when 'BVBA' or "SPRL" %}
{% assign legal_type = "015" %}
{% when 'VZW' or "ASBL" %}
{% assign legal_type = '017' %}
{% when 'ESV' or "GIE" %}
{% assign legal_type = '011' %}
{% when 'BV' or "SRL" %}
{% assign legal_type = "610" %}
{% when 'COMMV' or "SCOMM" %}
{% assign legal_type = "612" %}
{% when 'CV' or "SC" %}
{% assign legal_type = "706" %}
{% when 'MAATSCHAP' or "SOCIETE SIMPLE" %}
{% assign legal_type = '' %}
{% when 'VOF' or "SNC" %}
{% assign legal_type = '011' %}
{% endcase %}
{% comment %}show dropdown with default taken from the company-drop{% endcomment %}
{% input company.custom.chosen.legal_type as:select options:legal_types option_values:xbrl_codes_legal_types default:legal_type %}
Output:
TIP
If you want to print the chosen value somewhere else in your template, you’ll see the option value appear. So choosing “Naamloze vennootschap” will print it out the value “014” when doing company.custom.chosen.legal_type
.
That’s because the option_values are the real value of the database variable, even if you see something else in the dropdown. This was made so you can have a Dutch, French, … dropdown list and it would stay the same option value!
To avoid this however, simply capture the input statement and print the capture variable:
{% comment %}TIP! if you want to display the value of the chosen legal form somewhere else, it will display the option value instead of the name (eg 014 instead of "Naamloze vennootschap"
However, we can capture the input and print it as well, without the option value being shown!
{% endcomment %}
{% capture i_chosen_legal_form %}{% input company.custom.chosen.legal_type as:select options:legal_types option_values:xbrl_codes_legal_types default:legal_type %}{% endcapture %}
Value chosen legal form: {{ i_chosen_legal_form }}
Same can be used to create a similar list for RPR codes:
{% comment %}create RPR options{% endcomment %}
{% capture court_types %}{% t "Brussel, Franstalige|Brussel, Nederlandstalige|Antwerpen, afdeling Antwerpen|Antwerpen, afdeling Hasselt|Antwerpen, afdeling Mechelen|Antwerpen, afdeling Tongeren|Antwerpen, afdeling Turnhout|Eupen|Gent, afdeling Brugge|Gent, afdeling Dendermonde|Gent, afdeling Gent|Gent, afdeling Ieper|Gent, afdeling Kortrijk|Gent, afdeling Oostende|Gent, afdeling Oudenaarde|Gent, afdeling Veurne|Leuven|Liège, afdeling Arlon|Liège, afdeling Dinant|Liège, afdeling Huy|Liège, afdeling Liège|Liège, afdeling Marche-en-Famenne|Liège, afdeling Namur|Liège, afdeling Neufchâteau|Liège, afdeling Verviers|Mons-Charleroi, afdeling Charleroi|Mons-Charleroi, afdeling Mons|Mons-Charleroi, afdeling Tournai|Nivelles" %}{% endcapture %}
{% comment %}create the corresponding XBRL codes{% endcomment %}
{% assign xbrl_court_types = "31|32|03|10|17|25|27|30|05|07|09|12|13|22|23|29|14|04|08|11|15|16|19|20|28|06|18|26|21" %}
{% input company.custom.legal.chosen_rpr as:select options:court_types option_values:xbrl_court_types %}