import datetime

from django.db.models import Q, Count, F, Manager, QuerySet
from django.db.models.functions import Coalesce

from core.models import Officer
from location.models import Location, UserDistrict, HealthFacility
from medical_pricelist.models import ServicesPricelist, ItemsPricelist, ServicesPricelistDetail, ItemsPricelistDetail
from payer.models import Payer
from product.models import Product

template = """
{
  "docElements": [
    {
      "elementType": "text",
      "id": 3,
      "containerId": "0_header",
      "x": 150,
      "y": 20,
      "width": 575,
      "height": 40,
      "content": "Registers Status",
      "richText": false,
      "richTextContent": null,
      "richTextHtml": "",
      "eval": false,
      "styleId": "",
      "bold": true,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "center",
      "verticalAlignment": "middle",
      "textColor": "#006374",
      "backgroundColor": "",
      "font": "notosans",
      "fontSize": "24",
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": 1,
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": 2,
      "paddingTop": 2,
      "paddingRight": 2,
      "paddingBottom": 2,
      "printIf": "",
      "removeEmptyElement": false,
      "alwaysPrintOnSamePage": true,
      "pattern": "",
      "link": "",
      "cs_condition": "",
      "cs_styleId": "",
      "cs_bold": false,
      "cs_italic": false,
      "cs_underline": false,
      "cs_strikethrough": false,
      "cs_horizontalAlignment": "left",
      "cs_verticalAlignment": "top",
      "cs_textColor": "#000000",
      "cs_backgroundColor": "",
      "cs_font": "helvetica",
      "cs_fontSize": 12,
      "cs_lineSpacing": 1,
      "cs_borderColor": "#000000",
      "cs_borderWidth": "1",
      "cs_borderAll": false,
      "cs_borderLeft": false,
      "cs_borderTop": false,
      "cs_borderRight": false,
      "cs_borderBottom": false,
      "cs_paddingLeft": 2,
      "cs_paddingTop": 2,
      "cs_paddingRight": 2,
      "cs_paddingBottom": 2,
      "spreadsheet_hide": false,
      "spreadsheet_column": "",
      "spreadsheet_colspan": "",
      "spreadsheet_addEmptyRow": false,
      "spreadsheet_textWrap": false
    },
    {
      "elementType": "line",
      "id": 158,
      "containerId": "0_content",
      "x": 0,
      "y": 0,
      "width": 820,
      "height": 1,
      "color": "#000000",
      "printIf": ""
    },
    {
      "elementType": "table",
      "id": 297,
      "containerId": "0_content",
      "width": 470,
      "x": 180,
      "y": 70,
      "dataSource": "",
      "columns": "2",
      "header": false,
      "contentRows": "1",
      "footer": false,
      "border": "grid",
      "borderColor": "#000000",
      "borderWidth": "1",
      "printIf": "${error}",
      "removeEmptyElement": false,
      "spreadsheet_hide": false,
      "spreadsheet_column": "",
      "spreadsheet_addEmptyRow": false,
      "headerData": {
        "elementType": "none",
        "id": 298,
        "height": 20,
        "backgroundColor": "",
        "repeatHeader": false,
        "columnData": [
          {
            "elementType": "table_text",
            "id": 299,
            "width": 100,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          },
          {
            "elementType": "table_text",
            "id": 300,
            "width": 370,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          }
        ]
      },
      "contentDataRows": [
        {
          "elementType": "none",
          "id": 301,
          "height": 20,
          "backgroundColor": "",
          "alternateBackgroundColor": "",
          "groupExpression": "",
          "printIf": "",
          "alwaysPrintOnSamePage": true,
          "pageBreak": false,
          "repeatGroupHeader": false,
          "columnData": [
            {
              "elementType": "table_text",
              "id": 302,
              "width": 100,
              "content": "${error}",
              "eval": false,
              "colspan": "2",
              "styleId": "307",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#ff0000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "16",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 303,
              "width": 370,
              "content": "${error}",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "middle",
              "textColor": "#ff0000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            }
          ]
        }
      ],
      "footerData": {
        "elementType": "none",
        "id": 304,
        "height": 20,
        "backgroundColor": "",
        "columnData": [
          {
            "elementType": "table_text",
            "id": 305,
            "width": 100,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          },
          {
            "elementType": "table_text",
            "id": 306,
            "width": 370,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          }
        ]
      }
    },
    {
      "elementType": "table",
      "id": 262,
      "containerId": "0_content",
      "width": 360,
      "x": 240,
      "y": 20,
      "dataSource": "${header}",
      "columns": "2",
      "header": false,
      "contentRows": 2,
      "footer": false,
      "border": "grid",
      "borderColor": "#000000",
      "borderWidth": "1",
      "printIf": "",
      "removeEmptyElement": false,
      "spreadsheet_hide": false,
      "spreadsheet_column": "",
      "spreadsheet_addEmptyRow": false,
      "headerData": {
        "elementType": "none",
        "id": 263,
        "height": 20,
        "backgroundColor": "",
        "repeatHeader": false,
        "columnData": [
          {
            "elementType": "table_text",
            "id": 264,
            "width": 100,
            "content": "From",
            "eval": false,
            "colspan": "",
            "styleId": "33",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": "12",
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          },
          {
            "elementType": "table_text",
            "id": 265,
            "width": 260,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "34",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": "11",
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          }
        ]
      },
      "contentDataRows": [
        {
          "elementType": "none",
          "id": 280,
          "height": 20,
          "backgroundColor": "",
          "alternateBackgroundColor": "",
          "groupExpression": "",
          "printIf": "",
          "alwaysPrintOnSamePage": true,
          "pageBreak": false,
          "repeatGroupHeader": false,
          "columnData": [
            {
              "elementType": "table_text",
              "id": 281,
              "width": 100,
              "content": "Region",
              "eval": false,
              "colspan": "",
              "styleId": "33",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "12",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 282,
              "width": 260,
              "content": "${region}",
              "eval": false,
              "colspan": "",
              "styleId": "34",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "11",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            }
          ]
        },
        {
          "elementType": "none",
          "id": 283,
          "height": 20,
          "backgroundColor": "",
          "alternateBackgroundColor": "",
          "groupExpression": "",
          "printIf": "",
          "alwaysPrintOnSamePage": true,
          "pageBreak": false,
          "repeatGroupHeader": false,
          "columnData": [
            {
              "elementType": "table_text",
              "id": 284,
              "width": 100,
              "content": "District",
              "eval": false,
              "colspan": "",
              "styleId": "33",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "12",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 285,
              "width": 260,
              "content": "${district}",
              "eval": true,
              "colspan": "",
              "styleId": "34",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "11",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            }
          ]
        }
      ],
      "footerData": {
        "elementType": "none",
        "id": 269,
        "height": 20,
        "backgroundColor": "",
        "columnData": [
          {
            "elementType": "table_text",
            "id": 270,
            "width": 100,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          },
          {
            "elementType": "table_text",
            "id": 271,
            "width": 260,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          }
        ]
      }
    },
    {
      "elementType": "table",
      "id": 195,
      "containerId": "0_content",
      "width": 800,
      "x": 10,
      "y": 100,
      "dataSource": "${data}",
      "columns": 9,
      "header": false,
      "contentRows": 6,
      "footer": true,
      "border": "grid",
      "borderColor": "#000000",
      "borderWidth": "1",
      "printIf": "",
      "removeEmptyElement": false,
      "spreadsheet_hide": false,
      "spreadsheet_column": "",
      "spreadsheet_addEmptyRow": false,
      "headerData": {
        "elementType": "none",
        "id": 196,
        "height": 20,
        "backgroundColor": "",
        "repeatHeader": true,
        "columnData": [
          {
            "elementType": "table_text",
            "id": 205,
            "width": 240,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "33",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": "12",
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          },
          {
            "elementType": "table_text",
            "id": 206,
            "width": 70,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "33",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": "12",
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          },
          {
            "elementType": "table_text",
            "id": 239,
            "width": 70,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "33",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": "12",
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          },
          {
            "elementType": "table_text",
            "id": 374,
            "width": 70,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          },
          {
            "elementType": "table_text",
            "id": 385,
            "width": 70,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          },
          {
            "elementType": "table_text",
            "id": 396,
            "width": 70,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          },
          {
            "elementType": "table_text",
            "id": 407,
            "width": 70,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          },
          {
            "elementType": "table_text",
            "id": 418,
            "width": 70,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          },
          {
            "elementType": "table_text",
            "id": 429,
            "width": 70,
            "content": "",
            "eval": false,
            "colspan": "",
            "styleId": "",
            "bold": false,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "left",
            "verticalAlignment": "top",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "helvetica",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "printIf": "",
            "growWeight": 0,
            "borderWidth": 1
          }
        ]
      },
      "contentDataRows": [
        {
          "elementType": "none",
          "id": 257,
          "height": 20,
          "backgroundColor": "",
          "alternateBackgroundColor": "",
          "groupExpression": "${region_code}",
          "printIf": "",
          "alwaysPrintOnSamePage": true,
          "pageBreak": false,
          "repeatGroupHeader": false,
          "columnData": [
            {
              "elementType": "table_text",
              "id": 259,
              "width": 240,
              "content": "'Region: ${region_code} - ${region_name}' if ${region_code} != 'XXXX' else '${region_name}'",
              "eval": true,
              "colspan": "9",
              "styleId": "286",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "middle",
              "textColor": "#ffffff",
              "backgroundColor": "#006374",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 260,
              "width": 70,
              "content": "Description",
              "eval": false,
              "colspan": "",
              "styleId": "33",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "12",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 261,
              "width": 70,
              "content": "Date & Time",
              "eval": false,
              "colspan": "",
              "styleId": "33",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "12",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 375,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 386,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 397,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 408,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 419,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 430,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "286",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "middle",
              "textColor": "#ffffff",
              "backgroundColor": "#006374",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            }
          ]
        },
        {
          "elementType": "none",
          "id": 314,
          "height": 20,
          "backgroundColor": "",
          "alternateBackgroundColor": "",
          "groupExpression": "${region_code}",
          "printIf": "",
          "alwaysPrintOnSamePage": true,
          "pageBreak": false,
          "repeatGroupHeader": false,
          "columnData": [
            {
              "elementType": "table_text",
              "id": 316,
              "width": 240,
              "content": "District",
              "eval": false,
              "colspan": "",
              "styleId": "338",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#cccccc",
              "backgroundColor": "#cccccc",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 0,
              "paddingTop": 0,
              "paddingRight": 0,
              "paddingBottom": 0,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 317,
              "width": 70,
              "content": "Enrollment Officers",
              "eval": false,
              "colspan": "2",
              "styleId": "295",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 318,
              "width": 70,
              "content": "Enrollment Officers",
              "eval": false,
              "colspan": "",
              "styleId": "295",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 378,
              "width": 70,
              "content": "Users",
              "eval": false,
              "colspan": "6",
              "styleId": "338",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#cccccc",
              "backgroundColor": "#cccccc",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 0,
              "paddingTop": 0,
              "paddingRight": 0,
              "paddingBottom": 0,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 389,
              "width": 70,
              "content": "Products",
              "eval": false,
              "colspan": "",
              "styleId": "338",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#cccccc",
              "backgroundColor": "#cccccc",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 0,
              "paddingTop": 0,
              "paddingRight": 0,
              "paddingBottom": 0,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 400,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "338",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#cccccc",
              "backgroundColor": "#cccccc",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 0,
              "paddingTop": 0,
              "paddingRight": 0,
              "paddingBottom": 0,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 411,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 422,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 433,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            }
          ]
        },
        {
          "elementType": "none",
          "id": 342,
          "height": 20,
          "backgroundColor": "",
          "alternateBackgroundColor": "",
          "groupExpression": "${region_code}",
          "printIf": "",
          "alwaysPrintOnSamePage": true,
          "pageBreak": false,
          "repeatGroupHeader": false,
          "columnData": [
            {
              "elementType": "table_text",
              "id": 344,
              "width": 240,
              "content": "District",
              "eval": false,
              "colspan": "1",
              "styleId": "295",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 345,
              "width": 70,
              "content": "Active",
              "eval": false,
              "colspan": "",
              "styleId": "295",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 346,
              "width": 70,
              "content": "Inactive",
              "eval": false,
              "colspan": "",
              "styleId": "295",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 379,
              "width": 70,
              "content": "Users",
              "eval": false,
              "colspan": "",
              "styleId": "295",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 390,
              "width": 70,
              "content": "Products",
              "eval": false,
              "colspan": "",
              "styleId": "295",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 401,
              "width": 70,
              "content": "Health Facilities",
              "eval": false,
              "colspan": "",
              "styleId": "295",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 412,
              "width": 70,
              "content": "Service Pricelists (Services in PLs)",
              "eval": false,
              "colspan": "",
              "styleId": "295",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 423,
              "width": 70,
              "content": "Item Pricelists (Items in PLs)",
              "eval": false,
              "colspan": "",
              "styleId": "295",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 434,
              "width": 70,
              "content": "Payers",
              "eval": false,
              "colspan": "",
              "styleId": "295",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            }
          ]
        },
        {
          "elementType": "none",
          "id": 450,
          "height": 20,
          "backgroundColor": "",
          "alternateBackgroundColor": "",
          "groupExpression": "",
          "printIf": "",
          "alwaysPrintOnSamePage": true,
          "pageBreak": false,
          "repeatGroupHeader": false,
          "columnData": [
            {
              "elementType": "table_text",
              "id": 452,
              "width": 240,
              "content": "'${district_code} - ${district_name}' if ${district_code} != 'XXXX' else '${district_name}'",
              "eval": true,
              "colspan": "",
              "styleId": "296",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "11",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 453,
              "width": 70,
              "content": "${active_eo}",
              "eval": false,
              "colspan": "",
              "styleId": "296",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "11",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 454,
              "width": 70,
              "content": "${inactive_eo}",
              "eval": false,
              "colspan": "",
              "styleId": "296",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "11",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 455,
              "width": 70,
              "content": "${users}",
              "eval": false,
              "colspan": "",
              "styleId": "296",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "11",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 456,
              "width": 70,
              "content": "${products}",
              "eval": false,
              "colspan": "",
              "styleId": "296",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "11",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 457,
              "width": 70,
              "content": "${hfs}",
              "eval": false,
              "colspan": "",
              "styleId": "296",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "11",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 458,
              "width": 70,
              "content": "${service_pls} (${service_pl_details})",
              "eval": false,
              "colspan": "",
              "styleId": "296",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "11",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 459,
              "width": 70,
              "content": "${item_pls} (${item_pl_details})",
              "eval": false,
              "colspan": "",
              "styleId": "296",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "11",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 460,
              "width": 70,
              "content": "${payers}",
              "eval": false,
              "colspan": "",
              "styleId": "296",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": "11",
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            }
          ]
        },
        {
          "elementType": "none",
          "id": 361,
          "height": 20,
          "backgroundColor": "",
          "alternateBackgroundColor": "",
          "groupExpression": "${region_code}",
          "printIf": "",
          "alwaysPrintOnSamePage": true,
          "pageBreak": false,
          "repeatGroupHeader": false,
          "columnData": [
            {
              "elementType": "table_text",
              "id": 363,
              "width": 240,
              "content": "'Total for region ${region_code}:' if ${region_code} != 'XXXX' else 'Total for ${region_name}:'",
              "eval": true,
              "colspan": "",
              "styleId": "366",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#006374",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 364,
              "width": 70,
              "content": "${r_active_eo}",
              "eval": false,
              "colspan": "",
              "styleId": "366",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#006374",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 365,
              "width": 70,
              "content": "${r_inactive_eo}",
              "eval": false,
              "colspan": "",
              "styleId": "366",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#006374",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 382,
              "width": 70,
              "content": "${r_users}",
              "eval": false,
              "colspan": "",
              "styleId": "366",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#006374",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 393,
              "width": 70,
              "content": "${r_products}",
              "eval": false,
              "colspan": "",
              "styleId": "366",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#006374",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 404,
              "width": 70,
              "content": "${r_hfs}",
              "eval": false,
              "colspan": "",
              "styleId": "366",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#006374",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 415,
              "width": 70,
              "content": "${r_service_pls} (${r_service_pl_details})",
              "eval": false,
              "colspan": "",
              "styleId": "366",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#006374",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 426,
              "width": 70,
              "content": "${item_pls} (${r_item_pl_details})",
              "eval": false,
              "colspan": "",
              "styleId": "366",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#006374",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 437,
              "width": 70,
              "content": "${r_payers}",
              "eval": false,
              "colspan": "",
              "styleId": "366",
              "bold": true,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "center",
              "verticalAlignment": "middle",
              "textColor": "#006374",
              "backgroundColor": "",
              "font": "notosans",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            }
          ]
        },
        {
          "elementType": "none",
          "id": 199,
          "height": 20,
          "backgroundColor": "",
          "alternateBackgroundColor": "",
          "groupExpression": "${region_code}",
          "printIf": "",
          "alwaysPrintOnSamePage": true,
          "pageBreak": false,
          "repeatGroupHeader": false,
          "columnData": [
            {
              "elementType": "table_text",
              "id": 208,
              "width": 240,
              "content": "",
              "eval": false,
              "colspan": "9",
              "styleId": "338",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#cccccc",
              "backgroundColor": "#cccccc",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 0,
              "paddingTop": 0,
              "paddingRight": 0,
              "paddingBottom": 0,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 209,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "yyyy/MM/dd",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 240,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 383,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 394,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 405,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 416,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 427,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#000000",
              "backgroundColor": "",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 2,
              "paddingTop": 2,
              "paddingRight": 2,
              "paddingBottom": 2,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            },
            {
              "elementType": "table_text",
              "id": 438,
              "width": 70,
              "content": "",
              "eval": false,
              "colspan": "",
              "styleId": "338",
              "bold": false,
              "italic": false,
              "underline": false,
              "strikethrough": false,
              "horizontalAlignment": "left",
              "verticalAlignment": "top",
              "textColor": "#cccccc",
              "backgroundColor": "#cccccc",
              "font": "helvetica",
              "fontSize": 12,
              "lineSpacing": 1,
              "paddingLeft": 0,
              "paddingTop": 0,
              "paddingRight": 0,
              "paddingBottom": 0,
              "pattern": "",
              "link": "",
              "cs_condition": "",
              "cs_styleId": "",
              "cs_bold": false,
              "cs_italic": false,
              "cs_underline": false,
              "cs_strikethrough": false,
              "cs_horizontalAlignment": "left",
              "cs_verticalAlignment": "top",
              "cs_textColor": "#000000",
              "cs_backgroundColor": "",
              "cs_font": "helvetica",
              "cs_fontSize": 12,
              "cs_lineSpacing": 1,
              "cs_paddingLeft": 2,
              "cs_paddingTop": 2,
              "cs_paddingRight": 2,
              "cs_paddingBottom": 2,
              "spreadsheet_textWrap": false,
              "borderWidth": 1,
              "growWeight": 0
            }
          ]
        }
      ],
      "footerData": {
        "elementType": "none",
        "id": 202,
        "height": 20,
        "backgroundColor": "",
        "columnData": [
          {
            "elementType": "table_text",
            "id": 211,
            "width": 240,
            "content": "Grand total:",
            "eval": false,
            "colspan": "",
            "styleId": "349",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "center",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          },
          {
            "elementType": "table_text",
            "id": 212,
            "width": 70,
            "content": "${total_active_eo}",
            "eval": false,
            "colspan": "",
            "styleId": "349",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "center",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          },
          {
            "elementType": "table_text",
            "id": 241,
            "width": 70,
            "content": "${total_inactive_eo}",
            "eval": false,
            "colspan": "",
            "styleId": "349",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "center",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          },
          {
            "elementType": "table_text",
            "id": 384,
            "width": 70,
            "content": "${total_users}",
            "eval": false,
            "colspan": "",
            "styleId": "349",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "center",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          },
          {
            "elementType": "table_text",
            "id": 395,
            "width": 70,
            "content": "${total_products}",
            "eval": false,
            "colspan": "",
            "styleId": "349",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "center",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          },
          {
            "elementType": "table_text",
            "id": 406,
            "width": 70,
            "content": "${total_hfs}",
            "eval": false,
            "colspan": "",
            "styleId": "349",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "center",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          },
          {
            "elementType": "table_text",
            "id": 417,
            "width": 70,
            "content": "${total_service_pls} (${total_service_pl_details})",
            "eval": false,
            "colspan": "",
            "styleId": "349",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "center",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          },
          {
            "elementType": "table_text",
            "id": 428,
            "width": 70,
            "content": "${total_item_pls} (${total_item_pl_details})",
            "eval": false,
            "colspan": "",
            "styleId": "349",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "center",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          },
          {
            "elementType": "table_text",
            "id": 439,
            "width": 70,
            "content": "${total_payers}",
            "eval": false,
            "colspan": "",
            "styleId": "349",
            "bold": true,
            "italic": false,
            "underline": false,
            "strikethrough": false,
            "horizontalAlignment": "center",
            "verticalAlignment": "middle",
            "textColor": "#000000",
            "backgroundColor": "",
            "font": "notosans",
            "fontSize": 12,
            "lineSpacing": 1,
            "paddingLeft": 2,
            "paddingTop": 2,
            "paddingRight": 2,
            "paddingBottom": 2,
            "pattern": "",
            "link": "",
            "cs_condition": "",
            "cs_styleId": "",
            "cs_bold": false,
            "cs_italic": false,
            "cs_underline": false,
            "cs_strikethrough": false,
            "cs_horizontalAlignment": "left",
            "cs_verticalAlignment": "top",
            "cs_textColor": "#000000",
            "cs_backgroundColor": "",
            "cs_font": "helvetica",
            "cs_fontSize": 12,
            "cs_lineSpacing": 1,
            "cs_paddingLeft": 2,
            "cs_paddingTop": 2,
            "cs_paddingRight": 2,
            "cs_paddingBottom": 2,
            "spreadsheet_textWrap": false,
            "borderWidth": 1,
            "growWeight": 0
          }
        ]
      }
    },
    {
      "elementType": "text",
      "id": 7,
      "containerId": "0_footer",
      "x": 567,
      "y": 0,
      "width": 255,
      "height": 30,
      "content": "Page ${page_number} / ${page_count}",
      "richText": false,
      "richTextContent": null,
      "richTextHtml": "",
      "eval": false,
      "styleId": "",
      "bold": false,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "right",
      "verticalAlignment": "middle",
      "textColor": "#666666",
      "backgroundColor": "",
      "font": "notosans",
      "fontSize": 12,
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": 1,
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": 2,
      "paddingTop": 2,
      "paddingRight": 2,
      "paddingBottom": 2,
      "printIf": "",
      "removeEmptyElement": false,
      "alwaysPrintOnSamePage": true,
      "pattern": "",
      "link": "",
      "cs_condition": "",
      "cs_styleId": "",
      "cs_bold": false,
      "cs_italic": false,
      "cs_underline": false,
      "cs_strikethrough": false,
      "cs_horizontalAlignment": "left",
      "cs_verticalAlignment": "top",
      "cs_textColor": "#000000",
      "cs_backgroundColor": "",
      "cs_font": "helvetica",
      "cs_fontSize": 12,
      "cs_lineSpacing": 1,
      "cs_borderColor": "#000000",
      "cs_borderWidth": "1",
      "cs_borderAll": false,
      "cs_borderLeft": false,
      "cs_borderTop": false,
      "cs_borderRight": false,
      "cs_borderBottom": false,
      "cs_paddingLeft": 2,
      "cs_paddingTop": 2,
      "cs_paddingRight": 2,
      "cs_paddingBottom": 2,
      "spreadsheet_hide": false,
      "spreadsheet_column": "",
      "spreadsheet_colspan": "",
      "spreadsheet_addEmptyRow": false,
      "spreadsheet_textWrap": false
    },
    {
      "elementType": "text",
      "id": 8,
      "containerId": "0_footer",
      "x": 0,
      "y": 0,
      "width": 500,
      "height": 30,
      "content": "Created on ${current_date}",
      "richText": false,
      "richTextContent": null,
      "richTextHtml": "",
      "eval": false,
      "styleId": "",
      "bold": false,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "left",
      "verticalAlignment": "middle",
      "textColor": "#666666",
      "backgroundColor": "",
      "font": "notosans",
      "fontSize": 12,
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": 1,
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": 2,
      "paddingTop": 2,
      "paddingRight": 2,
      "paddingBottom": 2,
      "printIf": "",
      "removeEmptyElement": false,
      "alwaysPrintOnSamePage": true,
      "pattern": "",
      "link": "",
      "cs_condition": "",
      "cs_styleId": "",
      "cs_bold": false,
      "cs_italic": false,
      "cs_underline": false,
      "cs_strikethrough": false,
      "cs_horizontalAlignment": "left",
      "cs_verticalAlignment": "top",
      "cs_textColor": "#000000",
      "cs_backgroundColor": "",
      "cs_font": "helvetica",
      "cs_fontSize": 12,
      "cs_lineSpacing": 1,
      "cs_borderColor": "#000000",
      "cs_borderWidth": "1",
      "cs_borderAll": false,
      "cs_borderLeft": false,
      "cs_borderTop": false,
      "cs_borderRight": false,
      "cs_borderBottom": false,
      "cs_paddingLeft": 2,
      "cs_paddingTop": 2,
      "cs_paddingRight": 2,
      "cs_paddingBottom": 2,
      "spreadsheet_hide": false,
      "spreadsheet_column": "",
      "spreadsheet_colspan": "",
      "spreadsheet_addEmptyRow": false,
      "spreadsheet_textWrap": false
    }
  ],
  "parameters": [
    {
      "id": 1,
      "name": "page_count",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": true,
      "testData": ""
    },
    {
      "id": 2,
      "name": "page_number",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": true,
      "testData": ""
    },
    {
      "id": 9,
      "name": "current_date",
      "type": "date",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "d/M/yyyy H:mm",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    },
    {
      "id": 272,
      "name": "data",
      "type": "array",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": "",
      "children": [
        {
          "id": 273,
          "name": "row_number",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": true,
          "testData": ""
        },
        {
          "id": 287,
          "name": "user_name",
          "type": "string",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 319,
          "name": "region_code",
          "type": "string",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 320,
          "name": "region_name",
          "type": "string",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 321,
          "name": "district_code",
          "type": "string",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 322,
          "name": "district_name",
          "type": "string",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 461,
          "name": "active_eo",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 462,
          "name": "inactive_eo",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 463,
          "name": "users",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 464,
          "name": "products",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 465,
          "name": "hfs",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 466,
          "name": "service_pls",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 467,
          "name": "item_pls",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 468,
          "name": "service_pl_details",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 469,
          "name": "item_pl_details",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 470,
          "name": "payers",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 471,
          "name": "r_active_eo",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 472,
          "name": "r_inactive_eo",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 473,
          "name": "r_users",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 474,
          "name": "r_products",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 475,
          "name": "r_hfs",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 476,
          "name": "r_service_pls",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 477,
          "name": "r_item_pls",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 478,
          "name": "r_service_pl_details",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 479,
          "name": "r_item_pl_details",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 480,
          "name": "r_payers",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        }
      ]
    },
    {
      "id": 274,
      "name": "header",
      "type": "array",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": "",
      "children": [
        {
          "id": 275,
          "name": "row_number",
          "type": "number",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": true,
          "testData": ""
        },
        {
          "id": 276,
          "name": "date_from",
          "type": "date",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "dd/MM/yyyy",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 277,
          "name": "date_to",
          "type": "date",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "dd/MM/yyyy",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 278,
          "name": "region",
          "type": "string",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 279,
          "name": "district",
          "type": "string",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        },
        {
          "id": 313,
          "name": "product",
          "type": "string",
          "arrayItemType": "string",
          "eval": false,
          "nullable": false,
          "pattern": "",
          "expression": "",
          "showOnlyNameType": false,
          "testData": ""
        }
      ]
    },
    {
      "id": 309,
      "name": "error",
      "type": "string",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    },
    {
      "id": 440,
      "name": "total_active_eo",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    },
    {
      "id": 441,
      "name": "total_inactive_eo",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    },
    {
      "id": 442,
      "name": "total_users",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    },
    {
      "id": 443,
      "name": "total_products",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    },
    {
      "id": 444,
      "name": "total_hfs",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    },
    {
      "id": 445,
      "name": "total_service_pls",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    },
    {
      "id": 446,
      "name": "total_item_pls",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    },
    {
      "id": 447,
      "name": "total_service_pl_details",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    },
    {
      "id": 448,
      "name": "total_item_pl_details",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    },
    {
      "id": 449,
      "name": "total_payers",
      "type": "number",
      "arrayItemType": "string",
      "eval": false,
      "nullable": false,
      "pattern": "",
      "expression": "",
      "showOnlyNameType": false,
      "testData": ""
    }
  ],
  "styles": [
    {
      "id": 33,
      "name": "Table Header",
      "bold": true,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "left",
      "verticalAlignment": "middle",
      "textColor": "#000000",
      "backgroundColor": "",
      "font": "notosans",
      "fontSize": "12",
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "2",
      "paddingTop": "2",
      "paddingRight": "2",
      "paddingBottom": "2"
    },
    {
      "id": 34,
      "name": "Table Content",
      "bold": false,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "left",
      "verticalAlignment": "middle",
      "textColor": "#000000",
      "backgroundColor": "",
      "font": "notosans",
      "fontSize": "11",
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "2",
      "paddingTop": "2",
      "paddingRight": "2",
      "paddingBottom": "2"
    },
    {
      "id": 35,
      "name": "Table Content Highlight",
      "bold": true,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "center",
      "verticalAlignment": "middle",
      "textColor": "#3d85c6",
      "backgroundColor": "",
      "font": "notosans",
      "fontSize": "9",
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "2",
      "paddingTop": "2",
      "paddingRight": "2",
      "paddingBottom": "2"
    },
    {
      "id": 286,
      "name": "Content header 1",
      "bold": true,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "left",
      "verticalAlignment": "middle",
      "textColor": "#ffffff",
      "backgroundColor": "#006374",
      "font": "notosans",
      "fontSize": 12,
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "2",
      "paddingTop": "2",
      "paddingRight": "2",
      "paddingBottom": "2"
    },
    {
      "id": 295,
      "name": "Content title",
      "bold": true,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "center",
      "verticalAlignment": "middle",
      "textColor": "#000000",
      "backgroundColor": "",
      "font": "notosans",
      "fontSize": 12,
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "2",
      "paddingTop": "2",
      "paddingRight": "2",
      "paddingBottom": "2"
    },
    {
      "id": 296,
      "name": "Content content",
      "bold": false,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "center",
      "verticalAlignment": "middle",
      "textColor": "#000000",
      "backgroundColor": "",
      "font": "notosans",
      "fontSize": "11",
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "2",
      "paddingTop": "2",
      "paddingRight": "2",
      "paddingBottom": "2"
    },
    {
      "id": 307,
      "name": "Error",
      "bold": true,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "center",
      "verticalAlignment": "middle",
      "textColor": "#ff0000",
      "backgroundColor": "",
      "font": "notosans",
      "fontSize": "16",
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "2",
      "paddingTop": "2",
      "paddingRight": "2",
      "paddingBottom": "2"
    },
    {
      "id": 337,
      "name": "Content header 2",
      "bold": true,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "left",
      "verticalAlignment": "middle",
      "textColor": "#ffffff",
      "backgroundColor": "#80B0B9",
      "font": "notosans",
      "fontSize": 12,
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "2",
      "paddingTop": "2",
      "paddingRight": "2",
      "paddingBottom": "2"
    },
    {
      "id": 338,
      "name": "No content",
      "bold": false,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "left",
      "verticalAlignment": "top",
      "textColor": "#cccccc",
      "backgroundColor": "#cccccc",
      "font": "helvetica",
      "fontSize": 12,
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "",
      "paddingTop": "",
      "paddingRight": "",
      "paddingBottom": ""
    },
    {
      "id": 341,
      "name": "Content header 3",
      "bold": true,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "left",
      "verticalAlignment": "middle",
      "textColor": "#ffffff",
      "backgroundColor": "#F4AE2B",
      "font": "notosans",
      "fontSize": 12,
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "2",
      "paddingTop": "2",
      "paddingRight": "2",
      "paddingBottom": "2"
    },
    {
      "id": 349,
      "name": "Footer",
      "bold": true,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "center",
      "verticalAlignment": "middle",
      "textColor": "#000000",
      "backgroundColor": "",
      "font": "notosans",
      "fontSize": 12,
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "2",
      "paddingTop": "2",
      "paddingRight": "2",
      "paddingBottom": "2"
    },
    {
      "id": 366,
      "name": "Subtotals",
      "bold": true,
      "italic": false,
      "underline": false,
      "strikethrough": false,
      "horizontalAlignment": "center",
      "verticalAlignment": "middle",
      "textColor": "#006374",
      "backgroundColor": "",
      "font": "notosans",
      "fontSize": 12,
      "lineSpacing": 1,
      "borderColor": "#000000",
      "borderWidth": "1",
      "borderAll": false,
      "borderLeft": false,
      "borderTop": false,
      "borderRight": false,
      "borderBottom": false,
      "paddingLeft": "2",
      "paddingTop": "2",
      "paddingRight": "2",
      "paddingBottom": "2"
    }
  ],
  "version": 3,
  "documentProperties": {
    "pageFormat": "A4",
    "pageWidth": "",
    "pageHeight": "",
    "unit": "mm",
    "orientation": "landscape",
    "contentHeight": "",
    "marginLeft": "10",
    "marginTop": "10",
    "marginRight": "10",
    "marginBottom": "10",
    "header": true,
    "headerSize": "80",
    "headerDisplay": "always",
    "footer": true,
    "footerSize": "30",
    "footerDisplay": "always",
    "patternLocale": "en",
    "patternCurrencySymbol": "$"
  }
}
"""

