%tr#price_document_row{:id => price_document.id}
  -tr = {}
  
  -if false
  
    %td
      = price_document.p_customer.code if price_document.p_customer
  
    %td
      = price_document.p_customer.p_commercial.long_name if price_document.p_customer and price_document.p_customer.p_commercial
    %td
      = price_document.p_customer.show_name if price_document.p_customer
    %td
      =price_document.label
    %td
      =price_document.d_number
  
    %td
      =l price_document.date, :format => :date
    %td=number_to_currency price_document.tot_amount_ht
    %td=number_to_currency price_document.tot_amount_tva
    %td=number_to_currency price_document.tot_amount_ttc
    %td
      ="oui" if price_document.solded if price_document.price_document_type and price_document.price_document_type.accounting
    %td
      =number_to_currency price_document.to_paid_ttc if price_document.price_document_type and price_document.price_document_type.accounting

      
  -tr[:accounting_zone_id] = capture do
    %td=AccountingZone.where(:id => price_document.accounting_zone_id).first.name if AccountingZone.where(:id => price_document.accounting_zone_id).first
  
  -tr[:p_customer_code] = capture do
    %td
      =link_to price_document.p_customer.code, [:admin,price_document.p_customer] if price_document.p_customer
  -tr[:p_customer] = capture do
    %td
      =link_to price_document.p_customer.show_name, [:admin,price_document.p_customer] if price_document.p_customer
  
  -tr[:s_project] = capture do
    %td
      =link_to price_document.s_project.p_number, [:admin,price_document.s_project] if price_document.s_project

  -tr[:actions] = capture do
    %td.actions
      -if !price_document.d_number?
        = link_to i(:"trash-o"), [:admin, price_document], method: :delete, data: { confirm: 'Voulez-vous vraiment supprimer cet enregistrement ? ' } , :remote => true
        = link_to i(:pencil), edit_admin_price_document_path(price_document)
        = link_to i(:"check-circle-o"), generate_number_admin_price_document_path(price_document), data: { confirm: 'Voulez-vous vraiment valider cette facture et générer son numéro ? ' }
        
      =# link_to i(:eye), admin_price_document_path(price_document), :remote => true
      
     
      = link_to i(:copy), new_admin_price_document_path(:to_dup => price_document.id)
      = link_to i(:eye), admin_price_document_path(price_document.id), :remote => false, :target => "_blank"
      
      = link_to i(:"credit-card"), paid_by_ogone_admin_price_document_path(price_document.token), :remote => false, :target => "_blank"
      
      = link_to i(:download), print_admin_price_document_path(price_document.token), :remote => false, :target => "_blank"


  =render :partial => "qi/qi_ordered_table_object", :locals => {:tr => tr, :object => price_document}
    
  