-ok = ok || false


%table.table.sheet_line{:style => "width:100%;"}
  %tr
    =#%th{:style => "width:30px;"}
    %th 
      Etat
    %th
      Description
    %th
      Qte
    %th
      Prix U.
    %th 
      Prix Tot.
    %th
      Prix TTC
      
      
  -sheet_lines.each do |sheet_line|
    -ok = true if sheet_line.shiped
    %tr
      %td
        - if sheet_line.shiped
          Livréé
        -elsif sheet_line.bl
          En cours de livraison
          %br
          -if sheet_line.p_product.p_product_cat_id != 6 or sheet_line.externe and @p_customer_sheet
            =link_to "Indiquer comme livré", set_sheet_line_ship_admin_p_customer_sheet_path(@p_customer_sheet, :p_sheet_line_ids => [sheet_line.id]), :remote => true
      %td
        =sheet_line.p_product.name 
        
       
        
      -if ok
        %td
          =sheet_line.ok_qte
        %td
          =number_to_currency sheet_line.ok_price if sheet_line.ok_price
        
        %td
          =number_to_currency sheet_line.ok_price_tot if sheet_line.ok_price_tot
        
        %td
          =number_to_currency sheet_line.ok_price_tot_ttc if sheet_line.ok_price_tot_ttc
      -else
        %td
          =sheet_line.qte
          
        %td
          =number_to_currency sheet_line.price if sheet_line.price
        
        %td
          =number_to_currency sheet_line.price_tot if sheet_line.price_tot
        
        %td
          =number_to_currency sheet_line.price_tot_ttc if sheet_line.price_tot_ttc
        
  
  -totals =  PSheetLine.totals(sheet_lines)
  %tr
    %td{:style => "text-align:right;padding-right:10px;", :colspan =>5}
      %strong Total HT
    %td
      -if ok
        =number_to_currency totals[:ok_total]
      -else
        =number_to_currency totals[:total]
  %tr
    %td{:style => "text-align:right;padding-right:10px;", :colspan =>5}
      %strong Total TTC
    %td
      -if ok
        =number_to_currency totals[:ok_total_ttc]
      -else
        =number_to_currency totals[:total_ttc]

:scss
  .marges{
    td{
      vertical-align:top;
    }
  }