ALL_REGIONS = -42
ALL_DISTRICTS = -4242

CATEGORY_ACTIVE_EO = "active_eo"
CATEGORY_INACTIVE_EO = "inactive_eo"
CATEGORY_USERS = "users"
CATEGORY_PRODUCTS = "products"
CATEGORY_HFS = "hfs"
CATEGORY_SERVICE_PLS = "service_pls"
CATEGORY_ITEM_PLS = "item_pls"
CATEGORY_SERVICE_PL_DETAILS = "service_pl_details"
CATEGORY_ITEM_PL_DETAILS = "item_pl_details"
CATEGORY_PAYERS = "payers"

UNKNOWN_LOCATION_CODE = "XXXX"
REGION_OTHER_NAME = "Others"
DISTRICT_NATIONAL_NAME = "National - No location specified"
DISTRICT_REGIONAL_NAME = "Regional - No specific district"
DISTRICT_ARCHIVED_NAME = "Error - Archived location"
FAKE_REGION_ID = 0
FAKE_LOCATION_ID = FAKE_REGION_ID
FAKE_ARCHIVED_ID = -1

LOCATION_TYPE_REGION = "R"
LOCATION_TYPE_DISTRICT = "D"


def generate_subtotals_dict():
    """
    Generates a dictionary that represents a subtotal.

    Each key is a category and its corresponding value is the total for this category.


    Returns
    ----------
    dict
        A dictionary that represents a subtotal.
    """
    return {
        CATEGORY_ACTIVE_EO: 0,
        CATEGORY_INACTIVE_EO: 0,
        CATEGORY_USERS: 0,
        CATEGORY_PRODUCTS: 0,
        CATEGORY_HFS: 0,
        CATEGORY_SERVICE_PLS: 0,
        CATEGORY_ITEM_PLS: 0,
        CATEGORY_SERVICE_PL_DETAILS: 0,
        CATEGORY_ITEM_PL_DETAILS: 0,
        CATEGORY_PAYERS: 0,
    }


