#main
  
  %div{:style => "position:absolute;top:4.4cm;right:1cm;text-align:right;"}
    =@product_order_document.label
    n°
    =@product_order_document.d_number
    %br
    =l @product_order.created_at, :format => :date #@product_order_document.created_at



  - if @product_order.reseaux_id != 19
    %div{:style => "height:350px;"}
  -else
    %div{:style => "height:140px;"}
  

  -if @product_order.reseaux_id != 19
    %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
      -if @product_order.reseaux_id != 19
        %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
        -if @product_order.reseaux_id != 19
          %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{:style => ""+("border-bottom: 0;padding-bottom:0;"if @product_order.reseaux_id == 19).to_s}
          =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;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
          = 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;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
          =product_order_product.qty
        %td{:style => "text-align:right;"+("border-bottom: 0;"if @product_order.reseaux_id == 19).to_s}
          = number_to_currency(product_order_product.archived_final_price_ht_with_qty, locale: :fr) if product_order_product.archived_product
    
      -if @product_order.reseaux_id == 19
        %tr
          %td{:colspan => 3, :style => "border-top:0;padding-top:0"}
            %table.sub_products{:style => "width:100%;margin-bottom:20px;margin-top:5px;"}
              %tr
                %th Référence
                %th Nom
            
                %th Prix U.
                %th Nbr
                %th Prix HT
         
              -product_order_product.sub_products.each do |sub_product|
                %tr
                  %td
                    =sub_product.reference
                  %td
                    =sub_product.name
              
                  %td
                    =number_to_currency sub_product.price_ht_with_qte
             
                  %td
                    =sub_product.qte_tot
                  %td
                    =number_to_currency sub_product.price_tot_with_qte
          %td


    
    %tr
      %td{:colspan => (@product_order.reseaux_id != 19 ? 3 : 2), :rowspan => 3, :style => "border:0;text-align:left;"}
        -if @product_order.reseaux_id != 19
          %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)
      -if @product_order.reseaux_id != 19
        %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
  
  <!---
  .fdp
    %table.table
      %tr
        %td
          =@product_order.product_fdp_archived.fdp_description
        %td
          =number_to_currency @product_order.product_fdp_archived.price
  ="--->"
 