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: tax_declaration.rb
    path of file: ./repos/ekylibre/app/models
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

# = Informations
#
# == License
#
# Ekylibre - Simple agricultural ERP
# Copyright (C) 2008-2009 Brice Texier, Thibaud Merigon
# Copyright (C) 2010-20
    
    def set_purchase_entry_items_tax_modes(entry_items)
      { 'at_invoicing' => 'debit', 'at_paying' => 'payment' }.each do |tax_payability, declaration_mode|
        entry_items
          .joins('INNER JOIN purchase_items pi ON pi.id = journal_entry_items.resource_id')
          .joins('INNER JOIN purchases p ON p.id = pi.purchase_id')
          .where('p.tax_payability' => tax_payability)
          .update_all tax_declaration_mode: declaration_mode
      end
    end