def dispatch_results(data: dict, category: str, totals: dict, location_mapping: dict):
    """
    Adds the results of a search into the totals.

    Data is dispatched at the location level, at the region level and at the global level.
    """
    for element in data:
        if element["count"]:  # There might not be any record for a given location
            location_id = element["location"] if element["location"] else FAKE_LOCATION_ID  # National data is going to be None
            totals["global"][category] += element["count"]

            if (location_id in location_mapping) or (location_id == FAKE_LOCATION_ID):  # = it's a known, active location
                totals["by_location"][location_id][category] += element["count"]

                # Handling regional level data is trickier because national-level data has no location defined
                if not location_id:
                    region_id = FAKE_REGION_ID  # No specific region
                elif location_mapping[location_id]["type"] == LOCATION_TYPE_REGION:
                    region_id = location_id
                else:
                    region_id = location_mapping[location_id]["parent_id"]
                totals["by_region"][region_id][category] += element["count"]
            else:  # Inactive, archived location
                totals["by_location"][FAKE_ARCHIVED_ID][category] += element["count"]
                totals["by_region"][FAKE_REGION_ID][category] += element["count"]



def format_global_totals(report_data: dict, totals: dict):
    """
    Formats the data related to global totals and adds it to the report_data level, with a prefix.
    """
    for key, value in totals["global"].items():
        key_name = f"total_{key}"
        report_data[key_name] = value


