#main{:style => "margin:0 1cm;border:0"}
  
  


  %div{:style => "height:5cm;"}
  
  =#;top:5cm;
  %div{:style => "position:relative;width:6.4cm;margin-right:1.5cm;float:right;"}
    %div{:style => "padding:4px 8px;min-height:80px;"}
      %h3{:style => "position:absolute;top:-40px;"} Adresse de facturation
    
      %strong
        =@p_document.particular_bill.civilite
        -if @p_document.particular_bill.organisation?
    
          =@p_document.particular_bill.organisation
    
        -if @p_document.particular_bill.firstname? or @p_document.particular_bill.name? 

          
          =@p_document.particular_bill.firstname

          =@p_document.particular_bill.name

      
      -if @p_document.particular_bill.address_2?
        %br
        =@p_document.particular_bill.address_2

      -if @p_document.particular_bill.address_3?
        %br
        =@p_document.particular_bill.address_3
      -if @p_document.particular_bill.cp? or @p_document.particular_bill.city?
        %br
        =@p_document.particular_bill.cp

        =@p_document.particular_bill.city
      %br
      =@p_document.particular_bill.country
      -if false
        -if @p_document.particular_bill.tel
          %br
          %br
          =@p_document.particular_bill.tel
        .p_contacts
          -@p_document.particular_bill.p_contacts.each do |p_contact|
            .p_contact
              =p_contact.name if p_contact.name?
              =p_contact.tel if p_contact.tel?
              =link_to p_contact.email, "mailto:"+p_contact.email.to_s if p_contact.email?
  =#right:9cm;top:5cm;
  %div{:style => "position:relative;width:6.4cm;margin-right:1.5cm;float:right;"}
    %div{:style => "padding:4px 8px;min-height:80px;"}
    
      %h3{:style => "position:absolute;top:-40px;"} Adresse de livraison
  
      %strong
        =@p_document.particular_send.civilite
        -if @p_document.particular_send.organisation?
    
          =@p_document.particular_send.organisation
    
        -if @p_document.particular_send.firstname? or @p_document.particular_send.name? 

          =@p_document.particular_send.firstname

          =@p_document.particular_send.name

      
      -if @p_document.particular_send.address_2?
        %br
        =@p_document.particular_send.address_2

      -if @p_document.particular_send.address_3?
        %br
        =@p_document.particular_send.address_3
      -if @p_document.particular_send.cp? and @p_document.particular_send.city?
        %br
        =@p_document.particular_send.cp

        =@p_document.particular_send.city
      %br
      =@p_document.particular_send.country

      -if false 
        .p_contacts
          -@p_document.particular_send.p_contacts.each do |p_contact|
            .p_contact
              =p_contact.name if p_contact.name?
              =p_contact.tel if p_contact.tel?
              =link_to p_contact.email, "mailto:"+p_contact.email.to_s if p_contact.email?
        
  %p{:style => "clear:both;height:0.5cm;"}
  
  %table.en-tete-table{:style => "width:auto;"}
    %tr
      %th Date
      %th N° Client
      %th Type
      %th Référence doc.
      -if @p_document.cust_ref?
        %th Réf. com. client
        
    %tr
      
    
      %td{:style => "width:100px"}
        =l @p_document.created_at, :format => :date #@p_document.created_at
      
      %td{:style => "width:70px"}
        =@element.p_customer.code
      
      %td{:style => "width:110px"}
        =@p_document.label

      %td{:style => "width:90px"}
        =@p_document.d_number
      
      -if @p_document.cust_ref?
        %td{:style => "width:90px"}
          =@p_document.cust_ref
     
  %br
  
  -if ["Facture"].include?(@p_document.label)
    -ok = true
  -else
    -ok = false
  =render :partial => "admin/p_sheet_lines/print_p_sheet_lines", :locals => {:sheet_lines => @p_document.p_sheet_lines, :ok => ok }
  
  %table.en-tete-table{:style => "width:auto;position:relative;top:-40px;"}
    %tr
      %th Conditions de réglement
      %th Echéance
      
    
    %tr
      
    
      %td{:style => "width:150px;"}
        -if @p_document.p_payment_type
          =@p_document.p_payment_type.name
          %br
        
        -if @p_document.comptant
          Comptant
        -else
          =@p_document.payment_delais.to_i
          j nets
      
      %td{:style => "width:100px"}
        =l @p_document.echeance, :format => :date
      
      
  -if false and @element.p_customer.p_contacts.count > 0
    %p{:style => "margin-bottom:0;"} Contacts généraux du compte client :
    .p_contacts
      -@element.p_customer.p_contacts.each do |p_contact|
        .p_contact
          =p_contact.name if p_contact.name?
          =p_contact.tel if p_contact.tel?
          =link_to p_contact.email, "mailto:"+p_contact.email.to_s if p_contact.email?
  
  -if @p_document.d_prefix == "F"
    %p.reglement
    
      Passée la date d'échéance ci-dessus, une pénalité de retard de 1% mois sera
      appliquée (Loi 2008-776 du 4 août 2008) ainsi qu'une indemnité pour frais de
      recouvrement de 40€ (Décret 2012-1115 du 2 octobre 2012).
      %br
      Pas d'escompte pour règlement anticipé.
    
  :scss
    .en-tete-table{
      table{
        border-collapse:collapse;
      }
      td,th{
        border:1px solid black;
      }
    }
    .reglement{
      margin-top:20px;
      color:rgba(0,0,0,0.6);
      font-size:8pt;
    }