Class: Backend::JournalEntryItemsController

Inherits:
BaseController show all
Defined in:
app/controllers/backend/journal_entry_items_controller.rb

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_theme

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseController

account_lettering_states_crit, accounts_range_crit, amount_range_crit, crit_params, journal_entries_states_crit, journal_letter_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name, #session_controller?

Class Method Details

.list_conditionsObject


23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/backend/journal_entry_items_controller.rb', line 23

def self.list_conditions
  code = ''
  code << search_conditions + ';'
  code << "if params[:tax_declaration_item_id]\n"
  code << "  c[0] += ' AND #{JournalEntryItem.table_name}.id IN (SELECT DISTINCT journal_entry_item_id FROM #{TaxDeclarationItemPart.table_name} WHERE tax_declaration_item_id = ?)'\n"
  code << "  c << params[:tax_declaration_item_id].to_i\n"
  code << "end\n"
  code << "if params[:account_id].to_i > 0\n"
  code << "  c[0] += ' AND account_id = ?'\n"
  code << "  c << params[:account_id].to_i\n"
  code << "end\n"
  code << "unless params[:period].blank? or params[:period]='all'\n"
  code << "  c[0] += ' AND id IN (SELECT account_id FROM #{JournalEntryItem.table_name} AS jel JOIN #{JournalEntry.table_name} AS je ON (entry_id=je.id) WHERE '+JournalEntry.period_condition(params[:period], params[:started_on], params[:stopped_on], 'je')+')'\n"
  code << "end\n"
  code << "c\n"
  code.c
end

Instance Method Details

#indexObject


60
# File 'app/controllers/backend/journal_entry_items_controller.rb', line 60

def index; end

#showObject


62
63
64
65
66
67
68
# File 'app/controllers/backend/journal_entry_items_controller.rb', line 62

def show
  if @journal_entry_item = JournalEntryItem.find_by(id: params[:id])
    redirect_to backend_journal_entry_path(@journal_entry_item.entry_id)
  else
    redirect_to backend_root_path
  end
end