!!!
%html
  %head

    %meta{:"http-equiv" => "Content-Type", :content=>"text/html; charset=UTF-8"}
    %meta{:name=>"viewport", :content=>"width=device-width,initial-scale=1"}
    <link href="https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i" rel="stylesheet">
    :scss
      body{
        font-size:11pt;
        padding :0px;
        margin:0px;
        background-color: transparent; 
        
        font-family:"Lato", Arial, Sans-serif;
        padding:1cm;
      }
      #main{
        //margin-left:4.2cm;
        
      }
      td, th{
          //border:1px solid black;
          padding:5px;
          vertical-align:top;
      
        }
      th{
        font-weight:normal;
        border-bottom:1px solid gray;
        text-align:left;
      }
      
      td{
        border-bottom:1px solid rgba(0,0,0,0.1);
        
        p{
          margin:5px 0;
        }
        
      }
        
      table{
        border-collapse:collapse;
        
        
    
      }
      
      tr{
        page-break-inside:avoid; 
      
      }
      
      #bottom{
      page-break-inside:avoid; 
      
      }
      .right{
        text-align:right;
        
      }
      .line p{
        margin:0px;
      }
      .description{
        padding-top:2pt;
        display:block;
      
      }
      
      .bot_separate{
        height:50pt;
      
      }
      
      .upcase{
        
        text-transform:uppercase;
      }
      
      h3{
        
        font-size:1em;
        margin-bottom:5px;
        font-weight:normal;
      }
      

      
   
      

      
    
  
  %body
    #main
      
      %div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
        Facture n°
        =@product_order.bill_number
        %br
        =l @product_order.paid_at, :format => :date
    
    
      %div{:style => "height:350px;"}
      


      %table.table{:style => "position:absolute;right:1cm;top:220px"}
        %tr
          %td{:style => "width:5.5cm;border:0"}
            %h3 Adresse de facturation
            
            %strong=@product_order.particular_bill.organisation
            %br
            =@product_order.particular_bill.firstname

            =@product_order.particular_bill.name
            %br
            =@product_order.particular_bill.address_2

            -if @product_order.particular_bill.address_3?
              %br
              =@product_order.particular_bill.address_3
            %br
            =@product_order.particular_bill.cp

            =@product_order.particular_bill.city
            %br
            =@product_order.particular_bill.country
            %br
            %br
            =@product_order.particular_bill.tel
            
            
          %td{:style => "width:5.5cm;border:0"}
            %h3 Adresse de livraison
            
            %strong=@product_order.particular_bill.organisation
            %br
            =@product_order.particular_send.firstname

            =@product_order.particular_send.name
            %br
            =@product_order.particular_send.address_2

            -if @product_order.particular_send.address_3?
              %br
              =@product_order.particular_send.address_3
            %br
            =@product_order.particular_send.cp

            =@product_order.particular_send.city
            %br
            =@product_order.particular_send.country
            %br
            %br
            =@product_order.particular_bill.tel
    
      %table.table{:style => "width:100%;margin:1cm 0;"}
        %tr
          %th
          %th
            Description
          %th{:style => "text-align:right;width:100px"}
            Prix U. HT
          %th{:style => "text-align:right;width:80px"}
            Qté
          %th{:style => "text-align:right;width:100px"}
            Prix HT
        -@product_order.product_order_products.order(:product_id).each do |product_order_product|
          
          %tr
            %td{:style => "width:135px;padding:0;vertical-align:middle"}
              =image_tag "http://negos.pro"+product_order_product.product.default_image.image_file.file.large.medium.small.thumb.url, :style => "width:130px;" if product_order_product.product.default_image
            %td
              =simple_format product_order_product.archived_product.lang(:fr).bl_title

          
              =# product_order_product.archived_product_size.name if product_order_product.archived_product_size
            
            
              =# product_order_product.archived_product_option.lang(I18n.locale).name if product_order_product.archived_product_option

            %td{:style => "text-align:right;"}
              = number_to_currency(product_order_product.archived_product.final_price_ht.to_f, locale: :fr) if product_order_product.archived_product
            %td{:style => "text-align:right;"}
              =product_order_product.qty
            %td{:style => "text-align:right;"}
              = number_to_currency(product_order_product.archived_final_price_ht_with_qty, locale: :fr) if product_order_product.archived_product
          
        


  
    
        %tr
          %td{:colspan => 3, :rowspan => 3, :style => "border:0;text-align:left;"}
            %p
              %br
              Mode de paiment :
              -if @product_order.product_order_payment_type_ok_id == 3
                CB
              -elsif @product_order.product_order_payment_type_ok_id == 1
                Chèque
              -elsif @product_order.product_order_payment_type_ok_id == 2
                Virement
              -elsif @product_order.product_order_payment_type_ok_id == 4
                Mandat administratif
              %br
              %br
              Franco de port pour le Pays Voironnais
          %td Total HT :
          %td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ht, locale: :fr)
    
        %tr

          %td TVA :
          %td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_tva, locale: :fr)
    
        %tr
    
          %td Total TTC :
          %td{:style => "text-align:right;"}= number_to_currency(@product_order.archived_total_ttc, locale: :fr)
    
        
      

    %br
      
      
      
      