def format_final_data(totals: dict, location_mapping: dict):
    # Format the final data to match the expected format
    data = []
    for location_id, location_totals in totals["by_location"].items():
        new_data_line = {**location_totals}
        region_id = find_region_id(location_id, location_mapping)
        add_regional_totals(new_data_line, region_id, totals)
        add_region_district_labels(location_id, region_id, new_data_line, location_mapping)
        data.append(new_data_line)
    # order results by region, then district
    data.sort(key=lambda x: (x["region_code"], x["district_code"]))
    return data


def find_region_id(location_id: int, location_mapping: dict):
    if location_id < 1:  # It's not a real location, see generate_other_subtotals
        return FAKE_REGION_ID
    location = location_mapping[location_id]
    if location["type"] == LOCATION_TYPE_REGION:
        return location_id
    return location["parent_id"]


def add_regional_totals(new_line: dict, region_id: int, totals: dict):
    # Adds the regional totals to each entry, with a specific "r_" prefix for the region
    for key, value in totals["by_region"][region_id].items():
        new_key = f"r_{key}"
        new_line[new_key] = value


def add_region_district_labels(location_id: int, region_id: int, new_data_line: dict, location_mapping: dict):
    if region_id not in location_mapping:
        new_data_line["region_name"] = REGION_OTHER_NAME
        new_data_line["region_code"] = UNKNOWN_LOCATION_CODE
        new_data_line["district_name"] = DISTRICT_NATIONAL_NAME if location_id == FAKE_LOCATION_ID else DISTRICT_ARCHIVED_NAME
        new_data_line["district_code"] = UNKNOWN_LOCATION_CODE
    else:
        if location_id == region_id:
            new_data_line["region_name"] = location_mapping[location_id]["name"]
            new_data_line["region_code"] = location_mapping[location_id]["code"]
            new_data_line["district_name"] = DISTRICT_REGIONAL_NAME
            new_data_line["district_code"] = UNKNOWN_LOCATION_CODE
        else:
            new_data_line["region_name"] = location_mapping[region_id]["name"]
            new_data_line["region_code"] = location_mapping[region_id]["code"]
            new_data_line["district_name"] = location_mapping[location_id]["name"]
            new_data_line["district_code"] = location_mapping[location_id]["code"]


