Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Commit

Permalink
Got it working with new CSV
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickmcelwee committed Mar 26, 2012
1 parent cd2b158 commit fd0f917
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions app/controllers/admin/shipping_docs_controller.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
require 'csv'

class Admin::ShippingDocsController < Admin::BaseController
include Admin::ShippingDocsHelper
Expand All @@ -16,9 +17,9 @@ def index
date_end = Time.zone.parse(params[:end]).end_of_day rescue ""
end

@orders = Order.find(:all, :conditions => { :created_at => date_start..date_end, :state => 'complete' })
@orders = Order.find(:all, :conditions => { :completed_at => date_start..date_end, :state => 'complete' })

csv_string = FasterCSV.generate do |csv|
csv_string = CSV.generate do |csv|

# header row
csv << csv_header_row
Expand Down
4 changes: 2 additions & 2 deletions app/helpers/admin/shipping_docs_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ def csv_order_row(order)
order.bill_address.address1,
order.bill_address.address2,
order.bill_address.city,
State.find(:first, :conditions => { :id =>order.bill_address.state_id}).abbr,
order.bill_address.state_text,
order.bill_address.zipcode,
order.ship_address.firstname,
order.ship_address.lastname,
order.ship_address.address1,
order.ship_address.address2,
order.ship_address.city ,
State.find(:first, :conditions => { :id => order.ship_address.state_id}).abbr,
order.ship_address.state_text,
order.ship_address.zipcode,
shipmentWeight,
order.email,
Expand Down
2 changes: 1 addition & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Rails.application.routes.draw do
match 'admin/shippingdocs', :to => 'admin/shippingdocs#index'
match 'admin/shippingdocs', :to => 'admin/shipping_docs#index'
end

0 comments on commit fd0f917

Please sign in to comment.