> ## Documentation Index
> Fetch the complete documentation index at: https://docs.tic.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Financial reports table

> Retrieves all or specific financial report for period in a table format suited for simple visualization. If no language code is specificed Swedish is assumed.

### Details

This endpoint is suited for localized views where you intend to visualize the response in a table like format. It
automatically organize the result into cells with rows and columns with the language you provide. It also
returns formatting helpers to help automatically styling the result.

Please note that the order field is used to sort the correct order when outputting the grid for the income statement,
balance sheet, key metrics, footnotes and other additional information.

Here is a simple javascript example you can use to visualize the response with the help of [Handsontable](https://handsontable.com/).

```html index.html theme={null}
<html>
  <head>
    <script
      type="text/javascript"
      src="https://cdn.jsdelivr.net/npm/handsontable/dist/handsontable.full.min.js"
    ></script>
    <script
      type="text/javascript"
      src="https://cdn.jsdelivr.net/npm/lodash/lodash.min.js"
    ></script>
  </head>
  <body>
    <div id="grid" style="width: 100vw; height: 100vh"></div>
    <script type="text/javascript" src="index.js"
  </body>
</html>
```

```javscript index.js theme={null}
  const sourceData = "add your response here from the API";
  const rows = _(sourceData).map('row').uniq().value();
  const columns = _(sourceData).map('column').uniq().value();
  const tableData = [];
  _.forEach(rows, (row) => {
    let rowData = [];
    let first = _.find(
      sourceData,
      (item) => item.column == columns[0] && item.row == row
    );
    rowData.push(first.localizedFieldName);
    _.forEach(columns, (column) => {
      let match = _.find(
        sourceData,
        (item) => item.column == column && item.row == row
      );
      rowData.push(match.value);
    });
    tableData.push(rowData);
  });
  document.addEventListener('DOMContentLoaded', () => {
   const grid = document.getElementById("grid");

  // Helps styling the cells with the cellProperties
  function customRenderer(hotInstance, td, row, column, prop, value, cellProperties) {
    Handsontable.renderers.BaseRenderer.apply(this, arguments);

    if (cellProperties.customData == 'undefined') {
      console.log(
        'Wierd emtpy custom data in row ' + row + ' and column ' + column
      );
    }
    switch (cellProperties.customData?.type) {
      case 'Int':
        if (value != null)
          return (td.innerHTML = value.toLocaleString('sv-SE', {
            maximumFractionDigits: 0,
          }));
        break;
      case 'String':
        break;
      case 'Decimal':
        if (value != null)
          return (td.innerHTML = value.toLocaleString('sv-SE', {
            style: 'decimal', // style: 'percent'
            minimumFractionDigits: 1,
            maximumFractionDigits: 1,
          }));
        break;
      case 'DateTime':
        return (td.innerHTML = new Date(value).toLocaleDateString());
        break;
      case 'Percentage':
        if (value != null)
          return (td.innerHTML = (value * 0.01).toLocaleString('sv-SE', {
            style: 'percent',
            minimumFractionDigits: 1,
            maximumFractionDigits: 1,
          }));
        break;
      default:
        break;
    }
    return (td.innerHTML = value);
  }

  const hotInstance = new Handsontable(grid, {
        data: tableData,
        licenseKey: 'non-commercial-and-evaluation',
        rowHeaders: false,
        colHeaders: false,
        fixedColumnsStart: 1,
        fixedRowsTop: 1,
        manualColumnResize: true,
        wordWrap: true,
        autoColumnSize: true,
        autoWrapRow: true,
        autoWrapCol: true,
        readOnly: true,
        comments: true,
        height: 'auto',
        contextMenu: ['copy'],
        className: 'htRight',
        fillHandle: false,
        stretchH: 'all',
        cells(row, col) {
          const cellProperties = {};
          cellProperties.className = 'htLeft';
          let match = _.find(
            sourceData,
            (item) => item.column == col - 1 && item.row == row
          );
          if (match?.notes != null) {
            cellProperties.comment = {
              value: match.notes,
              readOnly: true,
              style: { width: 200, height: 50 },
            };
          }
          cellProperties.customData = match;
          if (col == 0 || row == 0)
            cellProperties.className = 'htRight font-bold';
          if (col > 0 && row > 0)
            cellProperties.renderer = customRenderer;
          return cellProperties;
        },
      });
      });
```


## OpenAPI

````yaml get /datasets/companies/{companyId}/financial-reports
openapi: 3.0.4
info:
  title: TIC API
  description: ''
  version: v1
servers:
  - url: https://api.tic.io/
security:
  - ApiKey: []
tags:
  - name: BolagsverketStatistics
  - name: Companies
  - name: Companies_SE_
  - name: DocumentDelivery
  - name: EuropeanCommission
  - name: FinancialDocuments
  - name: Finansinspektionen
  - name: Free
  - name: ICA
  - name: ICAStatistics
  - name: Lists
  - name: Media
  - name: Persons
  - name: Persons_SE_
  - name: Properties_SE_
  - name: PTSPortings
  - name: Reseller
  - name: SearchBankruptciesReports
  - name: SearchCompanies
  - name: SearchCompaniesReports
  - name: SearchCompanyWorkplaces
  - name: SearchPerson
  - name: SearchProperties_SE_
  - name: SearchVehicles
  - name: TeamDocumentOrders
  - name: Teams
  - name: User
  - name: Vehicles_SE_
  - name: WatchLists
paths:
  /datasets/companies/{companyId}/financial-reports:
    get:
      tags:
        - Companies
      summary: Financial reports table
      description: >-
        Retrieves all or specific financial report for period in a table format
        suited for simple visualization. If no language code is specificed
        Swedish is assumed.
      operationId: CompanyFinancialReports
      parameters:
        - name: companyId
          in: path
          description: The company id
          required: true
          schema:
            type: integer
            format: int32
        - name: iso639_2_LanguageCode
          in: query
          description: The language code of the annual report
          schema:
            type: string
            default: sv
        - name: annualReportPeriod
          in: query
          description: >-
            Supply if you want to receive only a specific period as entered as
            YYYYMM
          schema:
            type: integer
            format: int32
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/Ormeo_Library_Models_SE_SE_CompanyAnnualReportsTableAll
        '404':
          description: Not Found
components:
  schemas:
    Ormeo_Library_Models_SE_SE_CompanyAnnualReportsTableAll:
      type: object
      properties:
        incomeStatement:
          type: array
          items:
            $ref: '#/components/schemas/Ormeo_Library_Models_GenericModelCell'
          nullable: true
        balanceSheets:
          type: array
          items:
            $ref: '#/components/schemas/Ormeo_Library_Models_GenericModelCell'
          nullable: true
        footnotes:
          type: array
          items:
            $ref: '#/components/schemas/Ormeo_Library_Models_GenericModelCell'
          nullable: true
        keyMetrics:
          type: array
          items:
            $ref: '#/components/schemas/Ormeo_Library_Models_GenericModelCell'
          nullable: true
        additionalInformation:
          type: array
          items:
            $ref: '#/components/schemas/Ormeo_Library_Models_GenericModelCell'
          nullable: true
      additionalProperties: false
    Ormeo_Library_Models_GenericModelCell:
      type: object
      properties:
        row:
          type: integer
          format: int32
        column:
          type: integer
          format: int32
        order:
          type: integer
          format: int32
        localizedFieldName:
          type: string
          nullable: true
        enFieldName:
          type: string
          nullable: true
        displayFormat:
          type: string
          nullable: true
        type:
          type: string
          nullable: true
        value:
          nullable: true
        notes:
          type: string
          nullable: true
        highlight:
          $ref: '#/components/schemas/Ormeo_Library_Models_GenericHighlight'
      additionalProperties: false
    Ormeo_Library_Models_GenericHighlight:
      enum:
        - green
        - yellow
        - red
      type: string
  securitySchemes:
    ApiKey:
      type: apiKey
      name: x-api-key
      in: header

````