def generate_other_subtotals(totals):
    # Prepares fake locations/regions in the totals dictionary for other cases
    totals["by_region"][FAKE_REGION_ID] = generate_subtotals_dict()  # Fake region for all special cases
    totals["by_location"][FAKE_LOCATION_ID] = generate_subtotals_dict()  # Fake location for national data (no location selected)
    totals["by_location"][FAKE_ARCHIVED_ID] = generate_subtotals_dict()  # Fake location for erroneous data (archived location selected)


def fetch_users(location_ids_mapping: dict, search_filters: Q, totals: dict):
    users = fetch_aggregated_data_count(UserDistrict.objects, search_filters)
    dispatch_results(users, CATEGORY_USERS, totals, location_ids_mapping)


def fetch_payers(location_ids_mapping: dict, search_filters: Q, totals: dict):
    # can be national (no district, no region)
    payers = fetch_aggregated_data_count(Payer.objects, search_filters)
    dispatch_results(payers, CATEGORY_PAYERS, totals, location_ids_mapping)


def fetch_item_pricelist_details(location_ids_mapping: dict, item_details_filters: Q, totals: dict):
    # can be national (no district, no region)
    item_pl_details = ItemsPricelistDetail.objects.filter(item_details_filters) \
                                                  .values(location=F("items_pricelist__location")) \
                                                  .annotate(count=Count(Coalesce("location", 0))) \
                                                  .order_by()
    dispatch_results(item_pl_details, CATEGORY_ITEM_PL_DETAILS, totals, location_ids_mapping)


