app/models/statement.rb in artfully_ose-1.2.0.beta.1 vs app/models/statement.rb in artfully_ose-1.2.0.pre

- old
+ new

@@ -24,12 +24,11 @@ :cc_net, :settled, :payment_method_rows, :order_location_rows, :ticket_type_rows, - :discount_rows, - :pass_rows + :discount_rows def self.for_show(show, imported=false) if show.nil? return new end @@ -80,11 +79,10 @@ items.each {|item| row << item} statement.order_location_rows[order_location] = row end statement.build_discount_rows(show.items) - statement.build_pass_rows(show.items) statement.build_ticket_type_rows(show, show.items) end end # @@ -92,17 +90,17 @@ # def build_ticket_type_rows(show, items) self.ticket_type_rows = {} show.chart.ticket_types.each do |ticket_type| - self.ticket_type_rows[ticket_type.name] = TicketTypeRow.new(ticket_type) + self.ticket_type_rows[ticket_type.name] = TicketTypeRow.new(ticket_type.name) end items.each do |item| #refunded items now have nil ticket types unless item.product.ticket_type.nil? - row = self.ticket_type_rows[item.product.ticket_type.name] || TicketTypeRow.new(item.product.ticket_type) + row = self.ticket_type_rows[item.product.ticket_type.name] || TicketTypeRow.new(item.product.ticket_type.name) row << item self.ticket_type_rows[item.product.ticket_type.name] = row end end end @@ -116,21 +114,10 @@ row.discount += (item.original_price - item.price) self.discount_rows[item.discount.code] = row end end end - - def build_pass_rows(items) - self.pass_rows = {} - items.each do |item| - unless item.pass.nil? - row = self.pass_rows[item.pass.pass_type.name] || PassRow.new(item.pass.pass_type.name) - row << item - self.pass_rows[item.pass.pass_type.name] = row - end - end - end module Row attr_accessor :tickets, :gross, :processing, @@ -151,15 +138,14 @@ end end class TicketTypeRow include Row - attr_accessor :ticket_type, :member_ticket + attr_accessor :ticket_type def initialize(ticket_type) - self.ticket_type = ticket_type.name - self.member_ticket = ticket_type.member_ticket + self.ticket_type = ticket_type self.tickets = 0 self.gross = 0 self.processing = 0 self.net = 0 end @@ -175,22 +161,9 @@ self.tickets = 0 self.gross = 0 self.processing = 0 self.net = 0 self.discount = 0 - end - end - - class PassRow - include Row - attr_accessor :pass_type_name - - def initialize(pass_type_name) - self.pass_type_name = pass_type_name - self.tickets = 0 - self.gross = 0 - self.processing = 0 - self.net = 0 end end class OrderLocationRow include Row \ No newline at end of file