.qi_header .right %h1 Lignes de commandes avec un stock nul .clear .qi_pannel.padding.new_table_container .table-area{:style => "overflow:auto;"} .table-area-inner .freezeTable %table.table.table-striped.table-hover.table-bordered.data_table %thead.header %tr %th ID %th Code produit %th Produit %th Quantité dans cette pièce comptable %th Quantité restante %th Quantité attendue %th N° de facture %th Date de facture %tbody -price_line_ids = [] -PriceDocument.where(:price_document_type_id => 4, :cost_ok => false).all.each do |p| -p.price_line_block.price_lines.order("p_product_ref_id").all.each do |pl| -@b = LineStock.where(:p_product_ref_id => pl.p_product_ref_id).sum(:qte_available).to_f -if pl.qte > @b -price_line_ids << pl.id %tr %td =pl.p_product_ref_id %td =pl.cc_ref %td =link_to admin_line_stocks_path(:p_product_ref_id => pl.p_product_ref.id) do =pl.cc_title %td =pl.qte %td =link_to admin_line_stocks_path(:p_product_ref_id => pl.p_product_ref.id) do =@b %td =pl.qte - @b %td =link_to admin_price_document_path(p) do =p.d_number %td =l p.date, :format => "%d/%m/%Y" .qi_header .right %h1 Stock attendu par produit .clear .qi_pannel.padding.new_table_container .table-area{:style => "overflow:auto;"} .table-area-inner .freezeTable %table.table.table-striped.table-hover.table-bordered.data_table %thead.header %tr %th ID %th Code produit %th Produit %th Quantité en commande facture %th Quantité restante %th Quantité nécessaire en réapprovisionnement %tbody -price_line_ids = price_line_ids.uniq -price_lines = PriceLine.where(:id => price_line_ids) -price_lines.order("cc_title").group(:p_product_ref_id).all.each do |p_product_group| -@needed_qty = price_lines.where(:p_product_ref_id => p_product_group.p_product_ref_id).sum(:qte) -@stock = LineStock.where(:p_product_ref_id => p_product_group.p_product_ref_id).sum(:qte_available).to_f %tr %td =p_product_group.p_product_ref_id %td =p_product_group.cc_ref %td =link_to admin_line_stocks_path(:p_product_ref_id => p_product_group.p_product_ref.id) do =p_product_group.cc_title %td =@needed_qty %td =link_to admin_line_stocks_path(:p_product_ref_id => p_product_group.p_product_ref.id) do =@stock %td =@needed_qty - @stock