app/controllers/admin/store/reports_controller.rb
# A list of items that are yet to be fulfilled (orders are still open)
A list of items that are yet to be fulfilled (orders are still open)
A list of items that are yet to be fulfilled ( orders are still open )
def pending_fulfillment
    sql = <<-EOF
      select oi.item_number, p.id, p.name, p.option_title, '', sum(quantity), s.name, s.id
      from store_order_items oi
      join store_orders o on oi.order_id = o.id
      join store_products p on oi.product_id = p.id
      left join store_label_sheets s on p.label_sheet_id = s.id
      where o.status in ('backordered', 'awaiting_shipment')
      group by oi.item_number;
    EOF
    @data = []
    ActiveRecord::Base.connection.execute(sql).each { |row| @data << row }
  end
def pending_fulfillment sql = <<-EOF 
      select oi.item_number, p.id, p.name, p.option_title, '', sum(quantity), s.name, s.id
      from store_order_items oi
      join store_orders o on oi.order_id = o.id
      join store_products p on oi.product_id = p.id
      left join store_label_sheets s on p.label_sheet_id = s.id
      where o.status in ('backordered', 'awaiting_shipment')
      group by oi.item_number;
     EOF @data = [ ] ActiveRecord :: Base . connection . execute ( sql ) . each { | row | @data << row } end
A list of items that are yet to be fulfilled (orders are still open)
A list of items that are yet to be fulfilled ( orders are still open )