%table.table.table-hover.table-striped#p_customer_etat{:id => p_customer.id}
  %thead
    %tr
    
      %th Date
      %th Echeance
      %th Type
      %th Réf
      %th Débit
      %th Crédit
      %th Soldé ?
      %th.action
    
  %tbody.lines
    =render p_customer.p_compta_elements.order("date DESC")
  
    %tr
      %th{:colspan => 4}
        Solde :
        =number_to_currency p_customer.p_compta_elements.sum(:amount)
      %th
        -a = p_customer.p_compta_elements.where("amount < 0.0").sum(:amount)
        =number_to_currency (a*-1)
      %th
        -b = p_customer.p_compta_elements.where("amount > 0.0").sum(:amount)
        =number_to_currency b
      %th
      %th
      