def fetch_service_pricelist_details(location_ids_mapping: dict, service_details_filters: Q, totals: dict):
    # can be national (no district, no region)
    service_pl_details = ServicesPricelistDetail.objects.filter(service_details_filters) \
                                                        .values(location=F("services_pricelist__location")) \
                                                        .annotate(count=Count(Coalesce("location", 0))) \
                                                        .order_by()
    dispatch_results(service_pl_details, CATEGORY_SERVICE_PL_DETAILS, totals, location_ids_mapping)


def fetch_item_pricelists(location_ids_mapping: dict, search_filters: Q, totals: dict):
    # can be national (no district, no region)
    item_pls = fetch_aggregated_data_count(ItemsPricelist.objects, search_filters)
    dispatch_results(item_pls, CATEGORY_ITEM_PLS, totals, location_ids_mapping)


def fetch_service_pricelists(location_ids_mapping: dict, search_filters: Q, totals: dict):
    # can be national (no district, no region)
    service_pls = fetch_aggregated_data_count(ServicesPricelist.objects, search_filters)
    dispatch_results(service_pls, CATEGORY_SERVICE_PLS, totals, location_ids_mapping)


def fetch_health_facilities(location_ids_mapping: dict, search_filters: Q, totals: dict):
    hfs = fetch_aggregated_data_count(HealthFacility.objects, search_filters)
    dispatch_results(hfs, CATEGORY_HFS, totals, location_ids_mapping)


