Class: Backend::IncomingPaymentsController

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

Instance Attribute Summary

Attributes inherited from ApplicationController

#current_theme

Class Method Summary collapse

Methods inherited from BaseController

accounts_range_crit, crit_params, journal_entries_states_crit, journal_period_crit, journals_crit, search_conditions

Methods inherited from ApplicationController

#after_sign_in_path_for, #authorized?, human_action_name, #human_action_name

Class Method Details

.incoming_payments_conditions(_options = {}) ⇒ Object


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

def self.incoming_payments_conditions(_options = {})
  code = search_conditions(incoming_payments: [:amount, :bank_check_number, :number, :bank_account_number], entities: [:number, :full_name]) + "||=[]\n"
  code << "if params[:s] == 'not_received'\n"
  code << "  c[0] += ' AND received=?'\n"
  code << "  c << false\n"
  code << "elsif params[:s] == 'to_deposit_later'\n"
  code << "  c[0] += ' AND to_bank_at > ?'\n"
  code << "  c << Time.zone.today\n"
  code << "elsif params[:s] == 'to_deposit_now'\n"
  code << "  c[0] += ' AND to_bank_at <= ? AND deposit_id IS NULL AND #{IncomingPaymentMode.table_name}.with_deposit'\n"
  code << "  c << Time.zone.now\n"
  # code << "elsif params[:s] == 'unparted'\n"
  # code << "  c[0] += ' AND used_amount != amount'\n"
  code << "end\n"
  code << "c\n"
  code.c
end