{"id":1025,"date":"2021-09-12T01:34:09","date_gmt":"2021-09-11T22:34:09","guid":{"rendered":"https:\/\/blog.andresgomez.org\/?p=1025"},"modified":"2021-09-12T01:39:11","modified_gmt":"2021-09-11T22:39:11","slug":"basic-libreoffice-invoice-in-finland","status":"publish","type":"post","link":"https:\/\/blog.andresgomez.org\/es\/2021\/09\/12\/basic-libreoffice-invoice-in-finland\/","title":{"rendered":"Basic LibreOffice invoice in Finland"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">WARNING<\/h2>\n\n\n\n<p>I have no responsibility if this guide and the linked examples are bogus and cause you any harm. The purpose of this post is solely as a personal note for myself. Follow and use it at your own risk.<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\"\/>\n\n\n\n<p>Through this post we&#8217;ll see how to create an invoice with <a rel=\"noreferrer noopener\" href=\"https:\/\/www.libreoffice.org\/\" target=\"_blank\">LibreOffice<\/a> which would include the Finnish Reference Number (Viitenumero) or the RF Creditor Reference generated from that Finnish Reference Number and the Finnish Bank Bar Code (Pankkiviivakoodi).<\/p>\n\n\n\n<hr class=\"wp-block-separator is-style-dots\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">The Finnish Reference Number<\/h2>\n\n\n\n<p>The Finnish Reference Number (<a rel=\"noreferrer noopener\" href=\"https:\/\/fi.wikipedia.org\/wiki\/Tilisiirto#Viitenumero\" target=\"_blank\">viitenumero<\/a>) identifies a specific bank transfer. In practice, it is used in invoices sent to a customer by a company or similar entity.<\/p>\n\n\n\n<p>When we create an invoice in Finland, we want to include such number so its payment is following a standard set by the Finnish banks. For example, some banks may charge a commission if, when setting a payment, this number is not included.<\/p>\n\n\n\n<p>The generation of this number follows a <a rel=\"noreferrer noopener\" href=\"https:\/\/wiki.xmldation.com\/support\/fk\/finnish_reference_number\" data-type=\"URL\" data-id=\"https:\/\/wiki.xmldation.com\/support\/fk\/finnish_reference_number\" target=\"_blank\">simple algorithm<\/a> and I&#8217;ve compiled several implementations in different programming languages. Since we want to use it in <a rel=\"noreferrer noopener\" href=\"https:\/\/www.libreoffice.org\/discover\/calc\/\" data-type=\"URL\" data-id=\"https:\/\/www.libreoffice.org\/discover\/calc\/\" target=\"_blank\">LibreOffice Calc<\/a>, the most suitable way would be through a <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/tanty\/finnish-reference-number#basic\" data-type=\"URL\" data-id=\"https:\/\/github.com\/tanty\/finnish-reference-number#basic\" target=\"_blank\">(Basic) macro<\/a>. It&#8217;s usage is as follows:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">=LASKEVIITE(number)<\/pre>\n\n\n\n<p>Which number to pass you say? Well, it is pretty much whatever you want to pass (check the algorithm for the restrictions) but I basically pass the incremental invoice number. In my case, I just number my invoices like <code>YYYY###<\/code> meaning the 4 digits of the current year plus 3 digits for the incremental number of that invoice along the year (not in my wildest dreams I would generate more than 999 invoices in a single year). For example <code>2021023<\/code> would indicated the 23rd invoice generated in 2021. The result in the cell will show <code>202 10236<\/code>, which is the provided number plus a check digit calculated by the algorithm and returned in a proper formatting (groups of 5 numbers).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The RF Creditor Reference<a href=\"https:\/\/github.com\/tanty\/finnish-reference-number#perl\"><\/a><\/h2>\n\n\n\n<p>The <a rel=\"noreferrer noopener\" href=\"https:\/\/en.wikipedia.org\/wiki\/Creditor_Reference\" data-type=\"URL\" data-id=\"https:\/\/en.wikipedia.org\/wiki\/Creditor_Reference\" target=\"_blank\">RF Creditor Reference<\/a> is an international business standard for an number preceded by the \u00abRF\u00bb letters which serves a similar purpose than the Finnish Reference Number: identifying a specific payment.<\/p>\n\n\n\n<p>The generation of this number also follows a <a rel=\"noreferrer noopener\" href=\"https:\/\/wiki.xmldation.com\/General_Information\/Non-payment_Standards\/ISO11649_-_Creditor_Reference\" target=\"_blank\">simple algorithm<\/a> and it was first implemented within the SEPA rulebook 3.2. Since having both numbers in the same invoice would be redundant and the RF Creditor Reference is international, we could just use this number and it should be accepted by the Finnish banks and some other banks, particularly some of those accepting SEPA transfers.<\/p>\n\n\n\n<p>If we use the Finnish Reference Number, the calculation of the RF Creditor Reference check digits is <a rel=\"noreferrer noopener\" href=\"https:\/\/fi.wikipedia.org\/wiki\/Tilisiirto#Esimerkki_kansainv%C3%A4lisen_viitenumeron_laskemisesta_suomalaisesta_viitenumerosta\" target=\"_blank\">pretty simple<\/a>. We can just use the following formula in a cell:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">=TEXT(98-MOD(SUBSTITUTE(LASKEVIITE(number),\" \",\"\")*1000000+271500,97),\"00\")<\/pre>\n\n\n\n<p>Following the example above, for the generated Finnish Reference Number <code>202 10236<\/code>, the result in the cell will show <code>42<\/code>. Then, we only have to concatenate everything together to get the full RF Creditor Reference: <code>RF42 2021 0236<\/code>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Bar codes<\/h2>\n\n\n\n<p>Finnish banks have jointly developed the (Finnish) Bank Bar Code (Pankkiviivakoodi) in order to accelerate payments and to prevent erroneous data from being keyed in. The Bank Bar Code is a <a rel=\"noreferrer noopener\" href=\"https:\/\/en.wikipedia.org\/wiki\/Code_128\" data-type=\"URL\" data-id=\"https:\/\/en.wikipedia.org\/wiki\/Code_128\" target=\"_blank\">Code 128<\/a> bar code explicitly developed to be used with reference numbers in invoicing.<\/p>\n\n\n\n<p>Hence, we want to add support to our Calc spreadsheet for generating bar codes. Fortunately, some <em><strong>Ji\u0159\u00ed Gabriel<\/strong><\/em> created a <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/tanty\/barcode-vba-macro-only\" data-type=\"URL\" data-id=\"https:\/\/github.com\/tanty\/barcode-vba-macro-only\" target=\"_blank\">sophisticated (basic) macro<\/a> for generating a whole set of 1D and 2D bar codes. This macro is able to generate the bar codes as graphical objects or as text which will be shown as the proper bar code when the companion\u00a0<a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/tanty\/barcode-vba-macro-only\/blob\/master\/BarsAndSpaces.ttf\" target=\"_blank\">BarsAndSpaces.ttf<\/a>\u00a0font is applied to the text. In my examples, I use the latter but you may prefer the former since that would allow you not to have <strong>that font installed<\/strong>.<\/p>\n\n\n\n<p>This formula will show as cell result a Code 128 bar code containing the passed <code>number<\/code> if we apply the BarsAndSpaces.ttf font to its content:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">=ENCODEBARCODE(CELL(\"SHEET\"),CELL(\"ADDRESS\"),number,0,0)<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">The Finnish Bank Bar Code<\/h2>\n\n\n\n<p>The Bank Bar Code is a form of presenting payment transaction data, approved by Finance<br>Finland (FFI). As commented above, it was jointly developed by Finnish banks and needs a reference number.<\/p>\n\n\n\n<p>The Bank Bar Code has 2 versions currently in active use: version 4 uses the Finnish Reference Number while version 5 uses the RF Creditor Reference. Below, you can see how the 54 length structure of this bar code is divided depending on the version:<\/p>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td>Data<\/td><td>Length<\/td><td>Value<\/td><\/tr><tr><td>Version<\/td><td>1<\/td><td>4<\/td><\/tr><tr><td>The numeric part of the payee\u2019s bank<br>account number (IBAN)<\/td><td>16<\/td><td>N<\/td><\/tr><tr><td>Euros<\/td><td>6<\/td><td>N<\/td><\/tr><tr><td>Cents<\/td><td>2<\/td><td>N<\/td><\/tr><tr><td>Reserve<\/td><td>3<\/td><td>000<\/td><\/tr><tr><td>Finnish Reference Number<\/td><td>20<\/td><td>N<\/td><\/tr><tr><td>Due Date<\/td><td>6<\/td><td>YYMMDD<\/td><\/tr><\/tbody><\/table><figcaption>(Finnish) Bank Bar Code v.4<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-table is-style-stripes\"><table><tbody><tr><td>Data<\/td><td>Length<\/td><td>Value<\/td><\/tr><tr><td>Version<\/td><td>1<\/td><td>5<\/td><\/tr><tr><td>The numeric part of the payee\u2019s bank<br>account number (IBAN)<\/td><td>16<\/td><td>N<\/td><\/tr><tr><td>Euros<\/td><td>6<\/td><td>N<\/td><\/tr><tr><td>Cents<\/td><td>2<\/td><td>N<\/td><\/tr><tr><td>The numeric part of the RF<br>Creditor Reference<\/td><td>23<\/td><td>N<\/td><\/tr><tr><td>Due Date<\/td><td>6<\/td><td>YYMMDD<\/td><\/tr><\/tbody><\/table><figcaption>(Finnish) Bank Bar Code v.5<\/figcaption><\/figure>\n\n\n\n<p>As you see, the algorithm is simple enough that can be easily implemented in a spreadsheet.<\/p>\n\n\n\n<p>The <a rel=\"noreferrer noopener\" href=\"https:\/\/www.finanssiala.fi\/wp-content\/uploads\/2021\/03\/Bank_bar_code_guide.pdf\" target=\"_blank\">full documentation<\/a> for the Bank Bar Code is provided by <a rel=\"noreferrer noopener\" href=\"https:\/\/www.finanssiala.fi\/en\/topics\/payment-services-in-finland\/payment-technical-documents\/\" target=\"_blank\">Finance Finland<\/a>.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Invoice examples<\/h2>\n\n\n\n<p>After all the blabbering above we get to the part that is, probably, the most interesting for you: the <a href=\"https:\/\/en.wikipedia.org\/wiki\/OpenDocument\" target=\"_blank\" rel=\"noreferrer noopener\">ODS<\/a> examples.<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><a href=\"https:\/\/www.andresgomez.org\/files\/example_bank_bar_code_v4.ods\" data-type=\"URL\" target=\"_blank\" rel=\"noreferrer noopener\">Finnish Reference Number and Finnish Bank Bar Code v.4 invoice example<\/a>.<\/li><li><a href=\"https:\/\/www.andresgomez.org\/files\/example_bank_bar_code_v5.ods\" target=\"_blank\" rel=\"noreferrer noopener\">RF Creditor Reference and Finnish Bank Bar Code v.5 invoice example<\/a>.<\/li><\/ul>\n\n\n\n<p>I hope it helps you! &#x1f600;&#xfe0f;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Appendix: QR Codes<\/h2>\n\n\n\n<p>Finance Finland also provides <a rel=\"noreferrer noopener\" href=\"https:\/\/www.finanssiala.fi\/wp-content\/uploads\/2021\/03\/QR_code_in_credit_transfer_forms.pdf\" target=\"_blank\">Guidelines for the use of QR code in credit transfer forms<\/a>. Additionally, our bar codes macro also supports QR code generation. In other words, it would be possible to create an invoice with LibreOffice Calc featuring this QR code (QR-koodi).<\/p>\n\n\n\n<p>However, I&#8217;ll leave this for another day &#8230; &#x1f609;&#xfe0f;<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>WARNING I have no responsibility if this guide and the linked examples are bogus and cause you any harm. The purpose of this post is solely as a personal note for myself. Follow and use it at your own risk. &hellip; <a href=\"https:\/\/blog.andresgomez.org\/es\/2021\/09\/12\/basic-libreoffice-invoice-in-finland\/\">Sigue leyendo <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,6,7],"tags":[],"class_list":["post-1025","post","type-post","status-publish","format-standard","hentry","category-english","category-free-software","category-general"],"_links":{"self":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts\/1025"}],"collection":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/comments?post=1025"}],"version-history":[{"count":8,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts\/1025\/revisions"}],"predecessor-version":[{"id":1034,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/posts\/1025\/revisions\/1034"}],"wp:attachment":[{"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/media?parent=1025"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/categories?post=1025"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.andresgomez.org\/es\/wp-json\/wp\/v2\/tags?post=1025"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}