def fetch_products(location_ids_mapping: dict, search_filters: Q, totals: dict):
    # can be national (no district, no region)
    products = fetch_aggregated_data_count(Product.objects, search_filters)
    dispatch_results(products, CATEGORY_PRODUCTS, totals, location_ids_mapping)


def fetch_inactive_officers(location_ids_mapping: dict, search_filters: Q, totals: dict):
    # can be national (no district)
    today = datetime.date.today()
    inactive_search_filters = search_filters & Q(works_to__lte=today)
    inactive_officers = fetch_aggregated_data_count(Officer.objects, inactive_search_filters)
    dispatch_results(inactive_officers, CATEGORY_INACTIVE_EO, totals, location_ids_mapping)


def fetch_active_officers(location_ids_mapping: dict, search_filters: Q, totals: dict):
    # can be national (no district)
    today = datetime.date.today()
    active_search_filters = search_filters & \
                            (Q(works_to__isnull=True) | Q(works_to__gt=today))
    active_officers = fetch_aggregated_data_count(Officer.objects, active_search_filters)
    dispatch_results(active_officers, CATEGORY_ACTIVE_EO, totals, location_ids_mapping)


def fetch_aggregated_data_count(manager: Manager, search_filters: Q):
    # The Count(Coalesce()) allows to group and count NULL values
    return manager.filter(search_filters) \
                  .values("location") \
                  .annotate(count=Count(Coalesce("location", 0))) \
                  .order_by()


