You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: balance_sheet_printer.rb
    path of file: ./repos/ekylibre/app/services/printers
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

# This object allow printing the general ledger
module Printers
  class BalanceSheetPrinter < PrinterBase
    include ApplicationHelper

    AGRI_PCG = [:fr_pcga, :fr_pcga2023].freeze
    GENERAL_PCG = [:fr_pcg82, :fr_pcg2023].freeze

    class << self
      # TODO move this elsewhere when refactoring the Document Management System
      def build_key(financial_year:)
        financial_year.code
      end
    end

    def initialize(*_args, financial_year:, template:, **_options)
      super(template: template)

      @financial_year = financial_year
      @accounting_system = @financial_year.accounting_system&.to_sym || Preference[:accounting_system]&.to_sym
      @current_compute = AccountancyComputation.new(@financial_year)
      @previous_compute = AccountancyComputation.new(@financial_year.previous) if @financial_year.previous
      @document_scope = :balance_sheet
    end

    def key
      self.class.build_key(financial_year: @financial_year)
    end

    def document_name
      "#{template.nature.human_name} (#{@financial_year.code})"
    end

    def compute_dataset
      dataset = []

      ## ACTIF
      actif = []
      current_net_total_actif = 0.0
      previous_net_total_actif = 0.0

      base_active = [
        [:unsubcribed_capital, false, [:unsubcribed_capital]], # unsubcribed_capital - 109
        [:incorporeal_assets, true, [:incorporeal_assets_creation_costs, :incorporeal_assets_others, :incorporeal_assets_advances]], # incorporeal_assets - 201...
        [:corporeal_assets, true, [:corporeal_assets_land_parcels, :corporeal_assets_settlements,
                                   :corporeal_assets_enhancement, :corporeal_assets_buildings,
                                   :corporeal_assets_equipments, :corporeal_assets_others,
                                   :corporeal_assets_in_progress, :corporeal_assets_advances]],
        [:financial_assets, true, [:financial_assets_participations, :financial_assets_participations_debts,
                                   :financial_assets_others]],

      ]

      base_bottom_active = [
        [:entities, true, [:entities_advance_giveables, :entities_client_receivables,
                           :entities_others_clients, :entities_state_receivables,
                           :entities_associate_receivables, :entities_other_receivables,
                           :entities_investment_security, :entities_reserve,
                           :entities_advance_charges, :entities_assets_gaps]]
      ]

      base_active.each do |group_item, is_multi_items, items|
        g = generate_items(group_item, is_multi_items, items)
        current_net_total_actif += g[:current_net_total]
        previous_net_total_actif += g[:previous_net_total] if @financial_year.previous
        actif << g
      end

      # PCGA - alive corporeal_assets, short & long_cycle_alive_products, stocks
      if @accounting_system.in?(AGRI_PCG)
        pcga_alive_active = [
          [:alive_c
    
    def compute_dataset
      dataset = []

      ## ACTIF
      actif = []
      current_net_total_actif = 0.0
      previous_net_total_actif = 0.0

      base_active = [
        [:unsubcribed_capital, false, [:unsubcribed_capital]], # unsubcribed_capital - 109
        [:incorporeal_assets, true, [:incorporeal_assets_creation_costs, :incorporeal_assets_others, :incorporeal_assets_advances]], # incorporeal_assets - 201...
        [:corporeal_assets, true, [:corporeal_assets_land_parcels, :corporeal_assets_settlements,
                                   :corporeal_assets_enhancement, :corporeal_assets_buildings,
                                   :corporeal_assets_equipments, :corporeal_assets_others,
                                   :corporeal_assets_in_progress, :corporeal_assets_advances]],
        [:financial_assets, true, [:financial_assets_participations, :financial_assets_participations_debts,
                                   :financial_assets_others]],

      ]

      base_bottom_active = [
        [:entities, true, [:entities_advance_giveables, :entities_client_receivables,
                           :entities_others_clients, :entities_state_receivables,
                           :entities_associate_receivables, :entities_other_receivables,
                           :entities_investment_security, :entities_reserve,
                           :entities_advance_charges, :entities_assets_gaps]]
      ]

      base_active.each do |group_item, is_multi_items, items|
        g = generate_items(group_item, is_multi_items, items)
        current_net_total_actif += g[:current_net_total]
        previous_net_total_actif += g[:previous_net_total] if @financial_year.previous
        actif << g
      end

      # PCGA - alive corporeal_assets, short & long_cycle_alive_products, stocks
      if @accounting_system.in?(AGRI_PCG)
        pcga_alive_active = [
          [:alive_corporeal_assets, true, [:alive_corporeal_assets_adult_animals, :alive_corporeal_assets_young_animals,
                                           :alive_corporeal_assets_service_animals, :alive_corporeal_assets_perennial_plants,
                                           :alive_corporeal_assets_others, :alive_corporeal_assets_in_progress,
                                           :alive_corporeal_assets_advances]],
          [:long_cycle_alive_products, true, [:long_cycle_alive_products_animals, :long_cycle_alive_products_plant_advance,
                                              :long_cycle_alive_products_plant_in_ground, :long_cycle_alive_products_wine,
                                              :long_cycle_alive_products_others]],
          [:short_cycle_alive_products, true, [:short_cycle_alive_products_animals, :short_cycle_alive_products_plant_advance,
                                               :short_cycle_alive_products_plant_in_ground, :short_cycle_alive_products_others]],
          [:stocks, true, [:stocks_supply, :stocks_others_products, :stocks_end_products]],

        ]

        pcga_alive_active.each do |group_item, is_multi_items, items|
          g = generate_items(group_item, is_multi_items, items)
          current_net_total_actif += g[:current_net_total]
          previous_net_total_actif += g[:previous_net_total] if @financial_year.previous
          actif << g
        end
      end