%p
  ="(#{@p_documents.total_count}) document(s)"
-if params[:print]
  %p
    -if @start
      Date début :
      =l @start
      ="-"
    -if @stop
      Date fin :
      =l @stop
      ="-"
    
    -type = []
    -PDocumentType.where(:id => params[:p_document_type_ids]).all.each do |pdt|
      -type << pdt.name
    =type.join(" | ")
%table.table
  %tr
    -if params[:detail]
      %th ID doc.
    %th Date
    %th N° offre
    -if params[:detail]
      %th Code client
    %th Client
    
    %th Type
    %th Numéro
    -if !params[:detail]
      
      %th Total HT
      %th Total TTC
    
     
      %th
        Payée
      %th
        Solde
      %th Echéance
      
      %th Jours de retard
      
      %th 
    
    -else
      -@totals = {}
      %th Code
      %th Produit
      %th Qte
      %th{:style => "width:80px"} Prix U HT
      
      %th Prix Tot HT.
      %th TVA
      %th{:style => "width:80px"} Prix Tot TTC
    



  %tbody#p_customer_sheets_rows
    =render @p_documents
  -if params[:detail] 
    %tfooter
      %tr
        %td{:colspan => 11}
          Totaux
        
        %td
        
          =number_to_currency @totals[:ht]
        %td=number_to_currency @totals[:tva]
        %td=number_to_currency @totals[:ttc]
      
      
    

.qi_pagination
  = paginate @p_documents