Module: Adherent::PaymentsHelper

Defined in:
app/helpers/adherent/payments_helper.rb

Instance Method Summary collapse

Instance Method Details

#max_dateObject



7
8
9
# File 'app/helpers/adherent/payments_helper.rb', line 7

def max_date
  @member.organism.range_date.last
end

#min_dateObject



3
4
5
# File 'app/helpers/adherent/payments_helper.rb', line 3

def min_date 
  @member.organism.range_date.first
end

#recu_cotisation(payment, member) ⇒ Object

Cette méthode est utilisée pour l’édition du reçu sous forme de courrier

cas de figure : le payment correspond précisément à l’adhésion du membre on fait une édition simple : pour votre cotisation du .… au … Le payment reprend plusieurs règlements TODO A voir, il peut y avoir des paiements partiels ou total



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'app/helpers/adherent/payments_helper.rb', line 17

def recu_cotisation(payment, member)
  rs = payment.reglements
  if rs.count == 1 && rs.first.try(:adhesion).try(:member) == member
    adh = rs.first.adhesion
    "votre adhésion pour la période #{du_au(adh.from_date, adh.to_date)}"
    
  elsif rs.size == 1
    # une seule adhésion mais pas pour lui
    adh = rs.first.adhesion
    "l'adhésion de #{coords(adh)} pour la période #{pour(adh)}"    
  else  
    # plusieurs adhésions
    str  = "les adhésions de :"
    rs.each do |r| 
      
      adh = r.adhesion
      
      str += " - #{coords(adh)} pour la période #{pour(adh)}"
      
    end
    
    str.html_safe
  end
  
end