.qi_header
  %h2 Importation arrondis

-@import= true

-i = 0
-noms = []

-logger.error "-- DEBUT IMPORT"
%table.table
  -@csv.each do |csv|
    -i += 1

    -logger.error "ligne : "+i.to_s
    
    -if (csv["Journal"].to_s == "Avoirs" or csv["Journal"].to_s == "Ventes P P") and csv["Pièce"] != ""
      -sheet_lines = PSheetLine.where(:arrondi => false, :piece => csv["Pièce"])
      -solde = (csv["Solde"].to_s.gsub(",",".")).to_f
      -sheet_lines.each do |sl|
        -if sl.ok_price_tot_ttc.to_f != solde
          %tr
            %td=link_to sl.p_customer.id, [:admin, sl.p_customer] if sl.p_customer
            %td=link_to sl.p_customer_sheet.id, [:admin, sl.p_customer_sheet] if sl.p_customer_sheet
            %td= sl.id
            %td
              =sl.piece
            
            %td=sl.ok_price_tot_ttc
            %td=solde
            
        -sl.ok_price_tot_ttc = solde
        -sl.price_tot_ttc = solde
        -sl.arrondi = true
        -sl.save
            
          
       
            


    
    -if i == 150
      -#break
-logger.error "-- FIN IMPORT"
-logger.error ""