def prepare_totals_and_locations(active_locations: QuerySet, location_ids_mapping: dict, totals: dict, region_id: int, district_id: int):
    # Prepares the totals dictionary and adds each location to the mapping
    for location in active_locations:
        location_ids_mapping[location["id"]] = location
        if location["type"] != LOCATION_TYPE_REGION or district_id == ALL_DISTRICTS:  # Don't want to add regional data when a district is specified
            totals["by_location"][location["id"]] = generate_subtotals_dict()
        if location["type"] == LOCATION_TYPE_REGION:
            totals["by_region"][location["id"]] = generate_subtotals_dict()
    if district_id == ALL_DISTRICTS and region_id == ALL_REGIONS:
        generate_other_subtotals(totals)


def registers_status_query(user,
                           requested_region_id: int = ALL_REGIONS,
                           requested_district_id: int = ALL_DISTRICTS,
                           **kwargs):
    """
    Generates data form the registers status report.

    This function can take a region ID and/or a district ID as parameter and counts the use of each region/district in the following models:
    - Officer
    - UserDistrict
    - Product
    - HealthFacility
    - ServicePricelist
    - ServicePricelistDetails
    - ItemPricelist
    - ItemPricelistDetails
    - Payer

    Note: if there is set on a national level (no location selected) and a district parameter is sent, the national data doesn't show up in the report

    """
    # Checking the parameters received and returning an error if anything is wrong
    region_id = int(requested_region_id)
    if region_id != ALL_REGIONS:
        region = Location.objects.filter(validity_to=None, type='R', id=region_id).first()
        if not region:
            return {"error": "Error - the requested region does not exist"}
    district_id = int(requested_district_id)
    if district_id != ALL_DISTRICTS:
        district_filters = Q(validity_to__isnull=True) & Q(type="D") & Q(id=district_id)
        if region_id != ALL_REGIONS:  # The FE pickers allow you to select a district without a region, so additional steps are required
            district_filters &= Q(parent_id=region_id)
        district = Location.objects.filter(district_filters).first()
        if not district:
            return {"error": "Error - the requested district does not exist"}
        if region_id == ALL_REGIONS:  # The FE pickers allow you to select a district without a region, so additional steps are required
            region = district.parent
            region_id = region.id

    # Preparing data for the header table
    header = {
        "region": "All regions" if region_id == ALL_REGIONS else f"{region.code} - {region.name}",
        "district": "All districts" if district_id == ALL_DISTRICTS else f"{district.code} - {district.name}",
    }
    report_data = {
        "header": [header]
    }

    # Preparing filters of making a list of active locations, which will be the base of this report
    active_location_filters = Q(validity_to__isnull=True)
    if district_id != ALL_DISTRICTS:
        active_location_filters &= (Q(id=district_id) | Q(id=region_id))
    elif region_id != ALL_REGIONS:
        active_location_filters &= (Q(id=region_id) | Q(parent_id=region_id))
    else:
        active_location_filters &= Q(type__in=['R', 'D'])

    # Preparing the list of locations & totals
    active_locations = Location.objects.filter(active_location_filters) \
                                       .values("id", "code", "name", "type", "parent_id") \
                                       .order_by("-type", "code")
    location_ids_mapping = {}
    totals = {
        "global": generate_subtotals_dict(),
        "by_region": {},
        "by_location": {},
    }
    prepare_totals_and_locations(active_locations, location_ids_mapping, totals, region_id, district_id)

    # Prepare the location filters
    search_filters = Q(validity_to__isnull=True)
    if district_id != ALL_DISTRICTS:
        search_filters &= Q(location_id=district_id)
    elif region_id != ALL_REGIONS:
        search_filters &= (Q(location__parent_id=region_id) | Q(location_id=region_id))

    # Fetch every data type
    fetch_active_officers(location_ids_mapping, search_filters, totals)
    fetch_inactive_officers(location_ids_mapping, search_filters, totals)
    fetch_users(location_ids_mapping, search_filters, totals)
    fetch_products(location_ids_mapping, search_filters, totals)
    fetch_health_facilities(location_ids_mapping, search_filters, totals)
    fetch_service_pricelists(location_ids_mapping, search_filters, totals)
    fetch_item_pricelists(location_ids_mapping, search_filters, totals)
    fetch_payers(location_ids_mapping, search_filters, totals)

    # Special filter as location is not directly stored in the object
    service_details_filters = Q(validity_to__isnull=True)
    if district_id != ALL_DISTRICTS:
        service_details_filters &= Q(services_pricelist__location_id=district_id)
    elif region_id != ALL_REGIONS:
        service_details_filters &= (
                Q(services_pricelist__location__parent_id=region_id)
                | Q(services_pricelist__location_id=region_id)
        )
    fetch_service_pricelist_details(location_ids_mapping, service_details_filters, totals)

    # Special filter as location is not directly stored in the object
    item_details_filters = Q(validity_to__isnull=True)
    if district_id != ALL_DISTRICTS:
        item_details_filters &= Q(items_pricelist__location_id=district_id)
    elif region_id != ALL_REGIONS:
        item_details_filters &= (
                Q(items_pricelist__location__parent_id=region_id)
                | Q(items_pricelist__location_id=region_id)
        )
    fetch_item_pricelist_details(location_ids_mapping, item_details_filters, totals)

    # Format the fetched data to match what is required in the report
    format_global_totals(report_data, totals)
    report_data["data"] = format_final_data(totals, location_ids_mapping)

    return report_data
